Edinburgh Speech Tools 2.4-release
 
Loading...
Searching...
No Matches
EST_THandle< BoxT, ObjectT > Class Template Reference

#include <include/EST_THandle.h>

Public Member Functions

 EST_THandle (BoxT *p)
 
 EST_THandle (const EST_THandle &cp)
 
bool null () const
 
int shareing (void) const
 
EST_THandleoperator= (EST_THandle h)
 
EST_THandleoperator= (BoxT *t_ptr)
 
 operator ObjectT * ()
 
 operator const ObjectT * () const
 
int operator== (const BoxT *p) const
 
int operator!= (const BoxT *p) const
 
const ObjectToperator* () const
 
ObjectToperator* ()
 
const ObjectToperator-> () const
 
ObjectToperator-> ()
 

Friends

int operator== (const EST_THandle< BoxT, ObjectT > &a, const EST_THandle< BoxT, ObjectT > &b)
 
int operator!= (const EST_THandle< BoxT, ObjectT > &a, const EST_THandle< BoxT, ObjectT > &b)
 
ostreamoperator<< (ostream &s, const EST_THandle< BoxT, ObjectT > &a)
 

Detailed Description

template<class BoxT, class ObjectT>
class EST_THandle< BoxT, ObjectT >

A ‘smart’ pointer which does reference counting.

Behaves almost like a pointer as far as naive code is concerned, but keeps count of how many handles are holding on to the contents and deletes it when there are none.

You need to be careful there are no dumb C++ pointers to things which are being handled this way.

Things to be handled should implement the same interface as EST_Handleable (either by taking that as a superclass or by reimplementing it) and in addition define {\tt object_ptr()}. See EST_TBox for an example.

There are two parameter types. In most cases the thing which contains the reference count and the data it represents will be the same object, but in the case of boxed values it may not be, so you can specify the type of both independently.

See also
EST_Handleable
EST_TBox
EST_THandle:example
Author
Richard Caley rjc@c.nosp@m.str..nosp@m.ed.ac.nosp@m..uk
Version
Id
EST_THandle.h,v 1.5 2006/07/19 21:52:12 awb Exp

Definition at line 71 of file EST_THandle.h.

Constructor & Destructor Documentation

◆ EST_THandle() [1/3]

Definition at line 78 of file EST_THandle.h.

◆ EST_THandle() [2/3]

template<class BoxT , class ObjectT >
EST_THandle< BoxT, ObjectT >::EST_THandle ( BoxT p)
inline

Definition at line 80 of file EST_THandle.h.

◆ EST_THandle() [3/3]

Definition at line 82 of file EST_THandle.h.

◆ ~EST_THandle()

template<class BoxT , class ObjectT >
EST_THandle< BoxT, ObjectT >::~EST_THandle ( void  )
inline

Definition at line 88 of file EST_THandle.h.

Member Function Documentation

◆ null()

template<class BoxT , class ObjectT >
bool EST_THandle< BoxT, ObjectT >::null ( ) const
inline

Definition at line 95 of file EST_THandle.h.

◆ shareing()

template<class BoxT , class ObjectT >
int EST_THandle< BoxT, ObjectT >::shareing ( void  ) const
inline

Definition at line 97 of file EST_THandle.h.

◆ operator=() [1/2]

Definition at line 99 of file EST_THandle.h.

◆ operator=() [2/2]

template<class BoxT , class ObjectT >
EST_THandle & EST_THandle< BoxT, ObjectT >::operator= ( BoxT t_ptr)
inline

Definition at line 114 of file EST_THandle.h.

◆ operator ObjectT *()

Definition at line 126 of file EST_THandle.h.

◆ operator const ObjectT *()

template<class BoxT , class ObjectT >
EST_THandle< BoxT, ObjectT >::operator const ObjectT * ( ) const
inline

Definition at line 130 of file EST_THandle.h.

◆ operator==()

template<class BoxT , class ObjectT >
int EST_THandle< BoxT, ObjectT >::operator== ( const BoxT p) const
inline

Definition at line 135 of file EST_THandle.h.

◆ operator!=()

template<class BoxT , class ObjectT >
int EST_THandle< BoxT, ObjectT >::operator!= ( const BoxT p) const
inline

Definition at line 136 of file EST_THandle.h.

◆ operator*() [1/2]

template<class BoxT , class ObjectT >
const ObjectT & EST_THandle< BoxT, ObjectT >::operator* ( ) const
inline

Definition at line 138 of file EST_THandle.h.

◆ operator*() [2/2]

template<class BoxT , class ObjectT >
ObjectT & EST_THandle< BoxT, ObjectT >::operator* ( )
inline

Definition at line 139 of file EST_THandle.h.

◆ operator->() [1/2]

template<class BoxT , class ObjectT >
const ObjectT * EST_THandle< BoxT, ObjectT >::operator-> ( ) const
inline

Definition at line 140 of file EST_THandle.h.

◆ operator->() [2/2]

template<class BoxT , class ObjectT >
ObjectT * EST_THandle< BoxT, ObjectT >::operator-> ( )
inline

Definition at line 141 of file EST_THandle.h.

Friends And Related Symbol Documentation

◆ operator==

template<class BoxT , class ObjectT >
int operator== ( const EST_THandle< BoxT, ObjectT > &  a,
const EST_THandle< BoxT, ObjectT > &  b 
)
friend

Definition at line 143 of file EST_THandle.h.

◆ operator!=

template<class BoxT , class ObjectT >
int operator!= ( const EST_THandle< BoxT, ObjectT > &  a,
const EST_THandle< BoxT, ObjectT > &  b 
)
friend

Definition at line 145 of file EST_THandle.h.

◆ operator<<

template<class BoxT , class ObjectT >
ostream & operator<< ( ostream s,
const EST_THandle< BoxT, ObjectT > &  a 
)
friend

Definition at line 148 of file EST_THandle.h.


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