MADARA  3.1.8
NativeDoubleVector.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_NATIVE_DOUBLE_VECTOR_H_
3 #define _MADARA_NATIVE_DOUBLE_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 NativeDoubleVector : public BaseContainer
32  {
33  public:
35  typedef double type;
36 
43 
51  NativeDoubleVector (const std::string & name,
53  int size = -1,
54  const KnowledgeUpdateSettings & settings =
56 
64  NativeDoubleVector (const std::string & name,
65  Variables & knowledge,
66  int size = -1,
67  const KnowledgeUpdateSettings & settings =
69 
74 
78  virtual ~NativeDoubleVector ();
79 
84  void modify (void);
85 
90  void operator= (const NativeDoubleVector & rhs);
91 
97  void push_back (type value);
98 
103  void resize (size_t size);
104 
110  void exchange (NativeDoubleVector & other);
111 
116  void transfer_to (NativeDoubleVector & other);
117 
122  void copy_to (KnowledgeVector & target) const;
123 
128  size_t size (void) const;
129 
136  void set_name (const std::string & var_name,
137  KnowledgeBase & knowledge, int size = -1);
138 
145  void set_name (const std::string & var_name,
146  Variables & knowledge, int size = -1);
147 
154  void set_name (const std::string & var_name,
155  ThreadSafeContext & knowledge, int size = -1);
156 
163  type operator[] (size_t index) const;
164 
173  int set (size_t index,
174  type value);
175 
185  int set (size_t index,
186  type value,
187  const KnowledgeUpdateSettings & settings);
188 
196  int set (
197  const std::vector <type> & value);
198 
207  int set (
208  const std::vector <type> & value,
209  const KnowledgeUpdateSettings & settings);
210 
218  void set_quality (size_t index, uint32_t quality,
219  const KnowledgeReferenceSettings & settings =
221 
228  knowledge::KnowledgeRecord to_record (size_t index) const;
229 
234  knowledge::KnowledgeRecord to_record (void) const;
235 
245  std::string get_debug_info (void);
246 
252  virtual BaseContainer * clone (void) const;
253 
258  bool is_true (void) const;
259 
264  bool is_false (void) const;
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  };
311 
314  }
315  }
316 }
317 
318 #endif // _MADARA_NATIVE_DOUBLE_VECTOR_H_
This class encapsulates an entry in a KnowledgeBase.
double 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...
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
ThreadSafeContext * context_
Variable context that we are modifying.
VariableReference vector_
Reference to the size field of the vector space.
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
NativeDoubleVector NativeDoubleArray
provide the Array alias for the NativeDoubleVector class
This class stores a vector of doubles inside of KaRL.
static constexpr struct madara::knowledge::tags::string_t string
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