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

osg::DynFieldAttachment< AttachmentDescT > Class Template Reference
[Field Container]

#include <OSGAttachmentImpl.h>

List of all members.

General Fieldcontainer Declaration

*virtual osg::FieldContainerTypegetType (void)
virtual const osg::FieldContainerTypegetType (void) const
virtual osg::FieldContainerPtr shallowCopy (void) const
virtual osg::UInt32 getContainerSize (void) const
static osg::FieldContainerTypegetClassType (void)
static osg::UInt32 getClassTypeId (void)
static PtrType create (void)
static PtrType createEmpty (void)

Public Types

typedef DynFieldAttachment<
AttachmentDescT > 
Self
typedef AttachmentDescT::ParentPtr ParentPtrType
typedef FCPtr< ParentPtrType,
Self
PtrType

Public Member Functions

Dynamic Field Access
*UInt32 addField (const FieldDescription &fieldDesc)
void subField (UInt32 fieldId)
FieldgetDynamicField (UInt32 index)
Clone
*FieldContainerPtr emptyCopy (void)
FieldContainerPtr clone (void)
Dump
*virtual void dump (UInt32 uiIndent=0, const BitVector bvFlags=0) const

Protected Types

typedef AttachmentDescT::Parent Inherited

Protected Member Functions

Constructors
DynFieldAttachment (void)
 DynFieldAttachment (const DynFieldAttachment &source)
Destructors
*virtual ~DynFieldAttachment (void)

Protected Attributes

Member
*FieldContainerType _localType
std::vector< Field * > _dynFieldsV

Static Protected Attributes

Type information
*static FieldContainerType _type

Private Member Functions

void operator= (const DynFieldAttachment &source)
 prohibit default functions (move to 'public' if needed)

Friends

class FieldContainer


Detailed Description

template<class AttachmentDescT>
class osg::DynFieldAttachment< AttachmentDescT >

Template to build simple attachment classes which store an arbitrary number of fields.

Definition at line 382 of file OSGAttachmentImpl.h.


Member Typedef Documentation

template<class AttachmentDescT>
typedef DynFieldAttachment<AttachmentDescT> osg::DynFieldAttachment< AttachmentDescT >::Self
 

Definition at line 388 of file OSGAttachmentImpl.h.

template<class AttachmentDescT>
typedef AttachmentDescT::ParentPtr osg::DynFieldAttachment< AttachmentDescT >::ParentPtrType
 

Definition at line 390 of file OSGAttachmentImpl.h.

template<class AttachmentDescT>
typedef FCPtr<ParentPtrType, Self > osg::DynFieldAttachment< AttachmentDescT >::PtrType
 

Definition at line 392 of file OSGAttachmentImpl.h.

template<class AttachmentDescT>
typedef AttachmentDescT::Parent osg::DynFieldAttachment< AttachmentDescT >::Inherited [protected]
 

Definition at line 431 of file OSGAttachmentImpl.h.


Constructor & Destructor Documentation

template<class AttachmentDescT>
osg::DynFieldAttachment< AttachmentDescT >::DynFieldAttachment void   )  [inline, protected]
 

Definition at line 471 of file OSGAttachmentImpl.inl.

00471                                                             :
00472      Inherited (     ),
00473     _localType (_type),
00474     _dynFieldsV(     )
00475 {
00476 }

template<class AttachmentDescT>
osg::DynFieldAttachment< AttachmentDescT >::DynFieldAttachment const DynFieldAttachment< AttachmentDescT > &  source  )  [inline, protected]
 

Definition at line 479 of file OSGAttachmentImpl.inl.

00480                                       :
00481 
00482      Inherited ( source            ),
00483     _localType (_type              ),
00484     _dynFieldsV( source._dynFieldsV) // Do a real copy soon ;-)
00485 {
00486 }

template<class AttachmentDescT>
osg::DynFieldAttachment< AttachmentDescT >::~DynFieldAttachment void   )  [inline, protected, virtual]
 

Definition at line 492 of file OSGAttachmentImpl.inl.

00493 {
00494 }


Member Function Documentation

template<class AttachmentDescT>
* virtual osg ::FieldContainerType& osg::DynFieldAttachment< AttachmentDescT >::getType void   )  [virtual]
 

Referenced by osg::DynFieldAttachment< AttachmentDescT >::dump().

template<class AttachmentDescT>
const FieldContainerType & osg::DynFieldAttachment< AttachmentDescT >::getType void   )  const [inline, virtual]
 

Definition at line 318 of file OSGAttachmentImpl.inl.

References osg::DynFieldAttachment< AttachmentDescT >::_localType.

00319 {
00320     return _localType;
00321 }

template<class AttachmentDescT>
static osg ::FieldContainerType& osg::DynFieldAttachment< AttachmentDescT >::getClassType void   )  [static]
 

Referenced by osg::Image::attachmentCount(), osg::Image::findAttachmentField(), osg::VRMLNodeDesc::getFieldAndDesc(), osg::Image::hasAttachment(), and osg::Image::setAttachmentField().

