MADARA  3.4.1
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 
50 
59 
68 
77  const type& value,
79 
87  StringStaged(const std::string& name, Variables& knowledge, const type& value,
89 
93  StringStaged(const StringStaged& rhs);
94 
98  virtual ~StringStaged();
99 
104  void modify(void);
105 
110  void operator=(const StringStaged& rhs);
111 
115  void read(void);
116 
120  void write(void);
121 
128  void set_name(
129  const std::string& var_name, KnowledgeBase& knowledge, bool sync = true);
130 
137  void set_name(
138  const std::string& var_name, Variables& knowledge, bool sync = true);
139 
146  void set_name(const std::string& var_name, ThreadSafeContext& knowledge,
147  bool sync = true);
148 
154  void exchange(StringStaged& other);
155 
161  type operator=(const type& value);
162 
168  bool operator==(const StringStaged& value) const;
169 
175  bool operator!=(const StringStaged& value) const;
176 
182  bool operator==(const type& value) const;
183 
189  bool operator!=(const type& value) const;
190 
196  bool operator<(const type& value) const;
197 
203  bool operator<=(const type& value) const;
204 
210  bool operator>(const type& value) const;
211 
217  bool operator>=(const type& value) const;
218 
223  type operator*(void)const;
224 
230  bool exists(void) const;
231 
237  type operator+=(const type& value);
238 
244  type operator-=(const type& value);
245 
251  knowledge::KnowledgeRecord to_record(void) const;
252 
257  double to_double(void) const;
258 
263  knowledge::KnowledgeRecord::Integer to_integer(void) const;
264 
269  std::string to_string(void) const;
270 
277  void set_quality(uint32_t quality,
279  false));
280 
290  std::string get_debug_info(void);
291 
297  virtual BaseContainer* clone(void) const;
298 
303  bool is_true(void) const;
304 
309  bool is_false(void) const;
310 
311 private:
316  virtual bool is_true_(void) const;
317 
322  virtual bool is_false_(void) const;
323 
332  virtual void modify_(void);
333 
343  virtual std::string get_debug_info_(void);
344 
349 
354 
359 
364 };
365 } // containers
366 } // knowledge
367 } // madara
368 
369 #include "StringStaged.inl"
370 
371 #endif // _MADARA_KNOWLEDGE_CONTAINERS_STRINGSTAGED_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 a string value to and from the knowledge base.
Definition: StringStaged.h:39
bool has_changed_
Tracks if value_ has changed since last read.
Definition: StringStaged.h:363
VariableReference variable_
Variable reference.
Definition: StringStaged.h:353
ThreadSafeContext * context_
Variable context that we are modifying.
Definition: StringStaged.h:348
std::string type
trait that describes the value type
Definition: StringStaged.h:42
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.