NAME
OTC_CtrPtr -
Smart pointer to help manage resources.
SYNOPSIS
#include <OTC/refcnt/ctrptr.hh>
template<class T>
class OTC_CtrPtr : public OTC_CCtrPtr<T>
{
public:
inline OTC_CtrPtr();
inline OTC_CtrPtr(T* theItem);
inline OTC_CtrPtr(OTC_CtrPtr<T> const& theCtrPtr);
inline T* item() const;
inline T* operator->() const;
inline operator T*() const;
inline T& operator*() const;
inline OTC_CtrPtr<T>& operator=(OTC_CtrPtr<T> const& theCtrPtr);
inline OTC_CtrPtr<T>& operator=(T* theItem);
};
CLASS TYPE
Concrete
DESCRIPTION
Designed to manage classes which do not contain the ability to
keep a reference count.
CONSTRUCTION
inline OTC_CtrPtr();
Creates a nil pointer class.
inline OTC_CtrPtr(T* theItem);
Creates a pointer class for theItem.
inline OTC_CtrPtr(OTC_CtrPtr<T> const& theCtrPtr);
Creates a pointer class for the
object pointed to by theCtrPtr.
ACCESS
inline T* item() const;
Returns the object being pointed at.
inline T* operator->() const;
Returns the object being pointed at.
If no item is held, an exception
is raised.
inline operator T*() const;
Returns the object being pointed at.
inline T& operator*() const;
Returns a reference to the item being
held. If no item is held, an exception
is raised.
ASSIGNMENT
With all the following, the count on the currently held
object will be decremented, and if it is no longer required,
it will be deleted.
inline OTC_CtrPtr<T>& operator=(OTC_CtrPtr<T> const& theCtrPtr);
Sets this class to point at the object
held by theCtrPtr.
inline OTC_CtrPtr<T>& operator=(T* theItem);
Sets this class to point at theItem.
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1991 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED