Om  1.0.0
A universal framework for multimedia simulation
Classes | Functions
om::util Namespace Reference

A namespace containing data structure classes and memory manipulation functions. More...

Classes

class  AlignedAllocator
 A class that allocates aligned memory from the global memory system. More...
 
class  Allocator
 A class that represents the interface for objects that allocate memory. More...
 
class  Array
 A class that represents a dynamically-sized sequence of objects stored contiguously in memory. More...
 
class  ArrayList
 An array-based list class. More...
 
class  HashMap
 A container class that uses a hash table to map key objects to value objects. More...
 
class  LinkedList
 A doubly-linked list class. More...
 
class  ObjectPool
 A class that manages a pool of objects that are stored at persistent locations in memory. More...
 
class  PODArray
 The template prototype for the PODArray class. More...
 
class  PODArray< T, 1, SizeType, AllocatorType >
 A specialization of the PODArray class with 1 dimension. More...
 
class  PODArray< T, 2, SizeType, AllocatorType >
 A specialization of the PODArray class with 2 dimensions. More...
 
class  PODArray< T, 3, SizeType, AllocatorType >
 A specialization of the PODArray class with 3 dimensions. More...
 
class  PriorityQueue
 A class that implements a max-heap-based priority queue. More...
 
class  ShortArray
 A class that represents a dynamically-sized sequence of objects stored contiguously in memory. More...
 
class  ShortArrayList
 An array-based list class that uses a fixed-size local buffer for its elements. More...
 
class  StaticArray
 A class that provides a safe wrapper for statically-sized arrays. More...
 
class  StaticArrayList
 An array-based list class with a static element capacity. More...
 

Functions

template<typename T >
T * allocate ()
 Allocate memory for a single object of type T. More...
 
template<typename T >
T * allocate (Size count)
 Allocate memory for the specified number of objects of type T. More...
 
template<typename T >
T * allocateAligned (Size count, Size alignment=Size(16))
 Allocate memory for the specified number of objects of type T. More...
 
template<typename T >
void deallocate (T *pointer)
 Free the memory block pointed to by the specified pointer. More...
 
template<typename T >
void deallocateAligned (T *pointer)
 Free the aligned memory block pointed to by the specified pointer. More...
 
template<typename T >
T * construct ()
 Construct and allocate an object of the templated type T, calling the default constructor. More...
 
template<typename T , typename P1 >
T * construct (const P1 &p1)
 Construct and allocate an object of the templated type T with one constructor parameter. More...
 
template<typename T , typename P1 , typename P2 >
T * construct (const P1 &p1, const P2 &p2)
 Construct and allocate an object of the templated type T with 2 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 >
T * construct (const P1 &p1, const P2 &p2, const P3 &p3)
 Construct and allocate an object of the templated type T with 3 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
