OpendTect-6_4  6.4
Namespaces | Macros | Functions
commondefs.h File Reference
Include dependency graph for commondefs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Threads
 interface to threads that should be portable.
 

Macros

#define mRounded(typ, x)   roundOff<typ>( x )
 
#define mNINT32(x)   mRounded( od_int32, x )
 
#define mNINT64(x)   mRounded( od_int64, x )
 
#define mMAX(x, y)   ( (x)>(y) ? (x) : (y) )
 
#define mMIN(x, y)   ( (x)<(y) ? (x) : (y) )
 
#define mMaxLimited(v, lim)   ( (v)<(lim) ? (v) : (lim) )
 
#define mMinLimited(v, lim)   ( (v)>(lim) ? (v) : (lim) )
 
#define mIsZero(x, eps)   isFPZero( x, eps )
 
#define mIsEqual(x, y, eps)   isFPEqual( x, y, eps )
 
#define mIsEqualWithUdf(x, y, e)   ((mIsUdf(x) && mIsUdf(y)) || mIsEqual(x,y,e) )
 
#define mDefEpsF   (1e-10f)
 
#define mDefEpsD   (1e-10)
 
#define mDefEps   mDefEpsD
 
#define M_PI   3.14159265358979323846
 
#define M_PIl   3.1415926535897932384626433832795029L
 
#define M_2PI   6.28318530717958647692
 
#define M_PI_2   1.57079632679489661923
 
#define M_PI_4   0.78539816339744830962
 
#define M_SQRT2   1.41421356237309504880168872421
 
#define M_SQRT1_2   0.70710678118654752440
 
#define M_PIf   3.14159265358979323846f
 
#define M_2PIf   6.28318530717958647692f
 
#define M_PI_2f   1.57079632679489661923f
 
#define M_PI_4f   0.78539816339744830962f
 
#define M_SQRT2f   1.41421356237309504880168872421f
 
#define M_SQRT1_2f   0.70710678118654752440f
 
#define MAXFLOAT   3.4028234663852886e+38F
 
#define MAXDOUBLE   1.7976931348623157e+308
 
#define mFromFeetFactorF   0.3048f
 
#define mFromFeetFactorD   0.3048
 
#define mToFeetFactorF   3.2808399f
 
#define mToFeetFactorD   3.28083989501312336
 
#define mToPercent(f)   (mIsUdf(f) ? f : f*100)
 
#define mFromPercent(f)   (mIsUdf(f) ? f : f*0.01)
 
#define mDeg2RadD   0.017453292519943292
 
#define mRad2DegD   57.295779513082323
 
#define mDeg2RadF   0.017453292519943292f
 
#define mRad2DegF   57.295779513082323f
 
#define mCast(tp, v)   ((tp)(v))
 
#define cCast(tp, v)   const_cast< tp >( v )
 
#define dCast(tp, v)   dynamic_cast< tp >( v )
 
#define rCast(tp, v)   reinterpret_cast< tp >( v )
 
#define sCast(tp, v)   static_cast< tp >( v )
 
#define mDynamicCast(typ, out, in)   out = dynamic_cast< typ >( in );
 
#define mDynamicCastGet(typ, out, in)   typ mDynamicCast(typ,out,in)
 
#define mDefSetupClssMemb(clss, typ, memb)
 
#define mDefSetupMemb(typ, memb)   mDefSetupClssMemb(Setup,typ,memb)
 
#define dll_export
 
#define dll_import
 
#define mMaxFilePathLength   255
 
#define mExp(module)   Export_##module
 
#define mExpClass(module)   class mExp( module )
 
#define mExpStruct(module)   struct mExp( module )
 
#define mGlobal(module)   mExp( module )
 
#define mClass(module)   class
 
#define mStruct(module)   mExpStruct( module )
 
#define mExtern(module)   extern mExp( module )
 
#define mExternC(module)   extern "C" mExp( module )
 
#define mExportInst(mod, tp)   Extern_##mod tp mExp(mod)
 
