opal::Blueprint Class Reference

#include <Blueprint.h>

List of all members.

Public Member Functions

OPAL_DECL Blueprint ()
virtual OPAL_DECL ~Blueprint ()
virtual OPAL_DECL void OPAL_CALL finalize ()
virtual OPAL_DECL bool OPAL_CALL isFinalized () const
virtual OPAL_DECL void OPAL_CALL addSolid (SolidData *data)
virtual OPAL_DECL void OPAL_CALL addJoint (JointData *data)
virtual OPAL_DECL void OPAL_CALL addMotor (MotorData *data)
virtual OPAL_DECL void OPAL_CALL addSensor (SensorData *data)
virtual OPAL_DECL unsigned
int OPAL_CALL 
getNumSolids () const
virtual OPAL_DECL unsigned
int OPAL_CALL 
getNumJoints () const
virtual OPAL_DECL unsigned
int OPAL_CALL 
getNumMotors () const
virtual OPAL_DECL unsigned
int OPAL_CALL 
getNumSensors () const
virtual OPAL_DECL SolidData
*OPAL_CALL 
getSolidData (unsigned int i) const
virtual OPAL_DECL JointData
*OPAL_CALL 
getJointData (unsigned int i) const
virtual OPAL_DECL MotorData
*OPAL_CALL 
getMotorData (unsigned int i) const
virtual OPAL_DECL SensorData
*OPAL_CALL 
getSensorData (unsigned int i) const

Private Member Functions

bool solidExists (const std::string &name)
bool jointExists (const std::string &name)
bool motorExists (const std::string &name)
bool sensorExists (const std::string &name)
int getSolidIndex (const std::string &name) const
int getJointIndex (const std::string &name) const
void printFinalizedMessage ()

Private Attributes

bool mFinalized
std::vector< SolidData * > mSolidList
std::vector< JointData * > mJointList
std::vector< MotorData * > mMotorList
std::vector< SensorData * > mSensorList


Detailed Description

Blueprints are useful for saving and loading systems of Solids, Joints, Motors, and/or Sensors. They are created by OPAL when an OPAL XML file is loaded. They can also be created by users and saved to an OPAL XML file. When setting up a Blueprint manually add all object data to the Blueprint and call finalize when finished. Blueprints are not guaranteed to yield perfect repeatability after a save/restore sequence.

Definition at line 49 of file Blueprint.h.


Constructor & Destructor Documentation

opal::Blueprint::Blueprint  ) 
 

Definition at line 45 of file Blueprint.cpp.

References mFinalized.

opal::Blueprint::~Blueprint  )  [virtual]
 

Definition at line 50 of file Blueprint.cpp.

References mSolidList.


Member Function Documentation

void opal::Blueprint::addJoint JointData data  )  [virtual]
 

Adds a new JointData object to the Blueprint. Makes a deep copy of the given data.

Definition at line 263 of file Blueprint.cpp.

References jointExists(), mFinalized, mJointList, opal::JointData::name, OPAL_LOGGER, and printFinalizedMessage().

void opal::Blueprint::addMotor MotorData data  )  [virtual]
 

Adds a new MotorData object to the Blueprint. Makes a deep copy of the given data.

Definition at line 284 of file Blueprint.cpp.

References opal::ATTRACTOR_MOTOR, opal::GEARED_MOTOR, opal::MotorData::getType(), mFinalized, mMotorList, motorExists(), opal::MotorData::name, OPAL_LOGGER, printFinalizedMessage(), opal::SERVO_MOTOR, opal::SPRING_MOTOR, and opal::THRUSTER_MOTOR.

void opal::Blueprint::addSensor SensorData data  )  [virtual]
 

Adds a new SensorData object to the Blueprint. Makes a deep copy of the given data.

Definition at line 333 of file Blueprint.cpp.

References opal::ACCELERATION_SENSOR, opal::SensorData::getType(), opal::INCLINE_SENSOR, mFinalized, opal::SensorData::name, OPAL_LOGGER, printFinalizedMessage(), opal::RAYCAST_SENSOR, sensorExists(), and opal::VOLUME_SENSOR.

void opal::Blueprint::addSolid SolidData data  )  [virtual]
 

Adds a new SolidData object to the Blueprint. Makes a deep copy of the given data.

Definition at line 242 of file Blueprint.cpp.

References mFinalized, mSolidList, opal::SolidData::name, OPAL_LOGGER, printFinalizedMessage(), and solidExists().

void opal::Blueprint::finalize  )  [virtual]
 

Updates references among internal objects. This must be called before the Blueprint can be instantiated. This is automatically called on Blueprints loaded from files.

Definition at line 77 of file Blueprint.cpp.

References getSolidIndex(), mJointList, and OPAL_LOGGER.

JointData * opal::Blueprint::getJointData unsigned int  i  )  const [virtual]
 

Returns a pointer to the JointData at the given index.

Definition at line 412 of file Blueprint.cpp.

References mJointList.