T * construct (const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Construct and allocate an object of the templated type T with 4 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
T * construct (const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Construct and allocate an object of the templated type T with 5 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
T * construct (const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6)
 Construct and allocate an object of the templated type T with 6 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
T * construct (const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7)
 Construct and allocate an object of the templated type T with 7 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
T * construct (const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8)
 Construct and allocate an object of the templated type T 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 >
T * construct (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)
 Construct and allocate an object of the templated type T 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 >
T * construct (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)
 Construct and allocate an object of the templated type T with 10 constructor parameters. More...
 
template<typename T >
void destruct (T *object)
 Destruct and free an object of the templated type T at the specified location. More...
 
template<typename T >
void destructAligned (T *object)
 Destruct and free an object of the templated type T at the specified location. More...
 
template<typename T >
T * constructArray (Size number)
 Construct and allocate an array of objects of the templated type T, calling the default constructor. More...
 
template<typename T , typename P1 >
T * constructArray (Size number, const P1 &p1)
 Construct and allocate an array of objects of the templated type T with one constructor parameter. More...
 
template<typename T , typename P1 , typename P2 >
void constructArray (Size number, const P1 &p1, const P2 &p2)
 Construct and allocate an array of objects of the templated type T with 2 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 >
void constructArray (Size number, const P1 &p1, const P2 &p2, const P3 &p3)
 Construct and allocate an array of objects of the templated type T with 3 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
void constructArray (Size number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Construct and allocate an array of objects of the templated type T with 4 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void constructArray (Size number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Construct and allocate an array of objects of the templated type T with 5 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
void constructArray (Size number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6)
 Construct and allocate an array of objects of the templated type T with 6 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
void constructArray (Size number, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7)
 Construct and allocate an array of objects of the templated type T with 7 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
void constructArray (Size 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)
 Construct and allocate an array of objects of the templated type T 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 >
void constructArray (Size 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)
 Construct and allocate an array of objects of the templated type T 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 >
void constructArray (Size 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)
 Construct and allocate an array of objects of the templated type T with 10 constructor parameters. More...
 
template<typename T >
T * constructArrayAligned (Size number, Size alignment)
 Construct and allocate an array of objects of the templated type T, calling the default constructor. More...
 
template<typename T , typename P1 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1)
 Construct and allocate an array of objects of the templated type T with one constructor parameter. More...
 
template<typename T , typename P1 , typename P2 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1, const P2 &p2)
 Construct and allocate an array of objects of the templated type T with 2 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1, const P2 &p2, const P3 &p3)
 Construct and allocate an array of objects of the templated type T with 3 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
 Construct and allocate an array of objects of the templated type T with 4 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5)
 Construct and allocate an array of objects of the templated type T with 5 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6)
 Construct and allocate an array of objects of the templated type T with 6 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7)
 Construct and allocate an array of objects of the templated type T with 7 constructor parameters. More...
 
template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
T * constructArrayAligned (Size number, Size alignment, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4, const P5 &p5, const P6 &p6, const P7 &p7, const P8 &p8)
 Construct and allocate an array of objects of the templated type T 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 >
T * constructArrayAligned (Size number, Size alignment, 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)
 Construct and allocate an array of objects of the templated type T 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 >
T * constructArrayAligned (Size number, Size alignment, 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)
 Construct and allocate an array of objects of the templated type T with 10 constructor parameters. More...
 
template<typename T >
T * copyArray (const T *oldArray, Size number)
 Allocate a new array and copy the specified number of elements from an old array. More...
 
template<typename T >
T * copyArrayAligned (const T *oldArray, Size number, Size alignment)
 Allocate a new aligned array and copy the specified number of elements from an old array. More...
 
template<typename T >
void destructArray (T *objects, Size number)
 Destruct and free an array of objects of the templated type T at the specified location. More...
 
template<typename T >
void destructArrayAligned (T *objects, Size number)
 Destruct and free an array of objects of the templated type T at the specified location. More...
 
template<typename T >
void swap (T &a, T &b)
 Swap the locations of two values of the templated type. More...
 
template<typename T , typename SizeType >
void swap (T *a, T *b, SizeType number)
 Swap the contents of two arrays of the templated type. More...
 
template<typename T , typename SizeType >
void copy (T *destination, const T *source, SizeType number)
 Copy the specified number of objects from the source pointer to the destination pointer. More...
 
template<typename SizeType >
void copy (unsigned char *destination, const unsigned char *source, SizeType number)
 
template<typename SizeType >
void copy (char *destination, const char *source, SizeType number)
 
template<typename SizeType >
void copy (unsigned short *destination, const unsigned short *source, SizeType number)
 
template<typename SizeType >
void copy (short *destination, const short *source, SizeType number)
 
template<typename SizeType >
void copy (unsigned int *destination, const unsigned int *source, SizeType number)
 
template<typename SizeType >
void copy (int *destination, const int *source, SizeType number)
 
template<typename SizeType >
void copy (unsigned long *destination, const unsigned long *source, SizeType number)
 
template<typename SizeType >
void copy (long *destination, const long *source, SizeType number)
 
template<typename SizeType >
void copy (unsigned long long *destination, const unsigned long long *source, SizeType number)
 