template<class AttachmentDescT>
static osg ::UInt32 osg::DynFieldAttachment< AttachmentDescT >::getClassTypeId void   )  [static]
 

template<class AttachmentDescT>
static PtrType osg::DynFieldAttachment< AttachmentDescT >::create void   )  [static]
 

Referenced by osg::VRMLViewpointDesc::init(), osg::VRMLInlineDesc::init(), osg::VRMLExtrusionDesc::init(), osg::VRMLGroupDesc::init(), osg::VRMLSwitchDesc::init(), osg::VRMLLODDesc::init(), osg::VRMLAppearanceDesc::init(), osg::VRMLGeometryObjectDesc::init(), osg::VRMLGeometryPartDesc::init(), osg::VRMLGeometryPointSetDesc::init(), osg::VRMLGeometryDesc::init(), osg::VRMLShapeDesc::init(), osg::VRMLNodeDesc::init(), and osg::Image::setAttachmentField().

template<class AttachmentDescT>
static PtrType osg::DynFieldAttachment< AttachmentDescT >::createEmpty void   )  [static]
 

template<class AttachmentDescT>
virtual osg ::FieldContainerPtr osg::DynFieldAttachment< AttachmentDescT >::shallowCopy void   )  const [virtual]
 

template<class AttachmentDescT>
virtual osg ::UInt32 osg::DynFieldAttachment< AttachmentDescT >::getContainerSize void   )  const [virtual]
 

template<class AttachmentDescT>
UInt32 osg::DynFieldAttachment< AttachmentDescT >::addField const FieldDescription fieldDesc  )  [inline]
 

Definition at line 327 of file OSGAttachmentImpl.inl.

References osg::DynFieldAttachment< AttachmentDescT >::_dynFieldsV, osg::DynFieldAttachment< AttachmentDescT >::_localType, osg::FieldContainerType::addDescription(), osg::FieldFactory::createField(), osg::FieldContainerType::getFieldDescription(), osg::FieldDescription::getTypeId(), osg::FieldDescription::setFieldId(), osg::FieldDescription::setFieldMask(), and osg::FieldFactory::the().

00329 {
00330     UInt32            returnValue = 0;
00331     Field            *fieldP      = NULL;
00332     FieldDescription *descP       = NULL;
00333 
00334     returnValue = _localType.addDescription(fieldDesc);
00335 
00336     if(returnValue != 0)
00337     {
00338         descP = _localType.getFieldDescription(returnValue);
00339 
00340         if(descP != NULL)
00341         {
00342             descP->setFieldId  (returnValue);
00343             descP->setFieldMask(
00344                         TypeTraits<BitVector>::One << returnValue);
00345 
00346             fieldP = FieldFactory::the().createField(fieldDesc.getTypeId());
00347 
00348             if(_dynFieldsV.size() <=
00349                returnValue - Inherited::NextFieldId)
00350             {
00351                 _dynFieldsV.resize((returnValue -
00352                                     Inherited::NextFieldId) + 1);
00353             }
00354 
00355             _dynFieldsV[returnValue - Inherited::NextFieldId] = fieldP;
00356         }
00357     }
00358 
00359     return returnValue;
00360 }

template<class AttachmentDescT>
void osg::DynFieldAttachment< AttachmentDescT >::subField UInt32  fieldId  )  [inline]
 

Definition at line 363 of file OSGAttachmentImpl.inl.

References osg::DynFieldAttachment< AttachmentDescT >::_dynFieldsV, osg::DynFieldAttachment< AttachmentDescT >::_localType, and osg::FieldContainerType::subDescription().

00364 {
00365     if(_localType.subDescription(fieldId) == true)
00366     {
00367         std::vector<Field *>::iterator vIt = _dynFieldsV.begin();
00368 
00369         vIt += fieldId - Inherited::NextFieldId;
00370 
00371         if(vIt != _dynFieldsV.end())
00372         {
00373             delete (*vIt);
00374 
00375             (*vIt) = NULL;
00376         }
00377     }
00378 }

template<class AttachmentDescT>
Field * osg::DynFieldAttachment< AttachmentDescT >::getDynamicField UInt32  index  )  [inline]
 

Definition at line 381 of file OSGAttachmentImpl.inl.

References osg::DynFieldAttachment< AttachmentDescT >::_dynFieldsV.

Referenced by osg::VRMLViewpointDesc::init(), osg::VRMLNodeDesc::prototypeAddField(), and osg::Image::setAttachmentField().

00383 {
00384     return _dynFieldsV[index - Inherited::NextFieldId];
00385 }

template<class AttachmentDescT>
FieldContainerPtr osg::DynFieldAttachment< AttachmentDescT >::emptyCopy void   )  [inline]
 

Definition at line 391 of file OSGAttachmentImpl.inl.

