MADARA  3.2.3
IntegerVector.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_CONTAINERS_INTEGER_VECTOR_H_
3 #define _MADARA_CONTAINERS_INTEGER_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  {
31  class MADARA_EXPORT IntegerVector : public BaseContainer
32  {
33  public:
36 
42  IntegerVector (const KnowledgeUpdateSettings & settings =
44  const std::string & delimiter = ".");
45 
55  IntegerVector (const std::string & name,
57  int size = -1,
58  bool delete_vars = true,
59  const KnowledgeUpdateSettings & settings =
61  const std::string & delimiter = ".");
62 
72  IntegerVector (const std::string & name,
73  Variables & knowledge,
74  int size = -1,
75  bool delete_vars = true,
76  const KnowledgeUpdateSettings & settings =
78  const std::string & delimiter = ".");
79 
83  IntegerVector (const IntegerVector & rhs);
84 
88  virtual ~IntegerVector ();
89 
94  void modify (void);
95 
101  void modify (size_t index);
102 
107  void operator= (const IntegerVector & rhs);
108 
114  void push_back (type value);
115 
122  void resize (int size = -1, bool delete_vars = true);
123 
132  void exchange (IntegerVector & other, bool refresh_keys = true,
133  bool delete_keys = true);
134 
139  void transfer_to (IntegerVector & other);
140 
145  void copy_to (KnowledgeVector & target) const;
146 
151  void copy_to (std::vector <type> & target) const;
152 
158  size_t size (void) const;
159 
166  void set_name (const std::string & var_name,
167  KnowledgeBase & knowledge, int size = -1);
168 
175  void set_name (const std::string & var_name,
176  Variables & knowledge, int size = -1);
177 
184  void set_name (const std::string & var_name,
185  ThreadSafeContext & knowledge, int size = -1);
186 
194  void set_delimiter (const std::string & delimiter);
195 
203  std::string get_delimiter (void);
204 
211  type operator[] (size_t index) const;
212 
219  knowledge::KnowledgeRecord to_record (size_t index) const;
220 
225  knowledge::KnowledgeRecord to_record (void) const;
226 
233  bool exists (size_t index) const;
234 
241  type inc (size_t index);
242 
251  int set (size_t index,
252  const type & value =
254 
264  int set (size_t index,
265  const type & value,
266  const KnowledgeUpdateSettings & settings);
267 
275  int set (
276  const std::vector <type> & value);
277 
286  int set (
287  const std::vector <type> & value,
288  const KnowledgeUpdateSettings & settings);
289 
297  void set_quality (size_t index, uint32_t quality,
298  const KnowledgeReferenceSettings & settings =
300 
305  VariableReference get_size_ref (void);
306 
316  std::string get_debug_info (void);
317 
323  virtual BaseContainer * clone (void) const;
324 
329  bool is_true (void) const;
330 
335  bool is_false (void) const;
336 
337  private:
338 
343  virtual bool is_true_ (void) const;
344 
349  virtual bool is_false_ (void) const;
350 
359  virtual void modify_ (void);
360 
370  virtual std::string get_debug_info_ (void);
371 
376 
380  std::vector <VariableReference> vector_;
381 
386 
391  };
392 
395  }
396  }
397 }
398 
399 #endif // _MADARA_CONTAINERS_INTEGER_VECTOR_H_
This class encapsulates an entry in a KnowledgeBase.
This class stores variables and their values for use by any entity needing state information in a thr...
This class stores a vector of integers inside of KaRL.
Definition: IntegerVector.h:31
ThreadSafeContext * context_
Variable context that we are modifying.
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
knowledge::KnowledgeRecord::Integer type
trait that describes the value type
Definition: IntegerVector.h:35
static struct madara::knowledge::tags::string_t string
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
IntegerVector IntegerArray
provide the Array alias for the IntegerVector class
VariableReference size_
Reference to the size field of the vector space.
std::vector< VariableReference > vector_
Values of the array.
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.
std::string delimiter_
Delimiter for the prefix to subvars.
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