template<typename SizeType >
void copy (long long *destination, const long long *source, SizeType number)
 
template<typename SizeType >
void copy (float *destination, const float *source, SizeType number)
 
template<typename SizeType >
void copy (double *destination, const double *source, SizeType number)
 
template<typename T >
void copyPOD (T *destination, const T *source, Size number)
 Copy the specified number of POD-type (plain-old-data) objects from the source pointer to the destination pointer. More...
 
template<typename T , typename U >
void convert (T *destination, const U *source, Size number)
 Copy the specified number of objects from the source pointer to the destination pointer, converting object type. More...
 
template<typename T >
void set (T *destination, T value, Size number)
 Set the specified number of objects at the destination pointer to the given value. More...
 
template<>
void set (unsigned char *destination, unsigned char value, Size number)
 
template<typename T >
void zero (T *destination, Size number)
 Set the specified number of objects at the destination pointer to zero. More...
 
template<>
void zero (unsigned char *destination, Size number)
 
template<>
void zero (char *destination, Size number)
 
template<>
void zero (unsigned short *destination, Size number)
 
template<>
void zero (short *destination, Size number)
 
template<>
void zero (unsigned int *destination, Size number)
 
template<>
void zero (int *destination, Size number)
 
template<>
void zero (unsigned long *destination, Size number)
 
template<>
void zero (long *destination, Size number)
 
template<>
void zero (unsigned long long *destination, Size number)
 
template<>
void zero (long long *destination, Size number)
 
template<>
void zero (float *destination, Size number)
 
template<>
void zero (double *destination, Size number)
 
template<typename T >
void zeroPOD (T *destination, Size number)
 Set the specified number of POD-type (plain-old-data) objects from the source pointer to all zeros. More...
 

Detailed Description

A namespace containing data structure classes and memory manipulation functions.

Function Documentation

template<typename T >
T* om::util::allocate ( )
inline

Allocate memory for a single object of type T.

This method returns a pointer to the start of the object in memory. The constructor of the allocated object is not called. It is the responsibility of the user to use placement new to initialize the object. Alternatively, one can call the construct() method instead which initializes the memory location by calling placement new after allocating the memory.

template<typename T >
T* om::util::allocate ( Size  count)
inline

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

This method returns a pointer to the start of the first object in memory. No constructors are called on the allocated memory locations. One must use placement new in order to initialize the objects.

Parameters
count- the number of objects to allocate space for.
template<typename T >
T* om::util::allocateAligned ( Size  count,
Size  alignment = Size(16) 
)
inline

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

This method returns a pointer to the start of the first object in memory. No constructors are called on the allocated memory locations. One must use placement new in order to initialize the objects.

Parameters
count- the number of objects to allocate space for.
alignment- the required alignment for the memory in bytes.
template<typename T >
void om::util::deallocate ( T *  pointer)
inline

Free the memory block pointed to by the specified pointer.

If the pointer is NULL, an assertion is raised.

Parameters
pointer- a pointer to the memory to be deallocated.
template<typename T >
void om::util::deallocateAligned ( T *  pointer)
inline

Free the aligned memory block pointed to by the specified pointer.

If the pointer is NULL, an assertion is raised. This method should only be called on memory aligned using the allocateAligned() family of functions.

Parameters
pointer- a pointer to the memory to be deallocated.
template<typename T >
T* om::util::construct ( )
inline

Construct and allocate an object of the templated type T, calling the default constructor.

template<typename T , typename P1 >
T* om::util::construct ( const P1 &  p1)
inline

Construct and allocate an object of the templated type T with one constructor parameter.

template<typename T , typename P1 , typename P2 >
T* om::util::construct ( const P1 &  p1,
const P2 &  p2 
)
inline

Construct and allocate an object of the templated type T with 2 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 >
T* om::util::construct ( const P1 &  p1,
const P2 &  p2,
const P3 &  p3 
)
inline

Construct and allocate an object of the templated type T with 3 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
T* om::util::construct ( const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4 
)
inline

