#include <BaseObjectDescription.h>
Base Interface for classes containing the description of an object, used to construct it. More...
Base Interface for classes containing the description of an object, used to construct it.
This class defines what informations are used as input (read from a file for instance) to create an object. This default implementation simply stores an attributes map and does not support any hierarchy.
Classes | |
class | Attribute |
Protected Attributes | |
AttributeMap | attributes |
std::vector< std::string > | errors |
Public Member Functions | |
BaseObjectDescription (const char *name=nullptr, const char *type=nullptr) | |
virtual | ~BaseObjectDescription () |
virtual Base * | getObject () |
Get the associated object (or nullptr if it is not created yet) More... | |
virtual std::string | getName () |
Get the object instance name. More... | |
virtual void | setName (const std::string &name) |
Set the object instance name. More... | |
virtual BaseObjectDescription * | getParent () const |
Get the parent node. More... | |
virtual std::string | getBaseFile () |
Get the file where this description was read from. Useful to resolve relative file paths. More... | |
virtual const AttributeMap & | getAttributeMap () const |
template<class T > | |
void | getAttributeList (T &container) const |
virtual BaseObjectDescription * | find (const char *nodeName, bool absolute=false) |
Find an object description given its name (relative to this object) More... | |
virtual Base * | findObject (const char *nodeName) |
Find an object given its name (relative to this object) More... | |
virtual const char * | getAttribute (const std::string &attr, const char *defaultVal=nullptr) |
Get an attribute given its name (return defaultVal if not present) More... | |
virtual float | getAttributeAsFloat (const std::string &attr, const float defaultVal=0.0) |
Docs is in .h. More... | |
virtual int | getAttributeAsInt (const std::string &attr, const int defaultVal=0.0) |
Docs is in .h. More... | |
virtual void | setAttribute (const std::string &attr, const std::string &val) |
Set an attribute. Override any existing value. More... | |
virtual bool | removeAttribute (const std::string &attr) |
Remove an attribute given its name. More... | |
virtual std::string | getFullName () |
Get the full name of this object (i.e. concatenation if all the names of its ancestors and itself) More... | |
virtual void | logError (const std::string &s) |
virtual void | logErrors (const std::vector< std::string > &e) |
std::vector< std::string > const & | getErrors () const |
virtual void | clearErrors () |
|
protected |
|
protected |
sofa::core::objectmodel::BaseObjectDescription::BaseObjectDescription | ( | const char * | name = nullptr , |
const char * | type = nullptr |
||
) |
|
virtual |
|
inlinevirtual |
|
virtual |
Find an object description given its name (relative to this object)
Reimplemented in sofa::simulation::xml::BaseElement.
Find an object given its name (relative to this object)
Find an object given its name.
|
virtual |
Get an attribute given its name (return defaultVal if not present)
|
virtual |
Docs is in .h.
Get an attribute converted to a float given its name. returns defaultVal if not present or in case the attribute cannot be parsed totally adds a message in the logError if the attribute cannot be totally parsed.
|
virtual |
Docs is in .h.
Get an attribute converted to a int given its name. returns defaultVal if not present or in case the attribute cannot be parsed totally adds a message in the logError if the attribute cannot be totally parsed.
|
inline |
|
virtual |
|
virtual |
Get the file where this description was read from. Useful to resolve relative file paths.
Reimplemented in sofa::simulation::xml::BaseElement.
|
inline |
|
virtual |
Get the full name of this object (i.e. concatenation if all the names of its ancestors and itself)
|
virtual |
Get the object instance name.
Reimplemented in sofa::simulation::xml::BaseElement.
|
virtual |
Get the associated object (or nullptr if it is not created yet)
Reimplemented in sofa::simulation::xml::BaseElement, sofa::simulation::xml::Element< Object >, sofa::simulation::xml::Element< sofa::core::objectmodel::BaseNode >, sofa::simulation::xml::Element< core::objectmodel::BaseObject >, and sofa::simulation::xml::Element< sofa::core::objectmodel::BaseObject >.
|
virtual |
Get the parent node.
Reimplemented in sofa::simulation::xml::BaseElement.
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
Remove an attribute given its name.
Remove an attribute given its name, returns false if the attribute was not there.
Reimplemented in sofa::simulation::xml::BaseElement.
|
virtual |
Set an attribute. Override any existing value.
|
virtual |
Set the object instance name.
Reimplemented in sofa::simulation::xml::BaseElement.