MADARA  3.1.8
IntegerStaged.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_KNOWLEDGE_CONTAINERS_INTEGERSTAGED_H_
3 #define _MADARA_KNOWLEDGE_CONTAINERS_INTEGERSTAGED_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 IntegerStaged : public BaseContainer
39  {
40  public:
43 
48  IntegerStaged (const KnowledgeUpdateSettings & settings =
50 
57  IntegerStaged (const std::string & name,
59  const KnowledgeUpdateSettings & settings =
61 
68  IntegerStaged (const std::string & name,
69  Variables & knowledge,
70  const KnowledgeUpdateSettings & settings =
72 
80  IntegerStaged (const std::string & name,
81  KnowledgeBase & knowledge,
82  type value,
83  const KnowledgeUpdateSettings & settings =
85 
93  IntegerStaged (const std::string & name,
94  Variables & knowledge,
95  type value,
96  const KnowledgeUpdateSettings & settings =
98 
102  IntegerStaged (const IntegerStaged & rhs);
103 
107  virtual ~IntegerStaged ();
108 
113  void modify (void);
114 
119  void operator= (const IntegerStaged & 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 (IntegerStaged & other);
167 
173  type operator= (type value);
174 
180  bool operator== (const IntegerStaged & value) const;
181 
187  bool operator!= (const IntegerStaged & value) const;
188 
194  bool operator== (type value) const;
195 
201  bool operator!= (type value) const;
202 
208  bool operator< (type value) const;
209 
215  bool operator<= (type value) const;
216 
222  bool operator> (type value) const;
223 
229  bool operator>= (type value) const;
230 
235  type operator* (void) const;
236 
242  bool exists (void) const;
243 
249  type operator+= (type value);
250 
256  type operator-= (type value);
257 
263  type operator++ (void);
264 
270  type operator-- (void);
271 
277  knowledge::KnowledgeRecord to_record (void) const;
278 
283  double to_double (void) const;
284 
289  knowledge::KnowledgeRecord::Integer to_integer (void) const;
290 
295  std::string to_string (void) const;
296 
303  void set_quality (uint32_t quality,
304  const KnowledgeReferenceSettings & settings =
306 
307 
317  std::string get_debug_info (void);
318 
324  virtual BaseContainer * clone (void) const;
325 
330  bool is_true (void) const;
331 
336  bool is_false (void) const;
337 
338  private:
339 
344  virtual bool is_true_ (void) const;
345 
350  virtual bool is_false_ (void) const;
351 
360  virtual void modify_ (void);
361 
371  virtual std::string get_debug_info_ (void);
372 
377 
382 
386  type value_;
387 
392  };
393  } // containers
394  } // knowledge
395 } // madara
396 
397 #include "IntegerStaged.inl"
398 
399 #endif // _MADARA_KNOWLEDGE_CONTAINERS_INTEGERSTAGED_H_
This class encapsulates an entry in a KnowledgeBase.
auto operator>=(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get() >=rhs.get())
Definition: Tracked.h:247
auto operator>(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get() >rhs.get())
Definition: Tracked.h:249
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
Definition: IntegerStaged.h:42
auto operator<=(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()<=rhs.get())
Definition: Tracked.h:246
auto operator<(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()< rhs.get())
Definition: Tracked.h:248
auto operator--(Tracked< T > &lhs) -> decltype(--lhs.get_mut())
Definition: Tracked.h:302
auto operator+=(Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get_mut()+=rhs.get())
Definition: Tracked.h:274
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.
Optimized reference to a variable within the knowledge base.
ThreadSafeContext * context_
Variable context that we are modifying.
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
auto operator*(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()*rhs.get())
Definition: Tracked.h:276
VariableReference variable_
Variable reference.
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
auto operator-=(Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get_mut()-=rhs.get())
Definition: Tracked.h:275
Stages an integer value to and from the knowledge base.
Definition: IntegerStaged.h:38
static constexpr struct madara::knowledge::tags::string_t string
auto operator==(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()==rhs.get())
Definition: Tracked.h:244
auto operator!=(const Tracked< T > &lhs, const Tracked< U > &rhs) -> decltype(lhs.get()!=rhs.get())
Definition: Tracked.h:245
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.
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
auto operator++(Tracked< T > &lhs) -> decltype(++lhs.get_mut())
Definition: Tracked.h:301