osg::MultiFunctorStore Class Reference

#include <OSGMultiFunctorStore.h>

List of all members.

Public Types

Types


typedef NewActionTypes::Functor Functor

Public Member Functions

Constructors


 MultiFunctorStore (void)
Destructor


 ~MultiFunctorStore (void)
Empty


bool empty (void) const
Functor Registration


void regFunctor (const Functor &refFunc, const FieldContainerType &refType)
void unregFunctor (const FieldContainerType &refType)
void regDefaultFunctor (const Functor &refFunc)
void unregDefaultFunctor (void)
Functor Access


FunctorgetFunctor (const FieldContainerType &refType)
FunctorgetDefaultFunctor (void)

Private Types

Types


typedef std::list< FunctorFunctorStore
typedef FunctorStore::iterator FunctorStoreIt
typedef
FunctorStore::const_iterator 
FunctorStoreConstIt
typedef std::vector
< FunctorStoreIt
FunctorMap
typedef FunctorMap::iterator FunctorMapIt
typedef FunctorMap::const_iterator FunctorMapConstIt

Private Attributes

FunctorStore _funcStore
FunctorMap _funcMap
Functor _defaultFunc
bool _bHasDefaultFunctor


Detailed Description

Definition at line 54 of file OSGMultiFunctorStore.h.


Member Typedef Documentation

Definition at line 62 of file OSGMultiFunctorStore.h.

typedef std::list<Functor> osg::MultiFunctorStore::FunctorStore [private]

Definition at line 112 of file OSGMultiFunctorStore.h.

typedef FunctorStore::iterator osg::MultiFunctorStore::FunctorStoreIt [private]

Definition at line 113 of file OSGMultiFunctorStore.h.

typedef FunctorStore::const_iterator osg::MultiFunctorStore::FunctorStoreConstIt [private]

Definition at line 114 of file OSGMultiFunctorStore.h.

typedef std::vector<FunctorStoreIt> osg::MultiFunctorStore::FunctorMap [private]

Definition at line 116 of file OSGMultiFunctorStore.h.

typedef FunctorMap::iterator osg::MultiFunctorStore::FunctorMapIt [private]

Definition at line 117 of file OSGMultiFunctorStore.h.

typedef FunctorMap::const_iterator osg::MultiFunctorStore::FunctorMapConstIt [private]

Definition at line 118 of file OSGMultiFunctorStore.h.


Constructor & Destructor Documentation

osg::MultiFunctorStore::MultiFunctorStore ( void   )  [inline]

Definition at line 45 of file OSGMultiFunctorStore.inl.

00046     : _funcStore         (     ),
00047       _funcMap           (     ),
00048       _defaultFunc       (     ),
00049       _bHasDefaultFunctor(false)
00050 {
00051 }

osg::MultiFunctorStore::~MultiFunctorStore ( void   )  [inline]

Definition at line 57 of file OSGMultiFunctorStore.inl.

00058 {
00059 }


Member Function Documentation

bool osg::MultiFunctorStore::empty ( void   )  const [inline]

Definition at line 65 of file OSGMultiFunctorStore.inl.

References _bHasDefaultFunctor, and _funcStore.

00066 {
00067     return _funcStore.empty() && !_bHasDefaultFunctor;
00068 }

void osg::MultiFunctorStore::regFunctor ( const Functor refFunc,
const FieldContainerType refType 
) [inline]

Definition at line 74 of file OSGMultiFunctorStore.inl.

References _funcMap, _funcStore, and osg::TypeBase::getId().

00076 {
00077     _funcStore.push_front(refFunc);
00078 
00079     if(_funcMap.size() <= refType.getId())
00080     {
00081         _funcMap.resize(refType.getId() + 1, _funcStore.end());
00082     }
00083 
00084     _funcMap[refType.getId()] = _funcStore.begin();
00085 }

void osg::MultiFunctorStore::unregFunctor ( const FieldContainerType refType  )  [inline]

Definition at line 88 of file OSGMultiFunctorStore.inl.

References _funcMap, _funcStore, and osg::TypeBase::getId().

00089 {
00090     FunctorStoreIt funcIter = _funcMap[refType.getId()];
00091 
00092     if(funcIter != _funcStore.end())
00093         _funcStore.erase(funcIter);
00094 
00095     _funcMap[refType.getId()] = _funcStore.end();
00096 }

void osg::MultiFunctorStore::regDefaultFunctor ( const Functor refFunc  )  [inline]

Definition at line 99 of file OSGMultiFunctorStore.inl.

References _bHasDefaultFunctor, and _defaultFunc.

00100 {
00101     _defaultFunc        = refFunc;
00102     _bHasDefaultFunctor = true;
00103 }

void osg::MultiFunctorStore::unregDefaultFunctor ( void   )  [inline]

Definition at line 106 of file OSGMultiFunctorStore.inl.

References _bHasDefaultFunctor.

00107 {
00108     _bHasDefaultFunctor = false;
00109 }

MultiFunctorStore::Functor * osg::MultiFunctorStore::getFunctor ( const FieldContainerType refType  )  [inline]

Definition at line 115 of file OSGMultiFunctorStore.inl.

References _bHasDefaultFunctor, _defaultFunc, _funcMap, _funcStore, and osg::TypeBase::getId().

00116 {
00117     Functor        *pRetFunc = NULL;
00118     FunctorStoreIt  funcIter = _funcStore.end();
00119 
00120     if(refType.getId() < _funcMap.size())
00121     {
00122         funcIter = _funcMap[refType.getId()];
00123     }
00124 
00125     if(funcIter != _funcStore.end())
00126     {
00127         pRetFunc =  &(*funcIter);
00128     }
00129     else if(_bHasDefaultFunctor)
00130     {
00131         pRetFunc = &_defaultFunc;
00132     }
00133 
00134     return pRetFunc;
00135 }

MultiFunctorStore::Functor * osg::MultiFunctorStore::getDefaultFunctor ( void   )  [inline]

Definition at line 138 of file OSGMultiFunctorStore.inl.

References _bHasDefaultFunctor, and _defaultFunc.

00139 {
00140     Functor *pRetFunc = NULL;
00141 
00142     if(_bHasDefaultFunctor)
00143     {
00144         pRetFunc = &_defaultFunc;
00145     }
00146 
00147     return pRetFunc;
00148 }


Member Data Documentation

Definition at line 123 of file OSGMultiFunctorStore.h.

Referenced by empty(), getFunctor(), regFunctor(), and unregFunctor().

Definition at line 124 of file OSGMultiFunctorStore.h.

Referenced by getFunctor(), regFunctor(), and unregFunctor().

Definition at line 126 of file OSGMultiFunctorStore.h.

Referenced by getDefaultFunctor(), getFunctor(), and regDefaultFunctor().


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

Generated on Mon Mar 17 12:21:37 2008 for OpenSG by  doxygen 1.5.5