Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Static Public Member Functions | List of all members
om::util::Allocator Class Reference

A class that represents the interface for objects that allocate memory. More...

#include <omAllocator.h>

Inheritance diagram for om::util::Allocator:
om::util::AlignedAllocator< defaultAlignment >

Public Member Functions

virtual ~Allocator ()
 Destroy this allocator. More...
 
virtual UByteallocate (Size numBytes)
 Allocate the specified number of bytes and return a pointer to the uninitialized memory. More...
 
virtual void deallocate (void *pointer)
 Free the previously allocated memory block pointed to by the specified pointer. More...
 

Static Public Member Functions

template<typename T >
static T * allocate (Size count=Size(1))
 Allocate unitialized memory for the specified number of objects of type T. More...
 
template<typename T >
static void deallocate (T *pointer)
 Free the previously allocated memory block pointed to by the specified pointer. More...
 
template<typename T >
static void construct (T *object)
 Call the default constructor of an object. More...
 
template<typename T , typename P1 >
static void construct (T *object, const P1 &p1)
 Call the constructor of an object with 1 constructor parameter. More...
 
template<typename T , typename P1 , typename P2 >
static void construct (T *object, const P1 &p1, const P2 &p2)
 Call the constructor of an object with 2 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3)
 Call the constructor of an object with 3 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Call the constructor of an object with 4 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Call the constructors of an array of objects with 5 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6)
 Call the constructor of an object with 6 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7)
 Call the constructor of an object with 7 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8)
 Call the constructor of an object with 8 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8, const P9 &p9)
 Call the constructor of an object with 9 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 , typename P10 >
static void construct (T *object, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8, const P9 &p9, const P10 &p10)
 Call the constructor of an object with 10 constructor parameters. More...
 
template<typename T , typename SizeType >
static void constructArray (T *objects, SizeType number)
 Call the default constructors of an array of objects. More...
 
template<typename T , typename SizeType , typename P1 >
static void constructArray (T *objects, SizeType number, const P1 &p1)
 Call the constructors of an array of objects with 1 constructor parameter. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2)
 Call the constructors of an array of objects with 2 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3)
 Call the constructors of an array of objects with 3 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Call the constructors of an array of objects with 4 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Call the constructors of an array of objects with 5 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6)
 Call the constructors of an array of objects with 6 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7)
 Call the constructors of an array of objects with 7 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8)
 Call the constructors of an array of objects with 8 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8, const P9 &p9)
 Call the constructors of an array of objects with 9 constructor parameters. More...
 
template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 , typename P10 >
static void constructArray (T *objects, SizeType number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8, const P9 &p9, const P10 &p10)
 Call the constructors of an array of objects with 10 constructor parameters. More...
 
template<typename T >
static void destruct (T *object)
 Call the destructor on an object of the templated type. More...
 
template<typename T , typename SizeType >
static void destructArray (T *objects, SizeType number)
 Call the destructors on an array of objects of the templated type. More...
 
template<typename T , typename SizeType >
static void copyArray (T *destination, const T *source, SizeType number)
 Copy an array of objects by calling the placement-new copy constructor for each object. More...
 
template<typename T , typename SizeType >
static void moveArray (T *destination, T *source, SizeType number)
 Copy an array of objects from the source to destination with placement new, calling destructors on the source. More...
 

Detailed Description

A class that represents the interface for objects that allocate memory.

Constructor & Destructor Documentation

virtual om::util::Allocator::~Allocator ( )
inlinevirtual

Destroy this allocator.

Member Function Documentation

virtual UByte* om::util::Allocator::allocate ( Size  numBytes)
inlinevirtual

Allocate the specified number of bytes and return a pointer to the uninitialized memory.

Reimplemented in om::util::AlignedAllocator< defaultAlignment >.

virtual void om::util::Allocator::deallocate ( void *  pointer)
inlinevirtual

Free the previously allocated memory block pointed to by the specified pointer.

Reimplemented in om::util::AlignedAllocator< defaultAlignment >.

template<typename T >
static T* om::util::Allocator::allocate ( Size  count = Size(1))
inlinestatic

Allocate unitialized memory for the specified number of objects of type T.

template<typename T >
static void om::util::Allocator::deallocate ( T *  pointer)
inlinestatic

Free the previously allocated memory block pointed to by the specified pointer.

template<typename T >
static void om::util::Allocator::construct ( T *  object)
inlinestatic

Call the default constructor of an object.

template<typename T , typename P1 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1 
)
inlinestatic

Call the constructor of an object with 1 constructor parameter.

template<typename T , typename P1 , typename P2 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2 
)
inlinestatic

Call the constructor of an object with 2 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3 
)
inlinestatic

Call the constructor of an object with 3 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4 
)
inlinestatic

Call the constructor of an object with 4 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5 
)
inlinestatic

Call the constructors of an array of objects with 5 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6 
)
inlinestatic

Call the constructor of an object with 6 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7 
)
inlinestatic

Call the constructor of an object with 7 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7,
const P8 &  p8 
)
inlinestatic

Call the constructor of an object with 8 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7,
const P8 &  p8,
const P9 &  p9 
)
inlinestatic

Call the constructor of an object with 9 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 , typename P10 >
static void om::util::Allocator::construct ( T *  object,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7,
const P8 &  p8,
const P9 &  p9,
const P10 &  p10 
)
inlinestatic

Call the constructor of an object with 10 constructor parameters.

template<typename T , typename SizeType >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number 
)
inlinestatic

Call the default constructors of an array of objects.

template<typename T , typename SizeType , typename P1 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1 
)
inlinestatic

Call the constructors of an array of objects with 1 constructor parameter.

template<typename T , typename SizeType , typename P1 , typename P2 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2 
)
inlinestatic

Call the constructors of an array of objects with 2 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3 
)
inlinestatic

Call the constructors of an array of objects with 3 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4 
)
inlinestatic

Call the constructors of an array of objects with 4 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5 
)
inlinestatic

Call the constructors of an array of objects with 5 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6 
)
inlinestatic

Call the constructors of an array of objects with 6 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7 
)
inlinestatic

Call the constructors of an array of objects with 7 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7,
const P8 &  p8 
)
inlinestatic

Call the constructors of an array of objects with 8 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7,
const P8 &  p8,
const P9 &  p9 
)
inlinestatic

Call the constructors of an array of objects with 9 constructor parameters.

template<typename T , typename SizeType , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 , typename P9 , typename P10 >
static void om::util::Allocator::constructArray ( T *  objects,
SizeType  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7,
const P8 &  p8,
const P9 &  p9,
const P10 &  p10 
)
inlinestatic

Call the constructors of an array of objects with 10 constructor parameters.

template<typename T >
static void om::util::Allocator::destruct ( T *  object)
inlinestatic

Call the destructor on an object of the templated type.

template<typename T , typename SizeType >
static void om::util::Allocator::destructArray ( T *  objects,
SizeType  number 
)
inlinestatic

Call the destructors on an array of objects of the templated type.

template<typename T , typename SizeType >
static void om::util::Allocator::copyArray ( T *  destination,
const T *  source,
SizeType  number 
)
inlinestatic

Copy an array of objects by calling the placement-new copy constructor for each object.

template<typename T , typename SizeType >
static void om::util::Allocator::moveArray ( T *  destination,
T *  source,
SizeType  number 
)
inlinestatic

Copy an array of objects from the source to destination with placement new, calling destructors on the source.


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