Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Xabsl2State Class Reference

Represents a single state written in Xabsl2. More...

`#include <Xabsl2Option.h>`

Inheritance diagram for Xabsl2State:

[legend]
Collaboration diagram for Xabsl2State:

[legend]
List of all members.

## Public Member Functions
| Xabsl2State (const char *name, Xabsl2ErrorHandler &errorHandler, unsigned long(*pTimeFunction)())
| Constructor.
| ~Xabsl2State ()
| Destructor.
void | create (Xabsl2InputSource &input, Xabsl2Array< Xabsl2Option * > &options, Xabsl2Array< Xabsl2BasicBehavior & > &basicBehaviors, Xabsl2Array< Xabsl2State * > &states, Xabsl2Array< double > &parameters, Xabsl2Symbols &symbols, unsigned long &timeOfOptionExecution)
| Creates the state and it's subelements from the intermediate code.
Xabsl2State * | getNextState ()
| Executes the decision tree and determines the next active state (can be the same).
void | setOutputSymbols ()
| Sets the output symbols of the state.
void | reset ()
| Sets the time when the state was activated to 0.
bool | isTargetState () const
| Returns wheter the state is a target state.
## Public Attributes
Xabsl2Option * | subsequentOption
| The option that is executed after that option if the state is active.
Xabsl2BasicBehavior * | subsequentBasicBehavior
| The basic behavior that is executed after that option if the state is active.
unsigned long | timeOfStateExecution
| the time how long the state is already active
Xabsl2Array< double * > | parametersOfSubsequentBehavior
| Pointers to the parameters of a subsequent basic behavior or a subsequent option.
Xabsl2Array< Xabsl2DecimalExpression * > | parameterValues
| Decimal expressions for the parameters of a subsequent basic behavior or a subsequent option.
## Private Attributes
unsigned long | timeWhenStateWasActivated
| The time, when the state was activated.
bool | targetState
| If true, the state is a target state.
Xabsl2ErrorHandler & | errorHandler
| Used for error handling.
Xabsl2Statement * | decisionTree
| The root element of the decision tree.
Xabsl2Array< Xabsl2EnumeratedOutputSymbol * > | outputSymbols
| The output symbols that are set if the state is active.
Xabsl2Array< int > | outputSymbolValues
| The for the output symbols that are set if the state is active.
unsigned long(* | pTimeFunction )()
| A pointer to a function that returns the system time in ms.

## Detailed Description

Represents a single state written in Xabsl2.

Author:
  Martin Lötzsch

Definition at line 149 of file Xabsl2Option.h.

## Constructor & Destructor Documentation

Xabsl2State::Xabsl2State | ( | const char * | name,
|  | Xabsl2ErrorHandler & | errorHandler,
|  | unsigned long(* | pTimeFunction)()
| ) |

  | Constructor. Does not create the state. Parameters:
  name | The name of the state. For debugging purposes.
  errorHandler | A reference to a Xabsl2ErrorHandler instance
  pTimeFunction | a pointer to a function that returns the system time in ms.
Definition at line 151 of file Xabsl2Option.cpp.

Xabsl2State::~Xabsl2State | ( |  | ) |

| Destructor. Definition at line 158 of file Xabsl2Option.cpp. References decisionTree, and Xabsl2Array< Xabsl2DecimalExpression * >::getSize().

Here is the call graph for this function:

## Member Function Documentation

void Xabsl2State::create | ( | Xabsl2InputSource & | input,
|  | Xabsl2Array< Xabsl2Option * > & | options,
|  | Xabsl2Array< Xabsl2BasicBehavior & > & | basicBehaviors,
|  | Xabsl2Array< Xabsl2State * > & | states,
|  | Xabsl2Array< double > & | parameters,
|  | Xabsl2Symbols & | symbols,
|  | unsigned long & | timeOfOptionExecution
| ) |

  | Creates the state and it's subelements from the intermediate code. Parameters:
  input | An input source for the intermediate code. It must be opened and read until A position where a state starts.
  options | All available options
  basicBehaviors | All available basicBehaviors
  states | All states of the option
  parameters | The parameters of the option
  symbols | All available symbols
  timeOfOptionExecution | The time how long the option is already active
Definition at line 166 of file Xabsl2Option.cpp. References Xabsl2Array< int >::append(), Xabsl2Array< Xabsl2EnumeratedOutputSymbol * >::append(), Xabsl2Array< Xabsl2DecimalExpression * >::append(), Xabsl2Array< double * >::append(), Xabsl2Statement::createStatement(), decisionTree, Xabsl2ArrayElement< double & >::e, Xabsl2ArrayElement< double >::e, Xabsl2ErrorHandler::error(), Xabsl2ErrorHandler::errorsOccurred, Xabsl2Array< Xabsl2EnumeratedOutputSymbol * >::exists(), Xabsl2Array< double & >::exists(), Xabsl2Array< double >::exists(), Xabsl2Array< T >::exists(), Xabsl2Symbols::existsEnumeratedOutputSymbol(), Xabsl2Array< Xabsl2EnumeratedOutputSymbol * >::getElement(), Xabsl2Array< T >::getElement(), Xabsl2Symbols::getEnumeratedOutputSymbol(), Xabsl2Array< double & >::getPElement(), Xabsl2Array< double >::getPElement(), Xabsl2ErrorHandler::message(), outputSymbols, outputSymbolValues, Xabsl2BasicBehavior::parameters, Xabsl2Option::parameters, parametersOfSubsequentBehavior, Xabsl2InputSource::readString(), Xabsl2InputSource::readValue(), subsequentBasicBehavior, targetState, timeOfStateExecution, and XABSL2_DEBUG_INIT.

