C++QEDCore  v2 Milestone 10
a framework for simulating open quantum dynamics – core
cpputils Namespace Reference

Namespace comprising otherwise hard-to-classify generic utilities. More...

Namespaces

 mii
 Helpers to MultiIndexIterator.
 

Classes

class  BooleanNegatedProxy
 Bound to a boolean lvalue, it behaves like a boolean always with opposite value. More...
 
struct  Converter
 
struct  ElementType
 template metafunction returning (by convention, as a member typedef type) the type of elements of the multi-array A More...
 
struct  Exception
 The class that is (meant to be, at least) the base of all exceptions in the framework. More...
 
class  KeyPrinter
 Stores and prints a “key” (a.k.a. legend) to data, that is, an explanation to each element of a certain range of data. More...
 
class  MultiIndexIterator
 An iterator over all possible combinations of indices (a number of integers) between certain bounds. More...
 
struct  Rank
 template metafunction for the rank (arity) of the multi-array A More...
 
class  TaggedException
 Class reporting also the “what-ness” of the exception. More...
 
struct  TypeID
 template metafunction providing an identifier string for the multi-array A More...
 

Typedefs

typedef boost::archive::binary_iarchive iarchive
 delegated to Boost.Serialization
 
typedef boost::archive::binary_oarchive oarchive
 delegated to Boost.Serialization More...
 

Functions

template<typename SeqOfSeqs , typename Out_Iterator >
const Out_Iterator concatenateViaIterator (const SeqOfSeqs &sOs, Out_Iterator out)
 Fills a container by output iterator with concatenated values taken subsequently from the input sequences. More...
 
template<typename SeqOfSeqs , typename Out >
const Out & concatenate (const SeqOfSeqs &sOs, Out &&out)
 Fills a container of the necessary size with concatenated values taken subsequently from the input sequences. More...
 
template<typename Out , typename SeqOfSeqs >
const Out concatenateGrow (const SeqOfSeqs &sOs)
 Fills an empty (default-constructed) container with concatenated values taken subsequently from the input sequences.
 
template<typename T >
const boost::shared_ptr< T > nonOwningSharedPtr (T *t)
 Returns a “non-owning” shared pointer that doesn’t do anything on deletion. More...
 
template<typename T >
const boost::shared_ptr< const T > nonOwningConstSharedPtr (T *t)
 Returns a “non-owning” shared pointer to const that doesn’t do anything on deletion. More...
 
template<typename T >
const boost::shared_ptr< T > sharedPointerize (boost::shared_ptr< T > t)
 Part of a bundle of functions providing a unified interface to wrap objects into the shared-pointer interface, it simply returns its argument. More...
 
template<typename T >
const boost::shared_ptr< T > sharedPointerize (T &t)
 Part of a bundle of functions providing a unified interface to wrap objects into the shared-pointer interface, it returns a non-owning shared pointer to its argument.
 
template<typename T >
const boost::shared_ptr< T > sharedPointerize (T *t)
 Part of a bundle of functions providing a unified interface to wrap objects into the shared-pointer interface, it returns a non-owning shared pointer to its argument.
 
Array memory traits
template<typename A >
bool isStorageContiguous (const A &a)
 
template<typename A >
size_t size (const A &a)
 
template<typename A >
std::vector< size_t > dimensions (const A &a)
 
template<typename A >
const double * data (const A &a)
 
template<typename A >
double * data (A &a)
 
template<typename A >
create (double *y, const A &a)
 Clone (create a non-owning array of data y of the same memory layout as a)
 
template<typename A >
const A create (const double *y, const A &a)
 Const clone (create a const non-owning array of data y of the same memory layout as a)
 
template<typename A >
create (const A &a)
 Empty clone (create a newly allocated owning empty array of the same memory layout as a)
 
Array traversal traits
template<typename A >
const A::element_type & subscript (const A &a, size_t i)
 subscription of a (which might be a multi-array) with a single integer More...
 
template<typename A >
A::element_type & subscript (A &a, size_t i)
 non-const subscription
 
template<typename A >
size_t subscriptLimit (const A &a)
 
`blitz::Array` memory traits for `blitz::Array<double,n>`
template<int n>
bool isStorageContiguous (const DArray< n > &a)
 
template<int n>
size_t size (const DArray< n > &a)
 
template<int n>
std::vector< size_t > dimensions (const DArray< n > &a)
 
template<int n>
const double * data (const DArray< n > &a)
 
template<int n>
double * data (DArray< n > &a)
 
template<int n>
DArray< n > create (double *y, const DArray< n > &a)
 
template<int n>
const DArray< n > create (const double *y, const DArray< n > &a)
 
template<int n>
DArray< n > create (const DArray< n > &a)
 
`blitz::Array` memory traits for `blitz::Array<dcomp,n>`
template<int n>
bool isStorageContiguous (const CArray< n > &a)
 
template<int n>
size_t size (const CArray< n > &a)
 
template<int n>
std::vector< size_t > dimensions (const CArray< n > &a)
 
template<int n>
const double * data (const CArray< n > &a)
 
template<int n>
double * data (CArray< n > &a)
 
template<int n>
CArray< n > create (double *y, const CArray< n > &a)
 
template<int n>
const CArray< n > create (const double *y, const CArray< n > &a)
 
template<int n>
CArray< n > create (const CArray< n > &a)
 
`blitz::Array` traversal traits for unary double and complex arrays
const double & subscript (const DArray< 1 > &a, size_t i)
 
double & subscript (DArray< 1 > &a, size_t i)
 
size_t subscriptLimit (const DArray< 1 > &a)
 
const dcompsubscript (const CArray< 1 > &a, size_t i)
 
dcompsubscript (CArray< 1 > &a, size_t i)
 
size_t subscriptLimit (const CArray< 1 > &a)
 
size_t stride (const CArray< 1 > &a)
 
template<int n>
const dcompsubscript (const CArray< n > &a, size_t i)
 
template<int n>
dcompsubscript (CArray< n > &a, size_t i)
 
template<int n>
size_t subscriptLimit (const CArray< n > &a)
 

Detailed Description

Namespace comprising otherwise hard-to-classify generic utilities.

Typedef Documentation

typedef boost::archive::binary_oarchive cpputils::oarchive

delegated to Boost.Serialization

Definition at line 74 of file Archive.h.

Function Documentation

template<typename SeqOfSeqs , typename Out >
const Out& cpputils::concatenate ( const SeqOfSeqs &  sOs,
Out &&  out 
)

Fills a container of the necessary size with concatenated values taken subsequently from the input sequences.

Parameters
[in]sOsthe sequence containing the input sequences

Definition at line 31 of file Algorithm.h.

template<typename SeqOfSeqs , typename Out_Iterator >
const Out_Iterator cpputils::concatenateViaIterator ( const SeqOfSeqs &  sOs,
Out_Iterator  out 
)

Fills a container by output iterator with concatenated values taken subsequently from the input sequences.

Note
Concatenation can be expressed as accumulation
Parameters
[in]sOsthe sequence containing the input sequences

Definition at line 16 of file Algorithm.h.

template<typename T >
const boost::shared_ptr<const T> cpputils::nonOwningConstSharedPtr ( T *  t)

Returns a “non-owning” shared pointer to const that doesn’t do anything on deletion.

Can be used even on automatic variables.

Template Parameters
Tthe type of the variable
Warning
Handle with due care! The wrapped object must live in a larger scope and must be properly deleted after the shared wrapper runs out of scope. Failure in the first respect will result in dangling pointers, while the second in memory leak.
Parameters
tthe object to be wrapped into the shared-pointer-to-const interface

Definition at line 43 of file SmartPtr.h.

template<typename T >
const boost::shared_ptr<T> cpputils::nonOwningSharedPtr ( T *  t)

Returns a “non-owning” shared pointer that doesn’t do anything on deletion.

Can be used even on automatic variables.

Template Parameters
Tthe type of the variable
Warning
Handle with due care! The wrapped object must live in a larger scope and must be properly deleted after the shared wrapper runs out of scope. Failure in the first respect will result in dangling pointers, while the second in memory leak.
Parameters
tthe object to be wrapped into the shared-pointer interface

Definition at line 33 of file SmartPtr.h.

template<typename T >
const boost::shared_ptr<T> cpputils::sharedPointerize ( boost::shared_ptr< T >  t)

Part of a bundle of functions providing a unified interface to wrap objects into the shared-pointer interface, it simply returns its argument.

Todo:
How to shared-pointerize an rvalue reference?

Definition at line 52 of file SmartPtr.h.

template<typename A >
const A::element_type& cpputils::subscript ( const A &  a,
size_t  i 
)

subscription of a (which might be a multi-array) with a single integer

Note
A::element_type is a hypothetic member type, which in fact never plays a role, since we are relying on template-parameter inference & overload resolution, wherein the return type does not play any role
template<int n>
const dcomp& cpputils::subscript ( const CArray< n > &  a,
size_t  i 
)
inline
Note
this is broken since blitz::Array iterators are not random-access
Todo:
fix this

Definition at line 139 of file BlitzArrayTraits.h.