osg::StatElemDescBase Class Reference

Brief. More...

#include <OSGStatElemDesc.h>

Inheritance diagram for osg::StatElemDescBase:

osg::StatElemDesc< Type >

List of all members.

instance



static bool isValidID (Int32 descId)
static StatElemDescBasegetDesc (Int32 descId)
static StatElemDescBasefindDescByName (const Char8 *name)
static Int32 getNumOfDescs (void)
static const Char8getClassname (void)
static void printAll (void)
void print (void)
Int32 getID (void)
const IDStringgetName (void)
const IDStringgetDescription (void)

Public Member Functions

Constructors


 StatElemDescBase (const Char8 *name, const Char8 *description)
 Constructor.
Destructor


virtual ~StatElemDescBase (void)
 Destructor.
Comparison


bool operator< (const StatElemDescBase &other) const
 assignment

Private Member Functions

virtual StatElemcreateElem (void)=0
 StatElemDescBase (const StatElemDescBase &source)
StatElemDescBaseoperator= (const StatElemDescBase &source)
 assignment

Private Attributes

Int32 _id
IDString _name
IDString _description

Static Private Attributes

static std::vector
< StatElemDescBase * > * 
_descVec = 0
static char cvsid [] = "@(#)$Id: $"

Friends

class StatCollector


Detailed Description

detailed

Definition at line 62 of file OSGStatElemDesc.h.


Constructor & Destructor Documentation

StatElemDescBase::StatElemDescBase ( const Char8 name,
const Char8 description 
)

Definition at line 112 of file OSGStatElemDesc.cpp.

References _descVec, _id, FFATAL, and findDescByName().

00113   :_id(-1), _name(name), _description(description)
00114 {
00115   StatElemDescBase *desc = 0;
00116 
00117   if (_descVec) 
00118     desc = findDescByName (name);
00119   else
00120     _descVec = new std::vector<StatElemDescBase*>;
00121   
00122   if (desc) {
00123     FFATAL (( "Try to register the StatElemDescBase name %s a second time\n",
00124               name ));
00125   }
00126   else {
00127     _id = _descVec->size();
00128     _descVec->push_back(this);
00129   }
00130 }  

StatElemDescBase::~StatElemDescBase ( void   )  [virtual]

Definition at line 141 of file OSGStatElemDesc.cpp.

00142 {
00143 }

osg::StatElemDescBase::StatElemDescBase ( const StatElemDescBase source  )  [private]


Member Function Documentation

bool osg::StatElemDescBase::isValidID ( Int32  descId  )  [inline, static]

Definition at line 43 of file OSGStatElemDesc.inl.

References _descVec.

00044 { 
00045   return (_descVec && (descId >= 0) && (descId < Int32(_descVec->size()))); 
00046 }

StatElemDescBase * osg::StatElemDescBase::getDesc ( Int32  descId  )  [inline, static]

Definition at line 50 of file OSGStatElemDesc.inl.

References _descVec.

Referenced by osg::StatCollector::getElem().

00051 { 
00052   return (*_descVec)[descId];
00053 }

StatElemDescBase * StatElemDescBase::findDescByName ( const Char8 name  )  [static]

Definition at line 74 of file OSGStatElemDesc.cpp.

References _descVec, _name, and osg::IDString::str().

Referenced by osg::StatCollector::getFromString(), osg::StatCollector::getValue(), and StatElemDescBase().

00075 {
00076   Int32 i,n = _descVec ? _descVec->size() : 0;
00077   StatElemDescBase *desc = 0;
00078 
00079   if (name && *name && n)
00080     for (i = 0; i < n; i++)
00081       if (!strcmp(name,(*_descVec)[i]->_name.str())) {
00082         desc = (*_descVec)[i];
00083         break;
00084       }
00085   
00086   return desc;
00087 }

Int32 osg::StatElemDescBase::getNumOfDescs ( void   )  [inline, static]

Definition at line 57 of file OSGStatElemDesc.inl.

References _descVec.

Referenced by osg::StatCollector::refitElemNum().

00058 { 
00059   return _descVec ? _descVec->size() : 0; 
00060 }

const Char8 * osg::StatElemDescBase::getClassname ( void   )  [inline, static]

Definition at line 64 of file OSGStatElemDesc.inl.

00065 { 
00066   return "StatElemDescBase"; 
00067 }

void StatElemDescBase::printAll ( void   )  [static]

Definition at line 145 of file OSGStatElemDesc.cpp.

References _descVec.

00146 {
00147   Int32 i,n = _descVec ? _descVec->size() : 0;
00148 
00149   for (i = 0; i < n; i++)
00150     (*_descVec)[i]->print();
00151 }

void StatElemDescBase::print ( void   ) 

Definition at line 153 of file OSGStatElemDesc.cpp.

References _description, _id, _name, FLOG, and osg::IDString::str().

00154 {
00155   FLOG (( "StatElemDescBase: ID/Name/Description: %d/%s/%s\n",
00156           _id, _name.str(), _description.str() ));
00157 }

Int32 osg::StatElemDescBase::getID ( void   )  [inline]

const IDString & osg::StatElemDescBase::getName ( void   )  [inline]

Definition at line 78 of file OSGStatElemDesc.inl.

References _name.

Referenced by osg::SimpleStatisticsForeground::draw().

00079 { 
00080   return _name; 
00081 }

const IDString & osg::StatElemDescBase::getDescription ( void   )  [inline]

Definition at line 85 of file OSGStatElemDesc.inl.

References _description.

00086 { 
00087   return _description; 
00088 }

bool StatElemDescBase::operator< ( const StatElemDescBase other  )  const

Definition at line 192 of file OSGStatElemDesc.cpp.

00193 {
00194     return this < &other;
00195 }

virtual StatElem* osg::StatElemDescBase::createElem ( void   )  [private, pure virtual]

StatElemDescBase & StatElemDescBase::operator= ( const StatElemDescBase source  )  [private]

Definition at line 170 of file OSGStatElemDesc.cpp.

00171 {
00172     if (this == &source)
00173         return *this;
00174 
00175     // copy parts inherited from parent
00176     //*(static_cast<Inherited *>(this)) = source;
00177 
00178     // free mem alloced by members of 'this'
00179 
00180     // alloc new mem for members
00181 
00182     // copy 
00183 
00184   return *this;
00185 }


Friends And Related Function Documentation

friend class StatCollector [friend]

Definition at line 64 of file OSGStatElemDesc.h.


Member Data Documentation

std::vector< StatElemDescBase * > * StatElemDescBase::_descVec = 0 [static, private]

char StatElemDescBase::cvsid = "@(#)$Id: $" [static, private]

Definition at line 133 of file OSGStatElemDesc.h.

Referenced by getID(), print(), and StatElemDescBase().

Definition at line 135 of file OSGStatElemDesc.h.

Referenced by findDescByName(), getName(), and print().

Definition at line 137 of file OSGStatElemDesc.h.

Referenced by getDescription(), and print().


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

Generated on Mon Mar 17 12:15:09 2008 for OpenSG by  doxygen 1.5.5