MADARA  3.4.1
NativeDoubleVectorStaged.cpp
Go to the documentation of this file.
4 
7  : BaseContainer("", settings), context_(0), has_changed_(false)
8 {
10  "NativeDoubleVectorStaged::constructor: new object\n");
11 }
12 
15  int size, const KnowledgeUpdateSettings& settings)
16  : BaseContainer(name, settings),
17  context_(&(knowledge.get_context())),
18  has_changed_(false)
19 {
21  "NativeDoubleVectorStaged::constructor called for %s[%d]\n", name.c_str(),
22  size);
23 
24  vector_ = knowledge.get_ref(name, settings_);
25  if (size >= 0)
26  {
27  resize(size);
28  }
29 }
30 
33  int size, const KnowledgeUpdateSettings& settings)
34  : context_(knowledge.get_context()), has_changed_(false)
35 {
37  "NativeDoubleVectorStaged::constructor called for %s[%d]\n", name.c_str(),
38  size);
39 
40  vector_ = knowledge.get_ref(name, settings);
41  if (size >= 0)
42  {
43  resize(size);
44  }
45 }
46 
49  : BaseContainer(rhs), context_(rhs.context_), vector_(rhs.vector_)
50 {
52  "NativeDoubleVectorStaged::copy constructor called on %s\n",
53  rhs.name_.c_str());
54 }
55 
58 {
60  "NativeDoubleVectorStaged::destructor called on %s\n",
61  this->name_.c_str());
62 
63  write();
64 }
65 
68 {
70  "NativeDoubleVectorStaged::clone: cloning %s\n", this->name_.c_str());
71 
72  return new NativeDoubleVectorStaged(*this);
73 }
74 
76  void) const
77 {
78  return is_false();
79 }
80 
82  void) const
83 {
84  return is_true();
85 }
86 
88 {
89  modify();
90 }
#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
KnowledgeUpdateSettings settings_
Settings for modifications.
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.
size_t size(void) const
Returns the size of the vector.
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 ...
virtual BaseContainer * clone(void) const
Clones this container.
VariableReference vector_
Reference to the size field of the vector space.
virtual bool is_true_(void) const
Polymorphic is true method which can be used to determine if all values in the container are true.
NativeDoubleVectorStaged(const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Default constructor.
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