API  4.5.1
For C++ developers
OpenSim::XMLDocument Class Reference
+ Inheritance diagram for OpenSim::XMLDocument:

Public Member Functions

virtual ~XMLDocument ()
 
 XMLDocument ()
 
 XMLDocument (const std::string &aFileName)
 
 XMLDocument (const XMLDocument &aDocument)
 
void copyDefaultObjects (const XMLDocument &aDocument)
 
void writeDefaultObjects (SimTK::Xml::Element &elmt)
 
const int & getDocumentVersion () const
 
SimTK::Xml::Element getRootDataElement ()
 
bool isEqualTo (XMLDocument &aOtherDocument, double toleranceForDoubles=1e-6, bool compareDefaults=false, bool compareVersionNumbers=false)
 
void setFileName (const std::string &aFileName)
 
const std::string & getFileName () const
 
void addDefaultObject (OpenSim::Object *aDefaultObject)
 
bool hasDefaultObjects () const
 
bool print (const std::string &aFileName={})
 If the filename is empty, the file is printed to cout. More...
 

Static Public Member Functions

static const int & getLatestVersion ()
 
static void renameChildNode (SimTK::Xml::Element &aNode, std::string oldElementName, std::string newElementName)
 
static void getVersionAsString (const int aVersion, std::string &aString)
 
static void addConnector (SimTK::Xml::Element &element, const std::string &connectorTag, const std::string &connectorName, const std::string &connectorValue)
 This adds an XML element to element of the following form: More...
 
static void updateConnectors30508 (SimTK::Xml::Element &componentElt)
 In version 30508, the XML syntax for Connectors changed: Previous: More...
 
static void addPhysicalOffsetFrame30505_30517 (SimTK::Xml::Element &element, const std::string &frameName, const std::string &parentFrameName, const SimTK::Vec3 &location, const SimTK::Vec3 &orientation)
 
static std::string updateConnecteePath30517 (const std::string &connecteeSetName, const std::string &connecteeName)
 Convert component names into the appropriate paths based on where we know components were located in version 30000 model files. More...
 
static SimTK::Xml::Element findElementWithName (SimTK::Xml::Element &element, const std::string &name)
 Find the first XML Element (depth-first search) with the provided name, anywhere in the XML document that contains element. More...
 

Static Public Attributes

static const int LatestVersion
 Latest version of the code encoded as an int xxyyzz where x: major release, y: minor, z: patch. More...
 

Constructor & Destructor Documentation

◆ ~XMLDocument()

virtual OpenSim::XMLDocument::~XMLDocument ( )
virtual

◆ XMLDocument() [1/3]

OpenSim::XMLDocument::XMLDocument ( )

◆ XMLDocument() [2/3]

OpenSim::XMLDocument::XMLDocument ( const std::string &  aFileName)

◆ XMLDocument() [3/3]

OpenSim::XMLDocument::XMLDocument ( const XMLDocument aDocument)

Member Function Documentation

◆ addConnector()

static void OpenSim::XMLDocument::addConnector ( SimTK::Xml::Element &  element,
const std::string &  connectorTag,
const std::string &  connectorName,
const std::string &  connectorValue 
)
static

This adds an XML element to element of the following form:

<Connector_PhysicalFrame_ name="parent_frame">
<connectee_name>...</connectee_name>
</Connector_PhysicalFrame_>

This syntax was revised in XML document version 30508; see updateConnectors30508(). As such, this function should not be used for updating versions 30508 or greater.

◆ addDefaultObject()

void OpenSim::XMLDocument::addDefaultObject ( OpenSim::Object aDefaultObject)

◆ addPhysicalOffsetFrame30505_30517()

static void OpenSim::XMLDocument::addPhysicalOffsetFrame30505_30517 ( SimTK::Xml::Element &  element,
const std::string &  frameName,
const std::string &  parentFrameName,
const SimTK::Vec3 &  location,
const SimTK::Vec3 &  orientation 
)
static

◆ copyDefaultObjects()

void OpenSim::XMLDocument::copyDefaultObjects ( const XMLDocument aDocument)

◆ findElementWithName()

static SimTK::Xml::Element OpenSim::XMLDocument::findElementWithName ( SimTK::Xml::Element &  element,
const std::string &  name 
)
static

Find the first XML Element (depth-first search) with the provided name, anywhere in the XML document that contains element.

If the XML document does not contain an element with name name, or if name is empty, then the returned Xml::Element is empty (Xml::Element::isValid() returns false).

◆ getDocumentVersion()

const int& OpenSim::XMLDocument::getDocumentVersion ( ) const
inline

◆ getFileName()

const std::string& OpenSim::XMLDocument::getFileName ( ) const

◆ getLatestVersion()

static const int& OpenSim::XMLDocument::getLatestVersion ( )
inlinestatic

◆ getRootDataElement()

SimTK::Xml::Element OpenSim::XMLDocument::getRootDataElement ( )

◆ getVersionAsString()

static void OpenSim::XMLDocument::getVersionAsString ( const int  aVersion,
std::string &  aString 
)
static

◆ hasDefaultObjects()

bool OpenSim::XMLDocument::hasDefaultObjects ( ) const
inline

◆ isEqualTo()

bool OpenSim::XMLDocument::isEqualTo ( XMLDocument aOtherDocument,
double  toleranceForDoubles = 1e-6,
bool  compareDefaults = false,
bool  compareVersionNumbers = false 
)

◆ print()

bool OpenSim::XMLDocument::print ( const std::string &  aFileName = {})

If the filename is empty, the file is printed to cout.

◆ renameChildNode()

static void OpenSim::XMLDocument::renameChildNode ( SimTK::Xml::Element &  aNode,
std::string  oldElementName,
std::string  newElementName 
)
static

◆ setFileName()

void OpenSim::XMLDocument::setFileName ( const std::string &  aFileName)

◆ updateConnecteePath30517()

static std::string OpenSim::XMLDocument::updateConnecteePath30517 ( const std::string &  connecteeSetName,
const std::string &  connecteeName 
)
static

Convert component names into the appropriate paths based on where we know components were located in version 30000 model files.

Parameters
connecteeSetName"bodyset", "jointset", etc.
connecteeNameThe name of the connectee from the version 30000 file. Note: It is okay for connecteePath to be a reference to connecteeName.

◆ updateConnectors30508()

static void OpenSim::XMLDocument::updateConnectors30508 ( SimTK::Xml::Element &  componentElt)
static

In version 30508, the XML syntax for Connectors changed: Previous:

<connectors>
<Connector_PhysicalFrame_ name="parent_frame">
<connectee_name>...</connectee_name>
</Connector_PhysicalFrame_>
<Connector_PhysicalFrame_ name="child_frame">
<connectee_name>...</connectee_name>
</Connector_PhysicalFrame_>
</connectors>

New:

<connector_parent_frame_connectee_name>...
</connector_parent_frame_connectee_name>
<connector_child_frame_connectee_name>...
</connector_child_frame_connectee_name>

If there is no <connectors> element, then this function does not edit componentElt.

◆ writeDefaultObjects()

void OpenSim::XMLDocument::writeDefaultObjects ( SimTK::Xml::Element &  elmt)

Member Data Documentation

◆ LatestVersion

const int OpenSim::XMLDocument::LatestVersion
static

Latest version of the code encoded as an int xxyyzz where x: major release, y: minor, z: patch.


The documentation for this class was generated from the following file: