#include <Instruction.h>
Public Types | |
Public Member Functions | |
bool | findAndExecute (std::vector< std::string > &instr, std::ostringstream &answer, unsigned int &numberOfReturnValues) |
std::string | getCmdHelpString () |
std::string | getCmdString () |
unsigned int | getCommandParameterCount () |
Instruction (const std::string &code) | |
virtual | ~Instruction () |
Static Public Member Functions | |
template<typename T > | |
static std::map< std::string, std::string > | GetAllNodesOfTypeFromViewer (IpsaSimulator *simulator) |
template<typename T > | |
static T | GetNodeOfTypeByName (const std::string &name) |
Protected Member Functions | |
virtual tExecResultType | vExecute (std::vector< std::string > &Instr, std::ostringstream &answer, unsigned int &numberOfReturnValues) |
Protected Attributes | |
const std::string | I_CODE |
std::vector< std::string > | instrdata |
Every instruction available for IPSRV is a subclass of Instruction. All instructions are stored in $(IPSA_HOME)/include/IPSA/viewer/instructions and $(IPSA_HOME)/source/viewer/instructions.
See How to create new IPSRV instructions on how to create new IPSRV instructions.
Definition at line 39 of file Instruction.h.
eOK | |
eUNKNOWN_ERROR | |
eJOINT_NOT_FOUND | |
eBODY_NOT_FOUND | |
eJOINT_TYPE_INCOMPATIBLE | |
eNODE_IS_NOT_A_BODY | |
eNO_ODE_BODY_FOUND | |
eBAD_FILENAME |
Definition at line 46 of file Instruction.h.
Instruction::Instruction | ( | const std::string & | code | ) |
code | name and parameters of the IPSRV command of format "commandName <parameter1> <parameter2> ... <parameterN>" |
Definition at line 151 of file Instruction.cpp.
virtual Instruction::~Instruction | ( | ) | [inline, virtual] |
Definition at line 43 of file Instruction.h.
bool Instruction::findAndExecute | ( | std::vector< std::string > & | instr, | |
std::ostringstream & | answer, | |||
unsigned int & | numberOfReturnValues | |||
) |
Checks if there are enough parameter values and then calls Instruction::vExecute().
instr | vector of strings where instr[0] is the command name and the rest are the parameter values | |
answer | stringstream where the answer of the command gets written to | |
numberOfReturnValues | stores the number expected return values |
Definition at line 183 of file Instruction.cpp.
References eBODY_NOT_FOUND, eJOINT_NOT_FOUND, eJOINT_TYPE_INCOMPATIBLE, eNODE_IS_NOT_A_BODY, eOK, eUNKNOWN_ERROR, instrdata, and vExecute().
Referenced by IpsaDialog::getSetValue().
std::map< std::string, std::string > Instruction::GetAllNodesOfTypeFromViewer | ( | IpsaSimulator * | simulator | ) | [inline, static] |
std::string Instruction::getCmdHelpString | ( | ) |
Definition at line 235 of file Instruction.cpp.
References I_CODE.
Referenced by ViewerHelp::vExecute().
std::string Instruction::getCmdString | ( | ) |
Definition at line 225 of file Instruction.cpp.
References instrdata.
Referenced by NVInstructions::AddEntry().
unsigned int Instruction::getCommandParameterCount | ( | ) |
Definition at line 244 of file Instruction.cpp.
References instrdata.
Referenced by IpsaDialog::getSetValue().
Instruction::GetNodeOfTypeByName | ( | const std::string & | name | ) | [inline, static] |
Calls SoNode::getByName() and returns a pointer which is dynamic_cast'ed to type T.
T | the type into which the found node should be cast to |
name | name of the node to find. |
Definition at line 76 of file Instruction.h.
Instruction::vExecute | ( | std::vector< std::string > & | Instr, | |
std::ostringstream & | answer, | |||
unsigned int & | numberOfReturnValues | |||
) | [inline, protected, virtual] |
Virtual method which must be overridden by any subclass. It does the "real" execution of the command and is called by Instruction::findAndExecute().
Instr | instruction vector which is build like Instruction::instrdata of the specific subclass of Instruction | |
answer | a stringstream where the answer of Instruction::vExecute() gets written to | |
numberOfReturnValues | tells the method how many values should be stored in answer . |
Reimplemented in GetBodyForce, GetBodyPosition, GetBodyRotation, GetBodyTorque, GetJointAngle, GetJointAngleRate, GetJointForce, GetJointPosition, GetJointPositionRate, GetJointTorque, ListAllBodies, ListAllJoints, ListBody2BodyContacts, ListBody2BodyForces, ListBodyContacts, QuitViewer, RemoveJoint, ResetIPSA, ResetViewer, SaveIVFile, ScheduleIPSA, SetBodyForce, SetBodyRelForce, SetBodyVelocity, SetDrawShape, SetJointForce, SetJointMaxForce, SetJointMaxForce2, SetJointSpeed, SetJointSpeed2, SetJointTorque, SetJointTorque2, SetStepsizeIPSA, SetVerbosity, ShowJoints, StepIPSA, UnscheduleIPSA, and ViewerHelp.
Definition at line 71 of file Instruction.h.
Referenced by findAndExecute().
Instruction::I_CODE [protected] |
One string which contains the name and parameters of the IPSRV command. The string is of the following format "commandName <parameter1> <parameter2> ... <parameterN>".
Definition at line 69 of file Instruction.h.
Referenced by getCmdHelpString(), and Instruction().
Instruction::instrdata [protected] |
The parsed Instruction::I_CODE is stored in here and has the following format:
Instruction::instrdata[0] = "commandName"
Instruction::instrdata[1] = "parameter1"
Instruction::instrdata[2] = "parameter2"
...
Instruction::instrdata[N] = "parameterN"
Definition at line 70 of file Instruction.h.
Referenced by findAndExecute(), getCmdString(), getCommandParameterCount(), and Instruction().
Generated on Sat Mar 10 20:00:19 2012 for IPSA by 1.5.8 |