GAMS  1.2.2
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"
65 #include "AlgorithmFactory.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 
125  void set_agents (variables::Agents * agents);
126 
131  void set_knowledge (madara::knowledge::KnowledgeBase * knowledge);
132 
137  void set_platform (platforms::BasePlatform * platform);
138 
143  void set_self (variables::Self * self);
144 
149  void set_sensors (variables::Sensors * sensors);
150 
154  void initialize_default_mappings (void);
155 
156  protected:
157 
160 
162  madara::knowledge::KnowledgeBase * knowledge_;
163 
166 
169 
172 
174  AlgorithmFactoryMap factory_map_;
175 
178 
181  };
182 
189  }
190 }
191 
192 #endif // _GAMS_ALGORITHMS_CONTROLLER_ALGORITHM_FACTORY_H_
Base class for algorithm factories that classes derived from.
variables::Self * self_
self-referencing variables
The controller&#39;s algorithm factory.
Copyright (c) 2014 Carnegie Mellon University.
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
AlgorithmFactoryMap factory_map_
a map of all aliases to factories
The base platform for all platforms to use.
Definition: BasePlatform.h:190
Copyright (c) 2014 Carnegie Mellon University.
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Copyright (c) 2014 Carnegie Mellon University.
platforms::BasePlatform * platform_
platform variables
Contains all GAMS-related tools, classes and code.
A container for self referencing information.
Definition: Self.h:69
Copyright (c) 2014 Carnegie Mellon University.
bool init_finished_
flag for seeing if an init defaultshas stopped
#define GAMS_EXPORT
Definition: GamsExport.h:20
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:94
Copyright (c) 2014 Carnegie Mellon University.
variables::Agents * agents_
list of agents participating in the swarm
bool init_started_
flag for seeing if an init defaults has started
GAMS_EXPORT AlgorithmFactoryRepository * global_algorithm_factory()
A globally accessible algorithm factory.
Copyright (c) 2014-2018 Carnegie Mellon University.
variables::Sensors * sensors_
sensor variables
madara::knowledge::KnowledgeBase * knowledge_
knowledge base containing variables
std::map< std::string, AlgorithmFactory * > AlgorithmFactoryMap
Convenience typedef for a map of aliases to factories.