| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes
TeSharedPtr< T > Class Template Reference

`#include <TeSharedPtr.h>`

List of all members.

## Public Member Functions

| TeSharedPtr ()
| Default Constructor( Shared mode ).
| TeSharedPtr (T *pointer)
| Alternative Constructor( Shared mode ).
| TeSharedPtr (const TeSharedPtr< T > &external)
| Alternative Constructor.
| TeSharedPtr (T &objectReference)
| Alternative Constructor( Not-shared mode ).
| TeSharedPtr (T *pointer, bool not_shared_flag)
| Alternative Constructor.
| ~TeSharedPtr ()
| Default Destructor.
bool | isActive () const
| Verifies if the current pointer points to an active object.
bool | isShared () const
| Verifies if the current pointer is shared.
void | reset ()
| Reset the active instance deleting any pointed object if the current instance is in shared mode and no more references to the pointed object exists.
void | reset (T *pointer)
| Reset the active instance the the new pointer (shared mode).
void | reset (T *pointer, bool not_shared_flag)
| Reset the active instance the the new pointer.
const TeSharedPtr< T > & | operator= (const TeSharedPtr< T > &external)
T & | operator* () const
| Operator * overload.
T * | operator-> () const
| Operator -> overload.
bool | operator== (const TeSharedPtr< T > &external) const
bool | operator< (const TeSharedPtr< T > &external) const
| Operator< overload.
bool | operator> (const TeSharedPtr< T > &external) const
| Operator> overload.
bool | operator!= (const TeSharedPtr< T > &external) const
T * | nakedPointer () const
| A Naked Pointer to the encapsulated object.
unsigned long int | getRefCount () const
| The number of current references to the pointed object.

## Protected Member Functions

void | init ()
| Set all internal variables to default values.

## Protected Attributes

TeMutex | this_lock_instance_
| This instance locking mutex.
TeMutex * | counter_lock_instance_ptr_
| A pointer to the shared counter locking mutex (default:0).
unsigned long int volatile * | counter_
| A pointer to the current number of active users of this pointer (default:0).
T * | reference_
| A pointer to the current object encapsulated by this shared pointer (default:0).
bool | not_shared_flag_
| A flag indicating if this shared pointer was created by a dynamic assignment ( false value ) or by a static assignment(if true, the encapsulated object will not be deleted when apropriate) (default:false).

## Detailed Description

### template<class T>
class TeSharedPtr< T >

Examples:

  TePDIClassification_test.cpp, TePDIContrast_test.cpp, TePDICorrelationMatching_test.cpp, TePDIFFT_test.cpp, TePDIFilterMask_test.cpp, TePDIMIMatching_test.cpp, TePDIMMIOMatching_test.cpp, TePDIOFMatching_test.cpp, TePDIPrincipalComponents_test.cpp, TePDIRaster2Vector_test.cpp, TePDIRegister_test.cpp, TePDISegmentation_test.cpp, TePDIUtils_test.cpp, and TePDIWavelets_test.cpp.

## Constructor & Destructor Documentation

template<class T >

TeSharedPtr< T >::TeSharedPtr | ( |  | ) | `[explicit]`

Default Constructor( Shared mode ).

template<class T>

TeSharedPtr< T >::TeSharedPtr | ( | T * | pointer | ) | `[explicit]`

Alternative Constructor( Shared mode ).

Parameters:

  pointer | A pointer the the active object.

template<class T>

TeSharedPtr< T >::TeSharedPtr | ( | const TeSharedPtr< T > & | external | ) |

Alternative Constructor.

Parameters:

  external | External shared pointer reference.

template<class T>

TeSharedPtr< T >::TeSharedPtr | ( | T & | objectReference | ) | `[explicit]`

Alternative Constructor( Not-shared mode ).

Parameters:

  objectReference | A reference to an existing object.

Note:
  By using this constructor this pointer instance will be constructed in not-shared mode and will not delete the object instance.

template<class T>

TeSharedPtr< T >::TeSharedPtr | ( | T * | pointer,
|  | bool | not_shared_flag
| ) |  | `[explicit]`

Alternative Constructor.

Deprecated:
  DEPRECATED - Will be removed in the future (Use the method TeSharedPtr( T& objectReference ) to construct pointers in not-shared mode ).

