Synergy Color Management Component - SDK -  2018.0.80
SYNCOLOR::SharedPtr< T > Singleton Reference

Generic smart pointer. More...

Public Member Functions

 SharedPtr ()
 Empty constructor producing a null pointer. More...
 
 SharedPtr (T *t)
 Initialization constructor. More...
 
 SharedPtr (const SharedPtr &t)
 Copy Constructor. More...
 
 ~SharedPtr ()
 
SharedPtroperator= (const SharedPtr &t)
 Assignation operator. More...
 
T & operator* () const
 Dereferencing operator. More...
 
T * operator-> () const
 Dereferencing operator. More...
 
bool operator< (const SharedPtr &r) const
 Basic comparison operators. More...
 
bool operator== (const SharedPtr &r) const
 
bool operator!= (const SharedPtr &r) const
 
 operator bool () const
 Boolean operator. More...
 
long getUseCount () const
 Count of references to the underlying instance. More...
 
T * get () const
 Get the instance pointer. More...
 
void reset ()
 Release the underlying instance. More...
 
void reset (T *t)
 Reassign to a different instance. More...
 

Private Attributes

void * _data
 Opaque shared pointer data. More...
 

Detailed Description

template<class T>
singleton SYNCOLOR::SharedPtr< T >

Generic smart pointer.

Class that manages sharing of class instances. Implements a shared pointer where only the last instance holding a specific instance will delete it.

Constructor & Destructor Documentation

template<class T >
SYNCOLOR::SharedPtr< T >::SharedPtr ( )

Empty constructor producing a null pointer.

template<class T >
SYNCOLOR::SharedPtr< T >::SharedPtr ( T *  t)
explicit

Initialization constructor.

Parameters
tinstance to manage.
template<class T >
SYNCOLOR::SharedPtr< T >::SharedPtr ( const SharedPtr< T > &  t)

Copy Constructor.

The resulting SharedPtr shares the instance pointer with the SharedPtr passed as argument.

Parameters
tSharedPtr containing the pointer to share.
template<class T >
SYNCOLOR::SharedPtr< T >::~SharedPtr ( )

Destructor.

Member Function Documentation

template<class T >
SharedPtr& SYNCOLOR::SharedPtr< T >::operator= ( const SharedPtr< T > &  t)

Assignation operator.

The resulting SharedPtr shares the instance pointer with the SharedPtr passed as argument.

Parameters
tConstant SharedPtr to share.
Returns
Reference to the current instance.
template<class T >
T& SYNCOLOR::SharedPtr< T >::operator* ( ) const

Dereferencing operator.

Returns
Reference to the underlying instance.
template<class T >
T* SYNCOLOR::SharedPtr< T >::operator-> ( ) const

Dereferencing operator.

Returns
Pointer to the underlying instance.
template<class T >
bool SYNCOLOR::SharedPtr< T >::operator< ( const SharedPtr< T > &  r) const

Basic comparison operators.

template<class T >
SYNCOLOR::SharedPtr< T >::operator bool ( ) const

Boolean operator.

Returns
True if the SharedPtr contains a non-null pointer.
template<class T >
long SYNCOLOR::SharedPtr< T >::getUseCount ( ) const

Count of references to the underlying instance.

Returns
Number of SharedPtr instances with the same underlying pointer.
template<class T >
T* SYNCOLOR::SharedPtr< T >::get ( ) const

Get the instance pointer.

Returns
Pointer to the underlying instance.
template<class T >
void SYNCOLOR::SharedPtr< T >::reset ( )

Release the underlying instance.

The underlyingTemplatem instance is deleted if no other SharedPtr has the same pointer.

template<class T >
void SYNCOLOR::SharedPtr< T >::reset ( T *  t)

Reassign to a different instance.

The initial underlying instance is deleted if no other SharedPtr has the same pointer.

Parameters
tPointer to the instance to reassign to.

Member Data Documentation

template<class T >
void* SYNCOLOR::SharedPtr< T >::_data
private

Opaque shared pointer data.