Class for memory handling. More...
#include <utilities/allocator.h>
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) |
Class for memory handling.
Definition at line 49 of file allocator.h.
| type * nitro::Allocator::AllocateArray | ( | const std::size_t & | ArrayLength | ) |
Function allocates memory for an array.
| ArrayLength | - array's length. |
| nitro::exception | Throws exception with the description of error. |
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 ) );
}
}

| type * nitro::Allocator::AllocateBlock | ( | void | ) |
Function allocates memory block.
| nitro::exception | Throws exception with the description of error. |
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 ) );
}
}

| void nitro::Allocator::DeallocateArray | ( | type * | Array | ) |
Function allocates memory block.
| Array | - Pointer to the allocated array. |
| nitro::exception | Throws exception with the description of error. |
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 ) );
}
}

| void nitro::Allocator::DeallocateBlock | ( | type * | Block | ) |
Function allocates memory block.
| Block | - Pointer to the allocated memory block. |
| nitro::exception | Throws exception with the description of error. |
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 ) );
}
}

1.6.1