MADARA  3.1.8
IntegerVectorVector.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_CONTAINERS_INTEGER_VECTOR_VECTOR_H_
3 #define _MADARA_CONTAINERS_INTEGER_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 IntegerVectorVector : public BaseContainer
33  {
34  public:
36  typedef std::vector<int64_t> type;
37 
39  struct Indices
40  {
41  std::size_t x, y;
42  };
43 
51  const std::string & delimiter = ".");
52 
62  IntegerVectorVector (const std::string & name,
64  int size = -1,
65  bool delete_vars = true,
66  const KnowledgeUpdateSettings & settings =
68  const std::string & delimiter = ".");
69 
79  IntegerVectorVector (const std::string & name,
80  Variables & knowledge,
81  int size = -1,
82  bool delete_vars = true,
83  const KnowledgeUpdateSettings & settings =
85  const std::string & delimiter = ".");
86 
91 
95  virtual ~IntegerVectorVector ();
96 
101  void modify (void);
102 
108  void modify (size_t index);
109 
114  void operator= (const IntegerVectorVector & rhs);
115 
121  void push_back (const type & value);
122 
129  void resize (int size = -1, bool delete_vars = true);
130 
139  void exchange (IntegerVectorVector & other, bool refresh_keys = true,
140  bool delete_keys = true);
141 
146  void copy_to (KnowledgeVector & target) const;
147 
152  void copy_to (std::vector <type > & target) const;
153 
158  void transfer_to (IntegerVectorVector & other);
159 
165  size_t size (void) const;
166 
173  void set_name (const std::string & var_name,
174  KnowledgeBase & knowledge, int size = -1);
175 
182  void set_name (const std::string & var_name,
183  Variables & knowledge, int size = -1);
184 
191  void set_name (const std::string & var_name,
192  ThreadSafeContext & knowledge, int size = -1);
193 
201  void set_delimiter (const std::string & delimiter);
202 
210  std::string get_delimiter (void);
211 
218  type operator[] (size_t index) const;
219 
226  int64_t operator[] (Indices index) const;
227 
234  knowledge::KnowledgeRecord to_record (size_t index) const;
235 
242  bool exists (size_t index) const;
243 
252  int set (size_t index, type value);
253 
261  int set (const std::vector <type> & value);
262 
272  int set (size_t index,
273  type value,
274  const KnowledgeUpdateSettings & settings);
275 
284  int set (
285  const std::vector <type> & value,
286  const KnowledgeUpdateSettings & settings);
287 
295  void set_quality (size_t index, uint32_t quality,
296  const KnowledgeReferenceSettings & settings =
298 
303  VariableReference get_size_ref (void);
304 
314  std::string get_debug_info (void);
315 
321  virtual BaseContainer * clone (void) const;
322 
327  bool is_true (void) const;
328 
333  bool is_false (void) const;
334 
335  private:
336 
341  virtual bool is_true_ (void) const;
342 
347  virtual bool is_false_ (void) const;
348 
357  virtual void modify_ (void);
358 
368  virtual std::string get_debug_info_ (void);
369 
374 
378  std::vector <VariableReference> vector_;
379 
384 
389  };
390  }
391  }
392 }
393 
394 #endif // _MADARA_CONTAINERS_INTEGER_VECTOR_VECTOR_H_
395 
This class encapsulates an entry in a KnowledgeBase.
std::vector< int64_t > type
trait that describes the value type
This class stores variables and their values for use by any entity needing state information in a thr...
VariableReference size_
Reference to the size field of the vector space.
std::vector< VariableReference > vector_
Values of the array.
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< KnowledgeRecord > KnowledgeVector
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
This class stores a vector of NativeIntegerVectors.
std::string delimiter_
Delimiter for the prefix to subvars.
static constexpr struct madara::knowledge::tags::string_t string
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.
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
ThreadSafeContext * context_
Variable context that we are modifying.