All Classes Namespaces Files Functions Variables Typedefs Friends Macros Modules
Public Member Functions | List of all members
sdf::Element Class Reference

SDF Element class. More...

#include <SDFImpl.hh>

Inheritance diagram for sdf::Element:
Inheritance graph
[legend]

Public Member Functions

 Element ()
 Constructor. More...
 
virtual ~Element ()
 Destructor. More...
 
void AddAttribute (const std::string &_key, const std::string &_type, const std::string &_defaultvalue, bool _required, const std::string &_description="")
 Add an attribute value. More...
 
ElementPtr AddElement (const std::string &_name)
 
void AddElementDescription (ElementPtr _elem)
 Add a new element description. More...
 
void AddValue (const std::string &_type, const std::string &_defaultValue, bool _required, const std::string &_description="")
 Add a value to this Element. More...
 
void ClearElements ()
 Remove all child elements. More...
 
ElementClone () const
 Create a copy of this Element. More...
 
void Copy (const ElementPtr _elem)
 Copy values from an Element. More...
 
template<typename T >
Get (const std::string &_key="")
 
ParamPtr GetAttribute (const std::string &_key)
 Get the param of an attribute. More...
 
ParamPtr GetAttribute (unsigned int _index) const
 Get an attribute using an index. More...
 
unsigned int GetAttributeCount () const
 Get the number of attributes. More...
 
bool GetAttributeSet (const std::string &_key)
 Return true if the attribute was set (i.e. not default value) More...
 
bool GetCopyChildren () const
 Return true if this Element's child elements should be copied during parsing. More...
 
std::string GetDescription () const
 Get a text description of the element. More...
 
ElementPtr GetElement (const std::string &_name) const
 
ElementPtr GetElement (const std::string &_name)
 
ElementPtr GetElementDescription (unsigned int _index) const
 Get an element description using an index. More...
 
ElementPtr GetElementDescription (const std::string &_key) const
 Get an element descriptio using a key. More...
 
unsigned int GetElementDescriptionCount () const
 Get the number of element descriptions. More...
 
ElementPtr GetElementImpl (const std::string &_name) const
 
ElementPtr GetFirstElement () const
 
std::string GetInclude () const
 
const std::string & GetName () const
 Get the Element's name. More...
 
ElementPtr GetNextElement (const std::string &_name="") const
 
ElementPtr GetParent () const
 Get a pointer to this Element's parent. More...
 
const std::string & GetRequired () const
 Get the requirement string. More...
 
ParamPtr GetValue ()
 Get the param of the elements value. More...
 
bool GetValueBool (const std::string &_key="") SDF_DEPRECATED(1.4)
 
char GetValueChar (const std::string &_key="") SDF_DEPRECATED(1.4)
 
sdf::Color GetValueColor (const std::string &_key="") SDF_DEPRECATED(1.4)
 
double GetValueDouble (const std::string &_key="") SDF_DEPRECATED(1.4)
 
float GetValueFloat (const std::string &_key="") SDF_DEPRECATED(1.4)
 
int GetValueInt (const std::string &_key="") SDF_DEPRECATED(1.4)
 
sdf::Pose GetValuePose (const std::string &_key="") SDF_DEPRECATED(1.4)
 
sdf::Quaternion GetValueQuaternion (const std::string &_key="") SDF_DEPRECATED(1.4)
 
std::string GetValueString (const std::string &_key="") SDF_DEPRECATED(1.4)
 
sdf::Time GetValueTime (const std::string &_key="") SDF_DEPRECATED(1.4)
 
unsigned int GetValueUInt (const std::string &_key="") SDF_DEPRECATED(1.4)
 
sdf::Vector2d GetValueVector2d (const std::string &_key="") SDF_DEPRECATED(1.4)
 
sdf::Vector3 GetValueVector3 (const std::string &_key="") SDF_DEPRECATED(1.4)
 
bool HasAttribute (const std::string &_key)
 
bool HasElement (const std::string &_name) const
 
bool HasElementDescription (const std::string &_name)
 Return true if an element description exists. More...
 
void InsertElement (ElementPtr _elem)
 
void PrintDescription (const std::string &_prefix)
 Output Element's description to stdout. More...
 
void PrintDocLeftPane (std::string &_html, int _spacing, int &_index)
 Helper function for SDF::PrintDoc. More...
 
