OpendTect  6.6
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 mNonConst(x)   getNonConst( x )
 
#define mSelf()   mNonConst( *this )
 
#define mUseType(scope, typ)   typedef scope::typ typ
 
#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)   static 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 = nullptr; } }
 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( nullptr ); } }
 
#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)
 
#define mMaxContiguousMemSize   0x4000000000
 
#define od_sprintf   snprintf
 
#define od_sscanf   sscanf
 

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 fT , class eT >
bool isFPZero (fT v, eT eps)
 
template<class T1 , class T2 , class eT >
bool isFPEqual (T1 v1, T2 v2, eT eps)
 
template<class T >
getLimited (T v, T min, T max)
 
template<class T >
void Swap (T &a, T &b)
 
template<class T >
T * getNonConst (const T *t)
 
template<class T >
T & getNonConst (const T &t)
 
bool Threads::atomicSetIfValueIs (volatile int &val, int curval, int newval, int *actualvalptr)
 

Macro Definition Documentation

◆ cCast

#define cCast (   tp,
 
)    const_cast< tp >( v )

◆ dCast

#define dCast (   tp,
 
)    dynamic_cast< tp >( v )

◆ dll_export

#define dll_export

◆ dll_import

#define dll_import

◆ M_2PI

#define M_2PI   6.28318530717958647692

◆ M_2PIf

#define M_2PIf   6.28318530717958647692f

◆ M_PI

#define M_PI   3.14159265358979323846

◆ M_PI_2

#define M_PI_2   1.57079632679489661923

◆ M_PI_2f

#define M_PI_2f   1.57079632679489661923f

◆ M_PI_4

#define M_PI_4   0.78539816339744830962

◆ M_PI_4f

#define M_PI_4f   0.78539816339744830962f

◆ M_PIf

#define M_PIf   3.14159265358979323846f

◆ M_PIl

#define M_PIl   3.1415926535897932384626433832795029L

◆ M_SQRT1_2

#define M_SQRT1_2   0.70710678118654752440

◆ M_SQRT1_2f

#define M_SQRT1_2f   0.70710678118654752440f

◆ M_SQRT2

#define M_SQRT2   1.41421356237309504880168872421

◆ M_SQRT2f

#define M_SQRT2f   1.41421356237309504880168872421f

◆ MAXDOUBLE

#define MAXDOUBLE   1.7976931348623157e+308

◆ MAXFLOAT

#define MAXFLOAT   3.4028234663852886e+38F

◆ mCast

#define mCast (   tp,
 
)    ((tp)(v))

◆ mClass

#define mClass (   module)    class

◆ mDeclareAndTryAlloc

#define mDeclareAndTryAlloc (   tp,
  var,
  stmt 
)
Value:
tp var; \
mTryAlloc(var,stmt)

Creates variable, try to alloc and catch bad_alloc.

◆ mDefEps

#define mDefEps   mDefEpsD

◆ mDefEpsD

#define mDefEpsD   (1e-10)

◆ mDefEpsF

#define mDefEpsF   (1e-10f)

◆ mDefineStaticLocalObject

#define mDefineStaticLocalObject (   type,
  var,
  init 
)    static type var init;

◆ mDefSetupClssMemb

#define mDefSetupClssMemb (   clss,
  typ,
  memb 
)
Value:
typ memb##_; \
clss& memb( typ val ) { memb##_ = val; return *this; }

◆ mDefSetupMemb

#define mDefSetupMemb (   typ,
  memb 
)    mDefSetupClssMemb(Setup,typ,memb)

◆ mDeg2RadD

#define mDeg2RadD   0.017453292519943292

◆ mDeg2RadF

#define mDeg2RadF   0.017453292519943292f

◆ mDynamicCast

#define mDynamicCast (   typ,
  out,
  in 
)    out = dynamic_cast< typ >( in );

◆ mDynamicCastGet

#define mDynamicCastGet (   typ,
  out,
  in 
)    typ mDynamicCast(typ,out,in)

◆ mExp

#define mExp (   module)    Export_##module

◆ mExpClass

#define mExpClass (   module)    class mExp( module )

◆ mExportInst

#define mExportInst (   mod,
  tp 
)    Extern_##mod tp mExp(mod)

◆ mExportTemplClassInst

#define mExportTemplClassInst (   mod)    mExportInst(mod,template class)

◆ mExpStruct

#define mExpStruct (   module)    struct mExp( module )

◆ mExtern

#define mExtern (   module)    extern mExp( module )

◆ mExternC

#define mExternC (   module)    extern "C" mExp( module )

◆ mFDQtclass

#define mFDQtclass (   cls)    class cls;

◆ mFromFeetFactorD

#define mFromFeetFactorD   0.3048

◆ mFromFeetFactorF

