MADARA  3.2.3
BaseContainer.cpp
Go to the documentation of this file.
1 #include "BaseContainer.h"
3 
4 namespace logger = madara::logger;
5 
7  const std::string & name, const KnowledgeUpdateSettings & settings)
8  : name_ (name), settings_ (settings)
9 {
10 }
11 
12 
14  const BaseContainer & rhs)
15 : name_ (rhs.name_),
16  settings_ (rhs.settings_)
17 {
18 
19 }
20 
21 
23 {
24 
25 }
26 
27 void
29 const KnowledgeUpdateSettings & settings)
30 {
31  MADARA_GUARD_TYPE guard (mutex_);
32 
33  settings_ = settings;
34 }
35 
38 {
39  MADARA_GUARD_TYPE guard (mutex_);
40 
41  return settings_;
42 }
43 
45  BaseContainer & conditional)
46 {
47  bool result (false);
48 
50  "BaseContainer::is_true: calling condition.is_true()\n");
51 
52  if (conditional.is_true_ ())
53  {
55  "BaseContainer::is_true: condition.is_true() returned true\n");
56 
57  this->modify_ ();
58  result = true;
59  }
60 
61  return result;
62 }
63 
65  BaseContainer & conditional)
66 {
67  bool result (false);
68 
70  "BaseContainer::is_false: calling !condition.is_true()\n");
71 
72  if (!conditional.is_true_ ())
73  {
75  "BaseContainer::is_false: !condition.is_true() returned true\n");
76  this->modify_ ();
77  result = true;
78  }
79 
80  return result;
81 }
std::string name_
Prefix of variable.
void set_settings(const KnowledgeUpdateSettings &settings)
Sets the update settings for the container.
MADARA_EXPORT utility::Refcounter< logger::Logger > global_logger
virtual bool is_true_(void) const =0
Polymorphic is true method which can be used to determine if all values in a container are true...
MADARA_LOCK_TYPE mutex_
guard for access and changes
Provides knowledge logging services to files and terminals.
Definition: GlobalLogger.h:11
virtual void modify_(void)=0
Polymorphic modify method used by collection containers.
virtual bool modify_if_false(BaseContainer &conditional)
Modifies the container if the argument is false.
static struct madara::knowledge::tags::string_t string
#define madara_logger_ptr_log(logger, level,...)
Fast version of the madara::logger::log method for Logger pointers.
Definition: Logger.h:32
virtual bool modify_if_true(BaseContainer &conditional)
Modifies the container if the argument is true.
KnowledgeUpdateSettings get_settings(void)
Gets the update settings for the container.
KnowledgeUpdateSettings settings_
Settings for modifications.
Settings for applying knowledge updates.
BaseContainer(const std::string &name="", const KnowledgeUpdateSettings &settings=KnowledgeUpdateSettings())
Constructor.
This class is an abstract base class for all containers.
Definition: BaseContainer.h:33