void PrintDocRightPane (std::string &_html, int _spacing, int &_index)
 Helper function for SDF::PrintDoc. More...
 
void PrintValues (std::string _prefix)
 Output Element's values to stdout. More...
 
void PrintWiki (std::string _prefix)
 
void RemoveChild (ElementPtr _child)
 Remove a child element. More...
 
void RemoveFromParent ()
 Remove this element from its parent. More...
 
void Reset ()
 
template<typename T >
bool Set (const T &_value)
 
void SetCopyChildren (bool _value)
 Set whether this element should copy its child elements during parsing. More...
 
void SetDescription (const std::string &_desc)
 Set a text description for the element. More...
 
void SetInclude (const std::string &_filename)
 
void SetName (const std::string &_name)
 Set the name of the Element. More...
 
void SetParent (const ElementPtr _parent)
 Set the parent of this Element. More...
 
void SetRequired (const std::string &_req)
 Set the requirement type. More...
 
std::string ToString (const std::string &_prefix) const
 Convert the element values to a string representation. More...
 
void Update ()
 

Detailed Description

SDF Element class.

Constructor & Destructor Documentation

sdf::Element::Element ( )

Constructor.

virtual sdf::Element::~Element ( )
virtual

Destructor.

Member Function Documentation

void sdf::Element::AddAttribute ( const std::string &  _key,
const std::string &  _type,
const std::string &  _defaultvalue,
bool  _required,
const std::string &  _description = "" 
)

Add an attribute value.

Parameters
[in]_keyKey value.
[in]_typeType of data the attribute will hold.
[in]_defaultValueDefault value for the attribute.
[in]_requiredRequirement string. Element::SetRequired.
[in]_descriptionA text description of the attribute.
ElementPtr sdf::Element::AddElement ( const std::string &  _name)
void sdf::Element::AddElementDescription ( ElementPtr  _elem)

Add a new element description.

void sdf::Element::AddValue ( const std::string &  _type,
const std::string &  _defaultValue,
bool  _required,
const std::string &  _description = "" 
)

Add a value to this Element.

Parameters
[in]_typeType of data the attribute will hold.
[in]_defaultValueDefault value for the attribute.
[in]_requiredRequirement string. Element::SetRequired.
[in]_descriptionA text description of the attribute.
void sdf::Element::ClearElements ( )

Remove all child elements.

Element* sdf::Element::Clone ( ) const

Create a copy of this Element.

Returns
A copy of this Element.
void sdf::Element::Copy ( const ElementPtr  _elem)

Copy values from an Element.

Parameters
[in]_elemElement to copy value from.
template<typename T >
T sdf::Element::Get ( const std::string &  _key = "")
inline

References sdf::Param::Get(), Get(), and sdferr.

Referenced by Get().

ParamPtr sdf::Element::GetAttribute ( const std::string &  _key)

Get the param of an attribute.

Parameters
[in]_keythe name of the attribute
Returns
The parameter attribute value. NULL if the key is invalid.
ParamPtr sdf::Element::GetAttribute ( unsigned int  _index) const

Get an attribute using an index.

unsigned int sdf::Element::GetAttributeCount ( ) const

Get the number of attributes.

bool sdf::Element::GetAttributeSet ( const std::string &  _key)

Return true if the attribute was set (i.e. not default value)

bool sdf::Element::GetCopyChildren ( ) const

Return true if this Element's child elements should be copied during parsing.

Returns
True to copy child elements during parsing.
std::string sdf::Element::GetDescription ( ) const

Get a text description of the element.

ElementPtr sdf::Element::GetElement ( const std::string &  _name) const
ElementPtr sdf::Element::GetElement ( const std::string &  _name)
ElementPtr sdf::Element::GetElementDescription ( unsigned int  _index) const

Get an element description using an index.

ElementPtr sdf::Element::GetElementDescription ( const std::string &  _key) const

Get an element descriptio using a key.

unsigned int sdf::Element::GetElementDescriptionCount ( ) const

Get the number of element descriptions.

ElementPtr sdf::Element::GetElementImpl ( const std::string &  _name) const
ElementPtr sdf::Element::GetFirstElement ( ) const
std::string sdf::Element::GetInclude ( ) const
const std::string& sdf::Element::GetName ( ) const

