All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Modules | Classes | Typedefs | Functions | Variables
Utility module

Modules

 Assertions
 
 Compile time constraints
 
 Logging
 
 Meta-Programming Language
 
 Random number generation
 
 Serialization
 
 Singleton
 
 Thread parallelization
 
 Time measurement
 
 Type lists
 
 Type traits
 
 Value traits
 

Classes

struct  blaze::AlignmentTrait< T >
 Evaluation of the required alignment of the given data type.The AlignmentTrait class template evaluates the required alignment for the given data type. For instance, for fundamental data types that can be vectorized via SSE or AVX instructions, the proper alignment is 16 or 32 bytes, respectively. For all other data types, a multiple of the alignment chosen by the compiler is returned. The evaluated alignment can be queried via the nested value member. More...
 
struct  blaze::DisableIfTrue< Condition, T >
 Substitution Failure Is Not An Error (SFINAE) class.The DisableIfTrue class template is an auxiliary tool for an intentional application of the Substitution Failure Is Not An Error (SFINAE) principle. It allows a function template or a class template specialization to include or exclude itself from a set of matching functions or specializations based on properties of its template arguments. For instance, it can be used to restrict the selection of a function template to specific data types. The following example illustrates this in more detail. More...
 
struct  blaze::DisableIf< Condition, T >
 Substitution Failure Is Not An Error (SFINAE) class.The DisableIf class template is an auxiliary tool for an intentional application of the Substitution Failure Is Not An Error (SFINAE) principle. It allows a function template or a class template specialization to include or exclude itself from a set of matching functions or specializations based on properties of its template arguments. For instance, it can be used to restrict the selection of a function template to specific data types. The following example illustrates this in more detail. More...
 
struct  blaze::EmptyType
 Empty data type for utility purposes. More...
 
struct  blaze::EnableIfTrue< Condition, T >
 Substitution Failure Is Not An Error (SFINAE) class.The EnableIfTrue class template is an auxiliary tool for an intentional application of the Substitution Failure Is Not An Error (SFINAE) principle. It allows a function template or a class template specialization to include or exclude itself from a set of matching functions or specializations based on properties of its template arguments. For instance, it can be used to restrict the selection of a function template to specific data types. The following example illustrates this in more detail. More...
 
struct  blaze::EnableIf< Condition, T >
 Substitution Failure Is Not An Error (SFINAE) class.The EnableIf class template is an auxiliary tool for an intentional application of the Substitution Failure Is Not An Error (SFINAE) principle. It allows a function template or a class template specialization to include or exclude itself from a set of matching functions or specializations based on properties of its template arguments. For instance, it can be used to restrict the selection of a function template to specific data types. The following example illustrates this in more detail. More...
 
class  blaze::InputString
 Implementation of a string wrapper.The InputString class is a wrapper class for the purpose to read input strings delimited by quotations from streams, like for instance "example input". All characters between the leading and the trailing quotation are extracted unchanged from the input stream, including whitespaces. The input string has to be in one single line. In case of input errors, the std::istream::failbit of the input stream is set. More...
 
struct  blaze::Limits< Type >
 Numerical limits of built-in data types.The Limits class provides numerical limits for the following built-in data types: More...
 
class  blaze::MemoryPool< Type, Blocksize >
 Memory pool for small objects.The memory pool efficiently improves the performance of dynamic memory allocations for small objects. By allocating a large block of memory that can be dynamically assigned to small objects, the memory allocation is reduced from a few hundred cycles to only a few cycles.
The memory pool is build from memory blocks of type Block, which hold the memory for a specified number of objects. The memory of these blocks is managed as a single free list. More...
 
class  blaze::NonCopyable
 Base class for non-copyable class instances.The NonCopyable class is intended to work as a base class for non-copyable classes. Both the copy constructor and the copy assignment operator are declared private and left undefined in order to prohibit copy operations of the derived classes.
. More...
 
class  blaze::NonCreatable
 Base class for non-creatable (static) classes.The NonCreatable class is intended to work as a base class for non-creatable classes, i.e. classes that cannot be instantiated and exclusively offer static functions/data. Both the standard as well as the copy constructor and the copy assignment operator are declared private and left undefinded in order to prohibit the instantiation of objects of derived classes.
. More...
 
class  blaze::Null
 Safe C++ NULL pointer implementation.This implementation offers a remedy for the use of the NULL pointer in C++. For this, the NULL macro is replaced by an instance of the Null class, which can only be assigned and compared with pointers and pointers-to-member. Therefore the use of NULL regains the type safety it lost in C++ due to the strict C++ type system.
