sofa::simulation::tree::GNode Class Reference

Define the structure of the scene. More...

#include <GNode.h>

Inheritance diagram for sofa::simulation::tree::GNode:

Inheritance graph
[legend]
Collaboration diagram for sofa::simulation::tree::GNode:

Collaboration graph
[legend]

Public Types

typedef Sequence< GNode >::iterator ChildIterator

Public Member Functions

 GNode (const std::string &name="", GNode *parent=NULL)
virtual ~GNode ()
void reinit ()
 Update the parameters of the System.
virtual void addChild (GNode *node)
 Add a child node.
virtual void removeChild (GNode *node)
 Remove a child.
virtual void addChild (BaseNode *node)
 Add a child node.
virtual void removeChild (BaseNode *node)
 Remove a child node.
virtual void moveChild (GNode *obj)
 Move a node from another node.
virtual void initVisualContext ()
 Called during initialization to corectly propagate the visual context to the children.
virtual void updateContext ()
 Update the whole context values, based on parent and local ContextObjects.
virtual void updateVisualContext (int FILTER=0)
 Update the visual context values, based on parent and local ContextObjects.
virtual void updateSimulationContext ()
 Update the simulation context values(gravity, time...), based on parent and local ContextObjects.
void addTime (ctime_t t, const std::string &s, core::objectmodel::BaseObject *obj)
 Log time spent on an action category and the concerned object.
ctime_t endTime (ctime_t t0, const std::string &s, core::objectmodel::BaseObject *obj)
 Log time spent given a start time, an action category, and the concerned object.
void addTime (ctime_t t, const std::string &s, core::objectmodel::BaseObject *obj, core::objectmodel::BaseObject *parent)
 Log time spent on an action category, and the concerned object, plus remove the computed time from the parent caller object.
ctime_t endTime (ctime_t t0, const std::string &s, core::objectmodel::BaseObject *obj, core::objectmodel::BaseObject *parent)
 Log time spent given a start time, an action category, and the concerned object, plus remove the computed time from the parent caller object.
std::string getPathName () const
 Return the full path name of this node.
virtual void * getObject (const sofa::core::objectmodel::ClassInfo &class_info, SearchDirection dir=SearchUp) const
 Generic object access, possibly searching up or down from the current context.
virtual void * getObject (const sofa::core::objectmodel::ClassInfo &class_info, const std::string &path) const
 Generic object access, given a path from the current context.
virtual void getObjects (const sofa::core::objectmodel::ClassInfo &class_info, GetObjectsCallBack &container, SearchDirection dir=SearchUp) const
 Generic list of objects access, possibly searching up or down from the current context.
void addListener (MutationListener *obj)
void removeListener (MutationListener *obj)
Visitors and graph traversal
core::objectmodel::BaseNode * getParent ()
 Execute a recursive action starting from this node.
const core::objectmodel::BaseNode * getParent () const
 Get parent node (or NULL if no hierarchy or for root node).
sofa::helper::vector
< core::objectmodel::BaseNode * > 
getChildren ()
 Get parent node (or NULL if no hierarchy or for root node).
const sofa::helper::vector
< core::objectmodel::BaseNode * > 
getChildren () const
 Get parent node (or NULL if no hierarchy or for root node).
GNode * getChild (const std::string &name) const
 Find a child node given its name.
GNode * getTreeNode (const std::string &name) const
 Get a descendant node given its name.
Components
virtual bool addObject (core::objectmodel::BaseObject *obj)
 Add an object and return this. Detect the implemented interfaces and add the object to the corresponding lists.
virtual bool removeObject (core::objectmodel::BaseObject *obj)
 Remove an object.
virtual void moveObject (core::objectmodel::BaseObject *obj)
 Import an object.
virtual
core::objectmodel::BaseObject * 
getMechanicalState () const
 Mechanical Degrees-of-Freedom.
virtual
core::componentmodel::topology::Topology * 
getTopology () const
 Topology.
virtual
core::componentmodel::topology::BaseMeshTopology * 
getMeshTopology () const
 Mesh Topology (unified interface for both static and dynamic topologies).
virtual
core::objectmodel::BaseObject * 
getShader () const
 Shader.
const BaseContext * getContext () const
 Get this node context.
BaseContext * getContext ()
 Get this node context.

Static Public Member Functions

static void create (GNode *&obj, xml::Element< core::objectmodel::BaseNode > *arg)

Data Fields

Single< GNode > parent
Sequence< GNode > child

Protected Member Functions

virtual void doAddChild (GNode *node)
 Add a child node.
void doRemoveChild (GNode *node)
 Remove a child.
void notifyAddChild (GNode *node)
void notifyRemoveChild (GNode *node)
void notifyMoveChild (GNode *node, GNode *prev)
void doExecuteVisitor (simulation::Visitor *action)
 Execute a recursive action starting from this node.
void notifyAddObject (core::objectmodel::BaseObject *obj)
void notifyRemoveObject (core::objectmodel::BaseObject *obj)
void notifyMoveObject (core::objectmodel::BaseObject *obj, GNode *prev)

Protected Attributes

Sequence< MutationListener > listener

Friends

class simulation::VisitorScheduler

Detailed Description

Define the structure of the scene.

Contains (as pointer lists) Component objects and children GNode objects.

Definition at line 55 of file GNode.h.


Member Typedef Documentation

Definition at line 194 of file GNode.h.


Constructor & Destructor Documentation

sofa::simulation::tree::GNode::GNode ( const std::string &  name = "",
GNode *  parent = NULL 
)

Definition at line 46 of file GNode.cpp.

References addChild().

Referenced by create().

sofa::simulation::tree::GNode::~GNode (  )  [virtual]

Definition at line 53 of file GNode.cpp.


Member Function Documentation

void sofa::simulation::tree::GNode::addChild ( BaseNode *  node  )  [virtual]

Add a child node.

Implements sofa::core::objectmodel::BaseNode.

Definition at line 85 of file GNode.cpp.

References addChild().

void sofa::simulation::tree::GNode::addChild ( GNode *  node  )  [virtual]

void sofa::simulation::tree::GNode::addListener ( MutationListener *  obj  ) 

Definition at line 597 of file GNode.cpp.

References listener.

Referenced by sofa::simulation::tree::MutationListener::addChild().

virtual bool sofa::simulation::tree::GNode::addObject ( core::objectmodel::BaseObject *  obj  )  [inline, virtual]

Add an object and return this. Detect the implemented interfaces and add the object to the corresponding lists.

Implements sofa::core::objectmodel::BaseNode.

Definition at line 113 of file GNode.h.

Referenced by sofa::component::container::ArticulatedHierarchyContainer::buildCenterArticulationsTree(), sofa::filemanager::pml::PMLReader::BuildStructure(), sofa::filemanager::pml::PMLStiffSpringForceField::createCollisionModel(), sofa::filemanager::pml::PMLRigidBody::createCollisionModel(), sofa::filemanager::pml::PMLFemForceField::createCollisionModel(), sofa::filemanager::pml::PMLStiffSpringForceField::createForceField(), sofa::filemanager::pml::PMLInteractionForceField::createForceField(), sofa::filemanager::pml::PMLFemForceField::createForceField(), sofa::component::collision::SubsetContactMapper< TCollisionModel, DataTypes >::createMapping(), sofa::component::collision::RigidContactMapper< TCollisionModel, DataTypes >::createMapping(), sofa::component::collision::IdentityContactMapper< TCollisionModel, DataTypes >::createMapping(), sofa::component::collision::BarycentricContactMapper< TCollisionModel, DataTypes >::createMapping(), sofa::filemanager::pml::PMLStiffSpringForceField::createMass(), sofa::filemanager::pml::PMLRigidBody::createMass(), sofa::filemanager::pml::PMLFemForceField::createMass(), sofa::filemanager::pml::PMLStiffSpringForceField::createMechanicalState(), sofa::filemanager::pml::PMLRigidBody::createMechanicalState(), sofa::filemanager::pml::PMLMappedBody::createMechanicalState(), sofa::filemanager::pml::PMLFemForceField::createMechanicalState(), sofa::filemanager::pml::PMLBody::createSolver(), sofa::filemanager::pml::PMLStiffSpringForceField::createTopology(), sofa::filemanager::pml::PMLFemForceField::createTopology(), sofa::filemanager::pml::PMLStiffSpringForceField::createVisualModel(), sofa::filemanager::pml::PMLRigidBody::createVisualModel(), sofa::filemanager::pml::PMLFemForceField::createVisualModel(), sofa::filemanager::pml::PMLStiffSpringForceField::FusionBody(), sofa::filemanager::pml::PMLFemForceField::FusionBody(), sofa::component::collision::DefaultPickingManager< TDataTypes, ContactForceField >::getMState(), SofaFlowVR::FlowVRInputMesh::init(), main(), sofa::gui::qt::viewer::SofaViewer::mouseEvent(), sofa::gui::glut::SimpleGUI::mouseEvent(), sofa::simulation::tree::ParallelVisitorScheduler::recursiveClone(), and sofa::filemanager::pml::LMLReader::updateStructure().

void sofa::simulation::tree::GNode::addTime ( ctime_t  t,
const std::string &  s,
core::objectmodel::BaseObject *  obj,
core::objectmodel::BaseObject *  parent 
) [virtual]

Log time spent on an action category, and the concerned object, plus remove the computed time from the parent caller object.

Reimplemented from sofa::simulation::Node.

Definition at line 561 of file GNode.cpp.

References sofa::simulation::Node::ObjectTimer::nVisit, sofa::simulation::Node::objectTime, and sofa::simulation::Node::ObjectTimer::tObject.

void sofa::simulation::tree::GNode::addTime ( ctime_t  t,
const std::string &  s,
core::objectmodel::BaseObject *  obj 
) [virtual]

Log time spent on an action category and the concerned object.

Reimplemented from sofa::simulation::Node.

Definition at line 580 of file GNode.cpp.

References sofa::simulation::Node::ObjectTimer::nVisit, sofa::simulation::Node::objectTime, and sofa::simulation::Node::ObjectTimer::tObject.

Referenced by endTime().

static void sofa::simulation::tree::GNode::create ( GNode *&  obj,
xml::Element< core::objectmodel::BaseNode > *  arg 
) [inline, static]

Definition at line 198 of file GNode.h.

References GNode(), and sofa::core::objectmodel::Base::parse().

void sofa::simulation::tree::GNode::doAddChild ( GNode *  node  )  [protected, virtual]

Add a child node.

Definition at line 57 of file GNode.cpp.

References child, and parent.

Referenced by addChild(), and moveChild().

void sofa::simulation::tree::GNode::doExecuteVisitor ( simulation::Visitor *  action  )  [protected, virtual]

void sofa::simulation::tree::GNode::doRemoveChild ( GNode *  node  )  [protected]

Remove a child.

Definition at line 64 of file GNode.cpp.

References child, and parent.

Referenced by moveChild(), and removeChild().

GNode::ctime_t sofa::simulation::tree::GNode::endTime ( ctime_t  t0,
const std::string &  s,
core::objectmodel::BaseObject *  obj,
core::objectmodel::BaseObject *  parent 
) [virtual]

Log time spent given a start time, an action category, and the concerned object, plus remove the computed time from the parent caller object.

Log time spent given a start time, an action category, and the concerned object.

Reimplemented from sofa::simulation::Node.

Definition at line 570 of file GNode.cpp.

References addTime(), sofa::simulation::Node::getLogTime(), and sofa::core::objectmodel::Context::getTime().

GNode::ctime_t sofa::simulation::tree::GNode::endTime ( ctime_t  t0,
const std::string &  s,
core::objectmodel::BaseObject *  obj 
) [virtual]

GNode * sofa::simulation::tree::GNode::getChild ( const std::string &  name  )  const

Find a child node given its name.

Definition at line 365 of file GNode.cpp.

References child.

Referenced by getObject(), getTreeNode(), and main().

const sofa::helper::vector< core::objectmodel::BaseNode * > sofa::simulation::tree::GNode::getChildren ( void   )  const [virtual]

Get parent node (or NULL if no hierarchy or for root node).

Implements sofa::core::objectmodel::BaseNode.

Definition at line 299 of file GNode.cpp.

References child.

sofa::helper::vector< core::objectmodel::BaseNode * > sofa::simulation::tree::GNode::getChildren ( void   )  [virtual]

Get parent node (or NULL if no hierarchy or for root node).

Implements sofa::core::objectmodel::BaseNode.

Definition at line 288 of file GNode.cpp.

References child.

BaseContext* sofa::simulation::tree::GNode::getContext (  )  [inline, virtual]

Get this node context.

Implements sofa::core::objectmodel::BaseNode.

Definition at line 134 of file GNode.h.

References getContext().

const BaseContext* sofa::simulation::tree::GNode::getContext (  )  const [inline, virtual]

