GAMS  1.2.2
Containerize.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_UTILITY_CONTAINERIZE_H_
55 #define _GAMS_UTILITY_CONTAINERIZE_H_
56 
57 #include "gams/GamsExport.h"
58 
59 #include <string>
60 
61 #include "madara/knowledge/KnowledgeBase.h"
62 
63 namespace gams
64 {
65  namespace utility
66  {
72  {
73  public:
77  Containerize (const std::string& n = "");
78 
82  virtual ~Containerize ();
83 
88  std::string get_name () const;
89 
94  void set_name (const std::string& n);
95 
99  void set_knowledge_base (madara::knowledge::KnowledgeBase* kb);
100 
105  void modify();
106 
111  void to_container (const std::string& name = "");
112 
118  void to_container (madara::knowledge::KnowledgeBase& kb,
119  const std::string& name = "");
120 
126  bool from_container (const std::string& name = "");
127 
134  bool from_container (
135  madara::knowledge::KnowledgeBase& kb,
136  const std::string& name = "");
137 
138  protected:
140  const static std::string object_type_suffix_;
141 
143  std::string name_;
144 
146  madara::knowledge::KnowledgeBase* prev_kb_;
147 
154  enum Class_ID
155  {
156  REGION_TYPE_ID = 0x00000001,
157  PRIORITIZED_REGION_TYPE_ID = 0x00000002,
158  SEARCH_AREA_TYPE_ID = 0x00000004,
159  INVALID = 0x80000000,
160  };
161 
169  bool is_valid_type (madara::knowledge::KnowledgeBase& kb,
170  const std::string& name, const Class_ID& expected) const;
171 
178  static Class_ID get_type (madara::knowledge::KnowledgeBase& kb,
179  const std::string& name);
180 
181  private:
188  virtual bool check_valid_type (
189  madara::knowledge::KnowledgeBase& kb,
190  const std::string& name) const = 0;
191 
197  virtual void to_container_impl (
198  madara::knowledge::KnowledgeBase& kb,
199  const std::string& name) = 0;
200 
206  virtual bool from_container_impl (
207  madara::knowledge::KnowledgeBase& kb,
208  const std::string& name) = 0;
209  };
210  }
211 }
212 
213 #endif // _GAMS_UTILITY_CONTAINERIZE_H_
static const std::string object_type_suffix_
object type suffix
Definition: Containerize.h:140
std::string name_
name of this object
Definition: Containerize.h:143
A class meant to assist with retrieving information into GAMS containers.
Definition: Containerize.h:71
Contains all GAMS-related tools, classes and code.
madara::knowledge::KnowledgeBase * prev_kb_
previous knowledge base used for sending objects
Definition: Containerize.h:146
#define GAMS_EXPORT
Definition: GamsExport.h:20
Class_ID
These are used to check on the type of the object in from_container.
Definition: Containerize.h:154