#include <utilities/pointer.h>
Inherits nitro::PointerInterface.
Public Member Functions | |
Pointer (void) | |
Pointer (std::size_t theItemCount) | |
Pointer (const Pointer< stored_type, memory_handler > &Ptr) | |
Pointer< stored_type, memory_handler > | operator= (const Pointer< stored_type, memory_handler > &Ptr) |
stored_type & | operator[] (std::size_t i) |
stored_type * | GetBuffer (void) |
std::size_t | GetBufferSize (void) const |
virtual void | Allocate (std::size_t theItemCount) |
virtual void | Release (void) |
virtual | ~Pointer () |
Private Attributes | |
stored_type * | StoredData |
Class determines pointer type.
Definition at line 20 of file pointer.h.
nitro::Pointer< stored_type, memory_handler >::Pointer | ( | void | ) |
nitro::Pointer< stored_type, memory_handler >::Pointer | ( | std::size_t | theItemCount | ) |
Constructor.
theItemCount | - Count of elements for wich memory will be allocated. |
Definition at line 217 of file pointer.h.
References nitro::Pointer< stored_type, memory_handler >::Allocate().
{ Allocate( theItemCount ); }
nitro::Pointer< stored_type, memory_handler >::Pointer | ( | const Pointer< stored_type, memory_handler > & | Ptr | ) |
Private copy constructor.
Ptr | - Pointer to copy. |
Definition at line 222 of file pointer.h.
References nitro::PointerInterface::ItemCount, nitro::Pointer< stored_type, memory_handler >::StoredData, and nitro::exception::what().
{ try { // const_cast memory_handler->Copy( StoredData , const_cast< char * >( Ptr.StoredData ) ); ItemCount = Ptr.ItemCount; } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::Pointer( const Pointer< stored_type , memory_handler > & Ptr )::" ) + e.what() , 0 ) ); } catch( ... ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::Pointer( const Pointer< stored_type , memory_handler > & Ptr )::An error occured while getting data from pointer" ) , 0 ) ); } }
nitro::Pointer< stored_type, memory_handler >::~Pointer | ( | ) | [virtual] |
Destructor.
Definition at line 352 of file pointer.h.
References nitro::Pointer< stored_type, memory_handler >::Release().
{ try { Release(); } catch( nitro::exception e ) { } catch( ... ) { } }
void nitro::Pointer< stored_type, memory_handler >::Allocate | ( | std::size_t | theItemCount | ) | [virtual] |
Function allocates memory for theItemCount elements.
theItemCount | - Count of elements for wich memory will be allocated. |
nitro::exception | Exception of this type is throw. It contains a description of the occured error. |
Implements nitro::PointerInterface.
Definition at line 309 of file pointer.h.
References nitro::PointerInterface::ItemCount, nitro::Pointer< stored_type, memory_handler >::Release(), nitro::Pointer< stored_type, memory_handler >::StoredData, and nitro::exception::what().
Referenced by nitro::Pointer< stored_type, memory_handler >::Pointer().
{ try { Release(); StoredData = memory_handler->Allocate< stored_type >( this , theItemCount ); ItemCount = theItemCount; } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::Allocate( std::size_t theItemCount )::" ) + e.what() , 0 ) ); } catch( ... ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::Allocate( std::size_t theItemCount )::An error occured while getting data from pointer" ) , 0 ) ); } }
stored_type * nitro::Pointer< stored_type, memory_handler >::GetBuffer | ( | void | ) |
Function provides access for stored data.
nitro::exception | Exception of this type is throw. It contains a description of the occured error. |
Definition at line 277 of file pointer.h.
References nitro::Pointer< stored_type, memory_handler >::StoredData, and nitro::exception::what().
{ try { return( StoredData ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::GetBuffer( void )::" ) + e.what() , 0 ) ); } catch( ... ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::GetBuffer( void )::An error occured while getting data from pointer" ) , 0 ) ); } }
std::size_t nitro::Pointer< stored_type, memory_handler >::GetBufferSize | ( | void | ) | const |
Function returns the size of the stored data.
nitro::exception | Exception of this type is throw. It contains a description of the occured error. |
Definition at line 293 of file pointer.h.
References nitro::PointerInterface::ItemCount, and nitro::exception::what().
{ try { return( sizeof( stored_type ) * ItemCount ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >GetBufferSize( void ) const::" ) + e.what() , 0 ) ); } catch( ... ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >GetBufferSize( void ) const::An error occured while getting data from pointer" ) , 0 ) ); } }
Pointer< stored_type, memory_handler > nitro::Pointer< stored_type, memory_handler >::operator= | ( | const Pointer< stored_type, memory_handler > & | Ptr | ) |
Private assign operator.
Ptr | - Pointer to copy. |
Definition at line 241 of file pointer.h.
References nitro::PointerInterface::ItemCount, nitro::Pointer< stored_type, memory_handler >::StoredData, and nitro::exception::what().
{ try { memory_handler->Copy( StoredData , const_cast< char * >( Ptr.StoredData ) ); ItemCount = Ptr.ItemCount; return( * this ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::operator=( const Pointer< stored_type , memory_handler > & Ptr )::" ) + e.what() , 0 ) ); } catch( ... ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::operator=( const Pointer< stored_type , memory_handler > & Ptr )::An error occured while getting data from pointer" ) , 0 ) ); } }
stored_type & nitro::Pointer< stored_type, memory_handler >::operator[] | ( | std::size_t | i | ) |
Operator provides access for stored data.
i | - Elemet's cursor. |
nitro::exception | Exception of this type is throw. It contains a description of the occured error. |
Definition at line 261 of file pointer.h.
References nitro::Pointer< stored_type, memory_handler >::StoredData, and nitro::exception::what().
{ try { return( StoredData[ i ] ); } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::operator[]( std::size_t i )::" ) + e.what() , 0 ) ); } catch( ... ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::operator[]( std::size_t i )::An error occured while getting data from pointer" ) , 0 ) ); } }
void nitro::Pointer< stored_type, memory_handler >::Release | ( | void | ) | [virtual] |
Function deallocates all allocated memory.
nitro::exception | - Exception of this type is throw. It contains a description of the occured error. |
Implements nitro::PointerInterface.
Definition at line 329 of file pointer.h.
References nitro::PointerInterface::ItemCount, nitro::Pointer< stored_type, memory_handler >::StoredData, and nitro::exception::what().
Referenced by nitro::Pointer< stored_type, memory_handler >::Allocate(), and nitro::Pointer< stored_type, memory_handler >::~Pointer().
{ try { if( StoredData ) { memory_handler->Deallocate( StoredData ); StoredData = NULL; ItemCount = NULL; } } catch( nitro::exception e ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::Release( void )::" ) + e.what() , 0 ) ); } catch( ... ) { throw( nitro::exception( std::string( "Pointer< stored_type , memory_handler >::Release( void )::An error occured while getting data from pointer" ) , 0 ) ); } }
stored_type* nitro::Pointer< stored_type, memory_handler >::StoredData [private] |
Pointer on the allocated data.
Definition at line 209 of file pointer.h.
Referenced by nitro::Pointer< stored_type, memory_handler >::Allocate(), nitro::Pointer< stored_type, memory_handler >::GetBuffer(), nitro::Pointer< stored_type, memory_handler >::operator=(), nitro::Pointer< stored_type, memory_handler >::operator[](), nitro::Pointer< stored_type, memory_handler >::Pointer(), and nitro::Pointer< stored_type, memory_handler >::Release().