core::objectmodel::BaseObject * sofa::simulation::tree::GNode::getMechanicalState ( void   )  const [virtual]

Mechanical Degrees-of-Freedom.

Reimplemented from sofa::simulation::Node.

Definition at line 447 of file GNode.cpp.

References sofa::simulation::Node::mechanicalState, and parent.

Referenced by sofa::component::container::ArticulatedHierarchyContainer::init().

core::componentmodel::topology::BaseMeshTopology * sofa::simulation::tree::GNode::getMeshTopology (  )  const [virtual]

Mesh Topology (unified interface for both static and dynamic topologies).

Reimplemented from sofa::simulation::Node.

Definition at line 425 of file GNode.cpp.

References sofa::simulation::Node::meshTopology, and parent.

void * sofa::simulation::tree::GNode::getObject ( const sofa::core::objectmodel::ClassInfo &  class_info,
const std::string &  path 
) const [virtual]

Generic object access, given a path from the current context.

Note that the template wrapper method should generally be used to have the correct return type,

Note that the template wrapper method should generally be used to have the correct return type,

Reimplemented from sofa::core::objectmodel::BaseContext.

Definition at line 157 of file GNode.cpp.

References child, sofa::core::objectmodel::ClassInfo::dynamicCast(), getChild(), getObject(), getPathName(), sofa::core::objectmodel::BaseContext::Local, sofa::core::objectmodel::ClassInfo::name(), sofa::core::objectmodel::Base::name, and parent.

void * sofa::simulation::tree::GNode::getObject ( const sofa::core::objectmodel::ClassInfo &  class_info,
SearchDirection  dir = SearchUp 
) const [virtual]

Generic object access, possibly searching up or down from the current context.

Note that the template wrapper method should generally be used to have the correct return type,

Note that the template wrapper method should generally be used to have the correct return type,

Reimplemented from sofa::core::objectmodel::BaseContext.

Definition at line 117 of file GNode.cpp.

References child, sofa::core::objectmodel::ClassInfo::dynamicCast(), sofa::core::objectmodel::BaseContext::Local, parent, sofa::core::objectmodel::BaseContext::SearchDown, sofa::core::objectmodel::BaseContext::SearchRoot, and sofa::core::objectmodel::BaseContext::SearchUp.

Referenced by getObject().

void sofa::simulation::tree::GNode::getObjects ( const sofa::core::objectmodel::ClassInfo &  class_info,
GetObjectsCallBack &  container,
SearchDirection  dir = SearchUp 
) const [virtual]

Generic list of objects access, possibly searching up or down from the current context.

Note that the template wrapper method should generally be used to have the correct return type,

Note that the template wrapper method should generally be used to have the correct return type,

Reimplemented from sofa::core::objectmodel::BaseContext.

Definition at line 229 of file GNode.cpp.

References child, sofa::core::objectmodel::ClassInfo::dynamicCast(), sofa::core::objectmodel::BaseContext::Local, parent, sofa::core::objectmodel::BaseContext::SearchDown, sofa::core::objectmodel::BaseContext::SearchRoot, and sofa::core::objectmodel::BaseContext::SearchUp.

const core::objectmodel::BaseNode * sofa::simulation::tree::GNode::getParent (  )  const [virtual]

Get parent node (or NULL if no hierarchy or for root node).

Implements sofa::core::objectmodel::BaseNode.

Definition at line 282 of file GNode.cpp.

References parent.

core::objectmodel::BaseNode * sofa::simulation::tree::GNode::getParent (  )  [virtual]

Execute a recursive action starting from this node.

Get parent node (or NULL if no hierarchy or for root node).

Get parent node (or NULL if no hierarchy or for root node)

Implements sofa::core::objectmodel::BaseNode.

Definition at line 276 of file GNode.cpp.

References parent.

Referenced by sofa::component::collision::DefaultCollisionGroupManager::createGroups(), sofa::gui::qt::RealGUI::graphRemoveObject(), initVisualContext(), sofa::simulation::tree::Simulation::unload(), updateContext(), SensAble::updatePosition(), updateSimulationContext(), and updateVisualContext().

std::string sofa::simulation::tree::GNode::getPathName (  )  const

Return the full path name of this node.

Definition at line 402 of file GNode.cpp.

References sofa::core::objectmodel::Base::getName(), and parent.

Referenced by getObject().