#define mExportTemplClassInst(mod)   mExportInst(mod,template class)
 
#define mLockStaticInitLock(nm)
 
#define mUnlockStaticInitLock(nm)
 
#define mDefineStaticLocalObject(type, var, init)
 
#define mIfNotFirstTime(act)
 Macro that does something except the very first time reached. More...
 
#define mFDQtclass(cls)   class cls;
 
#define mQtclass(cls)   ::cls
 
#define mUseQtnamespace
 
#define mTryAlloc(var, stmt)   { try { var = new stmt; } catch ( std::bad_alloc ) { var = 0; } }
 Catches bad_alloc and sets ptr to null as normal. More...
 
#define mTryAllocPtrMan(var, stmt)   { try { var = new stmt; } catch ( std::bad_alloc ) { var.set( 0 ); } }
 
#define mDeclareAndTryAlloc(tp, var, stmt)
 Creates variable, try to alloc and catch bad_alloc. More...
 
#define mGetIdxArr(tp, var, sz)
 Creates new array of an integer type filled with index. More...
 
#define mDoArrayPtrOperation(type, arr, operation, arrsz, ptrinc)
 

Functions

template<class RT , class T >
RT roundOff (T x)
 
template<class RT >
RT roundOff (double x)
 
template<class RT >
RT roundOff (float x)
 
template<class T >
void Swap (T &a, T &b)
 
template<class fT , class eT >
bool isFPZero (fT v, eT eps)
 
template<class T1 , class T2 , class eT >
bool isFPEqual (T1 v1, T2 v2, eT eps)
 
bool Threads::atomicSetIfValueIs (volatile int &val, int curval, int newval, int *actualvalptr)
 

Macro Definition Documentation

#define cCast (   tp,
 
)    const_cast< tp >( v )
#define dCast (   tp,
 
)    dynamic_cast< tp >( v )
#define dll_export
#define dll_import
#define M_2PI   6.28318530717958647692
#define M_2PIf   6.28318530717958647692f
#define M_PI   3.14159265358979323846
#define M_PI_2   1.57079632679489661923
#define M_PI_2f   1.57079632679489661923f
#define M_PI_4   0.78539816339744830962
#define M_PI_4f   0.78539816339744830962f
#define M_PIf   3.14159265358979323846f
#define M_PIl   3.1415926535897932384626433832795029L
#define M_SQRT1_2   0.70710678118654752440
#define M_SQRT1_2f   0.70710678118654752440f
#define M_SQRT2   1.41421356237309504880168872421
#define M_SQRT2f   1.41421356237309504880168872421f
#define MAXDOUBLE   1.7976931348623157e+308
#define MAXFLOAT   3.4028234663852886e+38F
#define mCast (   tp,
 
)    ((tp)(v))
#define mClass (   module)    class
#define mDeclareAndTryAlloc (   tp,
  var,
  stmt 
)
Value:
tp var; \
mTryAlloc(var,stmt)

Creates variable, try to alloc and catch bad_alloc.

