Public Member Functions | Private Member Functions | Private Attributes

nitro::SharedPointer< managed_type > Class Template Reference

Shared pointer interface. More...

#include <utilities/shared_pointer.h>

Inherits nitro::SharedPointerInterface.

Collaboration diagram for nitro::SharedPointer< managed_type >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SharedPointer (void)
 SharedPointer (managed_type *p)
 SharedPointer (const SharedPointer &p)
void Reset (managed_type *p)
SharedPointer< managed_type > operator= (const SharedPointer< managed_type > &p)
managed_type * GetData (void)
virtual void * GetDataAddress (void)
managed_type * operator-> (void)
managed_type & operator* (void)
 operator managed_type * (void)
virtual ~SharedPointer ()

Private Member Functions

void Release (void)

Private Attributes

int * ReferenceCounter
managed_type * Data
nitro::AllocatorDefaultAllocator

Detailed Description

template<class managed_type>
class nitro::SharedPointer< managed_type >

Shared pointer interface.

Shared pointer class.

Author:
Dodonov A.A.

Definition at line 66 of file shared_pointer.h.


Constructor & Destructor Documentation

template<class managed_type >
nitro::SharedPointer< managed_type >::SharedPointer ( void   ) 
template<class managed_type >
nitro::SharedPointer< managed_type >::SharedPointer ( managed_type *  p  ) 

Constructor.

Parameters:
p - Pointer to store.
Author:
Dodonov A.A.

Definition at line 285 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data, nitro::SharedPointer< managed_type >::DefaultAllocator, nitro::GetAllocator(), and nitro::SharedPointer< managed_type >::ReferenceCounter.

Here is the call graph for this function:

template<class managed_type >
nitro::SharedPointer< managed_type >::SharedPointer ( const SharedPointer< managed_type > &  p  ) 

Copy constructor.

Parameters:
p - Pointer to copy.
Author:
Dodonov A.A.

Definition at line 293 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data, nitro::SharedPointer< managed_type >::DefaultAllocator, nitro::GetAllocator(), and nitro::SharedPointer< managed_type >::ReferenceCounter.

        {
                DefaultAllocator = nitro::GetAllocator();
                ReferenceCounter = p.ReferenceCounter;
                Data = p.Data;
                ( * ReferenceCounter )++;
        }

Here is the call graph for this function:

template<class managed_type >
nitro::SharedPointer< managed_type >::~SharedPointer (  )  [virtual]

Destructor (virtual).

Author:
Dodonov A.A.

Definition at line 349 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Release().

        {
                Release();
        }

Here is the call graph for this function:


Member Function Documentation

template<class managed_type >
managed_type * nitro::SharedPointer< managed_type >::GetData ( void   ) 

Getting data to the pointer.

Returns:
Pointer to the stored data.
Author:
Dodonov A.A.

Definition at line 324 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data.

        {
                return( Data );
        }

template<class managed_type >
void * nitro::SharedPointer< managed_type >::GetDataAddress ( void   )  [virtual]

Getting data to the pointer.

Returns:
Pointer to the stored data.
Author:
Dodonov A.A.

Implements nitro::SharedPointerInterface.

Definition at line 329 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data.

        {
                return( ( void * )Data );
        }

template<class managed_type >
nitro::SharedPointer< managed_type >::operator managed_type * ( void   ) 

Cast operator.

Author:
Dodonov A.A.

Definition at line 344 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data.

        {
                return( Data );
        }

template<class managed_type >
managed_type & nitro::SharedPointer< managed_type >::operator* ( void   ) 

Dereferencing operator.

Author:
Dodonov A.A.

Definition at line 339 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data.

        {
                return( * Data );
        }

template<class managed_type >
managed_type * nitro::SharedPointer< managed_type >::operator-> ( void   ) 

Field selector.

Author:
Dodonov A.A.

Definition at line 334 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data.

        {
                return( Data );
        }

template<class managed_type >
SharedPointer< managed_type > nitro::SharedPointer< managed_type >::operator= ( const SharedPointer< managed_type > &  p  ) 

Assign operator.

Parameters:
p - Pointer to copy.
Author:
Dodonov A.A.

Definition at line 310 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data, nitro::SharedPointer< managed_type >::ReferenceCounter, and nitro::SharedPointer< managed_type >::Release().

        {
                if( this != & p )
                {
                        Release();

                        ReferenceCounter = p.ReferenceCounter;
                        Data = p.Data;
                        ( * ReferenceCounter )++;
                }

                return( * this );
        }

Here is the call graph for this function:

template<class managed_type >
void nitro::SharedPointer< managed_type >::Release ( void   )  [private]
template<class managed_type >
void nitro::SharedPointer< managed_type >::Reset ( managed_type *  p  ) 

Function initializes pointer.

Parameters:
p - Pointer.
Author:
Dodonov A.A.

Definition at line 301 of file shared_pointer.h.

References nitro::SharedPointer< managed_type >::Data, nitro::SharedPointer< managed_type >::ReferenceCounter, and nitro::SharedPointer< managed_type >::Release().

        {
                Release();

                ReferenceCounter = new int;
                * ReferenceCounter = 1;
                Data = p;
        }

Here is the call graph for this function:


Member Data Documentation

template<class managed_type>
managed_type* nitro::SharedPointer< managed_type >::Data [private]
template<class managed_type>
nitro::Allocator* nitro::SharedPointer< managed_type >::DefaultAllocator [private]

Default allocator.

Author:
Dodonov A.A.

Definition at line 273 of file shared_pointer.h.

Referenced by nitro::SharedPointer< managed_type >::Release(), and nitro::SharedPointer< managed_type >::SharedPointer().

template<class managed_type>
int* nitro::SharedPointer< managed_type >::ReferenceCounter [private]

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

Generated by  doxygen 1.6.1