GAMS  1.2.2
gams::controllers::MapeLoop Class Reference

A highly extensible MAPE loop. More...

#include <MapeLoop.h>

Public Member Functions

 MapeLoop (madara::knowledge::KnowledgeBase &knowledge)
 Constructor. More...
 
 ~MapeLoop ()
 Destructor. More...
 
void define_analyze (madara::knowledge::KnowledgeRecord(*func)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &))
 Defines the analyze function (the A of MAPE). More...
 
void define_execute (madara::knowledge::KnowledgeRecord(*func)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &))
 Defines the execute function (the E of MAPE). More...
 
void define_mape (const std::string &loop="monitor (); analyze (); plan (); execute ()")
 Defines the MAPE loop. More...
 
void define_monitor (madara::knowledge::KnowledgeRecord(*func)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &))
 Defines the monitor function (the M of MAPE). More...
 
void define_plan (madara::knowledge::KnowledgeRecord(*func)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &))
 Defines the plan function (the P of MAPE). More...
 
void init_vars (madara::knowledge::KnowledgeBase &knowledge, const madara::knowledge::KnowledgeRecord::Integer &id=0, const madara::knowledge::KnowledgeRecord::Integer &processes=-1)
 Initializes global variable containers. More...
 
madara::knowledge::KnowledgeRecord run (double period=0.5, double max_runtime=-1)
 Runs one iteration of the MAPE loop. More...
 

Protected Attributes

variables::Agents agents_
 Containers for agent-related variables. More...
 
madara::knowledge::KnowledgeBase & knowledge_
 knowledge base More...
 
madara::knowledge::CompiledExpression mape_loop_
 Compiled MAPE MapeLoop. More...
 
variables::Self self_
 Containers for self-referencing variables. More...
 
variables::Sensors sensors_
 Containers for sensor information. More...
 
variables::Swarm swarm_
 Containers for swarm-related variables. More...
 

Detailed Description

A highly extensible MAPE loop.

Definition at line 78 of file MapeLoop.h.

Constructor & Destructor Documentation

gams::controllers::MapeLoop::MapeLoop ( madara::knowledge::KnowledgeBase &  knowledge)

Constructor.

Parameters
knowledgeThe knowledge base to reference and mutate
gams::controllers::MapeLoop::~MapeLoop ( )

Destructor.

Member Function Documentation

void gams::controllers::MapeLoop::define_analyze ( madara::knowledge::KnowledgeRecord(*)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &)  func)

Defines the analyze function (the A of MAPE).

This function should return a 0 unless the MAPE loop should stop.

Parameters
functhe function to call
void gams::controllers::MapeLoop::define_execute ( madara::knowledge::KnowledgeRecord(*)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &)  func)

Defines the execute function (the E of MAPE).

This function should return a 0 unless the MAPE loop should stop.

Parameters
functhe function to call
void gams::controllers::MapeLoop::define_mape ( const std::string &  loop = "monitor (); analyze (); plan (); execute ()")

Defines the MAPE loop.

void gams::controllers::MapeLoop::define_monitor ( madara::knowledge::KnowledgeRecord(*)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &)  func)

Defines the monitor function (the M of MAPE).

This function should return a 0 unless the MAPE loop should stop.

Parameters
functhe function to call
void gams::controllers::MapeLoop::define_plan ( madara::knowledge::KnowledgeRecord(*)(madara::knowledge::FunctionArguments &, madara::knowledge::Variables &)  func)

Defines the plan function (the P of MAPE).

This function should return a 0 unless the MAPE loop should stop.

Parameters
functhe function to call
void gams::controllers::MapeLoop::init_vars ( madara::knowledge::KnowledgeBase &  knowledge,
const madara::knowledge::KnowledgeRecord::Integer &  id = 0,
const madara::knowledge::KnowledgeRecord::Integer &  processes = -1 
)

Initializes global variable containers.

Parameters
knowledgethe knowledge base to reference
idnode identifier
processesprocesses
madara::knowledge::KnowledgeRecord gams::controllers::MapeLoop::run ( double  period = 0.5,
double  max_runtime = -1 
)

Runs one iteration of the MAPE loop.

Parameters
periodtime between executions of the loop
max_runtimemaximum runtime within the MAPE loop
Returns
the result of the MAPE loop

Member Data Documentation

variables::Agents gams::controllers::MapeLoop::agents_
protected

Containers for agent-related variables.

Definition at line 160 of file MapeLoop.h.

madara::knowledge::KnowledgeBase& gams::controllers::MapeLoop::knowledge_
protected

knowledge base

Definition at line 163 of file MapeLoop.h.

madara::knowledge::CompiledExpression gams::controllers::MapeLoop::mape_loop_
protected

Compiled MAPE MapeLoop.

Definition at line 166 of file MapeLoop.h.

variables::Self gams::controllers::MapeLoop::self_
protected

Containers for self-referencing variables.

Definition at line 169 of file MapeLoop.h.

variables::Sensors gams::controllers::MapeLoop::sensors_
protected

Containers for sensor information.

Definition at line 172 of file MapeLoop.h.

variables::Swarm gams::controllers::MapeLoop::swarm_
protected

Containers for swarm-related variables.

Definition at line 175 of file MapeLoop.h.


The documentation for this class was generated from the following file: