Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::StateChunkClass Class Reference
[OpenGL State Handling]

The classification class for StateChunks, see StateChunkClass for a description. More...

#include <OSGStateChunk.h>

List of all members.

Class Access

typedef std::vector< std::string
>::const_iterator 
iterator
*static const Char8getName (UInt32 index)
static Int32 getNumSlots (UInt32 index)
static UInt32 getUsedSlots (void)
static iterator begin ()
static iterator end ()

Public Member Functions

Constructor
StateChunkClass (Char8 *name, UInt32 numslots=1)
Instance Access
*UInt32 getId (void) const
const Char8getName (void) const
Int32 getNumSlots (void) const

Private Attributes

UInt32 _classId

Static Private Attributes

static std::vector< std::string > * _classNames = NULL
static std::vector< UInt32 > * _numslots = NULL


Detailed Description

See StateChunkClass for the conceptual background.

Definition at line 58 of file OSGStateChunk.h.


Member Typedef Documentation

osg::StateChunkClass::iterator
 

Iterator type to access the chunk class list.

Definition at line 86 of file OSGStateChunk.h.


Constructor & Destructor Documentation

StateChunkClass::StateChunkClass Char8 name,
UInt32  numslots = 1
 

Constructor. The name is mandatory, the number of concurrently active slots is optional, default is 1.

Definition at line 106 of file OSGStateChunk.cpp.

References _classId, _classNames, and _numslots.

00107 {
00108     if(!_classNames)
00109     {
00110         _classNames = new std::vector<std::string>(0);
00111         _numslots   = new std::vector<     UInt32>(0);
00112     }
00113 
00114     _classId = _classNames->size();
00115 
00116     for(unsigned i = 0; i < numslots; i++)
00117     {
00118         _classNames->push_back(std::string(name));
00119         _numslots->push_back (numslots);
00120     }
00121 }


Member Function Documentation

UInt32 StateChunkClass::getId void   )  const
 

Definition at line 123 of file OSGStateChunk.cpp.

References _classId.

Referenced by osg::State::chunkPresent(), osg::StateChunk::getClassId(), osg::VertexProgramChunk::getStaticClassId(), osg::TransformChunk::getStaticClassId(), osg::TextureTransformChunk::getStaticClassId(), osg::TextureChunk::getStaticClassId(), osg::TexGenChunk::getStaticClassId(), osg::StencilChunk::getStaticClassId(), osg::StateChunk::getStaticClassId(), osg::RegisterCombinersChunk::getStaticClassId(), osg::ProgramChunk::getStaticClassId(), osg::PolygonChunk::getStaticClassId(), osg::PointChunk::getStaticClassId(), osg::MaterialChunk::getStaticClassId(), osg::LineChunk::getStaticClassId(), osg::LightChunk::getStaticClassId(), osg::FragmentProgramChunk::getStaticClassId(), osg::DepthChunk::getStaticClassId(), osg::CubeTextureChunk::getStaticClassId(), osg::ColorMaskChunk::getStaticClassId(), osg::ClipPlaneChunk::getStaticClassId(), and osg::BlendChunk::getStaticClassId().

00124 {
00125     return _classId;
00126 }

const Char8 * StateChunkClass::getName void   )  const
 

Definition at line 128 of file OSGStateChunk.cpp.

References _classId.

00129 {
00130     return(*_classNames)[_classId].c_str();
00131 }

Int32 StateChunkClass::getNumSlots void   )  const
 

Definition at line 133 of file OSGStateChunk.cpp.

References _classId.

Referenced by osg::State::activate(), osg::State::changeFrom(), osg::State::chunkPresent(), osg::State::deactivate(), and osg::State::subChunk().

00134 {
00135     return(*_numslots)[_classId];
00136 }

const Char8 * StateChunkClass::getName UInt32  index  )  [static]
 

Access the name for the class whose id is index.

Definition at line 141 of file OSGStateChunk.cpp.

00142 {
00143     if(index >=(*_classNames).size())
00144             return "<Unknown StatChunkClass!>";
00145 
00146     return(*_classNames)[index].c_str();
00147 }

Int32 StateChunkClass::getNumSlots UInt32  index  )  [static]
 

Access the number of slots for the class whose id is index.

Definition at line 152 of file OSGStateChunk.cpp.

References _numslots.

00153 {
00154     if(index >= (*_numslots).size())
00155         return -1;
00156 
00157     return (*_numslots)[index];
00158 }

UInt32 osg::StateChunkClass::getUsedSlots void   )  [inline, static]
 

Iterator type to access the chunk class list.

Definition at line 68 of file OSGStateChunk.inl.

References _numslots.

00069 {
00070     return StateChunkClass::_numslots->size();
00071 }

StateChunkClass::iterator StateChunkClass::begin void   )  [static]
 

Iterator to allow access to all known StateChunkClasses.

Definition at line 168 of file OSGStateChunk.cpp.

References _classNames.

00169 {
00170     return _classNames->begin();
00171 }

StateChunkClass::iterator StateChunkClass::end void   )  [static]
 

Iterator to allow access to all known StateChunkClasses.

Definition at line 176 of file OSGStateChunk.cpp.

References _classNames.

00177 {
00178     return _classNames->end();
00179 }


Member Data Documentation

osg::StateChunkClass::_classId [private]
 

The numerical ID associated with each StateChunkClass. It is used to uniquely identify and quickly compare the class.

Dev: The classId is consecutive in the number of slots allocated to the chunk class, i.e. if a class has id 4 and 4 chunks, the next registered class will get id 8. The classId is used as an index into the osg::State's chunk vector, which necessitates this behaviour.

Referenced by getId(), getName(), getNumSlots(), and StateChunkClass().

std::vector< std::string > * StateChunkClass::_classNames = NULL [static, private]
 

The global vector of known StateChunkClasses' names. Use StateChunkClass::getName with the Classes ID to access it.

Dev: See the osg::StateChunkClass::_classId for details.

Definition at line 91 of file OSGStateChunk.cpp.

Referenced by begin(), end(), and StateChunkClass().

std::vector< UInt32 > * StateChunkClass::_numslots = NULL [static, private]
 

The global vector of known StateChunkClasses' number of concurrently active slots. Use StateChunkClass::getNumSlots with the Class's ID to access it.

Dev: See the osg::StateChunkClass::_classId for details.

Definition at line 100 of file OSGStateChunk.cpp.

Referenced by getNumSlots(), getUsedSlots(), and StateChunkClass().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:21:06 2005 for OpenSG by  doxygen 1.4.3