MADARA  3.2.3
Integer.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_INTEGER_H_
3 #define _MADARA_INTEGER_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  {
31  class MADARA_EXPORT Integer : public BaseContainer
32  {
33  public:
36 
41  Integer (const KnowledgeUpdateSettings & settings =
43 
50  Integer (const std::string & name,
52  const KnowledgeUpdateSettings & settings =
54 
61  Integer (const std::string & name,
62  Variables & knowledge,
63  const KnowledgeUpdateSettings & settings =
65 
73  Integer (const std::string & name,
74  KnowledgeBase & knowledge,
75  type value,
76  const KnowledgeUpdateSettings & settings =
78 
86  Integer (const std::string & name,
87  Variables & knowledge,
88  type value,
89  const KnowledgeUpdateSettings & settings =
91 
95  Integer (const Integer & rhs);
96 
100  virtual ~Integer ();
101 
106  void modify (void);
107 
112  void operator= (const Integer & rhs);
113 
119  void set_name (const std::string & var_name,
120  KnowledgeBase & knowledge);
121 
127  void set_name (const std::string & var_name,
128  Variables & knowledge);
129 
135  void set_name (const std::string & var_name,
136  ThreadSafeContext & knowledge);
137 
143  void exchange (containers::Integer & other);
144 
150  type operator= (type value);
151 
157  bool operator== (const Integer & value) const;
158 
164  bool operator!= (const Integer & value) const;
165 
171  bool operator== (type value) const;
172 
178  bool operator!= (type value) const;
179 
185  bool operator< (type value) const;
186 
192  bool operator<= (type value) const;
193 
199  bool operator> (type value) const;
200 
206  bool operator>= (type value) const;
207 
212  type operator* (void) const;
213 
219  bool exists (void) const;
220 
226  type operator+= (type value);
227 
233  type operator-= (type value);
234 
240  type operator++ (void);
241 
247  type operator-- (void);
248 
254  knowledge::KnowledgeRecord to_record (void) const;
255 
260  double to_double (void) const;
261 
266  knowledge::KnowledgeRecord::Integer to_integer (void) const;
267 
272  std::string to_string (void) const;
273 
280  void set_quality (uint32_t quality,
281  const KnowledgeReferenceSettings & settings =
283 
284 
294  std::string get_debug_info (void);
295 
301  virtual BaseContainer * clone (void) const;
302 
307  bool is_true (void) const;
308 
313  bool is_false (void) const;
314 
315  private:
316 
321  virtual bool is_true_ (void) const;
322 
327  virtual bool is_false_ (void) const;
328 
337  virtual void modify_ (void);
338 
348  virtual std::string get_debug_info_ (void);
349 
354 
359  };
360  }
361  }
362 }
363 
364 #include "Integer.inl"
365 
366 #endif // _MADARA_INTEGER_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
VariableReference variable_
Variable reference.
Definition: Integer.h:358
This class stores variables and their values for use by any entity needing state information in a thr...
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
madara::knowledge::KnowledgeRecord::Integer Integer
This class stores an integer within a variable context.
Definition: Integer.h:31
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.
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
Definition: Integer.h:35
Settings for applying knowledge updates.
Copyright (c) 2015 Carnegie Mellon University.
ThreadSafeContext * context_
Variable context that we are modifying.
Definition: Integer.h:353
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