GAMS  1.2.2
MapeLoop.h
Go to the documentation of this file.
1 
55 #ifndef _GAMS_LOOP_H_
56 #define _GAMS_LOOP_H_
57 
58 #include "gams/GamsExport.h"
59 #include "gams/variables/Agent.h"
60 #include "gams/variables/Swarm.h"
61 #include "gams/variables/Self.h"
62 #include "gams/variables/Sensor.h"
65 #include "madara/knowledge/containers/Integer.h"
66 #include "madara/knowledge/containers/Double.h"
67 #include "madara/knowledge/containers/String.h"
68 #include "madara/knowledge/containers/DoubleVector.h"
69 #include "madara/knowledge/KnowledgeBase.h"
70 
71 namespace gams
72 {
73  namespace controllers
74  {
79  {
80  public:
85  MapeLoop (madara::knowledge::KnowledgeBase & knowledge);
86 
90  ~MapeLoop ();
91 
95  void define_mape (const std::string & loop =
96  "monitor (); analyze (); plan (); execute ()");
97 
103  void define_monitor (
104  madara::knowledge::KnowledgeRecord (*func) (
105  madara::knowledge::FunctionArguments &,
106  madara::knowledge::Variables &));
107 
113  void define_analyze (
114  madara::knowledge::KnowledgeRecord (*func) (
115  madara::knowledge::FunctionArguments &,
116  madara::knowledge::Variables &));
117 
123  void define_plan (
124  madara::knowledge::KnowledgeRecord (*func) (
125  madara::knowledge::FunctionArguments &,
126  madara::knowledge::Variables &));
127 
133  void define_execute (
134  madara::knowledge::KnowledgeRecord (*func) (
135  madara::knowledge::FunctionArguments &,
136  madara::knowledge::Variables &));
137 
144  void init_vars (madara::knowledge::KnowledgeBase & knowledge,
145  const madara::knowledge::KnowledgeRecord::Integer & id = 0,
146  const madara::knowledge::KnowledgeRecord::Integer & processes = -1);
147 
154  madara::knowledge::KnowledgeRecord run (double period = 0.5,
155  double max_runtime = -1);
156 
157  protected:
158 
161 
163  madara::knowledge::KnowledgeBase & knowledge_;
164 
166  madara::knowledge::CompiledExpression mape_loop_;
167 
170 
173 
176  };
177  }
178 }
179 
180 #endif // _GAMS_LOOP_H_
A container for swarm information.
Definition: Swarm.h:75
madara::knowledge::KnowledgeBase & knowledge_
knowledge base
Definition: MapeLoop.h:163
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
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.
variables::Self self_
Containers for self-referencing variables.
Definition: MapeLoop.h:169
GAMS_EXPORT void init_vars(AccentStatuses &variables, madara::knowledge::KnowledgeBase &knowledge, const std::string &prefix)
Initializes accent status containers.
Contains all GAMS-related tools, classes and code.
A container for self referencing information.
Definition: Self.h:69
#define GAMS_EXPORT
Definition: GamsExport.h:20
A highly extensible MAPE loop.
Definition: MapeLoop.h:78
variables::Sensors sensors_
Containers for sensor information.
Definition: MapeLoop.h:172
variables::Swarm swarm_
Containers for swarm-related variables.
Definition: MapeLoop.h:175
madara::knowledge::CompiledExpression mape_loop_
Compiled MAPE MapeLoop.
Definition: MapeLoop.h:166
Copyright (c) 2014-2018 Carnegie Mellon University.
variables::Agents agents_
Containers for agent-related variables.
Definition: MapeLoop.h:160
Copyright (c) 2014 Carnegie Mellon University.
Copyright (c) 2014 Carnegie Mellon University.