Parameters:

  pointer | A pointer the the active object.
  not_shared_flag | A flag indication for a static assignment ( the pointed object will not be deleted at the this object destruction ).

template<class T >

TeSharedPtr< T >::~TeSharedPtr | ( |  | ) |

Default Destructor.

## Member Function Documentation

template<class T >

unsigned long int TeSharedPtr< T >::getRefCount | ( |  | ) | const

The number of current references to the pointed object.

Returns:
  The number of current references to the pointed object.

template<class T >

void TeSharedPtr< T >::init | ( |  | ) | `[protected]`

Set all internal variables to default values.

template<class T>

bool TeSharedPtr< T >::isActive | ( |  | ) | const`[inline]`

Verifies if the current pointer points to an active object.

Returns:
  true if active, false if not.

template<class T>

bool TeSharedPtr< T >::isShared | ( |  | ) | const`[inline]`

Verifies if the current pointer is shared.

Returns:
  true if shared, false if not.

template<class T>

T* TeSharedPtr< T >::nakedPointer | ( |  | ) | const`[inline]`

A Naked Pointer to the encapsulated object.

Returns:
  The internal instance pointer.

template<class T>

bool TeSharedPtr< T >::operator!= | ( | const TeSharedPtr< T > & | external | ) | const`[inline]`

template<class T>

T& TeSharedPtr< T >::operator* | ( |  | ) | const`[inline]`

Operator * overload.

Returns:
  The pointed object reference.

template<class T>

T* TeSharedPtr< T >::operator-> | ( |  | ) | const`[inline]`

Operator -> overload.

Returns:
  The pointed object pointer.

template<class T>

bool TeSharedPtr< T >::operator< | ( | const TeSharedPtr< T > & | external | ) | const`[inline]`

Operator< overload.

Parameters:

  external | The external instance reference.

Returns:
  true if the current pointer pointed address has a lower value then the external shared pointer pointed address.

template<class T>

const TeSharedPtr< T > & TeSharedPtr< T >::operator= | ( | const TeSharedPtr< T > & | external | ) |

template<class T>

bool TeSharedPtr< T >::operator== | ( | const TeSharedPtr< T > & | external | ) | const`[inline]`

template<class T>

bool TeSharedPtr< T >::operator> | ( | const TeSharedPtr< T > & | external | ) | const`[inline]`

Operator> overload.

Parameters:

  external | The external instance reference.

Returns:
  true if the current pointer pointed address has a lower value then the external shared pointer pointed address.

template<class T>

void TeSharedPtr< T >::reset | ( | T * | pointer | ) | `[inline]`

Reset the active instance the the new pointer (shared mode).

Parameters:

  pointer | A pointer the the active object.

template<class T>

void TeSharedPtr< T >::reset | ( | T * | pointer,
|  | bool | not_shared_flag
| ) |  |

Reset the active instance the the new pointer.

Parameters:

  pointer | A pointer the the active object.
  not_shared_flag | A flag indication for a static assignment ( the pointed object will not be deleted at the this object destruction ).

template<class T>

void TeSharedPtr< T >::reset | ( |  | ) | `[inline]`

Reset the active instance deleting any pointed object if the current instance is in shared mode and no more references to the pointed object exists.

Examples:
  TePDIRegister_test.cpp.

## Member Data Documentation

template<class T>

unsigned long int volatile* TeSharedPtr< T >::counter_`[mutable, protected]`

A pointer to the current number of active users of this pointer (default:0).

template<class T>

TeMutex* TeSharedPtr< T >::counter_lock_instance_ptr_`[mutable, protected]`

A pointer to the shared counter locking mutex (default:0).

template<class T>

bool TeSharedPtr< T >::not_shared_flag_`[mutable, protected]`

A flag indicating if this shared pointer was created by a dynamic assignment ( false value ) or by a static assignment(if true, the encapsulated object will not be deleted when apropriate) (default:false).

template<class T>

T* TeSharedPtr< T >::reference_`[mutable, protected]`

A pointer to the current object encapsulated by this shared pointer (default:0).

template<class T>

TeMutex TeSharedPtr< T >::this_lock_instance_`[mutable, protected]`

This instance locking mutex.

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeSharedPtr.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines