#include <BaseElement.h>


Definition at line 57 of file BaseElement.h.
Public Types | |
| typedef helper::Factory < std::string, BaseElement, std::pair < std::string, std::string > > | NodeFactory |
Public Member Functions | |
| BaseElement (const std::string &name, const std::string &type, BaseElement *newParent=NULL) | |
| virtual | ~BaseElement () |
| virtual const char * | getClass () const =0 |
| Get the node class (Scene, Mapping, ...). | |
| std::string | getName () |
| Get the associated object. | |
| virtual void | setName (const std::string &newName) |
| std::string | getType () |
| Get the node instance type (MassObject, IdentityMapping, ...). | |
| virtual void | setType (const std::string &newType) |
| sofa::core::objectmodel::BaseObjectDescription * | getParent () const |
| Get the parent node. | |
| BaseElement * | getParentElement () const |
| Get the parent node. | |
| std::string | getBaseFile () |
| Get the file where this description was read from. Useful to resolve relative file paths. | |
| virtual void | setBaseFile (const std::string &newBaseFile) |
| bool | isFileRoot () |
| Return true if this element was the root of the file. | |
| virtual void | setAttribute (const std::string &attr, const char *val) |
| Set an attribute. Override any existing value. | |
| virtual bool | removeAttribute (const std::string &attr) |
| Remove an attribute. Fails if this attribute is "name" or "type". | |
| virtual BaseElement * | findNode (const char *nodeName, bool absolute=false) |
| Find a node given its name. | |
| virtual BaseObjectDescription * | find (const char *nodeName, bool absolute=false) |
| Find a node given its name. | |
| template<class Sequence> | |
| void | pushObjects (Sequence &result) |
| Get all objects of a given type. | |
| template<class Map> | |
| void | pushNamedObjects (Map &result) |
| Get all objects of a given type. | |
| virtual bool | addChild (BaseElement *child) |
| virtual bool | removeChild (BaseElement *child) |
| virtual bool | initNode ()=0 |
| virtual bool | init () |
| template<class Node> | |
| child_iterator< Node > | begin () |
| child_iterator < BaseElement > | begin () |
| template<class Node> | |
| child_iterator< Node > | end () |
| child_iterator < BaseElement > | end () |
Static Public Member Functions | |
| static BaseElement * | Create (const std::string &nodeClass, const std::string &name, const std::string &type) |
Protected Member Functions | |
| virtual bool | setParent (BaseElement *newParent) |
| Change this node's parent. Note that this method is protected as it should be called by the parent's addChild/removeChild methods. | |
Private Types | |
| typedef std::list < BaseElement * > | ChildList |
Private Attributes | |
| std::string | basefile |
| BaseElement * | parent |
| ChildList | children |
Data Structures | |
| class | child_iterator |
typedef std::list<BaseElement*> sofa::simulation::tree::xml::BaseElement::ChildList [private] |
Definition at line 65 of file BaseElement.h.
| typedef helper::Factory< std::string, BaseElement, std::pair<std::string, std::string> > sofa::simulation::tree::xml::BaseElement::NodeFactory |
Definition at line 225 of file BaseElement.h.
| sofa::simulation::tree::xml::BaseElement::BaseElement | ( | const std::string & | name, | |
| const std::string & | type, | |||
| BaseElement * | newParent = NULL | |||
| ) |
| sofa::simulation::tree::xml::BaseElement::~BaseElement | ( | ) | [virtual] |
| virtual const char* sofa::simulation::tree::xml::BaseElement::getClass | ( | ) | const [pure virtual] |
Get the node class (Scene, Mapping, ...).
Implemented in sofa::simulation::tree::xml::AttributeElement, sofa::simulation::tree::xml::DataElement, sofa::simulation::tree::xml::NodeElement, and sofa::simulation::tree::xml::ObjectElement.
Referenced by sofa::simulation::tree::xml::createNode(), and sofa::simulation::tree::xml::dumpNode().
| std::string sofa::simulation::tree::xml::BaseElement::getName | ( | ) | [inline, virtual] |
Get the associated object.
Get the node instance name
Reimplemented from sofa::core::objectmodel::BaseObjectDescription.
Definition at line 79 of file BaseElement.h.
References sofa::core::objectmodel::BaseObjectDescription::attributes.
Referenced by sofa::simulation::tree::xml::createNode(), sofa::simulation::tree::xml::dumpNode(), sofa::simulation::tree::xml::ObjectElement::initNode(), sofa::simulation::tree::xml::Element< Object >::initNode(), and sofa::simulation::tree::xml::recReplaceAttribute().
| virtual void sofa::simulation::tree::xml::BaseElement::setName | ( | const std::string & | newName | ) | [inline, virtual] |
Definition at line 82 of file BaseElement.h.
References sofa::core::objectmodel::BaseObjectDescription::attributes.
Referenced by sofa::simulation::tree::xml::includeNode().
| std::string sofa::simulation::tree::xml::BaseElement::getType | ( | ) | [inline] |
Get the node instance type (MassObject, IdentityMapping, ...).
Definition at line 86 of file BaseElement.h.
References sofa::core::objectmodel::BaseObjectDescription::attributes.
Referenced by sofa::component::topology::create(), sofa::simulation::tree::xml::createNode(), sofa::simulation::tree::xml::createWith2Objects(), sofa::simulation::tree::xml::createWith2ObjectsAndFilename(), sofa::simulation::tree::xml::createWithFilename(), sofa::simulation::tree::xml::createWithParentAndFilename(), and sofa::simulation::tree::xml::dumpNode().
| virtual void sofa::simulation::tree::xml::BaseElement::setType | ( | const std::string & | newType | ) | [inline, virtual] |
Definition at line 89 of file BaseElement.h.
References sofa::core::objectmodel::BaseObjectDescription::attributes.
| sofa::core::objectmodel::BaseObjectDescription* sofa::simulation::tree::xml::BaseElement::getParent | ( | ) | const [inline, virtual] |
Get the parent node.
Reimplemented from sofa::core::objectmodel::BaseObjectDescription.
Definition at line 93 of file BaseElement.h.
References parent.
Referenced by addChild(), sofa::simulation::tree::xml::createWithParent(), sofa::simulation::tree::xml::createWithParentAndFilename(), sofa::simulation::tree::xml::ObjectElement::initNode(), and removeChild().
| BaseElement* sofa::simulation::tree::xml::BaseElement::getParentElement | ( | ) | const [inline] |
Get the parent node.
Definition at line 97 of file BaseElement.h.
References parent.
Referenced by addChild(), findNode(), getBaseFile(), sofa::simulation::tree::xml::NodeElement::initNode(), sofa::simulation::tree::xml::DataElement::initNode(), and sofa::simulation::tree::xml::AttributeElement::initNode().
| std::string sofa::simulation::tree::xml::BaseElement::getBaseFile | ( | ) | [virtual] |
Get the file where this description was read from. Useful to resolve relative file paths.
Reimplemented from sofa::core::objectmodel::BaseObjectDescription.
Definition at line 62 of file BaseElement.cpp.
References basefile, getBaseFile(), getParentElement(), and isFileRoot().
Referenced by getBaseFile().
| void sofa::simulation::tree::xml::BaseElement::setBaseFile | ( | const std::string & | newBaseFile | ) | [virtual] |
Definition at line 69 of file BaseElement.cpp.
References basefile.
Referenced by sofa::simulation::tree::xml::createNode().
| bool sofa::simulation::tree::xml::BaseElement::isFileRoot | ( | ) |
Return true if this element was the root of the file.
Definition at line 75 of file BaseElement.cpp.
References basefile.
Referenced by getBaseFile().
| void sofa::simulation::tree::xml::BaseElement::setAttribute | ( | const std::string & | attr, | |
| const char * | val | |||
| ) | [virtual] |
Set an attribute. Override any existing value.
Definition at line 91 of file BaseElement.cpp.
References sofa::core::objectmodel::BaseObjectDescription::attributes.
Referenced by sofa::simulation::tree::xml::createNode(), sofa::simulation::tree::xml::AttributeElement::initNode(), and sofa::simulation::tree::xml::recReplaceAttribute().
| bool sofa::simulation::tree::xml::BaseElement::removeAttribute | ( | const std::string & | attr | ) | [virtual] |
Remove an attribute. Fails if this attribute is "name" or "type".
Reimplemented from sofa::core::objectmodel::BaseObjectDescription.
Definition at line 97 of file BaseElement.cpp.
References sofa::core::objectmodel::BaseObjectDescription::attributes.
| BaseElement * sofa::simulation::tree::xml::BaseElement::findNode | ( | const char * | nodeName, | |
| bool | absolute = false | |||
| ) | [virtual] |
Find a node given its name.
Definition at line 157 of file BaseElement.cpp.
References begin(), end(), findNode(), and getParentElement().
Referenced by find(), and findNode().
| virtual BaseObjectDescription* sofa::simulation::tree::xml::BaseElement::find | ( | const char * | nodeName, | |
| bool | absolute = false | |||
| ) | [inline, virtual] |
Find a node given its name.
Reimplemented from sofa::core::objectmodel::BaseObjectDescription.
Definition at line 127 of file BaseElement.h.
References findNode().
| void sofa::simulation::tree::xml::BaseElement::pushObjects | ( | Sequence & | result | ) | [inline] |
Get all objects of a given type.
Definition at line 134 of file BaseElement.h.
References begin(), end(), and sofa::core::objectmodel::BaseObjectDescription::getObject().
| void sofa::simulation::tree::xml::BaseElement::pushNamedObjects | ( | Map & | result | ) | [inline] |
Get all objects of a given type.
Definition at line 145 of file BaseElement.h.
References begin(), end(), sofa::core::objectmodel::BaseObjectDescription::getFullName(), and sofa::core::objectmodel::BaseObjectDescription::getObject().
| virtual bool sofa::simulation::tree::xml::BaseElement::setParent | ( | BaseElement * | newParent | ) | [inline, protected, virtual] |
Change this node's parent. Note that this method is protected as it should be called by the parent's addChild/removeChild methods.
Reimplemented in sofa::simulation::tree::xml::NodeElement.
Definition at line 158 of file BaseElement.h.
References parent.
Referenced by addChild(), and removeChild().
| bool sofa::simulation::tree::xml::BaseElement::addChild | ( | BaseElement * | child | ) | [virtual] |
Definition at line 111 of file BaseElement.cpp.
References children, getParent(), getParentElement(), removeChild(), and setParent().
Referenced by BaseElement(), sofa::simulation::tree::xml::createNode(), and sofa::simulation::tree::xml::NodeElement::initNode().
| bool sofa::simulation::tree::xml::BaseElement::removeChild | ( | BaseElement * | child | ) | [virtual] |
Definition at line 124 of file BaseElement.cpp.
References children, getParent(), and setParent().
Referenced by addChild().
| virtual bool sofa::simulation::tree::xml::BaseElement::initNode | ( | ) | [pure virtual] |
Implemented in sofa::simulation::tree::xml::AttributeElement, sofa::simulation::tree::xml::DataElement, sofa::simulation::tree::xml::Element< Object >, sofa::simulation::tree::xml::NodeElement, sofa::simulation::tree::xml::ObjectElement, sofa::simulation::tree::xml::Element< sofa::core::objectmodel::BaseNode >, and sofa::simulation::tree::xml::Element< sofa::core::objectmodel::BaseObject >.
Referenced by init().
| bool sofa::simulation::tree::xml::BaseElement::init | ( | void | ) | [virtual] |
Reimplemented in sofa::simulation::tree::xml::AttributeElement, sofa::simulation::tree::xml::NodeElement, and sofa::simulation::tree::xml::ObjectElement.
Definition at line 140 of file BaseElement.cpp.
References basefile, begin(), end(), and initNode().
Referenced by sofa::simulation::tree::Simulation::load(), and sofa::gui::qt::RealGUI::loadObject().
| child_iterator<Node> sofa::simulation::tree::xml::BaseElement::begin | ( | ) | [inline] |
Definition at line 204 of file BaseElement.h.
References children.
Referenced by sofa::simulation::tree::xml::dumpNode(), findNode(), sofa::simulation::tree::xml::ObjectElement::init(), init(), sofa::simulation::tree::xml::AttributeElement::init(), pushNamedObjects(), pushObjects(), and sofa::simulation::tree::xml::recReplaceAttribute().
| child_iterator<BaseElement> sofa::simulation::tree::xml::BaseElement::begin | ( | ) | [inline] |
Definition at line 209 of file BaseElement.h.
| child_iterator<Node> sofa::simulation::tree::xml::BaseElement::end | ( | ) | [inline] |
Definition at line 215 of file BaseElement.h.
References children.
Referenced by sofa::simulation::tree::xml::dumpNode(), findNode(), sofa::simulation::tree::xml::ObjectElement::init(), init(), sofa::simulation::tree::xml::AttributeElement::init(), pushNamedObjects(), pushObjects(), and sofa::simulation::tree::xml::recReplaceAttribute().
| child_iterator<BaseElement> sofa::simulation::tree::xml::BaseElement::end | ( | ) | [inline] |
Definition at line 220 of file BaseElement.h.
| BaseElement * sofa::simulation::tree::xml::BaseElement::Create | ( | const std::string & | nodeClass, | |
| const std::string & | name, | |||
| const std::string & | type | |||
| ) | [static] |
Definition at line 151 of file BaseElement.cpp.
References sofa::helper::Factory< TKey, TObject, TArgument >::CreateObject().
Referenced by sofa::simulation::tree::xml::createNode().
std::string sofa::simulation::tree::xml::BaseElement::basefile [private] |
Definition at line 63 of file BaseElement.h.
Referenced by getBaseFile(), init(), isFileRoot(), and setBaseFile().
Definition at line 64 of file BaseElement.h.
Referenced by getParent(), getParentElement(), and setParent().
Definition at line 66 of file BaseElement.h.
Referenced by addChild(), begin(), sofa::simulation::tree::xml::BaseElement::child_iterator< Node >::checkIt(), end(), removeChild(), and ~BaseElement().
1.5.3