Tomographer  v2.0
Tomographer C++ Framework Documentation
cxxutil.h File Reference

(v2.0)

Some C++ utilities, with a tad of C++11 tricks. More...

#include <cassert>
#include <cstddef>
#include <cstdlib>
#include <type_traits>
#include <Eigen/Core>
#include <tomographer2/tools/conststr.h>
+ Include dependency graph for cxxutil.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Tomographer::Tools::StaticOrDynamic< T_, IsDynamic_, StaticValue_ >
 A type which stores a value possibly known at compile-time. More...
 
class  Tomographer::Tools::StaticOrDynamic< T_, true, StaticValue_ >
 Template Specialization – see StaticOrDynamic<T_,IsDynamic_,StaticValue_> More...
 
struct  Tomographer::Tools::StoreIfEnabled< T_, enabled >
 Utility that stores a data type if a compile-time flag is enabled. More...
 
struct  Tomographer::Tools::StoreIfEnabled< T_, true >
 Specialization of StoreIfEnabled<T_,enabled> for if we're storing a value. More...
 
struct  Tomographer::Tools::isComplex< Scalar >
 statically determine whether a type is complex More...
 
struct  Tomographer::Tools::ComplexRealScalar< Scalar >
 The Real scalar type corresponding to a std::complex type. More...
 
struct  Tomographer::Tools::ComplexRealScalar< std::complex< RealScalar > >
 Implementation of ComplexRealScalar for complex types. More...
 

Namespaces

 Tomographer
 Base namespace for the Tomographer project.
 
 Tomographer::Tools
 Various useful tools.
 

Macros

#define TOMO_STATIC_ASSERT_EXPR(...)   static_assert(__VA_ARGS__, #__VA_ARGS__)
 Tool for static assertions without message. More...
 
#define tomographer_assert(...)   eigen_assert((__VA_ARGS__) && "assert: " #__VA_ARGS__)
 
#define PRINTF1_ARGS_SAFE
 
#define PRINTF2_ARGS_SAFE
 
#define PRINTF3_ARGS_SAFE
 
#define PRINTF4_ARGS_SAFE
 
#define TOMOGRAPHER_CXX_STACK_FORCE_REALIGN
 
#define TOMO_FUNCTION   __PRETTY_FUNCTION__
 Expands to the current function name or signature. More...
 

Functions

template<typename F >
tomo_internal::FinalAction< F > Tomographer::Tools::finally (F f)
 implementation of a finally clause, somewhat like in Python More...
 
template<typename T >
std::ostreamTomographer::Tools::operator<< (std::ostream &str, const StoreIfEnabled< T, false > &)
 C++ Stream operators for StoreIfEnabled. More...
 
template<typename T >
std::ostreamTomographer::Tools::operator<< (std::ostream &str, const StoreIfEnabled< T, true > &val)
 C++ Stream operators for StoreIfEnabled. More...
 
template<typename IntType = int>
constexpr bool Tomographer::Tools::isPowerOfTwo (IntType N)
 Return true if the argument is a power of two, false otherwise.
 
template<typename X >
std::enable_if< std::is_unsigned< X >::value, bool >::type Tomographer::Tools::isPositive (const X)
 Test whether the given value is positive or zero. More...
 
template<typename X >
std::enable_if<!std::is_unsigned< X >::value, bool >::type Tomographer::Tools::isPositive (const X val)
 See isPositive()
 
int Tomographer::Tools::getWidthForTerminalOutput (int max_width=0)
 Return a suitable width for displaying stuff on the standard output. More...
 
constexpr conststr Tomographer::Tools::extractFuncName (const conststr &funcname)
 Extract the function name from its signature. More...
 

Detailed Description

Some C++ utilities, with a tad of C++11 tricks.

Definition in file cxxutil.h.

Macro Definition Documentation

#define TOMO_FUNCTION   __PRETTY_FUNCTION__

Expands to the current function name or signature.

For Tomographer::Logger::LocalLogger, use TOMO_ORIGIN.

Definition at line 528 of file cxxutil.h.

#define TOMO_STATIC_ASSERT_EXPR (   ...)    static_assert(__VA_ARGS__, #__VA_ARGS__)

Tool for static assertions without message.

Simply use as message to C++11's static_assert() a stringified version of the expression itself.

Definition at line 59 of file cxxutil.h.

#define TOMOGRAPHER_CXX_STACK_FORCE_REALIGN

Force stack realign for some functions, where the stacks may not aligned by default (e.g. when using threads for Windows—set this attribute to any external entry points as http://stackoverflow.com/a/6718067/1694896 as well as http://www.peterstock.co.uk/games/mingw_sse/)

Todo:
Look up the exact conditions (compilers, platforms, stack sizes etc.) to make sure this macro has a correct value in all cases.

Definition at line 448 of file cxxutil.h.