MADARA  3.4.1
NativeIntegerVectorStaged.cpp
Go to the documentation of this file.
3 
6  : BaseContainer("", settings), context_(0), has_changed_(false)
7 {
9  "NativeIntegerVectorStaged::constructor: new object\n");
10 }
11 
14  int size, const KnowledgeUpdateSettings& settings)
15  : BaseContainer(name, settings),
16  context_(&(knowledge.get_context())),
17  has_changed_(false)
18 {
20  "NativeIntegerVectorStaged::constructor called for %s[%d]\n",
21  name.c_str(), size);
22 
23  vector_ = knowledge.get_ref(name, KnowledgeUpdateSettings(true));
24  if (size >= 0)
25  {
26  resize(size);
27  }
28 }
29 
32  int size, const KnowledgeUpdateSettings& settings)
33  : BaseContainer(name, settings),
34  context_(knowledge.get_context()),
35  has_changed_(false)
36 {
38  "NativeIntegerVectorStaged::constructor called for %s[%d]\n",
39  name.c_str(), size);
40 
41  vector_ = knowledge.get_ref(name, settings);
42  if (size >= 0)
43  {
44  resize(size);
45  }
46 }
47 
50  : BaseContainer(rhs),
51  context_(rhs.context_),
52  vector_(rhs.vector_),
53  has_changed_(false)
54 {
56  "NativeIntegerVectorStaged::copy constructor called on %s\n",
57  rhs.name_.c_str());
58 }
59 
62 {
64  "NativeIntegerVectorStaged::destructor called on %s\n",
65  this->name_.c_str());
66 
67  write();
68 }
69 
72 {
73  return new NativeIntegerVectorStaged(*this);
74 }
75 
77  void) const
78 {
79  return is_false();
80 }
81 
83  void) const
84 {
85  return is_true();
86 }
87 
89  void)
90 {
91  modify();
92 }
#define madara_logger_ptr_log(loggering, level,...)
Fast version of the madara::logger::log method for Logger pointers.
Definition: Logger.h:41
const ThreadSafeContext * context_
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:45
Settings for applying knowledge updates.
Provides an interface for external functions into the MADARA KaRL variable settings.
Definition: Variables.h:53
This class is an abstract base class for all containers.
Definition: BaseContainer.h:34
std::string name_
Prefix of variable.
This class stores a vector of doubles inside of KaRL.
virtual void modify_(void)
Polymorphic modify method used by collection containers.
virtual BaseContainer * clone(void) const
Clones this container.
virtual bool is_true_(void) const
Polymorphic is true method which can be used to determine if all values in the container are true.
size_t size(void) const
Returns the size of the vector.
NativeIntegerVectorStaged(const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Default constructor.
VariableReference vector_
Reference to the size field of the vector space.
virtual bool is_false_(void) const
Polymorphic is false method which can be used to determine if at least one value in the container is ...
constexpr string_t string
Provides functions and classes for the distributed knowledge base.
T get(const KnowledgeRecord &kr)
Get the value of a KnowlegeRecord.
Definition: GetRecord.h:121
MADARA_EXPORT utility::Refcounter< logger::Logger > global_logger