The NULL pointer is used exactly as before: More...
 
class  blaze::NullType
 Utility type for generic codes.The NullType class represents an invalid or terminating data type for generic codes. For instance, the TypeList class uses the NullType as terminating data type for the type list. More...
 
struct  blaze::ArrayDelete
 Array-delete policy class.The ArrayDelete policy functor class applies an array delete operation to the given argument. Note that the array delete operation is NOT permitted for inclomplete types (i.e. declared but undefined data types). The attempt to apply an ArrayDelete functor to a pointer to an array of objects of incomplete type results in a compile time error! More...
 
struct  blaze::ConstantGrowth< Growth >
 Constant growth policy class.The ConstantGrowth policy class implements a constant growth strategy. It can be customized for any purpose: the Growth template argument specifies the constant increase of the given size. More...
 
struct  blaze::Deallocate
 Deallocate policy class.The Deallocate deletion policy is the according deletion policy for arrays allocated via the blaze::allocate function. It uses deallocate to free the resource. Note that the delete operation is NOT permitted for inclomplete types (i.e. declared but undefined data types). The attempt to apply a PtrDelete functor to a pointer to an object of incomplete type results in a compile time error! More...
 
struct  blaze::DefaultDelete< Type >
 Default C++ deletion policy class.The DefaultDelete deletion policy is the standard delete for resources allocated via the new operator. It uses delete or array delete (depending on the template argument) to free the resource: More...
 
struct  blaze::LinearGrowth< Growth >
 Linear growth policy class.The LinearGrowth policy class implements a linear growth strategy. It can be customized for any purpose: the Growth template argument specifies the factor of the size growth. More...
 
struct  blaze::NoDelete
 No-delete policy class. More...
 
struct  blaze::OptimalGrowth
 Optimal growth policy class.The OptimalGrowth policy class implements the optimal growth strategy suggested by Andrew Koenig for the std::vector class (see Andrew Koenig's column in the September 1998 issue of JOOP (Journal of Object-Oriented Programming), or the Dr. Dobb's article 'C++ Made Easier: How Vectors Grow', 2001). It applies an exponential growth strategy using a factor of 1.5 and additionally ensures that the sizes returns are always multiples of four. More...
 
struct  blaze::PtrDelete
 Pointer-delete policy class.The PtrDelete policy functor class applies a delete operation to the given argument. Note that the delete operation is NOT permitted for inclomplete types (i.e. declared but undefined data types). The attempt to apply a PtrDelete functor to a pointer to an object of incomplete type results in a compile time error! More...
 
class  blaze::PtrIterator< Type >
 Implementation of an iterator for pointer vectors.The PtrIterator class follows the example of the random-access iterator classes of the STL. However, the focus of this iterator implementation is the use with (polymorphic) pointers. The implementation of the Blaze library eases the use of iterators over a range of pointers and improves the semantics on these pointers.
. More...
 
class  blaze::PtrVector< T, D, G >
 Implementation of a vector for (polymorphic) pointers. More...
 
class  blaze::PtrVector< T, D, G >::CastIterator< C >
 Dynamic cast iterator for polymorphic pointer vectors.The CastIterator class is part of the PtrVector class and represent a forward iterator over all elements of type C contained in a range of elements of type T, where C is a type derived from T. More...
 
class  blaze::PtrVector< T, D, G >::ConstCastIterator< C >
 Dynamic cast iterator for polymorphic pointer vectors.The ConstCastIterator class is part of the PtrVector class and represent a forward iterator over all elements of type C contained in a range of elements of type T, where C is a type derived from T. The ConstCastIterator is the counterpart of CastIterator for constant vectors. More...
 
struct  blaze::SelectType< Select, T1, T2 >
 Compile time type selection.The SelectType class template selects one of the two given types T1 and T2 depending on the Select template argument. In case the Select compile time constant expression evaluates to true, the member type definition Type is set to T1. In case Select evaluates to false, Type is set to T2. More...
 
struct  blaze::SizeTrait< T1, T2 >
 Base template for the SizeTrait class.The SizeTrait class template evaluates the larger of the two given data types by use of the sizeof operator. SizeTrait defines the data types Large for the larger of the two given data types and Small for the smaller data type. In case both data types have the same size, the first given data type T1 is chosen as the large and T2 as the small data type. More...
 