int opal::Blueprint::getJointIndex const std::string &  name  )  const [private]
 

Returns the index of the given Joint name in the Blueprint's list of JointData. Returns -1 if the Joint name is not found or if the given name is an empty string.

Definition at line 525 of file Blueprint.cpp.

MotorData * opal::Blueprint::getMotorData unsigned int  i  )  const [virtual]
 

Returns a pointer to the MotorData at the given index.

Definition at line 417 of file Blueprint.cpp.

References mMotorList.

unsigned int opal::Blueprint::getNumJoints  )  const [virtual]
 

Returns the number of JointData objects.

Definition at line 392 of file Blueprint.cpp.

References mJointList.

unsigned int opal::Blueprint::getNumMotors  )  const [virtual]
 

Returns the number of MotorData objects.

Definition at line 397 of file Blueprint.cpp.

References mMotorList.

unsigned int opal::Blueprint::getNumSensors  )  const [virtual]
 

Returns the number of SensorData objects.

Definition at line 402 of file Blueprint.cpp.

References mSensorList.

unsigned int opal::Blueprint::getNumSolids  )  const [virtual]
 

Returns the number of SolidData objects.

Definition at line 387 of file Blueprint.cpp.

References mSolidList.

SensorData * opal::Blueprint::getSensorData unsigned int  i  )  const [virtual]
 

Returns a pointer to the SensorData at the given index.

Definition at line 422 of file Blueprint.cpp.

References mSensorList.

SolidData * opal::Blueprint::getSolidData unsigned int  i  )  const [virtual]
 

Returns a pointer to the SolidData at the given index.

Definition at line 407 of file Blueprint.cpp.

References mSolidList.

int opal::Blueprint::getSolidIndex const std::string &  name  )  const [private]
 

Returns the index of the given Solid name in the Blueprint's list of SolidData. Returns -1 if the Solid name is not found or if the given name is an empty string.

Definition at line 507 of file Blueprint.cpp.

Referenced by finalize().

bool opal::Blueprint::isFinalized  )  const [virtual]
 

Returns true if this Blueprint has been finalized (via the finalize function).

Definition at line 237 of file Blueprint.cpp.

References mFinalized.

Referenced by opal::Simulator::instantiateBlueprint().

bool opal::Blueprint::jointExists const std::string &  name  )  [private]
 

Helper function that returns true if a Joint of the given name already exists in the Blueprint. Ignores empty name strings.

Definition at line 447 of file Blueprint.cpp.

Referenced by addJoint().

bool opal::Blueprint::motorExists const std::string &  name  )  [private]
 

Helper function that returns true if a Motor of the given name already exists in the Blueprint. Ignores empty name strings.

Definition at line 467 of file Blueprint.cpp.

Referenced by addMotor().

void opal::Blueprint::printFinalizedMessage  )  [private]
 

Prints a warning message saying that the Blueprint has already been finalized.

Definition at line 543 of file Blueprint.cpp.

References OPAL_LOGGER.

Referenced by addJoint(), addMotor(), addSensor(), and addSolid().

bool opal::Blueprint::sensorExists const std::string &  name  )  [private]
 

Helper function that returns true if a Sensor of the given name already exists in the Blueprint. Ignores empty name strings.

Definition at line 487 of file Blueprint.cpp.

Referenced by addSensor().

bool opal::Blueprint::solidExists const std::string &  name  )  [private]
 

Helper function that returns true if a Solid of the given name already exists in the Blueprint. Ignores empty name strings.

Definition at line 427 of file Blueprint.cpp.

Referenced by addSolid().


Member Data Documentation

bool opal::Blueprint::mFinalized [private]
 

True if the Blueprint has been finalized.

Definition at line 145 of file Blueprint.h.

Referenced by addJoint(), addMotor(), addSensor(), addSolid(), Blueprint(), and isFinalized().

std::vector<JointData*> opal::Blueprint::mJointList [private]
 

The set of all Joint pointers in this Blueprint.

Definition at line 151 of file Blueprint.h.

Referenced by addJoint(), finalize(), getJointData(), and getNumJoints().

std::vector<MotorData*> opal::Blueprint::mMotorList [private]
 

The set of all Motor pointers in this Blueprint.

Definition at line 154 of file Blueprint.h.

Referenced by addMotor(), getMotorData(), and getNumMotors().

std::vector<SensorData*> opal::Blueprint::mSensorList [private]
 

The set of all Sensor pointers in this Blueprint.

Definition at line 157 of file Blueprint.h.

Referenced by getNumSensors(), and getSensorData().

std::vector<SolidData*> opal::Blueprint::mSolidList [private]
 

The set of all Solid pointers in this Blueprint.

Definition at line 148 of file Blueprint.h.

Referenced by addSolid(), getNumSolids(), getSolidData(), and ~Blueprint().


The documentation for this class was generated from the following files:
Generated on Tue May 16 17:49:55 2006 for OPAL by  doxygen 1.4.6-NO