Public Member Functions

nitro::Allocator Class Reference

Class for memory handling. More...

#include <utilities/allocator.h>

List of all members.

Public Member Functions

template<class type >
type * AllocateBlock (void)
template<class type >
type * AllocateArray (const std::size_t &ArrayLength)
template<class type >
void DeallocateBlock (type *Block)
template<class type >
void DeallocateArray (type *Array)

Detailed Description

Class for memory handling.

Author:
Dodonov A.A.

Definition at line 49 of file allocator.h.


Member Function Documentation

template<class type >
type * nitro::Allocator::AllocateArray ( const std::size_t &  ArrayLength  ) 

Function allocates memory for an array.

Parameters:
ArrayLength - array's length.
Returns:
Pointer to the allocated array.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 153 of file allocator.h.

References nitro::exception::code(), and nitro::exception::what().

        {
                try
                {
                        return( new type[ ArrayLength ] );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "Allocator::AllocateArray( std::size_t ArrayLength )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "Allocator::AllocateArray( std::size_t ArrayLength )::An error occured" ) , 1 ) );
                }
        }

Here is the call graph for this function:

template<class type >
type * nitro::Allocator::AllocateBlock ( void   ) 

Function allocates memory block.

Returns:
Pointer to the allocated memory block.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 137 of file allocator.h.

References nitro::exception::code(), and nitro::exception::what().

Referenced by nitro::SharedPointer< managed_type >::SharedPointer().

        {
                try
                {
                        return( new type() );
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "Allocator::AllocateBlock( void )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "Allocator::AllocateBlock( void )::An error occured" ) , 1 ) );
                }
        }

Here is the call graph for this function:

template<class type >
void nitro::Allocator::DeallocateArray ( type *  Array  ) 

Function allocates memory block.

Parameters:
Array - Pointer to the allocated array.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 185 of file allocator.h.

References nitro::exception::code(), and nitro::exception::what().

        {
                try
                {
                        delete [] Array;
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "Allocator::DeallocateArray( type * Array )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "Allocator::DeallocateArray( type * Array )::An error occured" ) , 1 ) );
                }
        }

Here is the call graph for this function:

template<class type >
void nitro::Allocator::DeallocateBlock ( type *  Block  ) 

Function allocates memory block.

Parameters:
Block - Pointer to the allocated memory block.
Exceptions:
nitro::exception Throws exception with the description of error.
Author:
Dodonov A.A.

Definition at line 169 of file allocator.h.

References nitro::exception::code(), and nitro::exception::what().

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

        {
                try
                {
                        delete Block;
                }
                catch( nitro::exception e )
                {
                        throw( nitro::exception( std::string( "Allocator::DeallocateBlock( type * Block )::" ) + e.what() , e.code() ) );
                }
                catch( ... )
                {
                        throw( nitro::exception( std::string( "Allocator::DeallocateBlock( type * Block )::An error occured" ) , 1 ) );
                }
        }

Here is the call graph for this function:


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

Generated by  doxygen 1.6.1