MADARA  3.4.1
NativeIntegerVectorStaged.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_NATIVE_INTEGER_VECTOR_STAGED_H_
3 #define _MADARA_NATIVE_INTEGER_VECTOR_STAGED_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 NativeIntegerVectorStaged : public BaseContainer
32 {
33 public:
36 
43 
52  int size = -1,
54 
63  int size = -1,
65 
70 
74  virtual ~NativeIntegerVectorStaged();
75 
80  void modify(void);
81 
86  void operator=(const NativeIntegerVectorStaged& rhs);
87 
92  void operator=(const std::vector<type>& rhs);
93 
99  void push_back(type value);
100 
105  void resize(size_t size);
106 
112  void exchange(NativeIntegerVectorStaged& other);
113 
118  void transfer_to(NativeIntegerVectorStaged& other);
119 
124  void copy_to(KnowledgeVector& target) const;
125 
130  size_t size(void) const;
131 
139  void set_name(const std::string& var_name, KnowledgeBase& knowledge,
140  int size = -1, bool sync = true);
141 
149  void set_name(const std::string& var_name, Variables& knowledge,
150  int size = -1, bool sync = true);
151 
159  void set_name(const std::string& var_name, ThreadSafeContext& knowledge,
160  int size = -1, bool sync = true);
161 
168  type operator[](size_t index) const;
169 
176  void set(size_t index, type value);
177 
183  void set(const std::vector<type>& value);
184 
192  void set_quality(size_t index, uint32_t quality,
194  false));
195 
202  knowledge::KnowledgeRecord to_record(size_t index) const;
203 
208  knowledge::KnowledgeRecord to_record(void) const;
209 
219  std::string get_debug_info(void);
220 
226  virtual BaseContainer* clone(void) const;
227 
232  bool is_true(void) const;
233 
238  bool is_false(void) const;
239 
243  void read(void);
244 
248  void write(void);
249 
250 private:
255  virtual bool is_true_(void) const;
256 
261  virtual bool is_false_(void) const;
262 
271  virtual void modify_(void);
272 
282  virtual std::string get_debug_info_(void);
283 
288 
293 
298 
303 };
304 
307 }
308 }
309 }
310 
312 
313 #endif // _MADARA_NATIVE_INTEGER_VECTOR_STAGED_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
This class stores a vector of doubles inside of KaRL.
bool has_changed_
Tracks if value_ has changed since last read.
KnowledgeRecord value_
The staged value of the vector.
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
ThreadSafeContext * context_
Variable context that we are modifying.
VariableReference vector_
Reference to the size field of the vector space.
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
NativeIntegerVectorStaged NativeIntegerArrayStaged
provide the Array alias for the NativeIntegerVectorStaged class
constexpr string_t string
Provides functions and classes for the distributed knowledge base.
::std::vector< KnowledgeRecord > KnowledgeVector
Copyright(c) 2020 Galois.