MADARA  3.4.1
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 
50 
59 
68 
78 
86  IntegerStaged(const std::string& name, Variables& knowledge, type value,
88 
92  IntegerStaged(const IntegerStaged& rhs);
93 
97  virtual ~IntegerStaged();
98 
103  void modify(void);
104 
109  void operator=(const IntegerStaged& rhs);
110 
114  void read(void);
115 
119  void write(void);
120 
127  void set_name(
128  const std::string& var_name, KnowledgeBase& knowledge, bool sync = true);
129 
136  void set_name(
137  const std::string& var_name, Variables& knowledge, bool sync = true);
138 
145  void set_name(const std::string& var_name, ThreadSafeContext& knowledge,
146  bool sync = true);
147 
153  void exchange(IntegerStaged& other);
154 
160  type operator=(type value);
161 
167  bool operator==(const IntegerStaged& value) const;
168 
174  bool operator!=(const IntegerStaged& value) const;
175 
181  bool operator==(type value) const;
182 
188  bool operator!=(type value) const;
189 
195  bool operator<(type value) const;
196 
202  bool operator<=(type value) const;
203 
209  bool operator>(type value) const;
210 
216  bool operator>=(type value) const;
217 
222  type operator*(void)const;
223 
229  bool exists(void) const;
230 
236  type operator+=(type value);
237 
243  type operator-=(type value);
244 
250  type operator++(void);
251 
257  type operator--(void);
258 
264  knowledge::KnowledgeRecord to_record(void) const;
265 
270  double to_double(void) const;
271 
276  knowledge::KnowledgeRecord::Integer to_integer(void) const;
277 
282  std::string to_string(void) const;
283 
290  void set_quality(uint32_t quality,
292  false));
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:
329  virtual bool is_true_(void) const;
330 
335  virtual bool is_false_(void) const;
336 
345  virtual void modify_(void);
346 
356  virtual std::string get_debug_info_(void);
357 
362 
367 
372 
377 };
378 } // containers
379 } // knowledge
380 } // madara
381 
382 #include "IntegerStaged.inl"
383 
384 #endif // _MADARA_KNOWLEDGE_CONTAINERS_INTEGERSTAGED_H_
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
This class encapsulates an entry in a KnowledgeBase.
Settings for applying knowledge updates.
Settings for applying knowledge updates.
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 an interface for external functions into the MADARA KaRL variable settings.
Definition: Variables.h:53
This class is an abstract base class for all containers.
Definition: BaseContainer.h:34
Stages an integer value to and from the knowledge base.
Definition: IntegerStaged.h:39
ThreadSafeContext * context_
Variable context that we are modifying.
bool has_changed_
Tracks if value_ has changed since last read.
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
Definition: IntegerStaged.h:42
VariableReference variable_
Variable reference.
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
constexpr string_t string
Provides functions and classes for the distributed knowledge base.
auto operator==(const KnowledgeRecord &l, const T &r) -> decltype(knowledge_cast< T >(l)==r)
auto operator-=(KnowledgeRecord &l, const T &r) -> decltype(l -=knowledge_cast(r))
auto operator*(const 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+=(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)
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.
Copyright(c) 2020 Galois.