Aria: ArAction Class Reference

- Main Page
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ArAction Class Reference

`#include <ArAction.h>`

Inheritance diagram for ArAction:

List of all members.

## Detailed Description

Base class for actions.

actions Actions are objects queried for desired behavior by ArActionResolver to determine robot movement commands.

To implement an action object, define a subclass of ArAction, and implement the fire() method. You may also override setRobot() to obtain information from ArRobot, but you must also call ArAction::setRobot() so that the ArRobot pointer is stored by ArAction.

Several predefined action objects are also included in ARIA, they are listed here as ArActions's subclasses.

If an action is not active (it has been deactivated), then it will be ignored by the action resolver. Actions may be grouped using ArActionGroup, and activated/deactivated as a group. For example, ArMode, and ArServerMode (from ArNetworking), activate/deactivate action groups when switching modes.

See also:
  actions description in the ARIA overview.

  ArActionGroup

  ArResolver

  ArRobot

## Public Member Functions
virtual void | activate (void)
| Activate the action.
| ArAction (const char *name, const char *description="")
| Constructor.
virtual void | deactivate (void)
| Deactivate the action.
virtual ArActionDesired * | fire (ArActionDesired currentDesired)=0
| Fires the action, returning what the action wants to do.
virtual ArArg * | getArg (int number)
| Gets the numbered argument.
virtual const ArArg * | getArg (int number) const
virtual const char * | getDescription (void) const
| Gets the long description of the action.
virtual const ArActionDesired * | getDesired (void) const
| Gets what this action wants to do (for display purposes).
virtual ArActionDesired * | getDesired (void)
| Gets what this action wants to do (for display purposes).
virtual const char * | getName (void) const
| Gets the name of the action.
virtual int | getNumArgs (void) const
| Find the number of arguments this action takes.
ArRobot * | getRobot () const
| Get the robot we are controlling, which was set by setRobot().
virtual bool | isActive (void) const
| Returns whether the action is active or not.
virtual void | log (bool verbose=true) const
| Log information about this action using ArLog.
virtual void | setRobot (ArRobot *robot)
| Sets the robot this action is driving.
virtual | ~ArAction ()
| Desructor.
## Static Public Member Functions
static bool | getDefaultActivationState (void)
| Gets the default activation state for all ArActions.
static void | setDefaultActivationState (bool defaultActivationState)
| Sets the default activation state for all ArActions.
## Protected Member Functions
void | setNextArgument (ArArg const &arg)
| Sets the argument type for the next argument (must only be used in a constructor!).
## Protected Attributes
std::map< int, ArArg > | myArgumentMap
std::string | myDescription
bool | myIsActive
std::string | myName
int | myNumArgs
ArRobot * | myRobot
| The robot we are controlling, set by the action resolver using setRobot().
## Static Protected Attributes
static bool | ourDefaultActivationState

## Member Function Documentation

virtual ArActionDesired* ArAction::fire | ( | ArActionDesired | currentDesired | ) | `[pure virtual]`

Fires the action, returning what the action wants to do.

Parameters:

  | currentDesired | this is the tentative result, based on the resolver's processing of previous, higher-priority actions. This is only for the purpose of giving information to the action, changing it has no effect.

Returns:
  pointer to what this action wants to do, NULL if it wants to do nothing. Common practice is to keep an ArActionDesired object in your action subclass, and return a pointer to that object. This avoids the need to create new objects during each invocation (which could never be deleted). Clear your stored ArActionDesired before modifying it with ArActionDesired::reset().

Implemented in ArActionGoto.

virtual const ArArg* ArAction::getArg | ( | int | number | ) | const`[virtual]`

Gets the numbered argument

Java and Python Wrappers: Not available

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

- ArAction.h