RefCount Class Template Reference

Standard implementation of IRefCount. More...

#include <smartptr.h>

Inheritance diagram for RefCount:

IRefCount BodyReader BodyStream BodyWriter BodyWriter::StreamInfo BodyWriterHandler ClassRecord Component DataChunk Decrypt_Base Dictionary Encrypt_Base EssenceParser::WrappingConfig EssenceSink EssenceSource EssenceStreamDescriptor EssenceSubParser EssenceSubParserFactory FileParser GCReader GCReadHandler_Base GCWriter Hash_Base IndexEntry IndexManager IndexPos IndexSegment IndexTable KLVObject KLVReadHandler_Base Label MDObject MDObjectList MDOType MDTraits MDType MDValue Metadata MXFFile NewFileHandler Package ParserDescriptorList Partition PartitionInfo Primer ReorderIndex SmartPtr::__RefCounter SymbolSpace Track TypeRecord UL UMID UUID VBILine WrappingOption List of all members.

Protected Types

typedef ParentPtr< T > LocalParent
 Parent pointer to this type.
typedef std::list< LocalParent * > LocalParentList
 List of pointers to parent pointers.

Protected Member Functions

virtual void __IncRefCount ()
 Increment the number of references.
virtual void __DecRefCount ()
 Decrement the number of references, if none left delete the object.
virtual T * GetPtr ()
 Get a pointer to the object.
virtual IRefCount< T > * GetRef ()
 Get a pointer to the object.
virtual void __DestroyRef ()
 Destroy the object.
virtual void AddRef (ParentPtr< T > &Ptr)
 Add a parent pointer to this object.
virtual void DeleteRef (ParentPtr< T > &Ptr)
 Delete a parent pointer to this object.
 RefCount ()
 Constructor for the RefCount class.
virtual ~RefCount ()
 Clear all parent pointers when we are destroyed.
virtual void ClearParents (void)
 Clear all parent pointers.

Protected Attributes

int __m_counter
 The actual reference count.
LocalParentListParentPointers
 List of parent pointers to this object.

Detailed Description

template<class T>
class mxflib::RefCount< T >

Standard implementation of IRefCount.

Classes derived from RefCount will contain their own reference counting implementation and allow more efficient memory use.

Usage:
To derive a class from RefCount use:
class MyClass : public RefCount<MyClass> {...};
Note:
It is not necessary to derive a class from RefCount to use it with SmartPtr, but it makes more efficient use of memory if you do.


Member Typedef Documentation

typedef ParentPtr<T> LocalParent [protected]

Parent pointer to this type.

typedef std::list<LocalParent*> LocalParentList [protected]

List of pointers to parent pointers.


Constructor & Destructor Documentation

RefCount (  )  [inline, protected]

Constructor for the RefCount class.

virtual ~RefCount (  )  [inline, protected, virtual]

Clear all parent pointers when we are destroyed.


Member Function Documentation

virtual void __IncRefCount (  )  [inline, protected, virtual]

Increment the number of references.

Implements IRefCount.

virtual void __DecRefCount (  )  [inline, protected, virtual]

Decrement the number of references, if none left delete the object.

Implements IRefCount.

virtual T* GetPtr (  )  [inline, protected, virtual]

Get a pointer to the object.

Implements IRefCount.

virtual IRefCount<T>* GetRef (  )  [inline, protected, virtual]

Get a pointer to the object.

Implements IRefCount.

virtual void __DestroyRef (  )  [inline, protected, virtual]

Destroy the object.

Called once all references have gone

Reimplemented in SmartPtr::__RefCounter.

virtual void AddRef ( ParentPtr< T > &  Ptr  )  [inline, protected, virtual]

Add a parent pointer to this object.

Implements IRefCount.

virtual void DeleteRef ( ParentPtr< T > &  Ptr  )  [inline, protected, virtual]

Delete a parent pointer to this object.

Implements IRefCount.

void ClearParents ( void   )  [protected, virtual]

Clear all parent pointers.

Implements IRefCount.


Member Data Documentation

int __m_counter [protected]

The actual reference count.

LocalParentList* ParentPointers [protected]

List of parent pointers to this object.


The documentation for this class was generated from the following file:
Generated on Mon Apr 2 15:21:02 2007 for MXFLib by  doxygen 1.5.1-p1