core::objectmodel::BaseObject * sofa::simulation::tree::GNode::getShader (  )  const [virtual]

Shader.

Reimplemented from sofa::simulation::Node.

Definition at line 436 of file GNode.cpp.

References parent, and sofa::simulation::Node::shader.

core::componentmodel::topology::Topology * sofa::simulation::tree::GNode::getTopology (  )  const [virtual]

Topology.

Reimplemented from sofa::simulation::Node.

Definition at line 412 of file GNode.cpp.

References parent, and sofa::simulation::Node::topology.

GNode * sofa::simulation::tree::GNode::getTreeNode ( const std::string &  name  )  const

Get a descendant node given its name.

Definition at line 374 of file GNode.cpp.

References child, getChild(), and getTreeNode().

Referenced by getTreeNode().

void sofa::simulation::tree::GNode::initVisualContext (  )  [virtual]

void sofa::simulation::tree::GNode::moveChild ( GNode *  obj  )  [virtual]

virtual void sofa::simulation::tree::GNode::moveObject ( core::objectmodel::BaseObject *  obj  )  [inline, virtual]

Import an object.

Reimplemented from sofa::simulation::Node.

Definition at line 119 of file GNode.h.

void sofa::simulation::tree::GNode::notifyAddChild ( GNode *  node  )  [protected]

Definition at line 383 of file GNode.cpp.

References listener.

Referenced by addChild().

void sofa::simulation::tree::GNode::notifyAddObject ( core::objectmodel::BaseObject *  obj  )  [protected, virtual]

Reimplemented from sofa::simulation::Node.

Definition at line 612 of file GNode.cpp.

References listener.

void sofa::simulation::tree::GNode::notifyMoveChild ( GNode *  node,
GNode *  prev 
) [protected]

Definition at line 395 of file GNode.cpp.

References listener.

Referenced by moveChild().

void sofa::simulation::tree::GNode::notifyMoveObject ( core::objectmodel::BaseObject *  obj,
GNode *  prev 
) [protected]

Definition at line 624 of file GNode.cpp.

References listener.

void sofa::simulation::tree::GNode::notifyRemoveChild ( GNode *  node  )  [protected]

Definition at line 389 of file GNode.cpp.

References listener.

Referenced by removeChild().

void sofa::simulation::tree::GNode::notifyRemoveObject ( core::objectmodel::BaseObject *  obj  )  [protected, virtual]

Reimplemented from sofa::simulation::Node.

Definition at line 618 of file GNode.cpp.

References listener.

void sofa::simulation::tree::GNode::reinit (  ) 

Update the parameters of the System.

Reimplemented from sofa::simulation::Node.

Definition at line 460 of file GNode.cpp.

References sofa::simulation::Visitor::execute(), and sofa::core::objectmodel::Context::isActive().

Referenced by sofa::gui::qt::RealGUI::graphDesactivateNode().

void sofa::simulation::tree::GNode::removeChild ( BaseNode *  node  )  [virtual]

Remove a child node.

Implements sofa::core::objectmodel::BaseNode.

Definition at line 91 of file GNode.cpp.

References removeChild().

void sofa::simulation::tree::GNode::removeChild ( GNode *  node  )  [virtual]

void sofa::simulation::tree::GNode::removeListener ( MutationListener *  obj  ) 

Definition at line 607 of file GNode.cpp.

References listener.

Referenced by sofa::simulation::tree::MutationListener::removeChild().

virtual bool sofa::simulation::tree::GNode::removeObject ( core::objectmodel::BaseObject *  obj  )  [inline, virtual]

void sofa::simulation::tree::GNode::updateContext (  )  [virtual]

Update the whole context values, based on parent and local ContextObjects.

Reimplemented from sofa::simulation::Node.

Definition at line 495 of file GNode.cpp.

References sofa::core::objectmodel::Context::copyContext(), getParent(), and parent.

Referenced by sofa::component::collision::DefaultPickingManager< TDataTypes, ContactForceField >::getMState().

void sofa::simulation::tree::GNode::updateSimulationContext (  )  [virtual]

void sofa::simulation::tree::GNode::updateVisualContext ( int  FILTER = 0  )  [virtual]


Friends And Related Function Documentation

friend class simulation::VisitorScheduler [friend]

Definition at line 218 of file GNode.h.


Field Documentation


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

Generated on Sun Nov 23 04:24:38 2008 for Sofa by  doxygen 1.5.7.1