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

RS::AgentStep Class Reference

Used to represent a step in a plan. More...

Inheritance diagram for RS::AgentStep:

Inheritance graph
[legend]
Collaboration diagram for RS::AgentStep:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AgentStep ()
 The default constructor.

 AgentStep (const AgentStep &obj)
 The copy constructor.

virtual ~AgentStep ()
 The destructor.

AgentStep & operator= (const AgentStep &obj)
 The assignment operator.

void addMiscellaneousCommand (const Command *const command)
 Adds a miscellaneous command to the step.

void setBodyCommand (const TurnCommand *const command)
 Adds a body command to the step, only one body command can be executed in a step.

void setBodyCommand (const DashCommand *const command)
void setBodyCommand (const KickCommand *const command)
void setBodyCommand (const CatchCommand *const command)
void setBodyCommand (const TackleCommand *const command)
void setBodyCommand (const MoveCommand *const command)
ServerCommandgetBodyCommand () const
 The AgentStep will still own the command, so do not delete.

void setNeckCommand (const TurnNeckCommand *const command)
 Adds a neck command to the step, it will replace prior neck commands.

TurnNeckCommandgetNeckCommand () const
 Gets the neck command as set in this object.

void setSayCommand (const SayCommand *const command)
 Adds a say command to the step, it will replace prior say commands.

void setPointToCommand (const PointToCommand *const command)
 Adds a point to command to the step, it will replace prior point to commands.

void setChangeViewCommand (const ChangeViewCommand *const command)
 Adds a change mode command to the step, it will replace prior change mode commands.

void setChangeModeCommand (const ChangeModeCommand *const command)
 Adds a change view command to the step, it will replace prior change view commands.

void merge (const AgentStep &agentStep)
 Merges this object with the supplied agentStep, all variables supplied with agentStep will override variables defined in this object.

CommandgetNextCommand () const
 Get a copy of the first command in the sequence.

AgentStep & removeNextCommand ()
 Remove the first command in the sequence, if the step is not empty.

bool empty () const
 Test if the step contains no commands.

AgentStep & makeEmpty ()
 Removes all the commands stored in the step.

void print () const
 Prints the AgentStep to std::cout.


Protected Attributes

ServerCommandmBodyCommand
TurnNeckCommandmNeckCommand
SayCommandmSayCommand
PointToCommandmPointToCommand
ChangeModeCommandmChangeModeCommand
ChangeViewCommandmChangeViewCommand

Detailed Description

Used to represent a step in a plan.

A step is a set of commands that should and could be executed by the soccer server and the agent in a single simulator cycle.

Unit:
Library
Revision
1.1
Author
frehe
Date
2006/09/06 18:03:12

Definition at line 104 of file AgentStep.h.


Constructor & Destructor Documentation

RS::AgentStep::AgentStep  
 

The default constructor.

The step will take control of the command so don't delete it. If command is NULL the create an empty step, otherwise create a step with the command command.

Definition at line 80 of file AgentStep.cc.


Member Function Documentation

AgentStep & RS::AgentStep::operator= const AgentStep &    obj
 

The assignment operator.

Parameters:
obj is the object to be assigned from.
Returns:
A reference to the the newly assigned object.
Postcondition:
The object is an exact copy of obj.

Definition at line 116 of file AgentStep.cc.

References RS::ChangeViewCommand::clone(), RS::ChangeModeCommand::clone(), RS::PointToCommand::clone(), RS::SayCommand::clone(), RS::TurnNeckCommand::clone(), RS::ServerCommand::clone(), RS::Step::commandSequence, makeEmpty(), mBodyCommand, mChangeModeCommand, mChangeViewCommand, mNeckCommand, mPointToCommand, and mSayCommand.

void RS::AgentStep::setBodyCommand const TurnCommand *const    command
 

Adds a body command to the step, only one body command can be executed in a step.

The command will replace prior body commands.

Definition at line 232 of file AgentStep.cc.

References RS::TurnCommand::clone().

Referenced by RS::TurnBodyToPoint::generateStep(), RS::TurnBodyToAbsoluteDirection::generateStep(), RS::TurnBackToPoint::generateStep(), RS::SearchBall::generateStep(), RS::KickBallCloseToBody::generateStep(), RS::FreezeBall::generateStep(), RS::DashToPoint::generateStep(), RS::CatchBall::generateStep(), and RS::AccelerateBallToVelocity::generateStep().

TurnNeckCommand * RS::AgentStep::getNeckCommand   const [inline]
 

Gets the neck command as set in this object.

0 if no command has been set.

Definition at line 77 of file AgentStep.icc.

Command * RS::AgentStep::getNextCommand   const [virtual]
 

Get a copy of the first command in the sequence.

Remember to delete the command object otherwise you will have a memory leak. If the step is empty then NULL is returned.

Reimplemented from RS::Step.

Definition at line 158 of file AgentStep.cc.

References RS::ChangeViewCommand::clone(), RS::ChangeModeCommand::clone(), RS::PointToCommand::clone(), RS::SayCommand::clone(), RS::TurnNeckCommand::clone(), RS::ServerCommand::clone(), and RS::Step::commandSequence.

Referenced by RS::ActuatorInterface::addToPlan().

bool RS::AgentStep::empty   const [inline, virtual]
 

Test if the step contains no commands.

Returns:
true iff the step is empty.

Reimplemented from RS::Step.

Definition at line 61 of file AgentStep.icc.

References RS::Step::commandSequence.

Referenced by RS::ActuatorInterface::addToPlan(), and makeEmpty().


The documentation for this class was generated from the following files:
Generated on Mon Aug 29 08:23:07 2011 for RoboSoc by doxygen1.3-rc3