Here is the call graph for this function:

Xabsl2State * Xabsl2State::getNextState | ( |  | ) |

| Executes the decision tree and determines the next active state (can be the same). Definition at line 272 of file Xabsl2Option.cpp. References decisionTree, Xabsl2Statement::getNextState(), pTimeFunction, timeOfStateExecution, and timeWhenStateWasActivated. Referenced by Xabsl2Option::execute().

Here is the call graph for this function:

void Xabsl2State::setOutputSymbols | ( |  | ) |

| Sets the output symbols of the state. Definition at line 281 of file Xabsl2Option.cpp. References Xabsl2Array< Xabsl2EnumeratedOutputSymbol * >::getSize(), Xabsl2Array< double * >::getSize(), Xabsl2Array< double >::getSize(), Xabsl2Array< double & >::getSize(), outputSymbols, outputSymbolValues, Xabsl2Option::parameters, Xabsl2BasicBehavior::parameters, parametersOfSubsequentBehavior, Xabsl2Array< double >::setElement(), and subsequentBasicBehavior. Referenced by Xabsl2Option::execute().

Here is the call graph for this function:

void Xabsl2State::reset | ( |  | ) |

| Sets the time when the state was activated to 0. Definition at line 314 of file Xabsl2Option.cpp. References pTimeFunction, timeOfStateExecution, and timeWhenStateWasActivated. Referenced by Xabsl2Option::execute().

bool Xabsl2State::isTargetState | ( |  | ) | const

| Returns wheter the state is a target state. Definition at line 320 of file Xabsl2Option.cpp. References targetState. Referenced by Xabsl2Option::getOptionReachedATargetState().

## Member Data Documentation

Xabsl2Option* Xabsl2State::subsequentOption

| The option that is executed after that option if the state is active. If 0, a basic behavior is executed after that option. Definition at line 196 of file Xabsl2Option.h. Referenced by GT2005BehaviorControl::drawOptions(), Xabsl2Engine::execute(), GTXabsl2Profiler::recordLog(), and GTXabsl2EngineExecutor::sendDebugMessage().

Xabsl2BasicBehavior* Xabsl2State::subsequentBasicBehavior

| The basic behavior that is executed after that option if the state is active. If 0, an option is executed after that option. Definition at line 202 of file Xabsl2Option.h. Referenced by create(), Xabsl2Engine::execute(), and setOutputSymbols().

unsigned long Xabsl2State::timeOfStateExecution

| the time how long the state is already active Definition at line 205 of file Xabsl2Option.h. Referenced by create(), getNextState(), reset(), and GTXabsl2EngineExecutor::sendDebugMessage().

Xabsl2Array<double*> Xabsl2State::parametersOfSubsequentBehavior

| Pointers to the parameters of a subsequent basic behavior or a subsequent option. Definition at line 211 of file Xabsl2Option.h. Referenced by create(), and setOutputSymbols().

Xabsl2Array<Xabsl2DecimalExpression*> Xabsl2State::parameterValues

| Decimal expressions for the parameters of a subsequent basic behavior or a subsequent option. Definition at line 214 of file Xabsl2Option.h.

unsigned long Xabsl2State::timeWhenStateWasActivated`[private]`

| The time, when the state was activated. Definition at line 222 of file Xabsl2Option.h. Referenced by getNextState(), and reset().

bool Xabsl2State::targetState`[private]`

| If true, the state is a target state. Definition at line 225 of file Xabsl2Option.h. Referenced by create(), and isTargetState().

Xabsl2ErrorHandler& Xabsl2State::errorHandler`[private]`

| Used for error handling. Definition at line 228 of file Xabsl2Option.h.

Xabsl2Statement* Xabsl2State::decisionTree`[private]`

| The root element of the decision tree. Definition at line 231 of file Xabsl2Option.h. Referenced by create(), getNextState(), and ~Xabsl2State().

Xabsl2Array<Xabsl2EnumeratedOutputSymbol*> Xabsl2State::outputSymbols`[private]`

| The output symbols that are set if the state is active. Definition at line 234 of file Xabsl2Option.h. Referenced by create(), and setOutputSymbols().

Xabsl2Array<int> Xabsl2State::outputSymbolValues`[private]`

| The for the output symbols that are set if the state is active. Definition at line 237 of file Xabsl2Option.h. Referenced by create(), and setOutputSymbols().

unsigned long(* Xabsl2State::pTimeFunction)()`[private]`

| A pointer to a function that returns the system time in ms. Referenced by getNextState(), and reset().

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

- Tools/Xabsl2/Xabsl2Engine/Xabsl2Option.h
- Tools/Xabsl2/Xabsl2Engine/Xabsl2Option.cpp