class  blaze::SharedCountBase
 Base reference counting instance for a particular memory resource.The SharedCountBase class is the shared reference counting instance for a particular memory resource. Once the reference count drops to zero, the memory resource is released and the SharedCountBase instance destroys itself. More...
 
class  blaze::SharedCountImpl< Type >
 Implementation of a reference counting instance for a particular memory resource.The SharedCountImpl class takes responsibility to release the bound memory resource. In case the reference count of the SharedCountBase base class drops to zero, the SharedCountImpl::Destroy() function is called to release the memory. More...
 
class  blaze::RefCount
 Reference count management class for a particular memory resource.The RefCount class manages the reference counting for a shared memory resource. More...
 
class  blaze::SharedPtr< Type >
 Implementation of a shared pointer handle.The SharedPtr class is a RAII class for resource management similar to the std::tr1::shared_ptr class. However, SharedPtr offers only a limited functionality for the purpose of the physics engine. More...
 
class  blaze::SystemClock
 System clock of the Blaze library.The SystemClock class represents the system clock of the Blaze library. The system clock is the central timing functionality that can be used to query for the start time of the process, the current timestamp and the elapsed time since the start of the process. The following example demonstrates how the single system clock instance is acquired via the theSystemClock() functcion and how the system clock can be used: More...
 
class  blaze::UniqueArray< T, D >
 Scope-limited management of dynamically allocated arrays.The UniqueArray class implements a scope-restricted, lightweight smart pointer that manages a dynamically allocated array. In contrast to other smart pointer implementations, UniqueArray is non-copyable and therefore restricted to manage arrays within a single scope, but does so so with a minimum of runtime overhead. The following example demonstrates the application of UniqueArray: More...
 
class  blaze::UniquePtr< T, D >
 Scope-limited management of dynamically allocated resourses.The UniquePtr class implements a scope-restricted, lightweight smart pointer that manages a dynamically allocated resource. In contrast to other smart pointer implementations, UniquePtr is non-copyable and therefore restricted to manage resources within a single scope, but does so with a minimum of runtime overhead. The following example demonstrates the application of UniquePtr: More...
 
class  blaze::UnsignedValue< T >
 Implementation of a wrapper for built-in unsigned integral values.This class wraps a value of built-in unsigned integral type in order to be able to extract non-negative unsigned integral values from an input stream. More...
 
class  blaze::complex
 Complex data type of the Blaze library. More...
 
class  blaze::size_t
 Size type of the Blaze library. More...
 
class  blaze::ptrdiff_t
 Pointer difference type of the Blaze library. More...
 
class  blaze::int8_t
 8-bit signed integer type of the Blaze library. More...
 
class  blaze::uint8_t
 8-bit unsigned integer type of the Blaze library. More...
 
class  blaze::int16_t
 16-bit signed integer type of the Blaze library. More...
 
class  blaze::uint16_t
 16-bit unsigned integer type of the Blaze library. More...
 
class  blaze::int32_t
 32-bit signed integer type of the Blaze library. More...
 
class  blaze::uint32_t
 32-bit unsigned integer type of the Blaze library. More...
 
class  blaze::int64_t
 64-bit signed integer type of the Blaze library. More...
 
class  blaze::uint64_t
 64-bit unsigned integer type of the Blaze library. More...
 

Typedefs

typedef unsigned char blaze::byte
 Byte data type of the Blaze library.The byte data type is guaranteed to be an integral data type of size 1.
 
typedef boost::false_type blaze::FalseType
 Type/value traits base class.The FalseType class is used as base class for type traits and value traits that evaluate to false.
 
typedef boost::shared_ptr
< SystemClock > 
blaze::SystemClockID
 Handle for the system clock of the Blaze library.
 
typedef boost::shared_ptr
< const SystemClock > 
blaze::ConstSystemClockID
 Handle for the system clock of the Blaze library.
 
typedef boost::true_type blaze::TrueType
 Type traits base class.The TrueType class is used as base class for type traits and value traits that evaluate to true.
 
typedef int64_t blaze::large_t
 The largest available signed integer data type.
 
typedef uint64_t blaze::ularge_t
 The largest available unsigned integer data type.
 
typedef ularge_t blaze::id_t
 Unsigned integer data type for integral IDs.
 

Functions

template<typename T , unsigned int N>
size_t blaze::dimensionof (T(&a)[N])
 Static evaluation of array dimensions. More...
 
template<typename T1 >
void blaze::UNUSED_PARAMETER (const T1 &)
 Suppression of unused parameter warnings. More...
 

