GAMS  1.4.0
PlatformFactoryRepository.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_PLATFORMS_PLATFORM_FACTORY_REPOSITORY_H_
55 #define _GAMS_PLATFORMS_PLATFORM_FACTORY_REPOSITORY_H_
56 
57 #include "gams/GamsExport.h"
60 #include "gams/variables/Self.h"
61 #include "gams/variables/Sensor.h"
62 #include "madara/knowledge/KnowledgeBase.h"
63 #include "PlatformFactory.h"
64 
65 namespace gams
66 {
67  namespace platforms
68  {
69 
70  typedef std::map <std::string, PlatformFactory *> FactoryMap;
71 
76  {
77  public:
86  madara::knowledge::KnowledgeBase * knowledge = 0,
87  variables::Sensors * sensors = 0,
88  variables::Platforms * platforms = 0,
89  variables::Self * self = 0);
90 
95 
103  void add(const std::vector <std::string> & aliases,
104  PlatformFactory * factory);
105 
112  BasePlatform * create(const std::string & type,
113  const madara::knowledge::KnowledgeMap & args = madara::knowledge::KnowledgeMap());
114 
119  void set_knowledge(madara::knowledge::KnowledgeBase * knowledge);
120 
126 
131  void set_self(variables::Self * self);
132 
138 
143 
149  bool exists(const std::string & prefix) const;
150 
151  private:
152 
154  madara::knowledge::KnowledgeBase * knowledge_;
155 
158 
161 
164 
167  };
168 
176  }
177 }
178 
179 #endif // _GAMS_PLATFORMS_PLATFORM_FACTORY_REPOSITORY_H_
Copyright(c) 2014 Carnegie Mellon University.
#define GAMS_EXPORT
Definition: GamsExport.h:20
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
The base platform for all platforms to use.
Definition: BasePlatform.h:113
variables::Sensors * sensors_
sensor variables
void set_knowledge(madara::knowledge::KnowledgeBase *knowledge)
Sets the knowledge base.
void initialize_default_mappings(void)
Initializes factories for all supported GAMS algorithms.
FactoryMap factory_map_
a map of all aliases to factories
variables::Platforms * platforms_
platform variables
void set_self(variables::Self *self)
Sets self-referencing variables.
void set_platforms(variables::Platforms *platforms)
Sets the map of platform names to platform information.
bool exists(const std::string &prefix) const
Checks if a platform type exists in the repository.
PlatformFactoryRepository(madara::knowledge::KnowledgeBase *knowledge=0, variables::Sensors *sensors=0, variables::Platforms *platforms=0, variables::Self *self=0)
Constructor.
variables::Self * self_
self-referencing variables
madara::knowledge::KnowledgeBase * knowledge_
knowledge base containing variables
BasePlatform * create(const std::string &type, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Creates a platform.
void set_sensors(variables::Sensors *sensors)
Sets the map of sensor names to sensor information.
void add(const std::vector< std::string > &aliases, PlatformFactory *factory)
Adds an algorithm factory.
Base class for platform factories to create BasePlatforms.
A container for self referencing information.
Definition: Self.h:70
std::map< std::string, PlatformFactory * > FactoryMap
GAMS_EXPORT PlatformFactoryRepository * global_platform_factory()
A globally accessible platform factory.
std::map< std::string, PlatformStatus > Platforms
a map of sensor names to the sensor information
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
Contains all GAMS-related tools, classes and code.