UCommon
ost::RefObject Class Referenceabstract

A reference countable object. More...

#include <object.h>

Public Member Functions

virtual void * getObject (void)=0
 The actual object being managed can be returned by this method as a void and then recast to the actual type.
 

Protected Member Functions

 RefObject ()
 The constructor simply initializes the count.
 
virtual ~RefObject ()
 The destructor is called when the reference count returns to zero.
 

Protected Attributes

unsigned refCount
 

Friends

class RefPointer
 

Detailed Description

A reference countable object.

This is used in association with smart pointers (RefPointer).

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Object managed by smart pointer reference count.

Definition at line 64 of file object.h.

Constructor & Destructor Documentation

◆ RefObject()

ost::RefObject::RefObject ( )
inlineprotected

The constructor simply initializes the count.

Definition at line 77 of file object.h.

◆ ~RefObject()

virtual ost::RefObject::~RefObject ( )
protectedvirtual

The destructor is called when the reference count returns to zero.

This is done through a virtual destructor.

Member Function Documentation

◆ getObject()

virtual void * ost::RefObject::getObject ( void )
pure virtual

The actual object being managed can be returned by this method as a void and then recast to the actual type.

This removes the need to dynamic cast from RefObject and the dependence on rtti this implies.

Returns
underlying object being referenced.

Friends And Related Symbol Documentation

◆ RefPointer

friend class RefPointer
friend

Definition at line 70 of file object.h.

Field Documentation

◆ refCount

unsigned ost::RefObject::refCount
protected

Definition at line 72 of file object.h.


The documentation for this class was generated from the following file: