MADARA  3.2.3
DoubleVector3D.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_CONTAINERS_DOUBLE_VECTOR3D_H_
3 #define _MADARA_CONTAINERS_DOUBLE_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 DoubleVector3D : public BaseContainer
33  {
34  public:
36  struct Indices
37  {
38  std::size_t x, y, z;
39  };
40 
43 
45  typedef double type;
46 
52  DoubleVector3D (const KnowledgeUpdateSettings & settings =
54  const std::string & delimiter = ".");
55 
65  DoubleVector3D (const std::string & name,
67  const Dimensions & dimensions = {0,0,0},
68  bool delete_vars = true,
69  const KnowledgeUpdateSettings & settings =
71  const std::string & delimiter = ".");
72 
82  DoubleVector3D (const std::string & name,
83  Variables & knowledge,
84  const Dimensions & dimensions = {0,0,0},
85  bool delete_vars = true,
86  const KnowledgeUpdateSettings & settings =
88  const std::string & delimiter = ".");
89 
93  DoubleVector3D (const DoubleVector3D & rhs);
94 
98  virtual ~DoubleVector3D ();
99 
104  void copy_to (
105  std::vector<std::vector<std::vector<type> > > & target) const;
106 
111  void modify (void);
112 
118  void modify (const Indices & index);
119 
124  void operator= (const DoubleVector3D & rhs);
125 
132  void resize (const Dimensions & dimensions, bool delete_vars = true);
133 
139  Dimensions size (void) const;
140 
147  void set_name (const std::string & var_name,
148  KnowledgeBase & knowledge, const Dimensions & dimensions = {0,0,0});
149 
156  void set_name (const std::string & var_name,
157  Variables & knowledge, const Dimensions & dimensions = {0,0,0});
158 
165  void set_name (const std::string & var_name,
166  ThreadSafeContext & knowledge,
167  const Dimensions & dimensions = {0,0,0});
168 
176  void set_delimiter (const std::string & delimiter);
177 
185  std::string get_delimiter (void);
186 
193  type operator[] (const Indices & index) const;
194 
201  bool exists (const Indices & index) const;
202 
211  int set (const Indices & index, type value);
212 
219  int set (
220  const std::vector<std::vector<std::vector<type> > > & value);
221 
231  int set (const Indices & index,
232  type value,
233  const KnowledgeUpdateSettings & settings);
234 
242  int set (
243  const std::vector<std::vector<std::vector<type> > > & value,
244  const KnowledgeUpdateSettings & settings);
245 
253  void set_quality (const Indices & index, uint32_t quality,
254  const KnowledgeReferenceSettings & settings =
256 
261  VariableReference get_size_ref (void);
262 
272  std::string get_debug_info (void);
273 
279  virtual BaseContainer * clone (void) const;
280 
285  bool is_true (void) const;
286 
291  bool is_false (void) const;
292 
293  private:
294 
299  virtual bool is_true_ (void) const;
300 
305  virtual bool is_false_ (void) const;
306 
315  virtual void modify_ (void);
316 
326  virtual std::string get_debug_info_ (void);
327 
332 
336  std::vector<std::vector<std::vector<VariableReference> > > vector_;
337 
342 
347  };
348  }
349  }
350 }
351 
352 #endif // _MADARA_CONTAINERS_DOUBLE_VECTOR3D_H_
353 
Indices Dimensions
convenience typedef for size
This class stores variables and their values for use by any entity needing state information in a thr...
std::string delimiter_
Delimiter for the prefix to subvars.
Optimized reference to a variable within the knowledge base.
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
std::vector< std::vector< std::vector< VariableReference > > > vector_
Values of the array.
static struct madara::knowledge::tags::string_t string
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
double type
convenience typedef for element type
VariableReference size_
Reference to the size of 2D array.
ThreadSafeContext * context_
Variable context that we are modifying.
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.
Manages a 3D array of doubles as a virtual overlay in the KnowledgeBase.
Provides functions and classes for the distributed knowledge base.
Settings for applying knowledge updates.
Copyright (c) 2015 Carnegie Mellon University.
Settings for applying knowledge updates.
Provides an interface for external functions into the MADARA KaRL variable settings.
This class is an abstract base class for all containers.
Definition: BaseContainer.h:33