H3D API  2.4.1
Public Member Functions | List of all members
H3D::X3D::DEFNodes Class Reference

Provides a mapping between defined DEF names in X3D and the nodes they refer to. More...

#include <H3D/DEFNodes.h>

Inheritance diagram for H3D::X3D::DEFNodes:
Inheritance graph

Public Member Functions

 ~DEFNodes ()
 Destructor. unrefs all the nodes in the map.
 
const_iterator begin ()
 Returns a const_iterator to the first element in the DEFNodes struct.
 
const_iterator end ()
 Returns a const_iterator to the end element in the DEFNodes struct.
 
void addNode (const string &def_name, Node *def_node)
 Adds a DEF name/Node * pair to the structure. More...
 
void removeNode (const string &def_name)
 Removes a DEF name/Node * pair from the structure. More...
 
void merge (DEFNodes *dn)
 Add the entries from another DEFNodes structure do this one. More...
 
void clear ()
 Removes all the entries in the map.
 
NodegetNode (const string &def_name)
 Get the node by its DEF name. More...
 
template<class NodeType >
void getNode (const string &def_name, NodeType *&return_node)
 Get the node by its DEF name. More...
 

Detailed Description

Provides a mapping between defined DEF names in X3D and the nodes they refer to.

Member Function Documentation

◆ addNode()

void H3D::X3D::DEFNodes::addNode ( const string &  def_name,
Node def_node 
)
inline

Adds a DEF name/Node * pair to the structure.

Parameters
def_nameThe DEF name of the node.
def_nodeThe Node assiciated with the given DEF name.

References H3DUtil::RefCountedClass::ref().

◆ getNode() [1/2]

Node* H3D::X3D::DEFNodes::getNode ( const string &  def_name)
inline

Get the node by its DEF name.

Parameters
def_nameThe DEF name of the node as specified in the X3D input.
Returns
The Node with the given DEF name. NULL if no such node exists.

Referenced by H3D::X3DTextureNode::renderToImage(), H3D::Anchor::replaceSceneRoot(), and H3D::FBODebugger::traverseSG().

◆ getNode() [2/2]

template<class NodeType >
void H3D::X3D::DEFNodes::getNode ( const string &  def_name,
NodeType *&  return_node 
)
inline

Get the node by its DEF name.

Parameters
def_nameThe DEF name of the node as specified in the X3D input.
return_nodeThis pointer ref will be set to the the Node with the given DEF name. NULL if no such node exists.
Exceptions
InvalidNodeTypeThrown when the DEF Node type is not a subclass of the type of return_node.

◆ merge()

void H3D::X3D::DEFNodes::merge ( DEFNodes dn)
inline

Add the entries from another DEFNodes structure do this one.

If an entry already exists it will be replaced.

References begin(), and end().

Referenced by H3D::Inline::LoadedScene::update().

◆ removeNode()

void H3D::X3D::DEFNodes::removeNode ( const string &  def_name)
inline

Removes a DEF name/Node * pair from the structure.

Parameters
def_nameThe DEF name to remove.

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