Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglIndexedBitMaskSwitch Class Reference

#include <sglIndexedBitMaskSwitch.hpp>

Inheritance diagram for sglIndexedBitMaskSwitch::

sglBitMaskSwitch sglGroup sglNode sglObject List of all members.

Public Methods

 sglIndexedBitMaskSwitch ()
virtual ~sglIndexedBitMaskSwitch ()
void setIndex (unsigned int index)
unsigned int getIndex () const
void addMask (unsigned int mask)
virtual sglNodeclone (unsigned int mode) const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Protected Methods

void copyTo (sglIndexedBitMaskSwitch *dst, unsigned int mode) const

Protected Attributes

unsigned int m_switch_index
vector<unsigned int> m_index

Detailed Description

This is a subclass of sglBitMaskSwitch that adds a level of indirection to the selection mechanism by associating an index with each set of up to 32 children a nearly unlimited number of combinations of these 32 children can be selected with an integer index. The index is constructed as a vector of bit masks to be used (see sglBitMaskSwitch for full details on what the bitmasks mean).

As with sglBitMaskSwitch, the order that the children are added to the node is significant. In addition, the order the masks are added is significant, as it implicitly selects the index value for that bitmask.

Initially, the default index value and mask is undefined. At least one mask should be added using addMask(), and setIndex() should be used to set the default index. Otherwise, the default set of children selected will be the same as the default of the sglBitMaskSwitch, which is to select all children.

Special behaviour for intersect and pick traversals

This behaviour is the same as for the sglBitMaskSwitch.

Example:

   sglIndexedBitMaskSwitch *switch_node = new sglIndexedBitMaskSwitch;
   sglGeode *geode0 = new sglGeode;
   sglGeode *geode1 = new sglGeode;

   switch_node->addChild(geode0);
   switch_node->addChild(geode1);

   switch_node->addMask(0x0);     // select neither for index 0
   switch_node->addMask(0x2);     // select geode1 for index 1
   switch_node->addMask(0x1);     // select geode0 for index 2
   switch_node->addMask(0x3);     // select both for index 3
   switch_node->addMask(~0x0);    // select all children for index 4
   switch_node->setIndex(2);      // select zeroeth index (geode 0)

Todo:
Do we need to add complete mask management (remove, insert, etc)?

Definition at line 81 of file sglIndexedBitMaskSwitch.hpp.


Constructor & Destructor Documentation

sglIndexedBitMaskSwitch::sglIndexedBitMaskSwitch ( )
 

default constructor.

sglIndexedBitMaskSwitch::~sglIndexedBitMaskSwitch ( ) [virtual]
 

destructor.


Member Function Documentation

void sglIndexedBitMaskSwitch::setIndex ( unsigned int index ) [inline]
 

Set the index for selecting children. @index The index into the vector of masks.

Definition at line 92 of file sglIndexedBitMaskSwitch.hpp.

unsigned int sglIndexedBitMaskSwitch::getIndex ( ) const [inline]
 

Get the current index.

Returns:
The current index value (unsigned int).

Definition at line 104 of file sglIndexedBitMaskSwitch.hpp.

void sglIndexedBitMaskSwitch::addMask ( unsigned int mask ) [inline]
 

Add a new mask to the index vector. @mask The index into the vector of masks.

Definition at line 109 of file sglIndexedBitMaskSwitch.hpp.

virtual sglNode* sglIndexedBitMaskSwitch::clone ( unsigned int mode ) const [virtual]
 

Make a copy of the scenegraph rooted at this node.

Parameters:
mode   Bit masks to control the behaviour of the clone. These are OR-ed together from the mode values in sglObject::CloneModeEnum.
Returns:
Pointer to root of cloned scene graph.

Reimplemented from sglBitMaskSwitch.

virtual void sglIndexedBitMaskSwitch::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglBitMaskSwitch.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:08 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001