MADARA  3.4.1
IntegerVector3D.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_CONTAINERS_INTEGER_VECTOR3D_H_
3 #define _MADARA_CONTAINERS_INTEGER_VECTOR3D_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 IntegerVector3D : public BaseContainer
33 {
34 public:
36  struct Indices
37  {
38  std::size_t x, y, z;
39  };
40 
43 
46 
54  const std::string& delimiter = ".");
55 
66  const Dimensions& dimensions = {0, 0, 0}, bool delete_vars = true,
68  const std::string& delimiter = ".");
69 
80  const Dimensions& dimensions = {0, 0, 0}, bool delete_vars = true,
82  const std::string& delimiter = ".");
83 
87  IntegerVector3D(const IntegerVector3D& rhs);
88 
92  virtual ~IntegerVector3D();
93 
98  void copy_to(std::vector<std::vector<std::vector<type> > >& target) const;
99 
104  void modify(void);
105 
111  void modify(const Indices& index);
112 
117  void operator=(const IntegerVector3D& rhs);
118 
125  void resize(const Dimensions& dimensions, bool delete_vars = true);
126 
132  Dimensions size(void) const;
133 
140  void set_name(const std::string& var_name, KnowledgeBase& knowledge,
141  const Dimensions& dimensions = {0, 0, 0});
142 
149  void set_name(const std::string& var_name, Variables& knowledge,
150  const Dimensions& dimensions = {0, 0, 0});
151 
158  void set_name(const std::string& var_name, ThreadSafeContext& knowledge,
159  const Dimensions& dimensions = {0, 0, 0});
160 
168  void set_delimiter(const std::string& delimiter);
169 
177  std::string get_delimiter(void);
178 
185  type operator[](const Indices& index) const;
186 
193  bool exists(const Indices& index) const;
194 
203  int set(const Indices& index, type value);
204 
211  int set(const std::vector<std::vector<std::vector<type> > >& value);
212 
222  int set(const Indices& index, type value,
223  const KnowledgeUpdateSettings& settings);
224 
232  int set(const std::vector<std::vector<std::vector<type> > >& value,
233  const KnowledgeUpdateSettings& settings);
234 
242  void set_quality(const Indices& index, uint32_t quality,
243  const KnowledgeReferenceSettings& settings = KnowledgeReferenceSettings(
244  false));
245 
250  VariableReference get_size_ref(void);
251 
261  std::string get_debug_info(void);
262 
268  virtual BaseContainer* clone(void) const;
269 
274  bool is_true(void) const;
275 
280  bool is_false(void) const;
281 
282 private:
287  virtual bool is_true_(void) const;
288 
293  virtual bool is_false_(void) const;
294 
303  virtual void modify_(void);
304 
314  virtual std::string get_debug_info_(void);
315 
320 
324  std::vector<std::vector<std::vector<VariableReference> > > vector_;
325 
330 
335 };
336 }
337 }
338 }
339 
340 #endif // _MADARA_CONTAINERS_INTEGER_VECTOR3D_H_
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
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
Manages a 3D array of doubles as a virtual overlay in the KnowledgeBase.
Indices Dimensions
convenience typedef for size
std::string delimiter_
Delimiter for the prefix to subvars.
std::vector< std::vector< std::vector< VariableReference > > > vector_
Values of the array.
KnowledgeRecord::Integer type
convenience typedef for element type
VariableReference size_
Reference to the size of 2D array.
ThreadSafeContext * context_
Variable context that we are modifying.
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.
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.