Construct and allocate an object of the templated type T with 4 constructor parameters.

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

Construct and allocate an object of the templated type T with 5 constructor parameters.

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

Construct and allocate an object of the templated type T with 6 constructor parameters.

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

Construct and allocate an object of the templated type T with 7 constructor parameters.

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

Construct and allocate an object of the templated type T 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 >
T* om::util::construct ( 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 
)
inline

Construct and allocate an object of the templated type T 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 >
T* om::util::construct ( 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 
)
inline

Construct and allocate an object of the templated type T with 10 constructor parameters.

template<typename T >
void om::util::destruct ( T *  object)
inline

Destruct and free an object of the templated type T at the specified location.

This method calls the destructor of the pointed-to object and then deallocates the memory used by that object. If the object pointer is NULL, an assertion is raised.

Parameters
object- a pointer to the object to be destroyed.
template<typename T >
void om::util::destructAligned ( T *  object)
inline

Destruct and free an object of the templated type T at the specified location.

This method calls the destructor of the pointed-to object and then deallocates the memory used by that object. If the object pointer is NULL, an assertion is raised.

Parameters
object- a pointer to the object to be destroyed.
template<typename T >
T* om::util::constructArray ( Size  number)
inline

Construct and allocate an array of objects of the templated type T, calling the default constructor.

template<typename T , typename P1 >
T* om::util::constructArray ( Size  number,
const P1 &  p1 
)
inline

Construct and allocate an array of objects of the templated type T with one constructor parameter.

template<typename T , typename P1 , typename P2 >
void om::util::constructArray ( Size  number,
const P1 &  p1,
const P2 &  p2 
)
inline

Construct and allocate an array of objects of the templated type T with 2 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 >
void om::util::constructArray ( Size  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3 
)
inline

Construct and allocate an array of objects of the templated type T with 3 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
void om::util::constructArray ( Size  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4 
)
inline

Construct and allocate an array of objects of the templated type T with 4 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
void om::util::constructArray ( Size  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5 
)
inline

Construct and allocate an array of objects of the templated type T with 5 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
void om::util::constructArray ( Size  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6 
)
inline

Construct and allocate an array of objects of the templated type T with 6 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
void om::util::constructArray ( Size  number,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7 
)
inline

Construct and allocate an array of objects of the templated type T with 7 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
void om::util::constructArray ( Size  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 
)
inline

Construct and allocate an array of objects of the templated type T 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 >
void om::util::constructArray ( Size  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 
)
inline

Construct and allocate an array of objects of the templated type T 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 >
void om::util::constructArray ( Size  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 
)
inline

Construct and allocate an array of objects of the templated type T with 10 constructor parameters.

template<typename T >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment 
)
inline

Construct and allocate an array of objects of the templated type T, calling the default constructor.

template<typename T , typename P1 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1 
)
inline

Construct and allocate an array of objects of the templated type T with one constructor parameter.

template<typename T , typename P1 , typename P2 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1,
const P2 &  p2 
)
inline

Construct and allocate an array of objects of the templated type T with 2 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3 
)
inline

Construct and allocate an array of objects of the templated type T with 3 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4 
)
inline

Construct and allocate an array of objects of the templated type T with 4 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5 
)
inline

Construct and allocate an array of objects of the templated type T with 5 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6 
)
inline

Construct and allocate an array of objects of the templated type T with 6 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7 
)
inline

Construct and allocate an array of objects of the templated type T with 7 constructor parameters.

template<typename T , typename P1 , typename P2 , typename P3 , typename P4 , typename P5 , typename P6 , typename P7 , typename P8 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
const P1 &  p1,
const P2 &  p2,
const P3 &  p3,
const P4 &  p4,
const P5 &  p5,
const P6 &  p6,
const P7 &  p7,
const P8 &  p8 
)
inline

Construct and allocate an array of objects of the templated type T 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 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
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 
)
inline

Construct and allocate an array of objects of the templated type T 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 >
T* om::util::constructArrayAligned ( Size  number,
Size  alignment,
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 
)
inline

