Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::AllocationManager Class Reference

AllocationManager is a singleton class that is used to manage Allocators used to allocate Ion objects. More...

#include "allocationmanager.h"

Public Member Functions

 ~AllocationManager ()
 

Static Public Member Functions

static void SetDefaultAllocationLifetime (AllocationLifetime lifetime)
 Sets/returns the AllocationLifetime that is assumed when a default new() operator is used for an Allocatable. More...
 
static AllocationLifetime GetDefaultAllocationLifetime ()
 
static void SetDefaultAllocatorForLifetime (AllocationLifetime lifetime, const AllocatorPtr &allocator)
 Sets/returns the default Allocator to use for a specific AllocationLifetime. More...
 
static const AllocatorPtrGetDefaultAllocatorForLifetime (AllocationLifetime lifetime)
 
static const AllocatorPtrGetDefaultAllocator ()
 Convenience function that returns the default allocator to use when no lifetime is specified. More...
 
static const AllocatorPtrGetMallocAllocator ()
 Returns an allocator that performs conventional allocation and deallocation with malloc() and free(). More...
 
static const AllocatorPtrGetNonNullAllocator (const AllocatorPtr &allocator)
 This convenience function can be used where a non-NULL Allocator pointer is needed. More...
 

Detailed Description

AllocationManager is a singleton class that is used to manage Allocators used to allocate Ion objects.

Definition at line 29 of file allocationmanager.h.

Constructor & Destructor Documentation

ion::base::AllocationManager::~AllocationManager ( )

Definition at line 58 of file allocationmanager.cc.

Member Function Documentation

static AllocationLifetime ion::base::AllocationManager::GetDefaultAllocationLifetime ( )
inlinestatic

Definition at line 38 of file allocationmanager.h.

static const AllocatorPtr& ion::base::AllocationManager::GetDefaultAllocator ( )
inlinestatic

Convenience function that returns the default allocator to use when no lifetime is specified.

It returns the default allocator for the lifetime returned by GetDefaultAllocationLifetime().

Definition at line 70 of file allocationmanager.h.

static const AllocatorPtr& ion::base::AllocationManager::GetDefaultAllocatorForLifetime ( AllocationLifetime  lifetime)
inlinestatic
static const AllocatorPtr& ion::base::AllocationManager::GetMallocAllocator ( )
inlinestatic

Returns an allocator that performs conventional allocation and deallocation with malloc() and free().

Definition at line 77 of file allocationmanager.h.

static const AllocatorPtr& ion::base::AllocationManager::GetNonNullAllocator ( const AllocatorPtr allocator)
inlinestatic
static void ion::base::AllocationManager::SetDefaultAllocationLifetime ( AllocationLifetime  lifetime)
inlinestatic

Sets/returns the AllocationLifetime that is assumed when a default new() operator is used for an Allocatable.

It is MediumTerm by default.

Definition at line 35 of file allocationmanager.h.

static void ion::base::AllocationManager::SetDefaultAllocatorForLifetime ( AllocationLifetime  lifetime,
const AllocatorPtr allocator 
)
inlinestatic

Sets/returns the default Allocator to use for a specific AllocationLifetime.

The default Allocator will be used for allocations of Allocatable objects when using the new(AllocationLifetime) operator or when Ion allocates subordinate objects, unless the Allocator for the owner object overrides its GetAllocatorForLifetime() function.

By default, the Allocator returned by GetMallocAllocator() is used for all lifetimes. Setting an Allocator to NULL restores GetMallocAllocator() as the default allocator.

Note
these functions are not thread-safe, as it does not make sense for multiple threads to change the default allocation settings. Thread-specific allocation strategies can be implemented by overriding the Allocator::GetAllocatorForLifetime() function.

Definition at line 56 of file allocationmanager.h.

References ion::base::SharedPtr< T >::Get().


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