VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Types | Protected Attributes
makVrv::DtMultiReferencedNodeContainer< State > Class Template Reference

DtMultiReferencedNodeContainer is a class template that it used to provide support for dynamic nodes (such as switches and animations) that may be multiply referenced. More...

Inheritance diagram for makVrv::DtMultiReferencedNodeContainer< State >:
Inheritance graph
[legend]

Public Types

typedef boost::function< void(DynamicTerrain::NodePathHash)> NodeReferenceFunction
 Function type that runs on node reference.

Public Member Functions

 DtMultiReferencedNodeContainer ()
 CTOR.
 DtMultiReferencedNodeContainer (const DtMultiReferencedNodeContainer &orig)
 Copy CTOR param[in] orig the DtMultiReferencedNodeContainer to copy.
virtual ~DtMultiReferencedNodeContainer ()
 DTOR.
virtual
DynamicTerrain::NodePathHash 
addNodeInstance (const osg::NodePath &nodePath)
 Add a reference to a node and return the hash for the passed in node path.
virtual void setDefaultState (const State &state)
 Specify a default state used to initialize each node reference when added.
virtual const State & defaultState () const
 Get the default state used for node references.
virtual void setState (DynamicTerrain::NodePathHash hashIndex, const State &state)
 Set the state of a node reference.
virtual void setState (const State &state)
 Set the state of all node references.
virtual bool getState (DynamicTerrain::NodePathHash hashIndex, State &state)
 Get the state of node instance.
virtual
DynamicTerrain::NodePathHash 
calcNodePathHashValue (const osg::NodePath &nodePath)
 Calculate a node hash, checks all known depths that nodes werer added at.
virtual void forEachNodeReference (NodeReferenceFunction &perNodeFunction)
 Execute a function on each node reference in the container.

Protected Types

typedef boost::unordered_map
< DynamicTerrain::NodePathHash,
State > 
NodeInstanceMap

Protected Attributes

NodeInstanceMap myNodeInstanceMap
std::set< intmyNodePathDepths
State myDefaultState

Detailed Description

template<typename State>
class makVrv::DtMultiReferencedNodeContainer< State >

DtMultiReferencedNodeContainer is a class template that it used to provide support for dynamic nodes (such as switches and animations) that may be multiply referenced.

Each reference is tracked using a hash of the OSG node path from the root of the patch/page to the node. For each reference, the state of the node reference is maintained as a templated state object. When a deriving class has a visitor traverse it's referenced node, the nodePath of the traversal to the node is used to calculate a node hash which is then used to look up the state of that node reference for use in that traversal. Since the patch/page in which the reference was found may have been placed anywhere into the scene graph after it was been parsed, the path depth from the top of the patch/page to the switch is kept; the subsequent hash on traversal is then limited to that depth. The template parameter is used to allow different deriving types to maintain different state objects associated with the node references.

Member Typedef Documentation

template<typename State>
typedef boost::function<void (DynamicTerrain::NodePathHash)> makVrv::DtMultiReferencedNodeContainer< State >::NodeReferenceFunction

Function type that runs on node reference.

template<typename State>
typedef boost::unordered_map<DynamicTerrain::NodePathHash, State> makVrv::DtMultiReferencedNodeContainer< State >::NodeInstanceMap
protected

Constructor & Destructor Documentation

CTOR.

template<typename State>
makVrv::DtMultiReferencedNodeContainer< State >::DtMultiReferencedNodeContainer ( const DtMultiReferencedNodeContainer< State > &  orig)

Copy CTOR param[in] orig the DtMultiReferencedNodeContainer to copy.

template<typename State>
virtual makVrv::DtMultiReferencedNodeContainer< State >::~DtMultiReferencedNodeContainer ( )
virtual

DTOR.

Member Function Documentation

template<typename State>
virtual DynamicTerrain::NodePathHash makVrv::DtMultiReferencedNodeContainer< State >::addNodeInstance ( const osg::NodePath &  nodePath)
virtual

Add a reference to a node and return the hash for the passed in node path.

Parameters
[in]hashIndexthe hash of the OSG node path to the reference
template<typename State>
virtual void makVrv::DtMultiReferencedNodeContainer< State >::setDefaultState ( const State &  state)
virtual

Specify a default state used to initialize each node reference when added.

Parameters
[in]statethe state to use for new node references
template<typename State>
virtual const State& makVrv::DtMultiReferencedNodeContainer< State >::defaultState ( ) const
virtual

Get the default state used for node references.

Returns
The default state being assigned to all new node references
template<typename State>
virtual void makVrv::DtMultiReferencedNodeContainer< State >::setState ( DynamicTerrain::NodePathHash  hashIndex,
const State &  state 
)
virtual

Set the state of a node reference.

Parameters
[in]hashIndexthe node path hash of the reference
[in]statethe state value to set
template<typename State>
virtual void makVrv::DtMultiReferencedNodeContainer< State >::setState ( const State &  state)
virtual

Set the state of all node references.

Parameters
[in]statethe state value to set
template<typename State>
virtual bool makVrv::DtMultiReferencedNodeContainer< State >::getState ( DynamicTerrain::NodePathHash  hashIndex,
State &  state 
)
virtual

Get the state of node instance.

Parameters
[in]hashIndexthe node has that represents the node reference
[out]statethe current state saved for the node reference
Returns
true if the reference exists, false otherwise
template<typename State>
virtual DynamicTerrain::NodePathHash makVrv::DtMultiReferencedNodeContainer< State >::calcNodePathHashValue ( const osg::NodePath &  nodePath)
virtual

Calculate a node hash, checks all known depths that nodes werer added at.

Parameters
[in]nodePaththe node path to be hashed
Returns
the calculated node path hash
template<typename State>
virtual void makVrv::DtMultiReferencedNodeContainer< State >::forEachNodeReference ( NodeReferenceFunction perNodeFunction)
virtual

Execute a function on each node reference in the container.

Member Data Documentation

template<typename State>
NodeInstanceMap makVrv::DtMultiReferencedNodeContainer< State >::myNodeInstanceMap
protected
template<typename State>
std::set<int> makVrv::DtMultiReferencedNodeContainer< State >::myNodePathDepths
protected
template<typename State>
State makVrv::DtMultiReferencedNodeContainer< State >::myDefaultState
protected

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

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)