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

rdObject Class Reference

Class rdOject is intended to be used as the base class for all Realistic Dynamics, Inc. More...

#include <rdObject.h>

Inheritance diagram for rdObject:

rdActuator rdCallback rdControl rdEdge rdFunction rdGBody rdGModel rdLine rdObjectArray rdPlane rdPtrArray rdTriangle rdV3D rdValueArray< T > suTrackObject List of all members.

Public Member Functions

 rdObject ()
 Default constructor.

 rdObject (const char *aFileName)
 Construct an object from file.

 rdObject (const rdXMLDocument *aDocument)
 Construct an object from a document.

 rdObject (IDOM_Element *aNode)
 Construct an object from an IDOM_Element.

 rdObject (const rdObject &aObject)
 Copy constructor.

virtual ~rdObject ()
 Destructor.

rdObject & operator= (const rdObject &aObject)
 Assign this object to the values of another.

virtual bool operator== (const rdObject &aObject)
 Determine if two objects are equal.

const char * getType () const
 Get the type of this object.

void setName (const char *aName)
 Set the name of this object.

const char * getName () const
 Get the type of this object.

rdXMLDocumentgetDocument () const
 Get the document for this object.

IDOM_Element * getNode () const
 Get the node set for this object.

virtual void updateObject (bool aDeep=true)
 Update this object based on its XML node.

virtual void updateNode (bool aDeep=true)
 Update the XML node that represents this object.

virtual void generateNode (IDOM_Element *aParent)
 Generate an XML node to represent this object.

void print (const char *aFileName=NULL)
 Print the object.


Static Public Attributes

const int NAME_LENGTH = rdObject_NAME_LENGTH
 A length limit for the name of an object.

const char PROP_NAME [] = "name"
 Token for the name.


Protected Member Functions

void setType (const char *aType)
 Set the type of this object.


Protected Attributes

rdXMLDocument_document
 XML document.

IDOM_Element * _node
 XML element node.


Private Member Functions

void setNull ()
 Set all member variables to their null or default values.

void generateDocument ()
 Generate a new XML document with this object as the root node.


Private Attributes

char * _type
 Type.

char * _name
 Name .


Detailed Description

Class rdOject is intended to be used as the base class for all Realistic Dynamics, Inc.

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 operator. Future enhancements to rdObject might include thread functionality.

Version:
1.0
Author:
Frank C. Anderson


Constructor & Destructor Documentation

rdObject::rdObject const char *  aFileName  ) 
 

Construct an object from file.

The object is constructed from the root element of the XML document. The type of object is the tag name of the XML root element.

Parameters:
aFileName File name of the document.

rdObject::rdObject const rdXMLDocument 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.

rdObject::rdObject const rdObject &  aObject  ) 
 

Copy constructor.

Copy constructors for all rdObject's only copy the non-XML variable members of the object; that is, the object's IDOM_node and rdXMLDocument 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 rdObject:

1) Construction based on XML file (

See also:
rdObject(const char *aFileName)). In this case, the XML document is created by parsing the XML file.
2) Construction by rdObject(const rdXMLDocument *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 rdObject 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 rdObject member variable, are preserved.

3) A call to generateDocument(). This method generates an XML document for the rdObject from scratch. Only the essential document nodes are created (that is, nodes that correspond directly to member variables.).

Parameters:
aObject Object to be copied.
See also:
rdObject(const rdXMLDocument *aDocument)

rdObject(const char *aFileName)

generateDocument()


Member Function Documentation

void rdObject::generateNode IDOM_Element *  aParent  )  [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 must be from the same document as the parent. 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.S

Parameters:
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.

Reimplemented in rdGeneralizedForceAtv, rdLinearSetPoint, rdMuscleZajac, rdPolynomialSetPoint, rdSetPoint, rdControl, rdControlConstant, rdControlLinear, rdControlSet, rdActuator, rdActuatorSet, rdContactForce, rdContactForceSet, rdForce, rdGeneralizedForce, rdFunction, rdFunctionSet, rdGCVSpline, suSpringGeneralizedForce, suTrackJoint, suTrackObject, and suTrackObjectSet.

rdXMLDocument * rdObject::getDocument  )  const
 

Get the document for this object.

Returns:
Document set for this object.

IDOM_Element * rdObject::getNode  )  const
 

Get the node set for this object.

Returns:
Node set for this object.

rdObject & rdObject::operator= const rdObject &  aObject  ) 
 

Assign this object to the values of another.

Returns:
Reference to this object.

bool rdObject::operator== const rdObject &  aObject  )  [virtual]
 

Determine if two objects are equal.

Returns:
True if the two objects are equal, false otherwise.

void rdObject::print const char *  aFileName = NULL  ) 
 

Print the object.

Parameters:
aFileName File name. If the file name is NULL, which is the default, the object is printed to standard out.

void rdObject::updateNode bool  aDeep = true  )  [virtual]
 

Update the XML node that represents this object.

Parameters:
aDeep If true, update the XML node of this object AND the XML nodes of all class members that are rdObjects (child nodes); if false, update only the XML node of this object without updating the XML nodes of its children.

Reimplemented in rdGeneralizedForceAtv, rdLinearSetPoint, rdMuscleZajac, rdPolynomialSetPoint, rdSetPoint, rdControl, rdControlConstant, rdControlLinear, rdControlSet, rdActuator, rdActuatorSet, rdContactForce, rdContactForceSet, rdForce, rdGeneralizedForce, rdEdge, rdEdges, rdFunction, rdFunctionSet, rdGBodies, rdGBody, rdGCVSpline, rdGModel, rdObjectArray, rdPtrArray, rdTriangle, rdTriangles, rdV3D, rdValueArray< T >, rdVertices, suSpringGeneralizedForce, suTrackJoint, suTrackObject, and suTrackObjectSet.

void rdObject::updateObject bool  aDeep = true  )  [virtual]
 

Update this object based on its XML node.

Parameters:
aDeep If true, update this object and all its child objects (member variables that are rdObject's); if false, update only the member variables that are not rdObject's.

Reimplemented in rdGeneralizedForceAtv, rdLinearSetPoint, rdMuscleZajac, rdPolynomialSetPoint, rdSetPoint, rdControl, rdControlConstant, rdControlLinear, rdControlSet, rdActuator, rdActuatorSet, rdContactForce, rdContactForceSet, rdForce, rdGeneralizedForce, rdEdge, rdEdges, rdFunction, rdFunctionSet, rdGBodies, rdGBody, rdGCVSpline, rdGModel, rdObjectArray, rdPtrArray, rdTriangle, rdV3D, rdValueArray< T >, rdVertices, suSpringGeneralizedForce, suTrackJoint, suTrackObject, and suTrackObjectSet.


The documentation for this class was generated from the following files:
Generated on Wed Aug 20 02:17:12 2003 for Simulation Software by doxygen1.3