xabsl::Engine Class Reference#include <XabslEngine.h>
Inheritance diagram for xabsl::Engine:
[legend]Collaboration diagram for xabsl::Engine:
[legend]List of all members.
Detailed Description
Executes a behavior that was specified in the Xabsl language.
- Author:
- Martin Loetzsch
Max Risler
Matthias JŸngel
Definition at line 29 of file XabslEngine.h.
|
Public Member Functions |
| Engine (ErrorHandler &e, unsigned(*pTimeFunction)()) |
| Constructor.
|
| ~Engine () |
| Destructor.
|
void | execute () |
| Executes the engine for the selected agent starting from the root option.
|
void | createOptionGraph (InputSource &input) |
| Reads the intermediate code from an input source and creates the option graph.
|
void | registerBasicBehavior (BasicBehavior &basicBehavior) |
| Registers a basic behavior at the engine.
|
bool | setSelectedAgent (const char *name) |
| Sets the selected Agent.
|
void | reset () |
| Resets all active options.
|
|
const NamedArray< Agent * > & | getAgents () const |
| Returns the agents of the engine.
|
const NamedArray< Option * > & | getOptions () const |
| Return the options of the engine.
|
const NamedArray< BasicBehavior * > & | getBasicBehaviors () const |
| Returns the registered basic behaviors of the engine.
|
void | clearRootActions () |
| Clears the list of actions executed starting the option graph.
|
bool | addRootAction (const char *name, bool isOption=true) |
| Adds a given option or basic behavior to the list of actions executed starting the option graph.
|
bool | setRootAction (const char *name, bool isOption=true) |
| Executes the option graph starting from a given option or basic behavior.
|
void | setRootAction () |
| Sets the root option of the selected agent.
|
void | addRootAction (Behavior *behavior) |
| Adds the specified option or basic behavior to the list of root actions.
|
bool | addRootActionDecimalOutputSymbol (const char *name, double value) |
| Adds a decimal output symbol assignment to the list of root actions.
|
bool | addRootActionBooleanOutputSymbol (const char *name, bool value) |
| Adds a boolean output symbol assignment to the list of root actions.
|
bool | addRootActionEnumeratedOutputSymbol (const char *name, const char *value) |
| Adds an enumerated output symbol assignment to the list of root actions.
|
void | setRootAction (Behavior *behavior) |
| Sets the root option to the specified option or basic behavior.
|
const Action * | getRootAction (int i) const |
| Returns the selected root actions.
|
Action * | getRootAction (int i) |
| Returns the selected root actions.
|
const Array< Action * > & | getRootActions () const |
| Returns the selected root actions.
|
Array< Action * > & | getRootActions () |
| Returns the selected root actions.
|
const char * | getSelectedAgentName () const |
| Returns the name of the selected agent.
|
void | prepareIncomingMessages () |
| Prepare for processing incoming team messages.
|
void | processIncomingMessage (const TeamMessage &message) |
| Process an incoming team message from another agent.
|
void | generateOutgoingMessage (TeamMessage &message) |
| Generate the outgoing team message to be sent to other agents.
|
void | setSynchronizationTicks (int ticks) |
| Set the number of execution cycles that is required for synchonization with other agents, i.e time from sending a message until answer is received.
|
void | setAgentPriority (int priority) |
| Sets the priority value of the agent, used for solving conflicts in cooperative state assignment.
|
Private Member Functions |
bool | checkForLoops (Option *currentOption, ActionBehavior *currentOptionTree[], int currentLength, int maxSize) |
| A recursive function that is used to check for loops in the option graph.
|
void | addActions (ActionBehavior *actionToAdd, ActionBehavior *currentOptionTree[], int ¤tLength, int maxSize) |
| A recursive function that generates a list of actions referenced from a starting option This is used by checkForLoops.
|
int | countActions (Option *option) |
| Rescursively count the number of actions referenced from an option.
|
Private Attributes |
unsigned | timeOfExecutionStart |
| The time of the start of the current engine execution.
|
NamedArray< Agent * > | agents |
| The agents of the engine.
|
Agent * | selectedAgent |
| The selected agent.
|
NamedArray< Option * > | options |
| The options of the engine.
|
Array< Action * > | rootActions |
| The actions for the execution of the start of the option graph.
|
NamedArray< BasicBehavior * > | basicBehaviors |
| The registered basic behaviors of the engine.
|
ErrorHandler & | errorHandler |
| Is invoked when there are problems during initialization.
|
bool | initialized |
| If true, the engine was successfully initialized.
|
unsigned(* | pTimeFunction )() |
| A pointer to a function that returns the system time in ms.
|
NamedArray< double > | internalDecimalSymbols |
| Arrays containing internal symbol values.
|
NamedArray< bool > | internalBooleanSymbols |
NamedArray< int > | internalEnumeratedSymbols |
Array< CoopState * > | coopStates |
| Array of states which are used for cooperating agents.
|
int | agentPriority |
| Priority value of the agent, used for solving conflicts in cooperative state assignment.
|
int | synchronizationTicks |
| Number of execution cycles that is required for synchonization with other agents, i.e time from sending a message until answer is received.
|
Constructor & Destructor Documentation
xabsl::Engine::Engine |
( |
ErrorHandler & |
e, |
|
|
unsigned(* |
pTimeFunction)() |
|
) |
|
|
|
Constructor.
- Parameters:
-
e | Is invoked when there are problems during initialization |
pTimeFunction | a pointer to a function that returns the system time in ms. |
Definition at line 16 of file XabslEngine.cpp. |
Here is the call graph for this function:
Member Function Documentation
void xabsl::Engine::execute |
( |
|
) |
|
|
|
Executes the engine for the selected agent starting from the root option.
(Including the selected basic behavior)
Definition at line 39 of file XabslEngine.cpp.
References basicBehaviors, xabsl::ErrorHandler::error(), xabsl::Array< NamedArrayElement< BasicBehavior * > * >::getSize(), xabsl::Array< NamedArrayElement< Option * > * >::getSize(), xabsl::Array< Action * >::getSize(), initialized, options, pTimeFunction, xabsl::Symbols::resetOutputSymbols(), rootActions, and timeOfExecutionStart. |
Here is the call graph for this function:
void xabsl::Engine::createOptionGraph |
( |
InputSource & |
input |
) |
|
|
|
Reads the intermediate code from an input source and creates the option graph.
Note that the basic behaviors and symbols have to be registered before that function is called.
Definition at line 66 of file XabslEngine.cpp.
References agents, xabsl::Array< CoopState * >::append(), xabsl::NamedArray< Agent * >::append(), xabsl::NamedArray< Option * >::append(), xabsl::NamedArray< int >::append(), xabsl::NamedArray< bool >::append(), xabsl::NamedArray< double >::append(), basicBehaviors, checkForLoops(), xabsl::InputSource::close(), coopStates, countActions(), xabsl::Enumeration::enumElements, xabsl::ErrorHandler::error(), xabsl::ErrorHandler::errorsOccurred, xabsl::NamedArray< Enumeration * >::exists(), xabsl::NamedArray< int >::getElement(), xabsl::NamedArray< bool >::getElement(), xabsl::NamedArray< double >::getElement(), xabsl::Array< NamedArrayElement< Option * > * >::getSize(), xabsl::Array< NamedArrayElement< Agent * > * >::getSize(), xabsl::Array< NamedArrayElement< int > * >::getSize(), xabsl::Array< NamedArrayElement< EnumElement * > * >::getSize(), xabsl::Array< NamedArrayElement< bool > * >::getSize(), xabsl::Array< NamedArrayElement< double > * >::getSize(), initialized, internalBooleanSymbols, internalDecimalSymbols, internalEnumeratedSymbols, xabsl::ErrorHandler::message(), xabsl::NamedItem::n, xabsl::InputSource::open(), options, pTimeFunction, xabsl::InputSource::readString(), xabsl::InputSource::readValue(), xabsl::Symbols::registerBooleanOutputSymbol(), xabsl::Symbols::registerDecimalOutputSymbol(), xabsl::Symbols::registerEnumElement(), xabsl::Symbols::registerEnumeratedOutputSymbol(), selectedAgent, setRootAction(), timeOfExecutionStart, and XABSL_DEBUG_INIT. |
Here is the call graph for this function:
void xabsl::Engine::registerBasicBehavior |
( |
BasicBehavior & |
basicBehavior |
) |
|
|
|
Registers a basic behavior at the engine.
This must be done before the intermediate code is read. - Parameters:
-
basicBehavior | A reference to the basic behavior |
Definition at line 340 of file XabslEngine.cpp.
References xabsl::NamedArray< BasicBehavior * >::append(), basicBehaviors, xabsl::ErrorHandler::error(), xabsl::NamedArray< BasicBehavior * >::exists(), xabsl::Array< NamedArrayElement< BasicBehavior * > * >::getSize(), xabsl::BasicBehavior::index, xabsl::ErrorHandler::message(), xabsl::NamedItem::n, xabsl::Behavior::parameters, xabsl::Parameters::registerEnumerations(), xabsl::BasicBehavior::registerParameters(), and XABSL_DEBUG_INIT. |
Here is the call graph for this function:
bool xabsl::Engine::setSelectedAgent |
( |
const char * |
name |
) |
|
|
Here is the call graph for this function:
void xabsl::Engine::reset |
( |
|
) |
|
|
Here is the call graph for this function:
bool xabsl::Engine::checkForLoops |
( |
Option * |
currentOption, |
|
|
ActionBehavior * |
currentOptionTree[], |
|
|
int |
currentLength, |
|
|
int |
maxSize |
|
) |
[private] |
|
Here is the call graph for this function:
void xabsl::Engine::addActions |
( |
ActionBehavior * |
actionToAdd, |
|
|
ActionBehavior * |
currentOptionTree[], |
|
|
int & |
currentLength, |
|
|
int |
maxSize |
|
) |
[private] |
|
Here is the call graph for this function:
int xabsl::Engine::countActions |
( |
Option * |
option |
) |
[private] |
|
Here is the call graph for this function:
void xabsl::Engine::clearRootActions |
( |
|
) |
|
|
Here is the call graph for this function:
bool xabsl::Engine::addRootAction |
( |
const char * |
name, |
|
|
bool |
isOption = true |
|
) |
|
|
Here is the call graph for this function:
bool xabsl::Engine::setRootAction |
( |
const char * |
name, |
|
|
bool |
isOption = true |
|
) |
|
|
|
Executes the option graph starting from a given option or basic behavior.
Can be called to test a single option or basic behavior. - Parameters:
-
name | The name of the option or basic behavior |
isOption | True for an option, false for a basic behavior |
- Returns:
- When false, the option is not known to the engine
Definition at line 387 of file XabslEngine.cpp.
References addRootAction(), and clearRootActions(). |
Here is the call graph for this function:
void xabsl::Engine::setRootAction |
( |
|
) |
|
|
Here is the call graph for this function:
void xabsl::Engine::addRootAction |
( |
Behavior * |
behavior |
) |
|
|
Here is the call graph for this function:
bool xabsl::Engine::addRootActionDecimalOutputSymbol |
( |
const char * |
name, |
|
|
double |
value |
|
) |
|
|
Here is the call graph for this function:
bool xabsl::Engine::addRootActionBooleanOutputSymbol |
( |
const char * |
name, |
|
|
bool |
value |
|
) |
|
|
Here is the call graph for this function:
bool xabsl::Engine::addRootActionEnumeratedOutputSymbol |
( |
const char * |
name, |
|
|
const char * |
value |
|
) |
|
|
Here is the call graph for this function:
void xabsl::Engine::setRootAction |
( |
Behavior * |
behavior |
) |
|
|
Here is the call graph for this function:
const Action * xabsl::Engine::getRootAction |
( |
int |
i |
) |
const |
|
Action * xabsl::Engine::getRootAction |
( |
int |
i |
) |
|
|
const Array< Action * > & xabsl::Engine::getRootActions |
( |
|
) |
const |
|
const char * xabsl::Engine::getSelectedAgentName |
( |
|
) |
const |
|
void xabsl::Engine::prepareIncomingMessages |
( |
|
) |
|
|
Here is the call graph for this function:
void xabsl::Engine::processIncomingMessage |
( |
const TeamMessage & |
message |
) |
|
|
Here is the call graph for this function:
void xabsl::Engine::generateOutgoingMessage |
( |
TeamMessage & |
message |
) |
|
|
Here is the call graph for this function:
void xabsl::Engine::setSynchronizationTicks |
( |
int |
ticks |
) |
[inline] |
|
|
Set the number of execution cycles that is required for synchonization with other agents, i.e time from sending a message until answer is received.
Definition at line 238 of file XabslEngine.h. |
void xabsl::Engine::setAgentPriority |
( |
int |
priority |
) |
[inline] |
|
|
Sets the priority value of the agent, used for solving conflicts in cooperative state assignment.
Definition at line 241 of file XabslEngine.h. |
Member Data Documentation
|
Priority value of the agent, used for solving conflicts in cooperative state assignment.
Definition at line 142 of file XabslEngine.h. |
|
Number of execution cycles that is required for synchonization with other agents, i.e time from sending a message until answer is received.
Definition at line 145 of file XabslEngine.h. |
The documentation for this class was generated from the following files:
Up | Main Page | Generated at Wed Aug 19 17:32:30 2009.
|