Physsim::Base Class Reference

Class from which all Physsim classes are derived. More...

#include <Base.h>

Inheritance diagram for Physsim::Base:

Physsim::AAngle Physsim::CollisionDetection Physsim::CollisionGeometry Physsim::CollisionMethod Physsim::Constraint Physsim::Contact Physsim::ContactData Physsim::EulerAngles Physsim::Integrator Physsim::Primitive Physsim::Quat Physsim::RCArticulatedBodyFwdDynAlgo Physsim::RCArticulatedBodyInvDynAlgo Physsim::RecurrentForce Physsim::RestingContactMethod Physsim::Simulator Physsim::SoSeparatorWrapper Physsim::StaticFrictionInfo Physsim::Triangle Physsim::Visualizable List of all members.

Public Member Functions

 Base (const Base *b)
virtual void clone (BasePtr &cloned, bimap< BasePtr, BasePtr > *obj_map=NULL) const
 Clones this object.
virtual void load_state (BaseConstPtr object, bimap< BasePtr, BasePtr > *correspondence=NULL)
 Loads state from a Base object.
virtual void save_state (BasePtr object, bimap< BasePtr, BasePtr > *correspondence=NULL) const
 Saves state to a Base object.
virtual void save_to_xml (XMLTreePtr node, std::list< BaseConstPtr > &shared_objects) const
 Method for saving this object to XML.
virtual void load_from_xml (XMLTreeConstPtr node, std::map< std::string, BasePtr > &id_map)
 Method for loading the data for this object from XML.
virtual void output_object_state (std::ostream &out) const
 Outputs this class data to the stream.
virtual bool is_struct_identical (BaseConstPtr object) const
const std::string & id () const
 Gets the unique identifier for this object.
boost::shared_ptr< void > user_data () const
 Gets any userdata for this class.
void user_data (boost::shared_ptr< void > data)
 Sets userdata for this class.
const std::string & name () const
 Gets the name for this class.
void name (const std::string &name)
 Sets the name for this class.
void id (const std::string &ID)
 Sets the unique ID for this object.

Static Public Member Functions

template<class T>
static boost::shared_ptr< T > clone (boost::shared_ptr< T > x)
 Static method for cloning a shared pointer.

Detailed Description

Class from which all Physsim classes are derived.


Member Function Documentation

void Base::clone ( BasePtr &  cloned,
bimap< BasePtr, BasePtr > *  object_map = NULL 
) const [virtual]

Clones this object.

Most derived implementations of the Base class will want to override this method, but should call it as soon as a pointer is constructed - this method not only stores Base data (i.e., name, id, etc.) but also puts the newly constructed object into the object map. Methods that implement this class should generally follow a prescribed behavior: if cloned is NULL on entry, the implementation should construct an object of the class type, and otherwise should populate the given object.

Parameters:
cloned a reference to the cloned pointer; if this reference is NULL on entry, the derived class should construct an instance of the derived class type and set cloned to point to it
object_map a structure (possibly NULL) that maps original pointers to their clones; because cloning is a recursive process, cloning one object will generally result in many new objects being constructed; derived classes need not add this to the map: Base::clone() does that automatically
Note:
the cloned object will share the ID of the original!

Reimplemented in Physsim::ADFCollisionDetection, Physsim::CollisionDetection, Physsim::CollisionGeometry, Physsim::Contact, Physsim::ContactData, Physsim::CRBAlgorithm, Physsim::EulerIntegrator, Physsim::FSABAlgorithm, Physsim::ImpulseContactSimulator, Physsim::Joint, Physsim::LCPRestingContact, Physsim::MCArticulatedBody, Physsim::MirtichRestitutionModel, Physsim::NewtonRestitutionModel, Physsim::PenaltyRestingContact, Physsim::PoissonRestitutionModel, Physsim::PQPCollisionDetection, Physsim::PrismaticJoint, Physsim::RCArticulatedBody, Physsim::RCArticulatedBodyFwdDynAlgo, Physsim::RevoluteJoint, Physsim::RigidBody, Physsim::RungeKuttaImplicitIntegrator, Physsim::RungeKuttaIntegrator, Physsim::Simulator, Physsim::SphericalJoint, Physsim::ThreshContactSimulator, Physsim::UniversalJoint, and Physsim::Visualizable.

void Base::load_state ( BaseConstPtr  object,
bimap< BasePtr, BasePtr > *  correspondence = NULL 
) [virtual]

Loads state from a Base object.

Parameters:
the object from which to load this
bimap a pointer to a bidirectional map from objects being loaded to the objects being used to load them Loading/saving object state are similar to cloning, but without new objects being constructed; existing objects are used instead. Naturally, the object must have the same structure. This can be guaranteed by cloning this and then saving and loading states between this and the clone.

Reimplemented in Physsim::ADFCollisionDetection, Physsim::CollisionDetection, Physsim::CollisionGeometry, Physsim::Contact, Physsim::ContactData, Physsim::CRBAlgorithm, Physsim::ImpulseContactSimulator, Physsim::Joint, Physsim::LCPRestingContact, Physsim::MCArticulatedBody, Physsim::MirtichRestitutionModel, Physsim::NewtonRestitutionModel, Physsim::PenaltyRestingContact, Physsim::PoissonRestitutionModel, Physsim::PQPCollisionDetection, Physsim::PrismaticJoint, Physsim::RCArticulatedBody, Physsim::RCArticulatedBodyFwdDynAlgo, Physsim::RevoluteJoint, Physsim::RigidBody, Physsim::Simulator, Physsim::SphericalJoint, Physsim::ThreshContactSimulator, Physsim::UniversalJoint, and Physsim::Visualizable.

void Base::save_state ( BasePtr  object,
bimap< BasePtr, BasePtr > *  correspondence = NULL 
) const [virtual]

Saves state to a Base object.

Parameters:
the object to which to save this
bimap a pointer to a bidirectional map from objects being saved to the objects being saved to Loading/saving object state are similar to cloning, but without new objects being constructed; existing objects are used instead. Naturally, the object must have the same structure. This can be guaranteed by cloning this and then saving and loading states between this and the clone.

Reimplemented in Physsim::ADFCollisionDetection, Physsim::CollisionDetection, Physsim::CollisionGeometry, Physsim::Contact, Physsim::ContactData, Physsim::CRBAlgorithm, Physsim::FSABAlgorithm, Physsim::ImpulseContactSimulator, Physsim::Joint, Physsim::LCPRestingContact, Physsim::MCArticulatedBody, Physsim::MirtichRestitutionModel, Physsim::NewtonRestitutionModel, Physsim::PenaltyRestingContact, Physsim::PoissonRestitutionModel, Physsim::PQPCollisionDetection, Physsim::PrismaticJoint, Physsim::RCArticulatedBody, Physsim::RCArticulatedBodyFwdDynAlgo, Physsim::RevoluteJoint, Physsim::RigidBody, Physsim::Simulator, Physsim::SphericalJoint, Physsim::ThreshContactSimulator, Physsim::UniversalJoint, and Physsim::Visualizable.

void Base::save_to_xml ( XMLTreePtr  node,
std::list< BaseConstPtr > &  shared_objects 
) const [virtual]

Method for saving this object to XML.

Parameters:
node the XML node to which this object should be serialized
on output, a list of shared objects which should also be serialized

Reimplemented in Physsim::ADFCollisionDetection, Physsim::Box, Physsim::CollisionDetection, Physsim::CollisionGeometry, Physsim::ContactData, Physsim::CRBAlgorithm, Physsim::Cylinder, Physsim::EulerIntegrator, Physsim::FSABAlgorithm, Physsim::ImpulseContactSimulator, Physsim::Joint, Physsim::LCPRestingContact, Physsim::MCArticulatedBody, Physsim::MirtichRestitutionModel, Physsim::NewtonRestitutionModel, Physsim::StaticFrictionInfo, Physsim::PenaltyRestingContact, Physsim::PoissonRestitutionModel, Physsim::PQPCollisionDetection, Physsim::Primitive, Physsim::PrismaticJoint, Physsim::RCArticulatedBody, Physsim::RevoluteJoint, Physsim::RigidBody, Physsim::RungeKuttaImplicitIntegrator, Physsim::RungeKuttaIntegrator, Physsim::Simulator, Physsim::SoSeparatorWrapper, Physsim::Sphere, Physsim::SphericalJoint, Physsim::ThreshContactSimulator, Physsim::TriangleMesh, Physsim::UniversalJoint, and Physsim::Visualizable.

void Base::load_from_xml ( XMLTreeConstPtr  node,
std::map< std::string, BasePtr > &  id_map 
) [virtual]

Method for loading the data for this object from XML.

Parameters:
node the subtree under which all data necessary to load this object is stored
id_map a map from node IDs to read objects

Reimplemented in Physsim::ADFCollisionDetection, Physsim::Box, Physsim::CollisionDetection, Physsim::CollisionGeometry, Physsim::ContactData, Physsim::CRBAlgorithm, Physsim::Cylinder, Physsim::EulerIntegrator, Physsim::FSABAlgorithm, Physsim::ImpulseContactSimulator, Physsim::Joint, Physsim::LCPRestingContact, Physsim::MCArticulatedBody, Physsim::MirtichRestitutionModel, Physsim::NewtonRestitutionModel, Physsim::StaticFrictionInfo, Physsim::PenaltyRestingContact, Physsim::PoissonRestitutionModel, Physsim::PQPCollisionDetection, Physsim::Primitive, Physsim::PrismaticJoint, Physsim::RCArticulatedBody, Physsim::RevoluteJoint, Physsim::RigidBody, Physsim::RungeKuttaImplicitIntegrator, Physsim::RungeKuttaIntegrator, Physsim::Simulator, Physsim::SoSeparatorWrapper, Physsim::Sphere, Physsim::SphericalJoint, Physsim::ThreshContactSimulator, Physsim::TriangleMesh, Physsim::UniversalJoint, and Physsim::Visualizable.

void Base::output_object_state ( std::ostream &  out  )  const [virtual]

Outputs this class data to the stream.

This method outputs all of the low-level details to the stream; if serialization is desired, use save_to_xml() instead.

See also:
save_to_xml()

Reimplemented in Physsim::CollisionDetection, Physsim::ImpulseContactSimulator, Physsim::RigidBody, and Physsim::ThreshContactSimulator.

const std::string & Base::id (  )  const

Gets the unique identifier for this object.

If the unique identifier has not been set already, this method will return a string version of this.


The documentation for this class was generated from the following files:
Generated on Wed Oct 24 14:54:22 2007 for Physsim by  doxygen 1.5.1