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>

List of all members.

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.
void removeNode (const string &def_name)
 Removes a DEF name/Node * pair from the structure.
void merge (DEFNodes *dn)
 Add the entries from another DEFNodes structure do this one.
void clear ()
 Removes all the entries in the map.
NodegetNode (const string &def_name)
 Get the node by its DEF name.
template<class NodeType >
void getNode (const string &def_name, NodeType *&return_node)
 Get the node by its DEF name.


Detailed Description

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

Member Function Documentation

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

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

Parameters:
def_name The DEF name of the node.
def_node The Node assiciated with the given DEF name.

References H3DUtil::RefCountedClass::ref().

Referenced by H3D::X3D::X3DSAX2Handlers::handleExportElement(), H3D::X3D::X3DSAX2Handlers::handleImportElement(), and H3D::X3D::X3DSAX2Handlers::startElement().

const_iterator H3D::X3D::DEFNodes::begin (  )  [inline]

Returns a const_iterator to the first element in the DEFNodes struct.

Referenced by merge().

const_iterator H3D::X3D::DEFNodes::end (  )  [inline]

Returns a const_iterator to the end element in the DEFNodes struct.

Referenced by merge().

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_name The DEF name of the node as specified in the X3D input.
return_node This pointer ref will be set to the the Node with the given DEF name. NULL if no such node exists.
Exceptions:
InvalidNodeType Thrown when the DEF Node type is not a subclass of the type of return_node.

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

Get the node by its DEF name.

Parameters:
def_name The 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::X3D::X3DSAX2Handlers::handleExportElement(), H3D::X3D::X3DSAX2Handlers::handleImportElement(), H3D::X3D::X3DSAX2Handlers::handleRouteElement(), yy::VrmlParser::parse(), and H3D::X3D::X3DSAX2Handlers::startElement().

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().

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

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

Parameters:
def_name The DEF name to remove.


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

Generated on Fri Nov 7 10:31:35 2008 for H3D API by  doxygen 1.5.7