Variables

const blaze::Null NULL
 Global NULL pointer.This instance of the Null class replaces the NULL macro to ensure a type-safe NULL pointer.
 

InputString operators

bool blaze::IsFileName (const InputString &s)
 Tests for a valid file name. More...
 
std::ostream & blaze::operator<< (std::ostream &os, const InputString &str)
 Global output operator for the InputString class. More...
 
std::istream & blaze::operator>> (std::istream &is, InputString &str)
 Global input operator for the InputString class. More...
 

Pointer cast operators

template<typename To , typename From >
To * blaze::static_pointer_cast (From *ptr)
 Static cast for pointer types. More...
 
template<typename To , typename From >
To * blaze::dynamic_pointer_cast (From *ptr)
 Dynamic cast for pointer types. More...
 
template<typename To , typename From >
To * blaze::const_pointer_cast (From *ptr)
 Const cast for pointer types. More...
 
template<typename To , typename From >
To * blaze::reinterpret_pointer_cast (From *ptr)
 Reinterpret cast for pointer types. More...
 

Smart pointer cast operators

template<typename To , template< typename > class S, typename From >
S< To > blaze::static_pointer_cast (S< From > ptr)
 Static cast for smart pointers. More...
 
template<typename To , template< typename > class S, typename From >
S< To > blaze::dynamic_pointer_cast (S< From > ptr)
 Dynamic cast for smart pointers. More...
 
template<typename To , template< typename > class S, typename From >
S< To > blaze::const_pointer_cast (S< From > ptr)
 Const cast for smart pointers. More...
 
template<typename To , template< typename > class S, typename From >
S< To > blaze::reinterpret_pointer_cast (S< From > ptr)
 Reinterpret cast for smart pointers. More...
 

System clock setup functions

SystemClockID blaze::theSystemClock ()
 Returns a handle to the Blaze system clock. More...
 

Time functions

std::string blaze::getDate ()
 Creating a formated date string in the form YYYY-MM-DD. More...
 
std::string blaze::getTime ()
 Creating a formated time and date string. More...
 
double blaze::getWcTime ()
 Returns the current wall clock time in seconds. More...
 
double blaze::getCpuTime ()
 Returns the current CPU time in seconds. More...
 

Detailed Description

Function Documentation

template<typename To , typename From >
To * blaze::const_pointer_cast ( From *  ptr)
inline

Const cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The const_pointer_cast function is used exactly as the built-in const_cast operator but for pointer types.

class A { ... };
const A* a1; // Pointer to a constant A object
A* a2 = const_pointer_cast<A>( a1 ); // Const cast to a pointer to a non-constant A object
template<typename To , template< typename > class S, typename From >
S< To > blaze::const_pointer_cast ( S< From >  ptr)
inline

Const cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The const_pointer_cast function is used exactly as the built-in const_cast operator but for smart pointers.

class A { ... };
typedef SharedPtr<A> APtr;
typedef SharedPtr<const A> ConstAPtr;
ConstAPtr a1; // Smart pointer to a constant A object
APtr a2 = const_pointer_cast<A>( a1 ); // Const cast to a smart pointer to a non-constant A object
template<typename T , unsigned int N>
size_t blaze::dimensionof ( T(&)  a[N])
inline

Static evaluation of array dimensions.

Parameters
aReference to a static array of type T and size N.
Returns
Dimension of the static array.

The dimensionof function is a safe way to evaluate the size of an array. The function only works for array arguments and fails for pointers and user-defined class types.

int ai[ 42 ];
int* pi( ai );
std::vector<int> vi( 42 );
dimensionof( ai ); // Returns the size of the integer array (42)
dimensionof( pi ); // Fails to compile!
dimensionof( vi ); // Fails to compile!
template<typename To , typename From >
To * blaze::dynamic_pointer_cast ( From *  ptr)
inline

Dynamic cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The dynamic_pointer_cast function is used exactly as the built-in dynamic_cast operator but for pointer types. As in case with the built-in dynamic_cast 0 is returned if the runtime type conversion doesn't succeed.

class B { ... };
class D : public B { ... };
B* b = ...; // Base pointer
D* d = dynamic_pointer_cast<D>( b ); // Dynamic down-cast
template<typename To , template< typename > class S, typename From >
S< To > blaze::dynamic_pointer_cast ( S< From >  ptr)
inline

Dynamic cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The dynamic_pointer_cast function is used exactly as the built-in dynamic_cast operator but for smart pointers. As in case with the built-in dynamic_cast 0 is returned if the runtime type conversion doesn't succeed.

