MADARA  3.2.3
StringStaged.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_KNOWLEDGE_CONTAINERS_STRINGSTAGED_H_
3 #define _MADARA_KNOWLEDGE_CONTAINERS_STRINGSTAGED_H_
4 
5 #include <vector>
6 #include <string>
7 #include "madara/LockType.h"
11 #include "BaseContainer.h"
12 
21 namespace madara
22 {
23  namespace knowledge
24  {
25  namespace containers
26  {
38  class MADARA_EXPORT StringStaged : public BaseContainer
39  {
40  public:
42  typedef std::string type;
43 
48  StringStaged (const KnowledgeUpdateSettings & settings =
50 
57  StringStaged (const std::string & name,
59  const KnowledgeUpdateSettings & settings =
61 
68  StringStaged (const std::string & name,
69  Variables & knowledge,
70  const KnowledgeUpdateSettings & settings =
72 
80  StringStaged (const std::string & name,
81  KnowledgeBase & knowledge,
82  const type & value,
83  const KnowledgeUpdateSettings & settings =
85 
93  StringStaged (const std::string & name,
94  Variables & knowledge,
95  const type & value,
96  const KnowledgeUpdateSettings & settings =
98 
102  StringStaged (const StringStaged & rhs);
103 
107  virtual ~StringStaged ();
108 
113  void modify (void);
114 
119  void operator= (const StringStaged & rhs);
120 
124  void read (void);
125 
129  void write (void);
130 
137  void set_name (const std::string & var_name,
138  KnowledgeBase & knowledge,
139  bool sync = true);
140 
147  void set_name (const std::string & var_name,
148  Variables & knowledge,
149  bool sync = true);
150 
157  void set_name (const std::string & var_name,
158  ThreadSafeContext & knowledge,
159  bool sync = true);
160 
166  void exchange (StringStaged & other);
167 
173  type operator= (const type & value);
174 
180  bool operator== (const StringStaged & value) const;
181 
187  bool operator!= (const StringStaged & value) const;
188 
194  bool operator== (const type & value) const;
195 
201  bool operator!= (const type & value) const;
202 
208  bool operator< (const type & value) const;
209 
215  bool operator<= (const type & value) const;
216 
222  bool operator> (const type & value) const;
223 
229  bool operator>= (const type & value) const;
230 
235  type operator* (void) const;
236 
242  bool exists (void) const;
243 
249  type operator+= (const type & value);
250 
256  type operator-= (const type & value);
257 
263  knowledge::KnowledgeRecord to_record (void) const;
264 
269  double to_double (void) const;
270 
275  knowledge::KnowledgeRecord::Integer to_integer (void) const;
276 
281  std::string to_string (void) const;
282 
289  void set_quality (uint32_t quality,
290  const KnowledgeReferenceSettings & settings =
292 
293 
303  std::string get_debug_info (void);
304 
310  virtual BaseContainer * clone (void) const;
311 
316  bool is_true (void) const;
317 
322  bool is_false (void) const;
323 
324  private:
325 
330  virtual bool is_true_ (void) const;
331 
336  virtual bool is_false_ (void) const;
337 
346  virtual void modify_ (void);
347 
357  virtual std::string get_debug_info_ (void);
358 
363 
368 
372  type value_;
373 
378  };
379  } // containers
380  } // knowledge
381 } // madara
382 
383 #include "StringStaged.inl"
384 
385 #endif // _MADARA_KNOWLEDGE_CONTAINERS_STRINGSTAGED_H_
This class encapsulates an entry in a KnowledgeBase.
auto operator+=(KnowledgeRecord &l, const T &r) -> decltype(l+=knowledge_cast(r))
auto operator>=(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l) >=r)
auto operator>(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l) >r)
auto operator==(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)==r)
This class stores variables and their values for use by any entity needing state information in a thr...
bool has_changed_
Tracks if value_ has changed since last read.
Definition: StringStaged.h:377
Optimized reference to a variable within the knowledge base.
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
static struct madara::knowledge::tags::string_t string
auto operator<(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)< r)
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
auto operator*(const KnowledgeRecord &l, const T &r) -> decltype(l *knowledge_cast(r))
auto operator-=(KnowledgeRecord &l, const T &r) -> decltype(l-=knowledge_cast(r))
auto operator<=(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)<=r)
std::string type
trait that describes the value type
Definition: StringStaged.h:42
MADARA_EXPORT bool exists(const char *originator, uint64_t clock, uint32_t update_number, OriginatorFragmentMap &map)
Checks if a fragment already exists within a fragment map.
auto operator!=(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)!=r)
VariableReference variable_
Variable reference.
Definition: StringStaged.h:367
Provides functions and classes for the distributed knowledge base.
Settings for applying knowledge updates.
Copyright (c) 2015 Carnegie Mellon University.
Settings for applying knowledge updates.
Provides an interface for external functions into the MADARA KaRL variable settings.
This class is an abstract base class for all containers.
Definition: BaseContainer.h:33
ThreadSafeContext * context_
Variable context that we are modifying.
Definition: StringStaged.h:362
Stages a string value to and from the knowledge base.
Definition: StringStaged.h:38