MADARA  3.4.1
BaseContainer.h
Go to the documentation of this file.
1 
2 #ifndef _MADARA_CONTAINERS_BASE_CONTAINER_H_
3 #define _MADARA_CONTAINERS_BASE_CONTAINER_H_
4 
5 #include <vector>
6 #include <string>
7 #include "madara/LockType.h"
11 
20 namespace madara
21 {
22 namespace knowledge
23 {
24 namespace containers
25 {
27 class Collection;
28 
33 class MADARA_EXPORT BaseContainer
34 {
35 public:
37  friend class Collection;
38 
44  BaseContainer(const std::string& name = "",
46 
51  BaseContainer(const BaseContainer& rhs);
52 
56  virtual ~BaseContainer();
57 
62  std::string get_name(void) const;
63 
68  KnowledgeUpdateSettings get_settings(void);
69 
74  void set_settings(const KnowledgeUpdateSettings& settings);
75 
81  virtual BaseContainer* clone(void) const = 0;
82 
88  virtual bool modify_if_true(BaseContainer& conditional);
89 
95  virtual bool modify_if_false(BaseContainer& conditional);
96 
97 protected:
102  virtual bool is_true_(void) const = 0;
103 
108  virtual bool is_false_(void) const = 0;
109 
118  virtual void modify_(void) = 0;
119 
129  virtual std::string get_debug_info_(void) = 0;
130 
132 
136  mutable MADARA_LOCK_TYPE mutex_;
137 
142 
147 
152 };
153 }
154 }
155 }
156 
157 #include "BaseContainer.inl"
158 
159 #endif // _MADARA_CONTAINERS_BASE_CONTAINER_H_
Settings for applying knowledge updates.
This class stores variables and their values for use by any entity needing state information in a thr...
This class is an abstract base class for all containers.
Definition: BaseContainer.h:34
ThreadSafeContext * context_
Variable context that we are modifying.
KnowledgeUpdateSettings settings_
Settings for modifications.
std::string name_
Prefix of variable.
virtual bool is_false_(void) const =0
Polymorphic is false method which can be used to determine if all values in a container are false.
virtual std::string get_debug_info_(void)=0
Returns the type of the container along with name and any other useful information.
virtual BaseContainer * clone(void) const =0
Clones this container.
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
virtual void modify_(void)=0
Polymorphic modify method used by collection containers.
A collection of MADARA containers that can be used for aggregate operations on all containers in the ...
Definition: Collection.h:44
Provides container classes for fast knowledge base access and mutation.
Definition: Barrier.h:27
constexpr string_t string
Provides functions and classes for the distributed knowledge base.
Copyright(c) 2020 Galois.