GAMS  1.4.0
KarlEvaluator.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ALGORITHMS_KARL_H_
55 #define _GAMS_ALGORITHMS_KARL_H_
56 
59 #include "madara/utility/EpochEnforcer.h"
60 
61 namespace gams
62 {
63  namespace algorithms
64  {
69  {
70  public:
87  const std::string & logic,
88  const std::string & store_result,
89  bool is_wait,
90  double wait_time,
91  madara::knowledge::KnowledgeBase * knowledge = 0,
92  platforms::BasePlatform * platform = 0,
93  variables::Sensors * sensors = 0,
94  variables::Self * self = 0,
95  variables::Agents * agents = 0);
96 
101 
107 
112  virtual int analyze(void);
113 
118  virtual int execute(void);
119 
124  virtual int plan(void);
125 
126  protected:
127 
128 #ifndef _MADARA_NO_KARL_
130  madara::knowledge::CompiledExpression compiled_logic_;
131 #endif
132 
134  madara::knowledge::EvalSettings settings_;
135 
137  std::string logic_;
138 
140  bool is_wait_;
141 
143  double wait_time_;
144 
146  madara::utility::EpochEnforcer<std::chrono::steady_clock> enforcer_;
147  };
148 
153  {
154  public:
170  const madara::knowledge::KnowledgeMap & args,
171  madara::knowledge::KnowledgeBase * knowledge,
172  platforms::BasePlatform * platform,
173  variables::Sensors * sensors,
174  variables::Self * self,
175  variables::Agents * agents);
176  };
177  }
178 }
179 
180 #endif // _GAMS_ALGORITHMS_KARL_H_
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
#define GAMS_EXPORT
Definition: GamsExport.h:20
Base class for algorithm factories that classes derived from.
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:95
A factory class for creating KarlEvaluator algorithms.
virtual BaseAlgorithm * create(const madara::knowledge::KnowledgeMap &args, madara::knowledge::KnowledgeBase *knowledge, platforms::BasePlatform *platform, variables::Sensors *sensors, variables::Self *self, variables::Agents *agents)
Creates an KarlEvaluator Algorithm.
An algorithm capable of executing other algorithms.
Definition: KarlEvaluator.h:69
KarlEvaluator(const std::string &logic, const std::string &store_result, bool is_wait, double wait_time, madara::knowledge::KnowledgeBase *knowledge=0, platforms::BasePlatform *platform=0, variables::Sensors *sensors=0, variables::Self *self=0, variables::Agents *agents=0)
Constructor.
madara::knowledge::EvalSettings settings_
the evaluation settings
bool is_wait_
indicates if the logic should be evaluated as a wait statement
void operator=(KarlEvaluator &rhs)
Assignment operator.
virtual int plan(void)
Plans the next execution of the algorithm.
std::string logic_
original logic for debugging purposes
virtual int analyze(void)
Analyzes environment, platform, or other information.
madara::knowledge::CompiledExpression compiled_logic_
the compiled logic
virtual int execute(void)
Plans the next execution of the algorithm.
double wait_time_
indicates the time to wait. -1 means wait forever.
madara::utility::EpochEnforcer< std::chrono::steady_clock > enforcer_
an enforcer for maximum time taken
The base platform for all platforms to use.
Definition: BasePlatform.h:113
A container for self referencing information.
Definition: Self.h:70
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.