MADARA  3.1.8
NativeDoubleVectorStaged.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_NATIVE_DOUBLE_VECTOR_STAGED_H_
3 #define _MADARA_NATIVE_DOUBLE_VECTOR_STAGED_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  {
38  class MADARA_Export NativeDoubleVectorStaged : public BaseContainer
39  {
40  public:
42  typedef double type;
43 
50 
60  int size = -1,
61  const KnowledgeUpdateSettings & settings =
63 
72  Variables & knowledge,
73  int size = -1,
74  const KnowledgeUpdateSettings & settings =
76 
81 
85  virtual ~NativeDoubleVectorStaged ();
86 
91  void modify (void);
92 
97  void operator= (const NativeDoubleVectorStaged & rhs);
98 
103  void operator= (const std::vector <type> & rhs);
104 
110  void push_back (type value);
111 
116  void resize (size_t size);
117 
123  void exchange (NativeDoubleVectorStaged & other);
124 
129  void transfer_to (NativeDoubleVectorStaged & other);
130 
135  void copy_to (KnowledgeVector & target) const;
136 
141  size_t size (void) const;
142 
150  void set_name (const std::string & var_name,
151  KnowledgeBase & knowledge, int size = -1,
152  bool sync = true);
153 
161  void set_name (const std::string & var_name,
162  Variables & knowledge, int size = -1,
163  bool sync = true);
164 
172  void set_name (const std::string & var_name,
173  ThreadSafeContext & knowledge, int size = -1,
174  bool sync = true);
175 
182  type operator[] (size_t index) const;
183 
190  void set (size_t index,
191  type value);
192 
198  void set (
199  const std::vector <type> & value);
200 
208  void set_quality (size_t index, uint32_t quality,
209  const KnowledgeReferenceSettings & settings =
211 
218  knowledge::KnowledgeRecord to_record (size_t index) const;
219 
224  knowledge::KnowledgeRecord to_record (void) const;
225 
235  std::string get_debug_info (void);
236 
242  virtual BaseContainer * clone (void) const;
243 
248  bool is_true (void) const;
249 
254  bool is_false (void) const;
255 
259  void read (void);
260 
264  void write (void);
265 
266  private:
267 
272  virtual bool is_true_ (void) const;
273 
278  virtual bool is_false_ (void) const;
279 
288  virtual void modify_ (void);
289 
299  virtual std::string get_debug_info_ (void);
300 
305 
310 
315 
320  };
321 
324  }
325  }
326 }
327 
329 
330 #endif // _MADARA_NATIVE_DOUBLE_VECTOR_STAGED_H_
This class encapsulates an entry in a KnowledgeBase.
bool has_changed_
Tracks if value_ has changed since last read.
This class stores a vector of doubles inside of KaRL.
VariableReference vector_
Reference to the size field of the vector space.
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 container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
::std::vector< KnowledgeRecord > KnowledgeVector
KnowledgeRecord value_
The staged value of the vector.
ThreadSafeContext * context_
Variable context that we are modifying.
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
static constexpr struct madara::knowledge::tags::string_t string
Provides functions and classes for the distributed knowledge base.
NativeDoubleVectorStaged NativeDoubleArrayStaged
provide the Array alias for the NativeDoubleVectorStaged class
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