NAME

OTC_ResPtr - Smart pointer to help manage a resource.

SYNOPSIS


#include <OTC/refcnt/resptr.hh>

template<class T>
class OTC_ResPtr : public OTC_CResPtr<T>
{
  public:
    inline OTC_ResPtr();
    inline OTC_ResPtr(T* theItem);
    inline OTC_ResPtr(OTC_ResPtr<T> const& theRP);
    inline T* item() const;
    inline T* operator->() const;
    inline operator T*() const;
    inline T& operator*() const;
    inline OTC_ResPtr<T>& operator=(T* theItem);
    inline OTC_ResPtr<T>& operator=(OTC_ResPtr<T> const& theRP);
};

CLASS TYPE

Concrete

DESCRIPTION

Designed to manage classes which contain the ability to keep a reference count, such as classes derived from OTC_Resource.

CONSTRUCTION

inline OTC_ResPtr();
inline OTC_ResPtr(T* theItem);
inline OTC_ResPtr(OTC_ResPtr<T> const& theRP);

ACCESS

inline T* item() const;
inline T* operator->() const;
inline operator T*() const;
inline T& operator*() const;

ASSIGNMENT

With all the following, the object being assigned to this class will have its reference count incremented, the count on the currently held object will be decremented and if it is no longer required, it will be deleted.
inline OTC_ResPtr<T>& operator=(T* theItem);
inline OTC_ResPtr<T>& operator=(OTC_ResPtr<T> const& theRP);

SEE ALSO

OTC_Resource

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1991 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED