Class Oject is intended to be used as the base class for all OpenSim objects. More...
#include <Object.h>
Public Types | |
enum | { NAME_LENGTH = 128 } |
A length limit for a name. More... | |
Public Member Functions | |
virtual | ~Object () |
Destructor. | |
Object () | |
Default constructor. | |
Object (const std::string &aFileName, bool aUpdateFromXMLNode=true) SWIG_DECLARE_EXCEPTION | |
Object (const XMLDocument *aDocument) | |
Construct an object from a document. | |
Object (DOMElement *aNode) | |
Construct an object from an DOMElement. | |
Object (const Object &aObject) | |
Copy constructor. | |
virtual Object * | copy () const |
Construct and return a copy of this object. | |
virtual Object * | copy (DOMElement *aNode) const |
Copy this object and modify the copy so that it is consistent with a specified XML element node. | |
virtual const VisibleObject * | getDisplayer () const |
virtual VisibleObject * | updDisplayer () |
void | renameChildNode (const std::string &aOldName, const std::string &aNewName, DOMElement *startNode=NULL) |
Now this works by having classes that change over time, implement their own updateFromXMLNode method. | |
Object & | operator= (const Object &aObject) |
Assign this object to the values of another. | |
virtual bool | operator== (const Object &aObject) const |
Determine if two objects are equal. | |
virtual bool | operator< (const Object &aObject) const |
Determine if this property is less than another. | |
void | setType (const std::string &aType) |
const std::string & | getType () const |
Get the type of this object. | |
void | setName (const std::string &aName) |
const std::string & | getName () const |
Get the name of this object. | |
void | setDescription (const std::string &aDescrip) |
const std::string & | getDescription () const |
Get the description of this object. | |
const std::string & | toString () const |
Wrapper to be used on Java side to display objects in tree. | |
PropertySet & | getPropertySet () |
const PropertySet & | getPropertySet () const |
virtual bool | isValidDefaultType (const Object *aObject) const |
Determine whether a specified object is a valid or recognized type for this object. | |
virtual void | updateFromXMLNode () |
Update this object based on its XML node. | |
virtual void | updateDefaultObjectsFromXMLNode () |
Update the registered default objects based on an object's XML node. | |
virtual void | updateXMLNode (DOMElement *aParent, int aNodeIndex=0) |
Update the XML node that represents this object. | |
virtual void | updateDefaultObjectsXMLNode (DOMElement *aParent) |
Update the XML node for defaults object. | |
virtual void | generateXMLNode (DOMElement *aParent, int aNodeIndex=0) |
Generate an XML node to represent this object. | |
bool | getInlined () const |
Get the value of the inlined flag. | |
void | setInlined (bool aInlined, const std::string &aFileName="") |
XMLDocument * | getDocument () const |
Get the document for this object. | |
std::string | getDocumentFileName () const |
Get the document's filename. | |
DOMElement * | getXMLNode () const |
Get the XML node for this object. | |
void | clearXMLStructures () |
void | setAllPropertiesUseDefault (bool aUseDefault) |
bool | print (const std::string &aFileName) |
void | addObserver (Object &aObserver) |
void | deleteObserver (Object &aObserver) |
void | addObserverEvent (Object &aObserver, OpenSim::Event &aEvent) |
Eventually observers will have to specify what event to observe so that they're not called unnecessarily. | |
void | notifyObservers (OpenSim::Event &aEvent) |
void | deleteObservers () |
int | countObservers () const |
virtual void | update (const Object &aObject, OpenSim::Event &aEvent) |
virtual bool | isA (const char *type) const |
Static Public Member Functions | |
static Object * | SafeCopy (const Object *aObject) |
static void | RegisterType (const Object &aObject) |
Register a supported object type. | |
static void | RenameType (const std::string &oldTypeName, const Object &aObjectOfNewType) |
static void | setDebugLevel (int newLevel) |
static int | getDebugLevel () |
static Object * | makeObjectFromFile (const std::string &aFileName) |
makeObjectFromFile creates an OpenSim object based on the type of the object at the root node of the XML file passed in. | |
static Object * | newInstanceOfType (const std::string &aType) |
Create a new instance of the type indicated by aType. | |
static void | getRegisteredTypenames (Array< std::string > &rTypeNames) |
getRegisteredTypenames is a utility to retrieve all the typenames registered so far. | |
static void | PrintPropertyInfo (std::ostream &aOStream, const std::string &aClassNameDotPropertyName) |
static void | PrintPropertyInfo (std::ostream &aOStream, const std::string &aClassName, const std::string &aPropertyName) |
static void | setSerializeAllDefaults (bool aBoolean) |
static bool | getSerializeAllDefaults () |
static bool | isKindOf (const char *type) |
template<class T > | |
static void | getRegisteredObjectsOfGivenType (ArrayPtrs< T > &rArray) |
Static Public Attributes | |
static const std::string | DEFAULT_NAME |
Name used for default objects when they are serialized. | |
Protected Member Functions | |
void | setXMLNode (DOMElement *aNode) |
Set the XML node for this object. | |
void | setChanged () |
void | clearChanged () |
bool | hasChanged () |
Protected Attributes | |
PropertySet | _propertySet |
Property set for serializable member variables of this and derived classes. | |
std::string | _type |
Type. | |
std::string | _name |
Name. | |
std::string | _description |
A description of the object. | |
XMLDocument * | _document |
XML document. | |
DOMElement * | _node |
XML element node. | |
bool | _inlined |
Inlined object -> rdSerializable interface. | |
DOMElement * | _refNode |
For non inlined objects their _node and _document refer to external file _refNode contains the type and reference to file name -> rdSerializable interface. | |
Friends | |
std::ostream & | operator<< (std::ostream &aOut, const Object &aObject) |
Class Oject is intended to be used as the base class for all OpenSim objects.
It provides a common object from which to derive and also some basic functionality, such as writing to files in XML format and the equality, less than, and output operators. Future enhancements to Object might include thread functionality.
Object::~Object | ( | ) | [virtual] |
Destructor.
Object::Object | ( | ) |
Default constructor.
OpenSim::Object::Object | ( | const std::string & | aFileName, | |
bool | aUpdateFromXMLNode = true | |||
) |
Object::Object | ( | const XMLDocument * | aDocument | ) |
Construct an object from a document.
The document is copied and this object, including its derived classes, are constructed based on the nodes within the document.
Object::Object | ( | DOMElement * | aNode | ) |
Construct an object from an DOMElement.
Object::Object | ( | const Object & | aObject | ) |
Copy constructor.
Copy constructors for all Object's only copy the non-XML variable members of the object; that is, the object's DOMnode and XMLDocument are not copied but set to NULL. The reason for this is that for the object and all its derived classes to establish the correct connection to the XML document nodes, the the object would need to reconstruct based on the XML document not the values of the object's member variables.
There are three proper ways to generate an XML document for an Object:
1) Construction based on XML file (
2) Construction by Object(const XMLDocument *aDocument). This constructor explictly requests construction based on an XML document. In this way the proper connection between an object's node and the corresponding node within the XML document is established. This constructor is a copy constructor of sorts because all essential Object member variables should be held within the XML document. The advantage of this style of construction is that nodes within the XML document, such as comments that may not have any associated Object member variable, are preserved.
3) A call to generateXMLDocument(). This method generates an XML document for the Object from scratch. Only the essential document nodes are created (that is, nodes that correspond directly to member variables.).
aObject | Object to be copied. |
void OpenSim::Object::addObserver | ( | Object & | aObserver | ) | [inline] |
void OpenSim::Object::addObserverEvent | ( | Object & | aObserver, | |
OpenSim::Event & | aEvent | |||
) | [inline] |
Eventually observers will have to specify what event to observe so that they're not called unnecessarily.
Will do this after the Event class hierarchy matures.
void OpenSim::Object::clearChanged | ( | ) | [inline, protected] |
void Object::clearXMLStructures | ( | ) |
Object * Object::copy | ( | DOMElement * | aElement | ) | const [virtual] |
Copy this object and modify the copy so that it is consistent with a specified XML element node.
The copy is constructed by first using the contructor for the DOMElement in order to establish the relationship of the control with the XML node. Then, the assignment operator is used to set all member variables of the copy to the values of this object. Finally, the data members of the copy are updated from the DOMElment using updateObject().
aElement | XML element. |
Object * Object::copy | ( | ) | const [virtual] |
Construct and return a copy of this object.
The object is allocated using the new operator, so the caller is responsible for deleting the returned object.
Reimplemented in OpenSim::ContDerivMuscle, OpenSim::CoordinateActuator, OpenSim::CoordinateLimitForce, OpenSim::Delp1990Muscle, OpenSim::PointActuator, OpenSim::PointToPointActuator, OpenSim::RigidTendonMuscle, OpenSim::Schutte1993Muscle, OpenSim::SpringGeneralizedForce, OpenSim::Thelen2003Muscle, OpenSim::TorqueActuator, OpenSim::Actuation, OpenSim::ActuatorPerturbation, OpenSim::BodyKinematics, OpenSim::ForcePerturbationFunction, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, OpenSim::StaticOptimization, OpenSim::Constant, OpenSim::DisplayGeometry, OpenSim::Function, OpenSim::GCVSpline, OpenSim::LinearFunction, OpenSim::Material, OpenSim::MultiplierFunction, OpenSim::NaturalCubicSpline, OpenSim::ObjectGroup, OpenSim::PiecewiseConstantFunction, OpenSim::PiecewiseLinearFunction, OpenSim::Range, OpenSim::Scale, OpenSim::Set< T >, OpenSim::SimmMotionData, OpenSim::SimmMotionEvent, OpenSim::StateFunction, OpenSim::StepFunction, OpenSim::Storage, OpenSim::StorageInterface, OpenSim::VectorFunction, OpenSim::VectorFunctionUncoupledNxN, OpenSim::VectorGCVSplineR1R3, OpenSim::VisibleObject, OpenSim::ConstantController, OpenSim::ControlConstant, OpenSim::ControlLinear, OpenSim::ControlLinearNode, OpenSim::ControlSet, OpenSim::ControlSetController, OpenSim::PrescribedController, OpenSim::JointReactionReference, OpenSim::MarkerWeight, OpenSim::ActivationFiberLengthMuscle, OpenSim::Actuator_, OpenSim::Actuator, OpenSim::Analysis, OpenSim::AnalysisSet, OpenSim::BodyScale, OpenSim::BushingForce, OpenSim::Condition, OpenSim::ConditionalPathPoint, OpenSim::ContactGeometry, OpenSim::ContactHalfSpace, OpenSim::ContactMesh, OpenSim::ContactSphere, OpenSim::ControllerSet, OpenSim::ElasticFoundationForce, OpenSim::ElasticFoundationForce, OpenSim::ElasticFoundationForce, OpenSim::ExternalForce, OpenSim::ExternalLoads, OpenSim::Force, OpenSim::ForceSet, OpenSim::FunctionThresholdCondition, OpenSim::GeometryPath, OpenSim::HuntCrossleyForce, OpenSim::HuntCrossleyForce, OpenSim::HuntCrossleyForce, OpenSim::Ligament, OpenSim::LinearSpring, OpenSim::Marker, OpenSim::MarkerSet, OpenSim::Model, OpenSim::ModelComponentSet< T >, OpenSim::MovingPathPoint, OpenSim::Muscle, OpenSim::PathActuator, OpenSim::PathPoint, OpenSim::PointToPointSpring, OpenSim::PrescribedForce, OpenSim::TorsionalSpring, OpenSim::BallJoint, OpenSim::Body, OpenSim::Constraint, OpenSim::Coordinate, OpenSim::CoordinateCouplerConstraint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::Joint, OpenSim::PinJoint, OpenSim::PointConstraint, OpenSim::PointOnLineConstraint, OpenSim::RollingOnSurfaceConstraint, OpenSim::SimbodyEngine, OpenSim::SliderJoint, OpenSim::SpatialTransform, OpenSim::TransformAxis, OpenSim::UnilateralConstraint, OpenSim::WeldConstraint, OpenSim::WeldJoint, OpenSim::PathWrap, OpenSim::PathWrapPoint, OpenSim::WrapCylinder, OpenSim::WrapCylinderObst, OpenSim::WrapDoubleCylinderObst, OpenSim::WrapEllipsoid, OpenSim::WrapObject, OpenSim::WrapSphere, OpenSim::WrapSphereObst, OpenSim::WrapTorus, OpenSim::AnalyzeTool, OpenSim::CMC, OpenSim::CMC_Joint, OpenSim::CMC_Point, OpenSim::CMC_Task, OpenSim::CMCTool, OpenSim::CorrectionController, OpenSim::DynamicsTool, OpenSim::ForwardTool, OpenSim::GenericModelMaker, OpenSim::IKCoordinateTask, OpenSim::IKMarkerTask, OpenSim::IKTask, OpenSim::InverseDynamicsTool, OpenSim::InverseKinematicsTool, OpenSim::MarkerPair, OpenSim::MarkerPlacer, OpenSim::Measurement, OpenSim::ModelScaler, OpenSim::MuscleStateTrackingTask, OpenSim::RRATool, OpenSim::ScaleTool, OpenSim::SMC_Joint, OpenSim::TrackingTask, OpenSim::VectorFunctionForActuators, OpenSim::Set< ExternalForce >, OpenSim::Set< JointReactionReference >, OpenSim::Set< Actuator >, OpenSim::Set< ContactGeometry >, OpenSim::Set< PathPoint >, OpenSim::Set< Coordinate >, OpenSim::Set< MarkerWeight >, OpenSim::Set< WrapObject >, OpenSim::Set< IKTask >, OpenSim::Set< Force >, OpenSim::Set< Joint >, OpenSim::Set< MarkerPair >, OpenSim::Set< DisplayGeometry >, OpenSim::Set< ForcePerturbationFunction >, OpenSim::Set< Scale >, OpenSim::Set< Controller >, OpenSim::Set< Function >, OpenSim::Set< Muscle >, OpenSim::Set< PathWrap >, OpenSim::Set< TrackingTask >, OpenSim::Set< Measurement >, OpenSim::Set< BodyScale >, OpenSim::Set< Marker >, OpenSim::Set< Analysis >, OpenSim::Set< Body >, OpenSim::Set< Constraint >, OpenSim::Set< Control >, OpenSim::ModelComponentSet< ExternalForce >, OpenSim::ModelComponentSet< ContactGeometry >, OpenSim::ModelComponentSet< Coordinate >, OpenSim::ModelComponentSet< Force >, OpenSim::ModelComponentSet< Joint >, OpenSim::ModelComponentSet< Controller >, OpenSim::ModelComponentSet< Body >, and OpenSim::ModelComponentSet< Constraint >.
int OpenSim::Object::countObservers | ( | ) | const [inline] |
void OpenSim::Object::deleteObserver | ( | Object & | aObserver | ) | [inline] |
void OpenSim::Object::deleteObservers | ( | ) | [inline] |
void Object::generateXMLNode | ( | DOMElement * | aParent, | |
int | aNodeIndex = 0 | |||
) | [virtual] |
Generate an XML node to represent this object.
If the parent node is NULL the intent is to generate a new document as well as a new node. Howerver, for this request to be successful, a document must not already be associated with the object.
If the parent node is not NULL and this object already has a node, the node and the parent must be from the same document. Requesting that a new node be generated when one already exists is useful when it is desired to remake a node entirely including elements for all the properties of an object.
aParent | Intended parent of the node to be generated. If aParent is NULL, the intent is for this object to serve as the root element of a new document. |
static int OpenSim::Object::getDebugLevel | ( | ) | [inline, static] |
const string & Object::getDescription | ( | ) | const |
Get the description of this object.
Reimplemented in OpenSim::Storage.
virtual const VisibleObject* OpenSim::Object::getDisplayer | ( | ) | const [inline, virtual] |
XMLDocument * Object::getDocument | ( | ) | const |
Get the document for this object.
string Object::getDocumentFileName | ( | ) | const |
Get the document's filename.
bool Object::getInlined | ( | ) | const |
Get the value of the inlined flag.
const string & Object::getName | ( | ) | const |
Get the name of this object.
Reimplemented in OpenSim::Storage.
const PropertySet& OpenSim::Object::getPropertySet | ( | ) | const [inline] |
PropertySet& OpenSim::Object::getPropertySet | ( | ) | [inline] |
static void OpenSim::Object::getRegisteredObjectsOfGivenType | ( | ArrayPtrs< T > & | rArray | ) | [inline, static] |
void Object::getRegisteredTypenames | ( | Array< std::string > & | rTypeNames | ) | [static] |
getRegisteredTypenames is a utility to retrieve all the typenames registered so far.
This is done by traversing the registered objects map, so only concrete classes are dealt with. The result returned in rTypeNames should not be cached while more dlls are loaded as they get stale instead the list should be constructed whenever in doubt
static bool OpenSim::Object::getSerializeAllDefaults | ( | ) | [inline, static] |
const string & Object::getType | ( | ) | const |
Get the type of this object.
DOMElement * Object::getXMLNode | ( | ) | const |
Get the XML node for this object.
bool OpenSim::Object::hasChanged | ( | ) | [inline, protected] |
virtual bool OpenSim::Object::isA | ( | const char * | type | ) | const [inline, virtual] |
static bool OpenSim::Object::isKindOf | ( | const char * | type | ) | [inline, static] |
bool Object::isValidDefaultType | ( | const Object * | aObject | ) | const [virtual] |
Determine whether a specified object is a valid or recognized type for this object.
This method is used during XML serialization to determine whether or not objects in the type registry (
The default elements allow a user to see all the available properties for an object of a particular type and also allow a user to specify default values for any member objects.
The implementation of this method in Object always returns true. This results in every object in the type registery being written to the defaults header. To be more restrictive about which objects are valid (and written to the defaults header), this method should be overridden by derived classes. For example, class ActuatorSet might override this method to allow only object derived from Actuator to be valid.
aObject | Object to be tested as valid or invalid default type for this object. |
Object * Object::makeObjectFromFile | ( | const std::string & | aFileName | ) | [static] |
makeObjectFromFile creates an OpenSim object based on the type of the object at the root node of the XML file passed in.
This is useful since the constructor of Object doesn't have the proper type info. This works by using the defaults table so that "Object" does not need to know about derived classes, however it uses the defaults table to get an instance, so only "Registered" types will be considered.
Note: The object created is "New" so whoever makes the call also takes ownership of the object
Open the file and get the type of the root element
Object * Object::newInstanceOfType | ( | const std::string & | aType | ) | [static] |
Create a new instance of the type indicated by aType.
The instance is initialized to the default Object of corresponding type.
void OpenSim::Object::notifyObservers | ( | OpenSim::Event & | aEvent | ) | [inline] |
bool Object::operator< | ( | const Object & | aObject | ) | const [virtual] |
Determine if this property is less than another.
This property is less than another if the name of this string is less than the name of the other property.
aProperty | Property for which to make the less than test. |
Reimplemented in OpenSim::ControlLinearNode.
Assign this object to the values of another.
The XML-associated variable members are not copied-- the XML nodes and/or document must be generated anew for a copied object.
Reimplemented in OpenSim::ContDerivMuscle, OpenSim::CoordinateActuator, OpenSim::CoordinateLimitForce, OpenSim::Delp1990Muscle, OpenSim::PointActuator, OpenSim::PointToPointActuator, OpenSim::RigidTendonMuscle, OpenSim::Schutte1993Muscle, OpenSim::SpringGeneralizedForce, OpenSim::Thelen2003Muscle, OpenSim::TorqueActuator, OpenSim::Actuation, OpenSim::ActuatorPerturbation, OpenSim::BodyKinematics, OpenSim::ForceReporter, OpenSim::InverseDynamics, OpenSim::JointLoadOptimization, OpenSim::JointReaction, OpenSim::Kinematics, OpenSim::MuscleAnalysis, OpenSim::PointKinematics, OpenSim::StatesReporter, OpenSim::StaticOptimization, OpenSim::Constant, OpenSim::DisplayGeometry, OpenSim::Function, OpenSim::GCVSpline, OpenSim::GeometrySet, OpenSim::LinearFunction, OpenSim::Material, OpenSim::MultiplierFunction, OpenSim::NaturalCubicSpline, OpenSim::ObjectGroup, OpenSim::PiecewiseConstantFunction, OpenSim::PiecewiseLinearFunction, OpenSim::Range, OpenSim::Scale, OpenSim::ScaleSet, OpenSim::Set< T >, OpenSim::SimmMotionData, OpenSim::SimmMotionEvent, OpenSim::StepFunction, OpenSim::Storage, OpenSim::StorageInterface, OpenSim::VectorFunction, OpenSim::VectorFunctionUncoupledNxN, OpenSim::VectorGCVSplineR1R3, OpenSim::VisibleObject, OpenSim::ConstantController, OpenSim::Control, OpenSim::ControlConstant, OpenSim::Controller, OpenSim::ControlLinear, OpenSim::ControlLinearNode, OpenSim::ControlSet, OpenSim::ControlSetController, OpenSim::PrescribedController, OpenSim::TrackingController, OpenSim::CoordinateReference, OpenSim::JointReactionReference, OpenSim::MarkersReference, OpenSim::AbstractTool, OpenSim::ActivationFiberLengthMuscle, OpenSim::Actuator_, OpenSim::Actuator, OpenSim::Analysis, OpenSim::AnalysisSet, OpenSim::BodyScale, OpenSim::BodyScaleSet, OpenSim::BodySet, OpenSim::BushingForce, OpenSim::Condition, OpenSim::ConditionalPathPoint, OpenSim::ConstraintSet, OpenSim::ContactGeometrySet, OpenSim::ControllerSet, OpenSim::CoordinateSet, OpenSim::ExternalForce, OpenSim::ExternalLoads, OpenSim::Force, OpenSim::ForceSet, OpenSim::FunctionThresholdCondition, OpenSim::GeometryPath, OpenSim::JointSet, OpenSim::Ligament, OpenSim::Marker, OpenSim::MarkerSet, OpenSim::Model, OpenSim::ModelComponent, OpenSim::MovingPathPoint, OpenSim::Muscle, OpenSim::PathActuator, OpenSim::PathPoint, OpenSim::PathPointSet, OpenSim::PointToPointSpring, OpenSim::PrescribedForce, OpenSim::Reference_< T >, OpenSim::BallJoint, OpenSim::Body, OpenSim::Constraint, OpenSim::Coordinate, OpenSim::CoordinateCouplerConstraint, OpenSim::CustomJoint, OpenSim::EllipsoidJoint, OpenSim::FreeJoint, OpenSim::Joint, OpenSim::PinJoint, OpenSim::PointConstraint, OpenSim::PointOnLineConstraint, OpenSim::RollingOnSurfaceConstraint, OpenSim::SimbodyEngine, OpenSim::SliderJoint, OpenSim::SpatialTransform, OpenSim::TransformAxis, OpenSim::UnilateralConstraint, OpenSim::WeldConstraint, OpenSim::WeldJoint, OpenSim::PathWrap, OpenSim::PathWrapPoint, OpenSim::PathWrapSet, OpenSim::WrapCylinder, OpenSim::WrapCylinderObst, OpenSim::WrapDoubleCylinderObst, OpenSim::WrapEllipsoid, OpenSim::WrapObject, OpenSim::WrapObjectSet, OpenSim::WrapSphere, OpenSim::WrapSphereObst, OpenSim::WrapTorus, OpenSim::AnalyzeTool, OpenSim::CMC, OpenSim::CMC_Joint, OpenSim::CMC_Point, OpenSim::CMC_Task, OpenSim::CMCTool, OpenSim::CorrectionController, OpenSim::DynamicsTool, OpenSim::ForwardTool, OpenSim::GenericModelMaker, OpenSim::IKCoordinateTask, OpenSim::IKMarkerTask, OpenSim::IKTask, OpenSim::IKTaskSet, OpenSim::InverseDynamicsTool, OpenSim::InverseKinematicsTool, OpenSim::MarkerPair, OpenSim::MarkerPairSet, OpenSim::MarkerPlacer, OpenSim::Measurement, OpenSim::MeasurementSet, OpenSim::ModelScaler, OpenSim::MuscleStateTrackingTask, OpenSim::RRATool, OpenSim::ScaleTool, OpenSim::SMC_Joint, OpenSim::StateTrackingTask, OpenSim::Tool, OpenSim::TrackingTask, and OpenSim::VectorFunctionForActuators.
bool Object::operator== | ( | const Object & | aObject | ) | const [virtual] |
Determine if two objects are equal.
Reimplemented in OpenSim::DisplayGeometry, and OpenSim::ControlLinearNode.
bool OpenSim::Object::print | ( | const std::string & | aFileName | ) |
static void OpenSim::Object::PrintPropertyInfo | ( | std::ostream & | aOStream, | |
const std::string & | aClassName, | |||
const std::string & | aPropertyName | |||
) | [static] |
static void OpenSim::Object::PrintPropertyInfo | ( | std::ostream & | aOStream, | |
const std::string & | aClassNameDotPropertyName | |||
) | [static] |
void Object::RegisterType | ( | const Object & | aObject | ) | [static] |
Register a supported object type.
A global list of all supported objects (i.e., objects derived from Object) is kept mainly for two purposes:
---- Object Deserialization ---- Once a type is registered, that type can be read from XML files assuming that the type has implemented the following methods: 1) copy constructor 2) virtual Object* copy() const, 3) <class>& operator=() (where the class name is substituted for <class>),
---- Initialization by Default Object ---- When objects are deserialized, they are constructed based on the registered type and receive all of the registered type's property values. These values are over-ridden only if there is an element within an XML file that overrides a default element.
Because this method is static, registration of object types needs to be done only once per process and an object does not need to be instantiated to do so.
This method makes a copy of the specified object.
aObject | Object of the type to be registered. If the type is already registered, the current object is replaced by a copy of the specified object. |
void Object::renameChildNode | ( | const std::string & | aOldName, | |
const std::string & | aNewName, | |||
DOMElement * | startNode = NULL | |||
) |
Now this works by having classes that change over time, implement their own updateFromXMLNode method.
renameChildNode is a utility, helpful for migration to allow an object to change the "tag" in the XML structure from aOldName to aNewName so that the rest of the serialization code doesn't need to handle legacy file formats.
The method is responsible for massaging the DOM underneath the object to match latest XML layout. The implmentation of updateFromXMLNode (if any) should call the base class's method to do the actual parsing. The helper function renameChildNode helps with this since it's not provided by the DOM.
void Object::RenameType | ( | const std::string & | oldTypeName, | |
const Object & | aObjectOfNewType | |||
) | [static] |
void Object::setAllPropertiesUseDefault | ( | bool | aUseDefault | ) |
void OpenSim::Object::setChanged | ( | ) | [inline, protected] |
static void OpenSim::Object::setDebugLevel | ( | int | newLevel | ) | [inline, static] |
void OpenSim::Object::setDescription | ( | const std::string & | aDescrip | ) |
Reimplemented in OpenSim::Storage.
void Object::setInlined | ( | bool | aInlined, | |
const std::string & | aFileName = "" | |||
) |
void OpenSim::Object::setName | ( | const std::string & | aName | ) |
Reimplemented in OpenSim::RigidTendonMuscle, OpenSim::Storage, OpenSim::ActivationFiberLengthMuscle, OpenSim::GeometryPath, and OpenSim::Muscle.
static void OpenSim::Object::setSerializeAllDefaults | ( | bool | aBoolean | ) | [inline, static] |
void OpenSim::Object::setType | ( | const std::string & | aType | ) |
void Object::setXMLNode | ( | DOMElement * | aNode | ) | [protected] |
Set the XML node for this object.
This method is not intended for general use. Generally, the XML node of an object is assigned during construction. In rare instances, however, it is convenient to have the ability to set the XML node of an object. This functionality is private and only accessible from within Object.
const string & Object::toString | ( | ) | const |
Wrapper to be used on Java side to display objects in tree.
virtual void OpenSim::Object::update | ( | const Object & | aObject, | |
OpenSim::Event & | aEvent | |||
) | [inline, virtual] |
void Object::updateDefaultObjectsFromXMLNode | ( | ) | [virtual] |
Update the registered default objects based on an object's XML node.
This method looks for an element with a tag name "defaults" and reads the objects in that element and registers them using the method Object::RegisterType().
void Object::updateDefaultObjectsXMLNode | ( | DOMElement * | aParent | ) | [virtual] |
Update the XML node for defaults object.
void Object::updateFromXMLNode | ( | ) | [virtual] |
Update this object based on its XML node.
Added parameter sourceNode to handle external documents For non-inlined objects the root of the childDocument is passed in else NULL.
Reimplemented in OpenSim::CoordinateActuator, OpenSim::PointActuator, OpenSim::PointToPointActuator, OpenSim::RigidTendonMuscle, OpenSim::TorqueActuator, OpenSim::GCVSpline, OpenSim::MultiplierFunction, OpenSim::NaturalCubicSpline, OpenSim::PiecewiseConstantFunction, OpenSim::PiecewiseLinearFunction, OpenSim::VisibleObject, OpenSim::JointReactionReference, OpenSim::AbstractTool, OpenSim::ActivationFiberLengthMuscle, OpenSim::Actuator, OpenSim::ConditionalPathPoint, OpenSim::ExternalForce, OpenSim::ExternalLoads, OpenSim::Model, OpenSim::MovingPathPoint, OpenSim::Muscle, OpenSim::PathActuator, OpenSim::PrescribedForce, OpenSim::CustomJoint, OpenSim::TransformAxis, OpenSim::CMC_Joint, OpenSim::CMC_Point, OpenSim::CMC_Task, OpenSim::ForwardTool, OpenSim::InverseDynamicsTool, OpenSim::InverseKinematicsTool, and OpenSim::RRATool.
void Object::updateXMLNode | ( | DOMElement * | aParent, | |
int | aNodeIndex = 0 | |||
) | [virtual] |
Update the XML node that represents this object.
aParent | Parent XML node of this object. Sending in a parent node allows an XML node to be generated for this object if it doesn't already have one. If the parent node is sent in as NULL and this object doesn't already have an XML node, this object will become the root node for a new XML document. If this object already has an XML node associated with it, no new nodes are ever generated and the parent node is not used. | |
aParent | Parent XML element. |
virtual VisibleObject* OpenSim::Object::updDisplayer | ( | ) | [inline, virtual] |
Reimplemented in OpenSim::ContactGeometry, OpenSim::Marker, OpenSim::PathPoint, and OpenSim::Body.
std::ostream& operator<< | ( | std::ostream & | aOut, | |
const Object & | aObject | |||
) | [friend] |
Reimplemented in OpenSim::Set< T >, and OpenSim::ControlLinearNode.
std::string OpenSim::Object::_description [protected] |
XMLDocument* OpenSim::Object::_document [protected] |
XML document.
-> rdSerializable interface
bool OpenSim::Object::_inlined [protected] |
Inlined object -> rdSerializable interface.
std::string OpenSim::Object::_name [protected] |
Name.
Made protected so that classes can customize their setName. -Ayman 04/04
Reimplemented in OpenSim::Storage.
DOMElement* OpenSim::Object::_node [protected] |
XML element node.
-> rdSerializable interface
PropertySet OpenSim::Object::_propertySet [protected] |
Property set for serializable member variables of this and derived classes.
DOMElement* OpenSim::Object::_refNode [protected] |
For non inlined objects their _node and _document refer to external file _refNode contains the type and reference to file name -> rdSerializable interface.
std::string OpenSim::Object::_type [protected] |
Type.
const string Object::DEFAULT_NAME [static] |
Name used for default objects when they are serialized.