MADARA  3.4.1
DoubleVectorVector.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_CONTAINERS_DOUBLE_VECTOR_VECTOR_H_
3 #define _MADARA_CONTAINERS_DOUBLE_VECTOR_VECTOR_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 {
32 class MADARA_EXPORT DoubleVectorVector : public BaseContainer
33 {
34 public:
36  typedef std::vector<double> type;
37 
39  struct Indices
40  {
41  std::size_t x, y;
42  };
43 
51  const std::string& delimiter = ".");
52 
63  int size = -1, bool delete_vars = true,
65  const std::string& delimiter = ".");
66 
77  int size = -1, bool delete_vars = true,
79  const std::string& delimiter = ".");
80 
85 
89  virtual ~DoubleVectorVector();
90 
95  void modify(void);
96 
102  void modify(size_t index);
103 
108  void operator=(const DoubleVectorVector& rhs);
109 
115  void push_back(const type& value);
116 
123  void resize(int size = -1, bool delete_vars = true);
124 
133  void exchange(DoubleVectorVector& other, bool refresh_keys = true,
134  bool delete_keys = true);
135 
140  void copy_to(KnowledgeVector& target) const;
141 
146  void copy_to(std::vector<type>& target) const;
147 
152  void transfer_to(DoubleVectorVector& other);
153 
159  size_t size(void) const;
160 
167  void set_name(
168  const std::string& var_name, KnowledgeBase& knowledge, int size = -1);
169 
176  void set_name(
177  const std::string& var_name, Variables& knowledge, int size = -1);
178 
185  void set_name(
186  const std::string& var_name, ThreadSafeContext& knowledge, int size = -1);
187 
195  void set_delimiter(const std::string& delimiter);
196 
204  std::string get_delimiter(void);
205 
212  type operator[](size_t index) const;
213 
220  double operator[](Indices index) const;
221 
228  knowledge::KnowledgeRecord to_record(size_t index) const;
229 
236  bool exists(size_t index) const;
237 
246  int set(size_t index, type value);
247 
255  int set(const std::vector<type>& value);
256 
266  int set(size_t index, type value, const KnowledgeUpdateSettings& settings);
267 
276  int set(
277  const std::vector<type>& value, const KnowledgeUpdateSettings& settings);
278 
286  void set_quality(size_t index, uint32_t quality,
288  false));
289 
294  VariableReference get_size_ref(void);
295 
305  std::string get_debug_info(void);
306 
312  virtual BaseContainer* clone(void) const;
313 
318  bool is_true(void) const;
319 
324  bool is_false(void) const;
325 
326 private:
331  virtual bool is_true_(void) const;
332 
337  virtual bool is_false_(void) const;
338 
347  virtual void modify_(void);
348 
358  virtual std::string get_debug_info_(void);
359 
364 
368  std::vector<VariableReference> vector_;
369 
374 
379 };
380 }
381 }
382 }
383 
384 #endif // _MADARA_CONTAINERS_DOUBLE_VECTOR_VECTOR_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 NativeDoubleVectors.
std::vector< VariableReference > vector_
Values of the array.
std::vector< double > type
trait that describes the value type
std::string delimiter_
Delimiter for the prefix to subvars.
ThreadSafeContext * context_
Variable context that we are modifying.
VariableReference size_
Reference to the size field of the vector space.
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.
::std::vector< KnowledgeRecord > KnowledgeVector
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.