#define mDefEps   mDefEpsD
#define mDefEpsD   (1e-10)
#define mDefEpsF   (1e-10f)
#define mDefineStaticLocalObject (   type,
  var,
  init 
)
Value:
mLockStaticInitLock( static##var##lck__ ); \
static type var init; \
mUnlockStaticInitLock( static##var##lck__ )
bool init()
#define mLockStaticInitLock(nm)
Definition: commondefs.h:191
#define mUnlockStaticInitLock(nm)
Definition: commondefs.h:192
#define mDefSetupClssMemb (   clss,
  typ,
  memb 
)
Value:
typ memb##_; \
clss& memb( typ val ) { memb##_ = val; return *this; }
#define mDefSetupMemb (   typ,
  memb 
)    mDefSetupClssMemb(Setup,typ,memb)
#define mDeg2RadD   0.017453292519943292
#define mDeg2RadF   0.017453292519943292f
#define mDynamicCast (   typ,
  out,
  in 
)    out = dynamic_cast< typ >( in );
#define mDynamicCastGet (   typ,
  out,
  in 
)    typ mDynamicCast(typ,out,in)
#define mExp (   module)    Export_##module
#define mExpClass (   module)    class mExp( module )
#define mExportInst (   mod,
  tp 
)    Extern_##mod tp mExp(mod)
#define mExportTemplClassInst (   mod)    mExportInst(mod,template class)
#define mExpStruct (   module)    struct mExp( module )
#define mExtern (   module)    extern mExp( module )
#define mExternC (   module)    extern "C" mExp( module )
#define mFDQtclass (   cls)    class cls;
#define mFromFeetFactorD   0.3048
#define mFromFeetFactorF   0.3048f
#define mFromPercent (   f)    (mIsUdf(f) ? f : f*0.01)
#define mGetIdxArr (   tp,
  var,
  sz 
)
Value:
tp* var; \
mTryAlloc(var,tp [sz]) \
if ( var ) \
for ( tp idx=0; idx<sz; idx++ ) \
var[idx] = idx

Creates new array of an integer type filled with index.

#define mGlobal (   module)    mExp( module )
#define mIfNotFirstTime (   act)
Value:
{ \
static volatile int _already_visited_ = 0; \
if ( !Threads::atomicSetIfValueIs( _already_visited_, \
0, 1, 0 ) ) \
act; \
}
bool atomicSetIfValueIs(volatile int &val, int curval, int newval, int *actualvalptr)
Definition: atomic.h:99

Macro that does something except the very first time reached.

#define mIsEqual (   x,
  y,
  eps 
)    isFPEqual( x, y, eps )
#define mIsEqualWithUdf (   x,
  y,
 
)    ((mIsUdf(x) && mIsUdf(y)) || mIsEqual(x,y,e) )
#define mIsZero (   x,
  eps 
)    isFPZero( x, eps )
#define mLockStaticInitLock (   nm)
#define mMAX (   x,
 
)    ( (x)>(y) ? (x) : (y) )
#define mMaxFilePathLength   255
#define mMaxLimited (   v,
  lim 
)    ( (v)<(lim) ? (v) : (lim) )
#define mMIN (   x,
 
)    ( (x)<(y) ? (x) : (y) )
#define mMinLimited (   v,
  lim 
)    ( (v)>(lim) ? (v) : (lim) )
#define mNINT32 (   x)    mRounded( od_int32, x )
#define mNINT64 (   x)    mRounded( od_int64, x )
#define mQtclass (   cls)    ::cls
#define mRad2DegD   57.295779513082323
#define mRad2DegF   57.295779513082323f
#define mRounded (   typ,
 
)    roundOff<typ>( x )
#define mStruct (   module)    mExpStruct( module )
#define mToFeetFactorD   3.28083989501312336
#define mToFeetFactorF   3.2808399f
#define mToPercent (   f)    (mIsUdf(f) ? f : f*100)
#define mTryAlloc (   var,
  stmt 
)    { try { var = new stmt; } catch ( std::bad_alloc ) { var = 0; } }

Catches bad_alloc and sets ptr to null as normal.

#define mTryAllocPtrMan (   var,
  stmt 
)    { try { var = new stmt; } catch ( std::bad_alloc ) { var.set( 0 ); } }
#define mUnlockStaticInitLock (   nm)
#define mUseQtnamespace
#define rCast (   tp,
 
)    reinterpret_cast< tp >( v )
#define sCast (   tp,
 
)    static_cast< tp >( v )

Function Documentation

template<class T1 , class T2 , class eT >
bool isFPEqual ( T1  v1,
T2  v2,
eT  eps 
)
inline
template<class fT , class eT >
bool isFPZero ( fT  v,
eT  eps 
)
inline
template<class RT , class T >
RT roundOff ( x)
inline
template<class RT >
RT roundOff ( double  x)
inline
template<class RT >
RT roundOff ( float  x)
inline
template<class T >
void Swap ( T &  a,
T &  b 
)
inline

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019