Ceylan::CountedPointer< T > Class Template Reference

#include <CeylanCountedPointer.h>

Inheritance diagram for Ceylan::CountedPointer< T >:
Inheritance graph
[legend]
Collaboration diagram for Ceylan::CountedPointer< T >:
Collaboration graph
[legend]

List of all members.

Classes

struct  Referent
 Second: implementation. More...

Public Types

typedef T ElementType
 The counted object (wrapped resource) type.
enum  TextOutputFormat { rawText, html }
 

Defines what text output formats for TextDisplayable instances are available.

More...

Public Member Functions

 CountedPointer (ElementType *resourcePointer=0)
 CountedPointer (const CountedPointer< T > &source)
 Copy constructor.
CountedPointer< T > & operator= (const CountedPointer< T > &source)
 ~CountedPointer () throw ()
 Destructor of a counted pointer, decreases the reference count which may lead to deallocation of resource.
ElementTypeoperator* () const
 Dereferences the counted pointer to access the wrapped resource, and returns a reference to this resource.
ElementTypeoperator-> () const
 Returns the wrapped resource pointer.
ElementTypeget () const
 Returns the wrapped resource pointer.
bool isUnique () const
 Tells whether the reference count for the wrapped resource is exactly 1.
ReferenceCount getReferenceCount () const
 Returns the reference count for this counted pointer.
virtual const std::string toString (VerbosityLevels level=high) const
 Returns a user-friendly description of this counted pointer.

Static Public Member Functions

static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

void reset (Referent *refPointer)
 Each CountedPointer has therefore a member: Referent * _referent ;.
void setReferent (Referent *refPointer)
 Sets the referent for this counter pointer.
void release ()
 Release a reference to the wrapped resource.

Private Attributes

struct
Ceylan::CountedPointer::Referent
_referent
 Second: implementation.

Detailed Description

template<typename T>
class Ceylan::CountedPointer< T >

Definition at line 161 of file CeylanCountedPointer.h.


Member Typedef Documentation

template<typename T>
typedef T Ceylan::CountedPointer< T >::ElementType

The counted object (wrapped resource) type.

Definition at line 172 of file CeylanCountedPointer.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

template<typename T>
Ceylan::CountedPointer< T >::CountedPointer ( ElementType resourcePointer = 0  )  [inline]
template<typename T>
Ceylan::CountedPointer< T >::CountedPointer ( const CountedPointer< T > &  source  )  [inline]

Copy constructor.

The two instances of counted pointer will refer to the same referent.

Definition at line 221 of file CeylanCountedPointer.h.

References Ceylan::CountedPointer< T >::_referent, and Ceylan::CountedPointer< T >::setReferent().

template<typename T>
Ceylan::CountedPointer< T >::~CountedPointer (  )  throw () [inline]

Destructor of a counted pointer, decreases the reference count which may lead to deallocation of resource.

Note:
Should not specifically be called explicitly under normal use.

Definition at line 270 of file CeylanCountedPointer.h.

References Ceylan::CountedPointer< T >::release().


Member Function Documentation

template<typename T>
ElementType* Ceylan::CountedPointer< T >::get (  )  const [inline]

Returns the wrapped resource pointer.

Definition at line 310 of file CeylanCountedPointer.h.

References Ceylan::CountedPointer< T >::_referent, and Ceylan::CountedPointer< T >::Referent::_resourcePointer.

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]
template<typename T>
ReferenceCount Ceylan::CountedPointer< T >::getReferenceCount (  )  const [inline]

Returns the reference count for this counted pointer.

Definition at line 337 of file CeylanCountedPointer.h.

References Ceylan::CountedPointer< T >::Referent::_refCount, and Ceylan::CountedPointer< T >::_referent.

template<typename T>
bool Ceylan::CountedPointer< T >::isUnique (  )  const [inline]

Tells whether the reference count for the wrapped resource is exactly 1.

Definition at line 324 of file CeylanCountedPointer.h.

References Ceylan::CountedPointer< T >::Referent::_refCount, and Ceylan::CountedPointer< T >::_referent.

template<typename T>
ElementType& Ceylan::CountedPointer< T >::operator* (  )  const [inline]

Dereferences the counted pointer to access the wrapped resource, and returns a reference to this resource.

Definition at line 284 of file CeylanCountedPointer.h.

template<typename T>
ElementType* Ceylan::CountedPointer< T >::operator-> (  )  const [inline]

Returns the wrapped resource pointer.

Definition at line 297 of file CeylanCountedPointer.h.

template<typename T>
CountedPointer<T>& Ceylan::CountedPointer< T >::operator= ( const CountedPointer< T > &  source  )  [inline]
template<typename T>
void Ceylan::CountedPointer< T >::release (  )  [inline, private]
template<typename T>
void Ceylan::CountedPointer< T >::reset ( Referent refPointer  )  [inline, private]

Each CountedPointer has therefore a member: Referent * _referent ;.

Releases one reference and sets the referent to the specified one.

Definition at line 543 of file CeylanCountedPointer.h.

References Ceylan::CountedPointer< T >::release(), and Ceylan::CountedPointer< T >::setReferent().

Referenced by Ceylan::CountedPointer< T >::operator=().

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

template<typename T>
void Ceylan::CountedPointer< T >::setReferent ( Referent refPointer  )  [inline, private]
const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

template<typename T>
virtual const std::string Ceylan::CountedPointer< T >::toString ( VerbosityLevels  level = high  )  const [inline, virtual]

Member Data Documentation

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

template<typename T>
struct Ceylan::CountedPointer::Referent * Ceylan::CountedPointer< T >::_referent [private]

The documentation for this class was generated from the following file:
Generated on Mon Nov 29 13:40:19 2010 for Ceylan by  doxygen 1.6.3