Construct and allocate an array of objects of the templated type T with 10 constructor parameters.

template<typename T >
T* om::util::copyArray ( const T *  oldArray,
Size  number 
)
inline

Allocate a new array and copy the specified number of elements from an old array.

template<typename T >
T* om::util::copyArrayAligned ( const T *  oldArray,
Size  number,
Size  alignment 
)
inline

Allocate a new aligned array and copy the specified number of elements from an old array.

template<typename T >
void om::util::destructArray ( T *  objects,
Size  number 
)
inline

Destruct and free an array of objects of the templated type T at the specified location.

template<typename T >
void om::util::destructArrayAligned ( T *  objects,
Size  number 
)
inline

Destruct and free an array of objects of the templated type T at the specified location.

This method should only be used to deallocate memory allocated with the allocateAligned() family of functions.

template<typename T >
void om::util::swap ( T &  a,
T &  b 
)
inline

Swap the locations of two values of the templated type.

template<typename T , typename SizeType >
void om::util::swap ( T *  a,
T *  b,
SizeType  number 
)
inline

Swap the contents of two arrays of the templated type.

template<typename T , typename SizeType >
void om::util::copy ( T *  destination,
const T *  source,
SizeType  number 
)
inline

Copy the specified number of objects from the source pointer to the destination pointer.

This method does not check the validity of the arguments.

template<typename SizeType >
void om::util::copy ( unsigned char *  destination,
const unsigned char *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( char *  destination,
const char *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( unsigned short *  destination,
const unsigned short *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( short *  destination,
const short *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( unsigned int *  destination,
const unsigned int *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( int *  destination,
const int *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( unsigned long *  destination,
const unsigned long *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( long *  destination,
const long *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( unsigned long long *  destination,
const unsigned long long *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( long long *  destination,
const long long *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( float *  destination,
const float *  source,
SizeType  number 
)
inline
template<typename SizeType >
void om::util::copy ( double *  destination,
const double *  source,
SizeType  number 
)
inline
template<typename T >
void om::util::copyPOD ( T *  destination,
const T *  source,
Size  number 
)
inline

Copy the specified number of POD-type (plain-old-data) objects from the source pointer to the destination pointer.

The objects of type T should have either an implicitly-declared or trivial copy constructor/assignment operator. The byes from the source pointer are copied directly to the destination.

template<typename T , typename U >
void om::util::convert ( T *  destination,
const U *  source,
Size  number 
)
inline

Copy the specified number of objects from the source pointer to the destination pointer, converting object type.

The method uses the assignment operator to assign the objects from the source to destination.

This method does not check the validity of the arguments in order to not impose unnecessary overhead on this low-level method.

template<typename T >
void om::util::set ( T *  destination,
value,
Size  number 
)
inline

Set the specified number of objects at the destination pointer to the given value.

The method uses the assignment operator to assign the value to the destination.

This method does not check the validity of the arguments in order to not impose unnecessary overhead on this low-level method.

template<>
void om::util::set ( unsigned char *  destination,
unsigned char  value,
Size  number 
)
inline
template<typename T >
void om::util::zero ( T *  destination,
Size  number 
)
inline

Set the specified number of objects at the destination pointer to zero.

The default value for the type is assigned to the destination array.

This method does not check the validity of the arguments in order to not impose unnecessary overhead on this low-level method.

template<>
void om::util::zero ( unsigned char *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( char *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( unsigned short *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( short *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( unsigned int *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( int *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( unsigned long *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( long *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( unsigned long long *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( long long *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( float *  destination,
Size  number 
)
inline
template<>
void om::util::zero ( double *  destination,
Size  number 
)
inline
template<typename T >
void om::util::zeroPOD ( T *  destination,
Size  number 
)
inline

Set the specified number of POD-type (plain-old-data) objects from the source pointer to all zeros.

The objects of type T should have either an implicitly-declared or trivial copy constructor/assignment operator. The bytes in the destination pointer are initialized to zero.