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

CTPointerBase Class Reference
[This and That]

Base class for the smart pointer template class. More...

#include <ctpointer.h>

Inheritance diagram for CTPointerBase:

CTPointer< T > List of all members.

Public Member Functions

virtual ~CTPointerBase ()
void setDescription (string descr)
const string & description () const
void setObjectDescription (string descr)
string objectDescription () const
int referenceCount () const
bool operator== (const CTPointerBase &p) const
bool sharingData (const CTPointerBase &p) const
bool operator!= (const CTPointerBase &p) const
virtual void * voidptr () const
void setAutoDelete (bool b)
bool isValid () const

Detailed Description

Base class for the smart pointer template class.

This is the base class to be inherited by a template class. This cannot be used directly.

Author:
Martin Preuss<martin@libchipcard.de>


Constructor & Destructor Documentation

virtual CTPointerBase::~CTPointerBase  )  [inline, virtual]
 

Destructor. If this one gets called, it automagically decrements the usage counter of the object pointed to. If it reaches zero, then no other pointer points to the object and the object faces deletion.

Author:
Martin Preuss<martin@libchipcard.de>


Member Function Documentation

const string& CTPointerBase::description  )  const [inline]
 

Get the description of this pointer.

Useful for debugging purposes.

Author:
Martin Preuss<martin@libchipcard.de>

bool CTPointerBase::isValid  )  const [inline]
 

Returns true if this CTPointer is valid.

This tells you if this pointer is pointing to accessible data.

Author:
Martin Preuss<martin@libchipcard.de>
Returns:
true if data is accessible, false if no data

string CTPointerBase::objectDescription  )  const [inline]
 

Returns the description of the object.

Useful for debugging purposes.

Author:
Martin Preuss<martin@libchipcard.de>

bool CTPointerBase::operator!= const CTPointerBase p  )  const [inline]
 

Inequality operator for the object pointed to.

This operator checks whether another pointer and this one are not pointing to the same data.

Author:
Martin Preuss<martin@libchipcard.de>

bool CTPointerBase::operator== const CTPointerBase p  )  const [inline]
 

Equality operator for the object pointed to.

This operator checks whether another pointer and this one are pointing to the same data.

Author:
Martin Preuss<martin@libchipcard.de>

int CTPointerBase::referenceCount  )  const [inline]
 

Returns the reference counter of the object.

Useful for debugging purposes.

Author:
Martin Preuss<martin@libchipcard.de>

void CTPointerBase::setAutoDelete bool  b  )  [inline]
 

Set the auto-deletion behaviour.

Set the auto-deletion behaviour of the CTPointerObject (the wrapper object around the "real" object pointed to) that is pointed to by this CTPointer.

By default, this is set to setAutoDeletion(true), i.e. the object will automatically be deleted when its last CTPointer gets deleted. On the other hand, when you call this with b=false, then the object this pointer points to will not be deleted by the last CTPointer.

This might be useful if you are pointing to constant objects, or if you need to continue using this object through raw pointers elsewhere.

This flag is a property of the CTPointerObject, i.e. even for multiple CTPointer's pointing to the same object there is only *one* autoDelete flag per object. Changes to this flag affect all of the CTPointer's at the same time.

This CTPointer MUST already point to an object (a NULL pointer is not allowed at this point) since the autodelete flag is a property of the class CTPointerObject. If called on an invalid CTPointer, this method will throw an CTError.

Parameters:
b True to set automatic deletion to be enabled, false to disable it.
Author:
Martin Preuss<martin@libchipcard.de>

void CTPointerBase::setDescription string  descr  )  [inline]
 

Set the description of this pointer.

Useful for debugging purposes.

Author:
Martin Preuss<martin@libchipcard.de>

void CTPointerBase::setObjectDescription string  descr  )  [inline]
 

Set the description of the object this pointer points to.

Useful for debugging purposes.

Author:
Martin Preuss<martin@libchipcard.de>

bool CTPointerBase::sharingData const CTPointerBase p  )  const [inline]
 

Checks whether both pointers share their data object.

Author:
Martin Preuss<martin@libchipcard.de>

virtual void* CTPointerBase::voidptr  )  const [inline, virtual]
 

Returns a raw pointer to the stored data.

You should not really use this, but if you do so please NEVER delete the object the pointer points to ! AND you should make sure that as long as you are using the pointer returned there is still a CTPointer pointing to it (because if the last CTPointer stops pointing to an object that object gets deleted) !!

Author:
Martin Preuss<martin@libchipcard.de>


The documentation for this class was generated from the following file:
Generated on Fri Dec 3 23:10:25 2004 for libchipcard by  doxygen 1.3.9.1