References osg::DynFieldAttachment< AttachmentDescT >::_localType, osg::FieldContainerType::getFieldDescription(), and osg::FieldContainerType::getNumFieldDescs().

00392 {
00393     PtrType returnValue = DynFieldAttachment<AttachmentDescT>::createEmpty();
00394 
00395     for(UInt32 i  = Inherited::NextFieldId;
00396                i <= _localType.getNumFieldDescs();
00397                i++)
00398     {
00399         returnValue->addField(*(_localType.getFieldDescription(i)));
00400     }
00401 
00402     return returnValue;
00403 }

template<class AttachmentDescT>
FieldContainerPtr osg::DynFieldAttachment< AttachmentDescT >::clone void   )  [inline]
 

Definition at line 406 of file OSGAttachmentImpl.inl.

References osg::DynFieldAttachment< AttachmentDescT >::_dynFieldsV, osg::DynFieldAttachment< AttachmentDescT >::_localType, osg::FieldContainerType::getFieldDescription(), and osg::FieldContainerType::getNumFieldDescs().

00407 {
00408     PtrType returnValue = DynFieldAttachment<AttachmentDescT>::createEmpty();
00409     UInt32  i;
00410 
00411     for(i  = Inherited::NextFieldId;
00412         i <= _localType.getNumFieldDescs();
00413         i++)
00414     {
00415         returnValue->addField(*(_localType.getFieldDescription(i)));
00416     }
00417 
00418     for(i  = Inherited::NextFieldId;
00419         i <= _localType.getNumFieldDescs();
00420         i++)
00421     {
00422         returnValue->getDynamicField(i)->setAbstrValue(
00423             *(_dynFieldsV[i - Inherited::NextFieldId]));
00424     }
00425 
00426     return returnValue;
00427 }

template<class AttachmentDescT>
void osg::DynFieldAttachment< AttachmentDescT >::dump UInt32  uiIndent = 0,
const BitVector  bvFlags = 0
const [inline, virtual]
 

Definition at line 433 of file OSGAttachmentImpl.inl.

References osg::FieldDescription::getCName(), osg::FieldContainerType::getFieldDescription(), osg::FieldContainerType::getNumFieldDescs(), osg::DynFieldAttachment< AttachmentDescT >::getType(), osg::indentLog(), and PLOG.

00435 {
00436     PtrType thisP(*this);
00437 
00438     indentLog(uiIndent, PLOG);
00439     PLOG << "DynFieldAttachment"
00440          << "(" 
00441          << thisP.getFieldContainerId()
00442          << ")" 
00443          << std::endl;
00444 
00445     indentLog(uiIndent, PLOG);
00446     PLOG << "{" << std::endl;
00447 
00448     uiIndent += 4;
00449 
00450     for(UInt32 i = 1; i <= getType().getNumFieldDescs(); i++)
00451     {
00452         indentLog(uiIndent, PLOG);
00453         PLOG <<      getType().getFieldDescription(i)->getCName ()
00454              << " ("
00455              << const_cast<Self *>(this)->getField(
00456                      getType().getFieldDescription(i)->getFieldId())
00457              << ")"
00458              << std::endl;
00459     }
00460 
00461     uiIndent -= 4;
00462 
00463     indentLog(uiIndent, PLOG);
00464     PLOG << "}" << std::endl;
00465 }

template<class AttachmentDescT>
void osg::DynFieldAttachment< AttachmentDescT >::operator= const DynFieldAttachment< AttachmentDescT > &  source  )  [private]
 


Friends And Related Function Documentation

template<class AttachmentDescT>
friend class FieldContainer [friend]
 

Definition at line 468 of file OSGAttachmentImpl.h.


Member Data Documentation

template<class AttachmentDescT>
* static FieldContainerType osg::DynFieldAttachment< AttachmentDescT >::_type [static, protected]
 

Definition at line 437 of file OSGAttachmentImpl.h.

template<class AttachmentDescT>
* FieldContainerType osg::DynFieldAttachment< AttachmentDescT >::_localType [protected]
 

Definition at line 444 of file OSGAttachmentImpl.h.

Referenced by osg::DynFieldAttachment< AttachmentDescT >::addField(), osg::DynFieldAttachment< AttachmentDescT >::clone(), osg::DynFieldAttachment< AttachmentDescT >::emptyCopy(), osg::DynFieldAttachment< AttachmentDescT >::getType(), and osg::DynFieldAttachment< AttachmentDescT >::subField().

template<class AttachmentDescT>
std::vector<Field *> osg::DynFieldAttachment< AttachmentDescT >::_dynFieldsV [protected]
 

Definition at line 446 of file OSGAttachmentImpl.h.

Referenced by osg::DynFieldAttachment< AttachmentDescT >::addField(), osg::DynFieldAttachment< AttachmentDescT >::clone(), osg::DynFieldAttachment< AttachmentDescT >::getDynamicField(), and osg::DynFieldAttachment< AttachmentDescT >::subField().


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