class B { ... };
class D : public B { ... };
typedef SharedPtr<B> BPtr;
typedef SharedPtr<D> DPtr;
BPtr b = ...; // Base smart pointer
DPtr d = dynamic_pointer_cast<D>( b ); // Dynamic down-cast
double blaze::getCpuTime ( )
inline

Returns the current CPU time in seconds.

Returns
The current CPU time in seconds.
std::string blaze::getDate ( )
inline

Creating a formated date string in the form YYYY-MM-DD.

Returns
Formated date string
std::string blaze::getTime ( )
inline

Creating a formated time and date string.

Returns
Formated time and date string in the format WEEKDAY DAY.MONTH YEAR, HOUR:MINUTES
double blaze::getWcTime ( )
inline

Returns the current wall clock time in seconds.

Returns
The current wall clock time in seconds.
bool blaze::IsFileName ( const InputString &  s)
inline

Tests for a valid file name.

Parameters
sThe file name string.
Returns
true if the string is a file name, false if it is not.

In order to be a file name, the first character can only be an alphanumerical character, '.', '/' or '_'.

std::ostream & blaze::operator<< ( std::ostream &  os,
const InputString &  str 
)
inline

Global output operator for the InputString class.

Parameters
osReference to the output stream.
strReference to a string object.
Returns
The output stream.
std::istream & blaze::operator>> ( std::istream &  is,
InputString &  str 
)
inline

Global input operator for the InputString class.

Parameters
isReference to the input stream.
strReference to a string object.
Returns
The input stream.

The input operator guarantees that the string object is not changed in the case of an input error.

template<typename To , typename From >
To * blaze::reinterpret_pointer_cast ( From *  ptr)
inline

Reinterpret cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The reinterpret_pointer_cast function is used exactly as the built-in reinterpret_cast operator but for pointer types.

class A { ... };
unsigned char* raw = new unsigned char[ sizeof(A)*10 ]; // Allocation of raw memory
A* a = reinterpret_pointer_cast<A>( raw ); // Reinterpretation cast
template<typename To , template< typename > class S, typename From >
S< To > blaze::reinterpret_pointer_cast ( S< From >  ptr)
inline

Reinterpret cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The reinterpret_pointer_cast function is used exactly as the built-in reinterpret_cast operator but for smart pointers.

template<typename To , typename From >
To * blaze::static_pointer_cast ( From *  ptr)
inline

Static cast for pointer types.

Parameters
ptrThe pointer to be cast.
Returns
The casted value.

The static_pointer_cast function is used exactly as the built-in static_cast operator but for pointer types.

class B { ... };
class D : public B { ... };
B* b = new D(); // Base pointer to a derived class object
D* d = static_pointer_cast<D>( b ); // Static down-cast
template<typename To , template< typename > class S, typename From >
S< To > blaze::static_pointer_cast ( S< From >  ptr)
inline

Static cast for smart pointers.

Parameters
ptrThe smart pointer to be cast.
Returns
The casted smart pointer.

The static_pointer_cast function is used exactly as the built-in static_cast operator but for smart pointers.

class B { ... };
class D : public B { ... };
typedef SharedPtr<B> BPtr;
typedef SharedPtr<D> DPtr;
BPtr b = BPtr( new D() ); // Base smart pointer to a derived class object
DPtr d = static_pointer_cast<D>( b ); // Static down-cast
SystemClockID blaze::theSystemClock ( )
inline

Returns a handle to the Blaze system clock.

Returns
Handle to the active system clock.
template<typename T1 >
void blaze::UNUSED_PARAMETER ( const T1 &  )
inline

Suppression of unused parameter warnings.

Returns
void

The UNUSED_PARAMETER function provides the functionality to suppress warnings about up to six unused parameters. Usually this problem occurs in case a parameter is given a name but is not used within the function:

void f( int x )
{} // x is not used within f. This may result in an unused parameter warning.

A possible solution is to keep the parameter unnamed:

void f( int )
{} // No warning about unused parameter is issued

However, there are situations where is approach is not possible, as for instance in case the variable must be documented via Doxygen. For these cases, the UNUSED_PARAMETER class can be used to suppress the warnings:

void f( int x )
{
UNUSED_PARAMETER( x ); // Suppresses the unused parameter warnings
}

The NullType class represents an invalid or terminating data type for generic codes. For instance, the TypeList class uses the NullType as terminating data type for the type list.