MADARA  3.4.1
NativeDoubleVectorStaged.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_NATIVE_DOUBLE_VECTOR_STAGED_H_
3 #define _MADARA_NATIVE_DOUBLE_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 {
38 class MADARA_EXPORT NativeDoubleVectorStaged : public BaseContainer
39 {
40 public:
42  typedef double type;
43 
50 
59  int size = -1,
61 
70  int size = -1,
72 
77 
81  virtual ~NativeDoubleVectorStaged();
82 
87  void modify(void);
88 
93  void operator=(const NativeDoubleVectorStaged& rhs);
94 
99  void operator=(const std::vector<type>& rhs);
100 
106  void push_back(type value);
107 
112  void resize(size_t size);
113 
119  void exchange(NativeDoubleVectorStaged& other);
120 
125  void transfer_to(NativeDoubleVectorStaged& other);
126 
131  void copy_to(KnowledgeVector& target) const;
132 
137  size_t size(void) const;
138 
146  void set_name(const std::string& var_name, KnowledgeBase& knowledge,
147  int size = -1, bool sync = true);
148 
156  void set_name(const std::string& var_name, Variables& knowledge,
157  int size = -1, bool sync = true);
158 
166  void set_name(const std::string& var_name, ThreadSafeContext& knowledge,
167  int size = -1, bool sync = true);
168 
175  type operator[](size_t index) const;
176 
183  void set(size_t index, type value);
184 
190  void set(const std::vector<type>& value);
191 
199  void set_quality(size_t index, uint32_t quality,
201  false));
202 
209  knowledge::KnowledgeRecord to_record(size_t index) const;
210 
215  knowledge::KnowledgeRecord to_record(void) const;
216 
226  std::string get_debug_info(void);
227 
233  virtual BaseContainer* clone(void) const;
234 
239  bool is_true(void) const;
240 
245  bool is_false(void) const;
246 
250  void read(void);
251 
255  void write(void);
256 
257 private:
262  virtual bool is_true_(void) const;
263 
268  virtual bool is_false_(void) const;
269 
278  virtual void modify_(void);
279 
289  virtual std::string get_debug_info_(void);
290 
295 
300 
305 
310 };
311 
314 }
315 }
316 }
317 
319 
320 #endif // _MADARA_NATIVE_DOUBLE_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.
ThreadSafeContext * context_
Variable context that we are modifying.
VariableReference vector_
Reference to the size field of the vector space.
KnowledgeRecord value_
The staged value of the vector.
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
NativeDoubleVectorStaged NativeDoubleArrayStaged
provide the Array alias for the NativeDoubleVectorStaged class
constexpr string_t string
Provides functions and classes for the distributed knowledge base.
::std::vector< KnowledgeRecord > KnowledgeVector
Copyright(c) 2020 Galois.