#define mFromFeetFactorF   0.3048f

◆ mFromPercent

#define mFromPercent (   f)    (mIsUdf(f) ? f : f*0.01)

◆ mGetIdxArr

#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.

◆ mGlobal

#define mGlobal (   module)    mExp( module )

◆ mIfNotFirstTime

#define mIfNotFirstTime (   act)
Value:
{ \
static volatile int _already_visited_ = 0; \
if ( !Threads::atomicSetIfValueIs( _already_visited_, \
0, 1, 0 ) ) \
act; \
}

Macro that does something except the very first time reached.

◆ mIsEqual

#define mIsEqual (   x,
  y,
  eps 
)    isFPEqual( x, y, eps )

◆ mIsEqualWithUdf

#define mIsEqualWithUdf (   x,
  y,
 
)    ((mIsUdf(x) && mIsUdf(y)) || mIsEqual(x,y,e) )

◆ mIsZero

#define mIsZero (   x,
  eps 
)    isFPZero( x, eps )

◆ mLockStaticInitLock

#define mLockStaticInitLock (   nm)

◆ mMAX

#define mMAX (   x,
 
)    ( (x)>(y) ? (x) : (y) )

◆ mMaxContiguousMemSize

#define mMaxContiguousMemSize   0x4000000000

◆ mMaxFilePathLength

#define mMaxFilePathLength   255

◆ mMaxLimited

#define mMaxLimited (   v,
  lim 
)    ( (v)<(lim) ? (v) : (lim) )

◆ mMIN

#define mMIN (   x,
 
)    ( (x)<(y) ? (x) : (y) )

◆ mMinLimited

#define mMinLimited (   v,
  lim 
)    ( (v)>(lim) ? (v) : (lim) )

◆ mNINT32

#define mNINT32 (   x)    mRounded( od_int32, x )

◆ mNINT64

#define mNINT64 (   x)    mRounded( od_int64, x )

◆ mNonConst

#define mNonConst (   x)    getNonConst( x )

◆ mQtclass

#define mQtclass (   cls)    ::cls

◆ mRad2DegD

#define mRad2DegD   57.295779513082323

◆ mRad2DegF

#define mRad2DegF   57.295779513082323f

◆ mRounded

#define mRounded (   typ,
 
)    roundOff<typ>( x )

◆ mSelf

#define mSelf ( )    mNonConst( *this )

◆ mStruct

#define mStruct (   module)    mExpStruct( module )

◆ mToFeetFactorD

#define mToFeetFactorD   3.28083989501312336

◆ mToFeetFactorF

#define mToFeetFactorF   3.2808399f

◆ mToPercent

#define mToPercent (   f)    (mIsUdf(f) ? f : f*100)

◆ mTryAlloc

#define mTryAlloc (   var,
  stmt 
)    { try { var = new stmt; } catch ( std::bad_alloc ) { var = nullptr; } }

Catches bad_alloc and sets ptr to null as normal.

◆ mTryAllocPtrMan

#define mTryAllocPtrMan (   var,
  stmt 
)    { try { var = new stmt; } catch ( std::bad_alloc ) { var.set( nullptr ); } }

◆ mUnlockStaticInitLock

#define mUnlockStaticInitLock (   nm)

◆ mUseQtnamespace

#define mUseQtnamespace

◆ mUseType

#define mUseType (   scope,
  typ 
)    typedef scope::typ typ

◆ od_sprintf

#define od_sprintf   snprintf

◆ od_sscanf

#define od_sscanf   sscanf

◆ rCast

#define rCast (   tp,
 
)    reinterpret_cast< tp >( v )

◆ sCast

#define sCast (   tp,
 
)    static_cast< tp >( v )

Function Documentation

◆ getLimited()

template<class T >
T getLimited ( v,
min,
max 
)
inline

◆ getNonConst() [1/2]

template<class T >
T& getNonConst ( const T &  t)
inline

◆ getNonConst() [2/2]

template<class T >
T* getNonConst ( const T *  t)
inline

◆ isFPEqual()

template<class T1 , class T2 , class eT >
bool isFPEqual ( T1  v1,
T2  v2,
eT  eps 
)
inline

◆ isFPZero()

template<class fT , class eT >
bool isFPZero ( fT  v,
eT  eps 
)
inline

◆ roundOff() [1/3]

template<class RT >
RT roundOff ( double  x)
inline

◆ roundOff() [2/3]

template<class RT >
RT roundOff ( float  x)
inline

◆ roundOff() [3/3]

template<class RT , class T >
RT roundOff ( x)
inline

◆ Swap()

template<class T >
void Swap ( T &  a,
T &  b 
)
inline
Threads::atomicSetIfValueIs
bool atomicSetIfValueIs(volatile int &val, int curval, int newval, int *actualvalptr)

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