Get the Element's name.

Returns
The name of this Element.
ElementPtr sdf::Element::GetNextElement ( const std::string &  _name = "") const
ElementPtr sdf::Element::GetParent ( ) const

Get a pointer to this Element's parent.

Returns
Pointer to this Element's parent, NULL if there is no parent.
const std::string& sdf::Element::GetRequired ( ) const

Get the requirement string.

Returns
The requirement string.
See also
Element::SetRequired
ParamPtr sdf::Element::GetValue ( )

Get the param of the elements value.

bool sdf::Element::GetValueBool ( const std::string &  _key = "")
char sdf::Element::GetValueChar ( const std::string &  _key = "")
sdf::Color sdf::Element::GetValueColor ( const std::string &  _key = "")
double sdf::Element::GetValueDouble ( const std::string &  _key = "")
float sdf::Element::GetValueFloat ( const std::string &  _key = "")
int sdf::Element::GetValueInt ( const std::string &  _key = "")
sdf::Pose sdf::Element::GetValuePose ( const std::string &  _key = "")
sdf::Quaternion sdf::Element::GetValueQuaternion ( const std::string &  _key = "")
std::string sdf::Element::GetValueString ( const std::string &  _key = "")
sdf::Time sdf::Element::GetValueTime ( const std::string &  _key = "")
unsigned int sdf::Element::GetValueUInt ( const std::string &  _key = "")
sdf::Vector2d sdf::Element::GetValueVector2d ( const std::string &  _key = "")
sdf::Vector3 sdf::Element::GetValueVector3 ( const std::string &  _key = "")
bool sdf::Element::HasAttribute ( const std::string &  _key)
bool sdf::Element::HasElement ( const std::string &  _name) const
bool sdf::Element::HasElementDescription ( const std::string &  _name)

Return true if an element description exists.

void sdf::Element::InsertElement ( ElementPtr  _elem)
void sdf::Element::PrintDescription ( const std::string &  _prefix)

Output Element's description to stdout.

Parameters
[in]_prefixString value to prefix to the output.
void sdf::Element::PrintDocLeftPane ( std::string &  _html,
int  _spacing,
int &  _index 
)

Helper function for SDF::PrintDoc.

This generates the SDF html documentation.

Parameters
[out]_htmlAccumulated HTML for output.
[in]_spacingAmount of spacing for this element.
[in]_indexUnique index for this element.
void sdf::Element::PrintDocRightPane ( std::string &  _html,
int  _spacing,
int &  _index 
)

Helper function for SDF::PrintDoc.

This generates the SDF html documentation.

Parameters
[out]_htmlAccumulated HTML for output
[in]_spacingAmount of spacing for this element.
void sdf::Element::PrintValues ( std::string  _prefix)

Output Element's values to stdout.

Parameters
[in]_prefixString value to prefix to the output.
void sdf::Element::PrintWiki ( std::string  _prefix)
void sdf::Element::RemoveChild ( ElementPtr  _child)

Remove a child element.

Parameters
[in]_childPointer to the child to remove.
void sdf::Element::RemoveFromParent ( )

Remove this element from its parent.

void sdf::Element::Reset ( )
template<typename T >
bool sdf::Element::Set ( const T &  _value)
inline
void sdf::Element::SetCopyChildren ( bool  _value)

Set whether this element should copy its child elements during parsing.

Parameters
[in]_valueTrue to copy Element's children.
void sdf::Element::SetDescription ( const std::string &  _desc)

Set a text description for the element.

void sdf::Element::SetInclude ( const std::string &  _filename)
void sdf::Element::SetName ( const std::string &  _name)

Set the name of the Element.

Parameters
[in]_nameThe new name for this Element.
void sdf::Element::SetParent ( const ElementPtr  _parent)

Set the parent of this Element.

Parameters
[in]_parentParen for this element.
void sdf::Element::SetRequired ( const std::string &  _req)

Set the requirement type.

Parameters
[in]_reqRequirement type for this element: 0: Not required 1: Exactly one element is required +: One or more elements are required *: Zero or more elements are required.
std::string sdf::Element::ToString ( const std::string &  _prefix) const

Convert the element values to a string representation.

Parameters
[in]_prefixString value to prefix to the output.
Returns
The string representation.
void sdf::Element::Update ( )

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