MADARA  3.2.3
DoubleStaged.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_KNOWLEDGE_CONTAINERS_DOUBLESTAGED_H_
3 #define _MADARA_KNOWLEDGE_CONTAINERS_DOUBLESTAGED_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 DoubleStaged : public BaseContainer
39  {
40  public:
42  typedef double type;
43 
48  DoubleStaged (const KnowledgeUpdateSettings & settings =
50 
57  DoubleStaged (const std::string & name,
59  const KnowledgeUpdateSettings & settings =
61 
68  DoubleStaged (const std::string & name,
69  Variables & knowledge,
70  const KnowledgeUpdateSettings & settings =
72 
80  DoubleStaged (const std::string & name,
81  KnowledgeBase & knowledge,
82  type value,
83  const KnowledgeUpdateSettings & settings =
85 
93  DoubleStaged (const std::string & name,
94  Variables & knowledge,
95  type value,
96  const KnowledgeUpdateSettings & settings =
98 
102  DoubleStaged (const DoubleStaged & rhs);
103 
107  virtual ~DoubleStaged ();
108 
113  void modify (void);
114 
119  void operator= (const DoubleStaged & 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 (DoubleStaged & other);
167 
173  type operator= (type value);
174 
180  bool operator== (const DoubleStaged & value) const;
181 
187  bool operator!= (const DoubleStaged & 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 "DoubleStaged.inl"
398 
399 #endif // _MADARA_KNOWLEDGE_CONTAINERS_DOUBLESTAGED_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)
auto operator--(Tracked< T > &lhs) -> decltype(--lhs.get_mut())
Definition: Tracked.h:302
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: DoubleStaged.h:391
Optimized reference to a variable within the knowledge base.
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
ThreadSafeContext * context_
Variable context that we are modifying.
Definition: DoubleStaged.h:376
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
Stages an integer value to and from the knowledge base.
Definition: DoubleStaged.h:38
VariableReference variable_
Variable reference.
Definition: DoubleStaged.h:381
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)
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)
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
double type
trait that describes the value type
Definition: DoubleStaged.h:42