libUtility.h File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include "Promotion.h"
#include "libDebug.h"

Go to the source code of this file.

Defines

#define ASSERT(__b)   {if (!(__b)) {UD("ASSERT FAILED: %s", #__b); abort();}}
#define ASSERTf(__b, s...)   {if (!(__b)) {UD("ASSERT FAILED: %s", #__b); UD(s); abort();}}
#define DEBUG   9
#define DTIMEEXECUTION(_s, _code)
#define DTIMELOOPEXECUTION(_s, _c, _code)
#define DTOCK(_s, _timer)   D(_s,TOCK( _timer ) )
#define ERROR(s...)   {UD("ERROR:" s); exit(1);}
#define HERE   UD("HERE");
#define IP(_c, _s...)   {IPX(_c,_s); printf("\n");}
#define IPX(_c, _s...)
#define P(_s...)   {printf(_s);printf("\n");}
#define PX(_s...)   {printf(_s);}
#define Stringify(x)   Stringify2(x)
#define Stringify2(x...)   #x
#define TICK(_timer)   double _timer = timestamp();
#define TOCK(_timer)   (timestamp() - _timer )
#define UDTIMEEXECUTION(_s, _code)
#define UDTOCK(_s, _timer)   UD(_s,TOCK( _timer ) )
#define WARNIF(b, s...)   do {if(b){WARNING(s);}} while(0)
#define WARNING(s...)   {printf("WARNING: "); printf(s); printf("\n");}

Functions

template<class T >
bool IsIntegral (const T &t)
template<class T1 , class T2 >
const PROMOTION (T1, T2)&max(const T1 &t1
template<class PRECISION >
 RANGEPROMOTION (PRECISION) sqr(const PRECISION &r)
template<class T >
int sign (const T &t)

Define Documentation

#define ASSERT ( __b   )     {if (!(__b)) {UD("ASSERT FAILED: %s", #__b); abort();}}
#define ASSERTf ( __b,
s...   )     {if (!(__b)) {UD("ASSERT FAILED: %s", #__b); UD(s); abort();}}
#define DEBUG   9
#define DTIMEEXECUTION ( _s,
_code   ) 
Value:
{                                                                                      \
        TIMEEXECUTION(_timer,_code);                                                                                            \
        D(_s,_timer);                                                                                                                           \
    }
#define DTIMELOOPEXECUTION ( _s,
_c,
_code   ) 
Value:
{                                                                           \
        TIMEEXECUTION(_timer,for (int _n=0; _n<_c; _n++){_code;});                              \
        D(_s,_timer);                                                                                                                           \
    }
#define DTOCK ( _s,
_timer   )     D(_s,TOCK( _timer ) )
#define ERROR ( s...   )     {UD("ERROR:" s); exit(1);}

Referenced by SourceAccessorSliceOf< DATA, 2, PRECISION, SOURCE >::Get(), Interpolate(), LoadAndScaleSources(), main(), NewInterpolatedSource(), CongealGroupPhasedOf< RECIPIE >::OptimizeSource(), PaddedImageBaseOf< DATA, 3 >::Pad(), SourceAccessorSliceOf< DATA, 2, PRECISION, SOURCE >::PrepareForAccess(), SourceMemoryOf< DATA, 3 >::RegisterDataAsParameters(), SourceMemoryOf< DATA, 2 >::RegisterDataAsParameters(), SourceMemoryOf< Real, DIMENSIONALITY >::RegisterDataAsParameters(), SourceTransformSpatialScaleOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceTransformSpatialScaleOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceTransformRemapOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceTransformRemapOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceTransformDataScaleOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceTransformDataScaleOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceAccessorSliceOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceAccessorRangeScaleOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceAccessorRangeScaleOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceAccessorLinearInterpolateOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceAccessorLinearInterpolateOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceAccessorEqualizeOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceAccessorEqualizeOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceAccessorDistributionFieldOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceAccessorDistributionFieldOf< DATA, 2, PRECISION, SOURCE >::Set(), SourceAccessorConvolutionOf< DATA, 3, PRECISION, SOURCE >::Set(), SourceAccessorConvolutionOf< DATA, 2, PRECISION, SOURCE >::Set(), OperatorLookupDimensionOf< Pixel8BitGrey, Point256DReal >::ToSource(), OperatorWeightedAverageOf< Point256DReal, Pixel8BitGrey >::ToSource(), OperatorIndexOfMaximumOf< DATA_OUT, DATA_SOURCE >::ToSource(), and OperatorMaximumDimensionOf< Point256DReal >::ToSource().

#define HERE   UD("HERE");
#define IP ( _c,
_s...   )     {IPX(_c,_s); printf("\n");}
#define IPX ( _c,
_s...   ) 
Value:
{                                                 \
        for (int _n=0; _n<_c; _n++){                                \
            printf("\t");                                                           \
        };                                                                                  \
        printf(_s);                                                                 \
}
#define P ( _s...   )     {printf(_s);printf("\n");}
#define PX ( _s...   )     {printf(_s);}

Referenced by Optimize_RandomWalk(), and PrintImage().

#define Stringify (  )     Stringify2(x)
#define Stringify2 ( x...   )     #x
#define TICK ( _timer   )     double _timer = timestamp();
#define TOCK ( _timer   )     (timestamp() - _timer )
#define UDTIMEEXECUTION ( _s,
_code   ) 
Value:
{                                                                                     \
        TIMEEXECUTION(_timer,_code);                                                                                            \
        UD(_s,_timer);                                                                                                                          \
    }
#define UDTOCK ( _s,
_timer   )     UD(_s,TOCK( _timer ) )
#define WARNIF ( b,
s...   )     do {if(b){WARNING(s);}} while(0)
#define WARNING ( s...   )     {printf("WARNING: "); printf(s); printf("\n");}

Referenced by ReadBrainWeb().


Function Documentation

template<class T >
bool IsIntegral ( const T &  t  )  [inline]
template<class T1 , class T2 >
const PROMOTION ( T1  ,
T2   
) const [inline]
template<class PRECISION >
RANGEPROMOTION ( PRECISION   )  const [inline]
template<class T >
int sign ( const T &  t  )  [inline]

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1