GAMS  1.4.0
AlgorithmFactoryRepository.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ALGORITHMS_CONTROLLER_ALGORITHM_FACTORY_H_
55 #define _GAMS_ALGORITHMS_CONTROLLER_ALGORITHM_FACTORY_H_
56 
57 #include "madara/utility/Refcounter.h"
58 #include "gams/GamsExport.h"
61 #include "gams/variables/Self.h"
62 #include "gams/variables/Sensor.h"
63 #include "gams/variables/Agent.h"
64 #include "madara/knowledge/KnowledgeBase.h"
66 
67 namespace gams
68 {
69  namespace algorithms
70  {
74  typedef std::map <std::string, AlgorithmFactory *> AlgorithmFactoryMap;
75 
80  {
81  public:
91  madara::knowledge::KnowledgeBase * knowledge = 0,
92  variables::Sensors * sensors = 0,
93  platforms::BasePlatform * platform = 0,
94  variables::Self * self = 0,
95  variables::Agents * agents = 0);
96 
101 
109  void add(const std::vector <std::string> & aliases,
110  AlgorithmFactory * factory);
111 
118  BaseAlgorithm * create(const std::string & type,
119  const madara::knowledge::KnowledgeMap & args = madara::knowledge::KnowledgeMap());
120 
126 
131  void set_knowledge(madara::knowledge::KnowledgeBase * knowledge);
132 
138 
143  void set_self(variables::Self * self);
144 
150 
155 
156  protected:
157 
160 
162  madara::knowledge::KnowledgeBase * knowledge_;
163 
166 
169 
172 
175 
178 
181  };
182 
189  }
190 }
191 
192 #endif // _GAMS_ALGORITHMS_CONTROLLER_ALGORITHM_FACTORY_H_
Copyright(c) 2014-2018 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
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.
AlgorithmFactoryRepository(madara::knowledge::KnowledgeBase *knowledge=0, variables::Sensors *sensors=0, platforms::BasePlatform *platform=0, variables::Self *self=0, variables::Agents *agents=0)
Constructor.
AlgorithmFactoryMap factory_map_
a map of all aliases to factories
void initialize_default_mappings(void)
Initializes factories for all supported GAMS algorithms.
variables::Self * self_
self-referencing variables
bool init_finished_
flag for seeing if an init defaultshas stopped
platforms::BasePlatform * platform_
platform variables
BaseAlgorithm * create(const std::string &type, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Creates an algorithm.
void set_sensors(variables::Sensors *sensors)
Sets the map of sensor names to sensor information.
bool init_started_
flag for seeing if an init defaults has started
variables::Agents * agents_
list of agents participating in the swarm
void set_platform(platforms::BasePlatform *platform)
Sets the map of platform names to platform information.
madara::knowledge::KnowledgeBase * knowledge_
knowledge base containing variables
void set_agents(variables::Agents *agents)
Sets list of agents participating in swarm.
void add(const std::vector< std::string > &aliases, AlgorithmFactory *factory)
Adds an algorithm factory.
void set_knowledge(madara::knowledge::KnowledgeBase *knowledge)
Sets the knowledge base.
void set_self(variables::Self *self)
Sets self-referencing variables.
Base class for algorithm factories that classes derived from.
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:95
The base platform for all platforms to use.
Definition: BasePlatform.h:113
A container for self referencing information.
Definition: Self.h:70
GAMS_EXPORT AlgorithmFactoryRepository * global_algorithm_factory()
A globally accessible algorithm factory.
std::map< std::string, AlgorithmFactory * > AlgorithmFactoryMap
Convenience typedef for a map of aliases to factories.
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Contains all GAMS-related tools, classes and code.