OpendTect  6.3
Classes | Macros
Basic

Classes

class  ArrayND< T >
 An ArrayND is an array with a given number of dimensions and a size. More...
 
class  Array1D< T >
 Array1D ( Subclass of ArrayND ) is a one dimensional array. More...
 
class  Array2D< T >
 Array2D ( Subclass of ArrayND ) is a two dimensional array. More...
 
class  Array3D< T >
 Array3D ( Subclass of ArrayND ) is a three dimensional array. More...
 
class  ArrayNDIter
 Iterates through all samples in an ArrayND. More...
 
class  ArrayNDValseriesAdapter< T >
 Adapter that makes any ArrayND to a (slow) value series. More...
 
class  ArrayNDDataExtracter< T >
 Gets a one dimensional array from an ArrayND. More...
 
class  ArrayImplBase< T >
 
class  Array1DImpl< T >
 Implementation of Array1D. More...
 
class  Array2DImpl< T >
 Implementation of Array2D. More...
 
class  Array3DImpl< T >
 Implementation of Array3D. More...
 
class  ArrayNDImpl< T >
 Implementation of ArrayND. More...
 
class  ArrayNDInfo
 Contains the information about the size of ArrayND, and in what order the data is stored (if accessable via a pointer). More...
 
class  Array1DInfo
 Contains the information about the size of Array1D, and in what order the data is stored (if accessable via a pointer). More...
 
class  Array2DInfo
 Contains the information about the size of Array2D, and in what order the data is stored (if accessable via a pointer). More...
 
class  Array3DInfo
 Contains the information about the size of Array3D, and in what order the data is stored (if accessable via a pointer). More...
 
class  Array1DInfoImpl
 Implementation of Array1DInfo. More...
 
class  Array2DInfoImpl
 Implementation of Array2DInfo. More...
 
class  Array3DInfoImpl
 Implementation of Array3DInfo. More...
 
class  ArrayNDInfoImpl
 Implementation of ArrayNDInfo. More...
 
class  ArrayNDSliceBase
 Base class of Array1DSlice and Array2DSlice. Access-tool to another ArrayND with higher dimensionality. More...
 
class  Array1DSlice< T >
 Subclass of Array1D and ArrayNDSliceBase. More...
 
class  Array2DSlice< T >
 Subclass of Array2D and ArrayNDSliceBase. More...
 
class  ArrayNDWrapper
 Access tool to another array with a lower number of dimensions. More...
 
class  Array3DWrapper< T >
 Subclass of ArrayNDWrapper. More...
 
class  ascbinostream
 writes to a stream that can be Ascii or Binary. More...
 
class  ascbinistream
 reads from a stream that was created in ascbinostream style. More...
 
class  ascostream
 OpendTect standard ascii format file writing. More...
 
class  ascistream
 OpendTect standard ascii format file reading. More...
 
class  Threads::Atomic< T >
 
class  Threads::AtomicPointer< T >
 Atomic instantiated with a pointer. The class really only handles the casting from a void* to a T*. More...
 
class  Threads::SpinLock
 Is an alternative to Mutex. It is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. Because they avoid overhead from operating system process re-scheduling or context switching, spinlocks are efficient if threads are only likely to be blocked for a short period. More...
 
class  Threads::SpinRWLock
 Is an alternative to ReadWriteLock. It is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. Because they avoid overhead from operating system process re-scheduling or context switching, spinlocks are efficient if threads are only likely to be blocked for a short period. More...
 
class  BinDataDesc
 Description of binary data. More...
 
class  BinID
 Positioning in a seismic survey: inline/crossline or lineNr/trcNr. More...
 
class  BinIDValue
 BinID and a value. More...
 
class  BinIDValues
 BinID and values. If one of the values is Z, make it the first one. More...
 
class  BufferString
 OD::String with its own variable length buffer. The buffer has a guaranteed minimum size. More...
 
class  StringPair
 A StringPair has two strings, first() and second(). The getCompString() function concatanates the two strings with the pipe character ('|') in between. More...
 
class  BufferStringSet
 Set of BufferString objects. More...
 
class  CallBack
 CallBacks object-oriented (object + method). More...
 
class  CallBackSet
 TypeSet of CallBacks with a few extras. More...
 
class  CallBacker
 Inherit from this class to be able to send and/or receive CallBacks. More...
 
class  CBCapsule< PLT >
 Capsule class to wrap any class into a CallBacker. More...
 
class  Color
 Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt. More...
 
class  Values::Undef< Color >
 Undefined Color. More...
 
class  CommandLineParser
 
class  Triplet< T >
 
class  CompoundKey
 Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager, or stratigraphic IDs. More...
 
class  Values::Undef< Coord2d >
 Undefined Coord2d. More...
 
class  Values::Undef< Coord3d >
 Undefined Coord3d. More...
 
class  Values::Undef< Coord2f >
 
class  Values::Undef< Coord3f >
 Undefined Coord3d. More...
 
class  Coords::PositionSystem
 
class  Coords::UnlocatedXY
 
class  DataPack
 A data packet: data+positioning and more that needs to be shared. More...
 
class  DataPack::FullID
 
class  BufferDataPack
 Simple DataPack based on an unstructured char array buffer. More...
 
class  DataPackMgr
 Manages DataPacks. More...
 
class  ConstDataPackRef< T >
 
class  DataPackRef< T >
 
class  DateInfo
 A date info class. More...
 
class  DBKey
 Full key to any object in the OpendTect data store. More...
 
class  DBKeySet
 
class  DirList
 Provides file and directory names in a certain directory. More...
 
class  EnumDef
 Holds data pertinent to a certain enum. It does not know the enum values themselves, but treat them as integers. More...
 
class  EnumDefImpl< ENUM >
 
class  Executor
 Specification to enable chunkwise execution of a process. More...
 
class  ExecutorGroup
 Executor consisting of other executors. More...
 
class  TextTaskRunner
 TaskRunner to show progress of a Task in text format. More...
 
class  FactoryBase
 Base class for Factories ( Factory, Factory1Param, Factory2Param and Factory3Param. ) More...
 
class  Factory< T >
 Generalized static factory that can deliver instances of T, when no variable is needed in the creation. More...
 
class  Factory1Param< T, P >
 Generalized static factory that can deliver instances of T, when a variable is needed in the creation. More...
 
class  Factory2Param< T, P0, P1 >
 Subclass of FactoryBase. More...
 
class  Factory3Param< T, P0, P1, P2 >
 Subclass of FactoryBase. More...
 
class  File::ViewPars
 
class  File::SystemAccess
 
class  File::LocalFileSystemAccess
 
class  File::Monitor
 Monitors files and directories for changes. More...
 
class  File::MultiSpec
 Specification for one or more files. More...
 
class  File::Path
 File pathname tools. More...
 
class  FixedString
 OD::String that holds an existing text string. More...
 
class  Values::Undef< FixedString >
 
class  Geom::Point2D< T >
 2D point or vector class. More...
 
class  Geom::Point3D< T >
 3D point or vector More...
 
class  Geom::Size2D< T >
 Basic 2D sizes (width/height) class. More...
 
class  Geom::Rectangle< T >
 Basic 2D rectangle class. More...
 
class  Geom::PixRectangle< T >
 Integer rectangle class. More...
 
class  Geom::PosRectangle< T >
 Floating-point rectangle class. More...
 
class  GlobExpr
 Glob-expression matching like UNIX shells. More...
 
class  GPU::Device
 
class  GPU::Platform
 
class  GPU::Context
 
class  IDWithGroup< GroupNrT, ObjNrT >
 A unique identifier for an object consisting of a group and an ID within the group. More...
 
class  HiddenParam< O, V >
 Workaround manager when you cannot add class members to a class due to binary compability issues. More...
 
class  IdxPair
 A pair of numbers; base class for BinID et al. More...
 
class  IndexInfo
 Info on (floating-point) position in an array or StepInterval. More...
 
class  IntegerID< IntType >
 single integer ID with comparison but no automatic conversion. Note that you will want to make a subclass to make the IDs specific for your class. Therefore, use the mDefIntegerID macro. More...
 
class  IOPar
 Generalized set of parameters of the keyword-value type. More...
 
class  LatLong
 Geographical coordinates, decimal but with conv to deg, min, sec. More...
 
class  ManagedObjectSetBase< T >
 Helper class to RefObjectSet and ManagedObjectSet. More...
 
class  ManagedObjectSet< T >
 ObjectSet where the objects contained are owned by this set. More...
 
class  RefObjectSet< T >
 
class  OD::ModDep
 Module Dependency. More...
 
class  OD::ModDepMgr
 Dependency manager - provides tools for the dependencies between the different OpendTect 'modules'. More...
 
class  Monitorable
 Object that can be MT-safely monitored from cradle to grave. More...
 
class  Monitorable::AccessLocker
 
class  Monitorable::ChangeData::AuxData
 
class  Monitorable::ChangeData
 
class  MonitorLock
 protects a Monitorable against change. More...
 
class  ChangeNotifyBlocker
 prevents change notifications coming out of a Monitorable. More...
 
class  ChangeRecorder
 base class for recorder of changes in a Monitorable More...
 
class  ChangeRecorder::Record
 
class  MonitorableIterBase< ITyp >
 base class for Monitorable iterators. Inherit from one of its subclasses. More...
 
class  MonitorableIter4Read< ITyp >
 base class for const Monitorable iterator. More...
 
class  MonitorableIter4Write< ITyp >
 base class for non-const Monitorable iterator. More...
 
class  MsgClass
 Class to encapsulate a message to the user. More...
 
class  NamedMonitorable
 Monitorable object with a name. All but name() are MT-safe. More...
 
class  NamedMonitorable::NameChgData
 
class  NamedObject
 object with a name. More...
 
class  NamedCallBacker
 CallBacker object with a name. Use if you want your object to be able to send and receive CallBack's, but Monitorable is not an option. More...
 
class  NotifierAccess
 Interface class for Notifier. See comments there. More...
 
class  Notifier< T >
 Class to help setup a callback handling. More...
 
class  CNotifier< T, PayLoad >
 Notifier with automatic capsule creation. More...
 
class  NotifyStopper
 Temporarily disables a Notifier. More...
 
class  NrBytesToStringCreator
 
class  ObjDisposer
 Disposes after a couple of msecs to avoid all kinds of trouble. More...
 
class  ObjectSet< T >
 Set of pointers to objects. More...
 
class  od_istream
 OD class for stream read. More...
 
class  od_ostream
 OD class for stream write common access to the user log file, or std::cout in batch progs. More...
 
class  od_stream
 OD base class for stream read/write. More...
 
class  od_istrstream
 OD class for streaming from string. More...
 
class  od_ostrstream
 OD class for stream write into string. More...
 
class  Values::Undef< float_complex >
 Undefined float_complex. More...
 
class  OD::RGBImage
 Class for Red, Green, Blue image. More...
 
class  OD::RGBImageLoader
 Class To load image files, and return the image data in RGBImage object. More...
 
class  MemSetter< T >
 Sets large amounts of values to a constant using multiple threads. More...
 
class  MemCopier< T >
 ValueSeries Copier. More...
 
class  MemValReplacer< T >
 Goes through some mem or a ValSeries and replaces one value with another. More...
 
class  OD::Platform
 Platform or Operating System. More...
 
class  OD::Set
 Base class for all sets used in OpendTect. More...
 
class  OD::String
 encapsulates the read-access-only part of strings in OD. More...
 
class  OS::CommandExecPars
 Specifies how to execute a command. More...
 
class  OS::MachineCommand
 Encapsulates an actual command to execute + the machine to run it on. More...
 
class  OS::CommandLauncher
 Launches machine commands. More...
 
class  ParallelTask
 Generalization of a task that can be run in parallel. More...
 
class  PerThreadObjectRepository< T >
 Class that keeps one object per thread. This enables temporary passing of objects (such as strings) where needed. More...
 
class  PluginManager
 Plugin manager - loads plugins: shared libs or DLLs. More...
 
class  Pos::IdxPair
 IdxPair with position indices; base class for BinID et al. More...
 
class  Pos::IdxPair2Coord
 Encapsulates linear transform from (i,j) index to (x,y) coordinates. More...
 
class  Pos::ValueIdxPair< IPT, FT >
 IdxPair with a value. More...
 
class  Pos::IdxPairValues< IPT, FT >
 IdxPair with 0-N values. More...
 
class  PosInfo::LineData
 Position info for a line - in a 3D cube, that would be an inline. Stored as (crossline-)number segments. More...
 
class  PosInfo::CubeDataPos
 Position in a CubeData. More...
 
class  PosInfo::CubeData
 Position info for an entire 3D cube. The LineData's are not sorted. More...
 
class  PosInfo::SortedCubeData
 Position info for an entire 3D cube. The LineData's are sorted. More...
 
class  PosInfo::CubeDataFiller
 Fills CubeData object. Requires inline- and crossline-sorting. More...
 
class  PosInfo::CubeDataIterator
 Iterates through CubeData. More...
 
class  PosInfo::Line2DPos
 One position on a 2D line. More...
 
class  PosInfo::Line2DPos3D
 Line2DPos with a z value. More...
 
class  PosInfo::Line2DData
 Position info for a 2D line. More...
 
class  PosInfo::Line2DDataIterator
 Iterates through Line2DData. More...
 
class  PosInfo::Line2DKey
 Key holding ID for both lineset and line. More...
 
class  PosInfo::Survey2D
 Repository for 2D line geometries. More...
 
class  ProgressMeter
 is an interface where processes can report their progress. More...
 
class  ProgressRecorder
 ProgressMeter that helps unifying different tasks. More...
 
class  TextStreamProgressMeter
 Textual progress indicator for batch programs. More...
 
class  PtrManBase< T >
 
class  ConstPtrManBase< T >
 
class  NonConstPtrManBase< T >
 
class  PtrMan< T >
 
class  ConstPtrMan< T >
 
class  ArrPtrMan< T >
 
class  ConstArrPtrMan< T >
 
class  RefMan< T >
 
class  ConstRefMan< T >
 
class  QueueEntry< T >
 One single queue entry. More...
 
class  ObjQueue< T >
 Queue of objects. More...
 
class  TypeQueue< T >
 Queue of basic data types. More...
 
class  BasicInterval< T >
 Base class for Interval. Has no virtual functions and can hence be used in places where no virtual functions are allowed (e.g. large memcpy operations. Does not have sort, clone and scale functions. If you need then, use the Interval<T> instead. More...
 
class  Interval< T >
 Interval of values. More...
 
class  StepInterval< T >
 Interval with step. More...
 
class  IntervalND< T >
 Class to store ranges in N dimensions. More...
 
class  Repos::FileProvider
 
class  Repos::IOPar
 IOPar with its Repos Source. More...
 
class  Repos::IOParSet
 Set of Repos::IOPar with each a unique name for user recognistion. More...
 
class  RowCol
 IdxPair used for its row() and col(). More...
 
class  SafeFileIO
 Protects file IO when you can't afford to have partly written things after write errors or have a file garbled by multiple access. More...
 
class  SafeWriteHelper
 Helps to write a new version of a file. On write error rollback, otherwise commit. More...
 
class  SamplingData< T >
 Holds the fundamental sampling info: start and interval. More...
 
class  Selector< T >
 Interface for classes that select on basis of a key. More...
 
class  SingleSelector< T >
 Selector selecting only a single value. More...
 
class  RangeSelector< T >
 Selector based on range specification (an Interval). More...
 
class  ArraySelector< T >
 Selector based on array. More...
 
class  SeparString
 List encoded in a string. More...
 
class  FileMultiString
 SeparString with backquotes as separators, use in most ascii files. More...
 
class  Settings
 Settings class holds the user settings. It is an IOPar. More...
 
class  SettingsAccess
 Functionality to access specific user settings and/or environment variables from different parts of OpendTect in order to avoid duplication of definitions and code. More...
 
class  SharedLibAccess
 Gives access to shared libs on runtime. Plugins should be loaded via the Plugin Manager (see plugins.h). More...
 
class  SharedObject
 
class  SignalHandling
 Asynchronous event handling and notification. More...
 
class  StreamData
 Holds data to use and close an iostream. More...
 
class  StreamData::StreamDataImpl
 
class  StreamProvider
 Provides I/O stream for file or system command. More...
 
class  Survey::Geometry
 A Geometry which holds trace positions. More...
 
class  Survey::GeometryManager
 Makes geometries accessible from a geometry ID, or a DBKey. More...
 
class  Survey::GeometryReader
 
class  Survey::GeometryWriter
 
class  Survey::Geometry2D
 Geometry of a 2D Line. More...
 
class  Survey::Geometry3D
 Scaled down survey geometry for an inl/crl geometry. More...
 
class  SurveyInfo
 Holds survey general information. More...
 
class  Task
 Generalization of something (e.g. a computation) that needs to be done in multiple steps. More...
 
class  TaskGroupController
 
class  TaskGroup
 A collection of tasks, that behave as a single task. More...
 
class  SequentialTask
 The generalization of something (e.g. a computation) where the steps must be done in sequence, i.e. not in parallel. More...
 
class  TaskRunner
 Class that can execute a task. More...
 
class  TextTranslateMgr
 
class  TextTranslatorLanguage
 
class  Threads::Mutex
 Is a lock that allows a thread to have exlusive rights to something. More...
 
class  Threads::ConditionVar
 Is an object that faciliates many threads to wait for something to happen. More...
 
class  Threads::ReadWriteLock
 Lock that permits multiple readers to lock the object at the same time, but it will not allow any readers when writelocked, and no writelock is allowed when readlocked. More...
 
class  Threads::MutexLocker
 
class  Threads::ReadLockLocker
 
class  Threads::WriteLockLocker
 
class  Threads::Barrier
 Waits for a number of threads to reach a certain point (i.e. the call to Barrier::waitForAll). Once everyone has arrived, everyone is released. More...
 
class  Threads::Thread
 Is the base class for all threads. Start it by creating it and give it the function or CallBack to execute. More...
 
class  Threads::Lock
 A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class. More...
 
class  Threads::Locker
 Locks the lock, shutting out access from other threads if needed. More...
 
class  Threads::WorkManager
 Takes work and puts it on a queue for execution either in parallel, singlethread or manual. More...
 
class  Threads::Work
 The abstraction of something that can be done. It can be an ordinary CallBack, a static function (must return bool) or a TaskFunction on a CallBackerinheriting class, or a Task. The three examples are shown below. More...
 
class  Time::Counter
 
class  Timer
 Timer class. More...
 
class  TrcKey
 Represents a unique trace position in one of the surveys that OpendTect is managing. More...
 
class  TrcKeySampling
 Horizontal sampling (inline and crossline range and steps). More...
 
class  TrcKeySamplingSet
 
class  TrcKeySamplingIterator
 Finds next BinID in TrcKeySampling; initializes to first position. More...
 
class  TrcKeyValue
 
class  TrcKeyCollection
 
class  SampledTrcKeyCollection
 
class  TableTrcKeySelection
 
class  TrcKeyZSampling
 Hor+Vert sampling in 3D surveys. More...
 
class  TypeSetBase< T, I >
 Base class for TypeSet, usually not used as such. More...
 
class  TypeSet< T >
 Set of (small) copyable elements. More...
 
class  BoolTypeSetType
 Needed because the std lib has a crazy specialisation vector<bool>. More...
 
class  LargeValVec< T >
 Large Value Vector. More...
 
class  uiString
 
class  uiStringSet
 
class  uiRetVal
 
class  uiStrings
 
class  Values::Undef< T >
 Templatized undefined values. More...
 
class  Values::Undef< short >
 Undefined od_int16. More...
 
class  Values::Undef< unsigned short >
 Undefined od_uint16. More...
 
class  Values::Undef< int >
 Undefined od_int32. More...
 
class  Values::Undef< unsigned int >
 Undefined od_uint32. More...
 
class  Values::Undef< int64_t >
 Undefined od_int64. More...
 
class  Values::Undef< uint64_t >
 Undefined od_uint64. More...
 
class  Values::Undef< bool >
 Undefined bool. More...
 
class  Values::Undef< float >
 Undefined float. More...
 
class  Values::Undef< double >
 Undefined double. More...
 
class  Values::Undef< const char * >
 Undefined const char*. More...
 
class  Values::Undef< char * >
 Undefined char*. More...
 
class  Values::Undef< char >
 Undefined char. More...
 
class  ValueSeries< T >
 Interface to a series of values. More...
 
class  ValueSeriesGetAll< T >
 Gets data from ValueSeries. More...
 
class  OffsetValueSeries< T >
 ValueSeries of offsets. More...
 
class  ArrayValueSeries< RT, AT >
 Series of values from a pointer to some kind of array. If a more advanced conversion between the return type and the array type is wanted, use ConvValueSeries instead. More...
 
class  MultiArrayValueSeries< RT, AT >
 Valueseries that allocates its data in smaller chunks. By doing this, it performs better in environments where the memory is fragmented (i.e. windows 32 bit). Default chunk size for windows 32 bit is 512MB and for all other platforms default is 32 GB. More...
 
class  VectorAccess< T, I >
 Simple vector-based container simplifying index-based work. More...
 
class  ZDomain::Def
 Definition of z-domain. More...
 
class  ZDomain::Info
 Information of z-domain. More...
 
class  std::fixedstreambuf
 Adapter to use a fixed buffer as a stream. More...
 
class  qstreambuf
 Adapter to use a qprocess as a stream. More...
 
class  iqstream
 Does everything a std::istream does, but also deletes the streambuf. More...
 
class  oqstream
 Does everything a std::ostream does, but also deletes the streambuf. More...
 
class  std::winfilebuf
 Adapter to seek in filebuffers on win64. More...
 
class  std::winifstream
 Adapter for input streams on win64. More...
 
class  std::winofstream
 Adapter for output streams on win64. More...
 

Macros

#define mCBCapsuleGet(PayLoadType, var, cb)   CBCapsule<PayLoadType>* var = dynamic_cast< CBCapsule<PayLoadType>* >( cb );
 
#define mDoArrayPtrOperation(type, arr, operation, arrsz, ptrinc)
 
#define mDeclareEnumUtils(enm)
 Some utilities surrounding the often needed enum <-> string table. More...
 
#define mLockerClassImpl(mod, clssnm, clss, lockfn, unlockfn, trylockfn)
 Is an object that is convenient to use when a mutex should be locked and unlocked automatically when returning. More...
 

Detailed Description

Basic, general purpose utilities.

Reference Counting

Reference counter is an integer that tracks how many references have been made to a class. When a reference-counted object is created, the reference count is 0. When the ref() function is called, it is incremented, and when unRef() is called it is decremented. If it then reaches 0, the object is deleted.

Example usage

A refcount class is set up by:

class A : public RefCount::Referenced
{
public:
//Your class stuff
};

This gives access to a number of class variables and functions:

public:
void ref() const;
void unRef() const;
void unRefNoDelete() const;

You should ensure that the destructor is not public in your class.

unRefNoDelete

The unRefNoDelete() is only used when you want to bring the class back to the original state of refcount==0. Such an example may be a static create function:

A* createA()
{
A* res = new A;
res->ref(); //refcount goes to 1
fillAWithData( res ); //May do several refs, unrefs
res->unRefNoDelete(); //refcount goes back to 0
return res;
}

ObjectSet with reference counted objects

ObjectSets with ref-counted objects can be modified by either:

deepRef( set );
deepUnRefNoDelete(set);
deepRef( set );
deepUnRef(set);

Smart pointers ot reference counted objects.

A pointer management is handled by the class RefMan, which has the same usage as PtrMan.

Reference counted objects on the stack

Reference counted object cannot be used directly on the stack, as they have no public destructor. Instead, use the RefMan:

RefMan<A> variable = new A;

Further, there are Observation pointers that can observe your ref-counted objects.

A* variable = new A;
variable->ref();
WeakPtr<A> ptr = variable; //ptr is set
variable->unRef(); //ptr becomes null

Macro Definition Documentation

#define mCBCapsuleGet (   PayLoadType,
  var,
  cb 
)    CBCapsule<PayLoadType>* var = dynamic_cast< CBCapsule<PayLoadType>* >( cb );

\ .

If you have a pointer to a capsule cb, this:

1 mCBCapsuleUnpack(const uiMouseEvent&,ev,cb)

would result in the availability of:

1 const uiMouseEvent& ev

If you're interested in the caller, you'll need to get the capsule itself:

1 mCBCapsuleGet(const uiMouseEvent&,caps,cb)

would result in the availability of:

1 CBCapsule<const uiMouseEvent&>* caps
#define mDeclareEnumUtils (   enm)
Value:
public: \
static const EnumDefImpl<enm>& enm##Def(); \
static mDeprecated const char** enm##Names();\
static mDeprecated bool parseEnum##enm(const char*,enm&); /*legacy */ \
static mDeprecated bool parseEnum(const char*,enm&); \
static mDeprecated bool parseEnum(const IOPar&,const char*,enm&); \
static mDeprecated enm parseEnum##enm(const char*); \
static const char* toString(enm); \
static uiString toUiString(enm); \
static mDeprecated const char* get##enm##String(enm); /*legacy */ \
static EnumDefImpl<enm>* enm##CreateDef(); \
static const char* enm##Keys_[]; \
static ConstPtrMan<EnumDefImpl<enm> > enm##Definition_; \
public:
#define private
Definition: winstreambuf.h:13
Definition: uistring.h:88
Definition: enums.h:83
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
uiString toUiString(const DBKey &ky)
Definition: dbkey.h:117
BufferString toString(const DBKey &ky)
Definition: dbkey.h:115
#define mDeprecated
Definition: plfdefs.h:213
Export_Basic bool parseEnum(const IOPar &, const char *, ViewStyle &)
Definition: ptrman.h:135

Some utilities surrounding the often needed enum <-> string table.

Normally, you'll have a class with an enum member. In that case, you'll want to use the EnumDef classes. These are normally almost hidden by a few simple macros: mDeclareEnumUtils(enm) will make sure the enum will have a string conversion mDefineEnumUtils(clss,enm,prettynm) defines the names. For namespaces, you can use mDeclareNameSpaceEnumUtils only

The 'Declare' macros should be placed in the public section of the class. Example of usage:

in myclass.h:

1 #include <enums.h>
2 
3 class MyClass
4 {
5 public:
6  enum State { Good, Bad, Ugly };
7  mDeclareEnumUtils(State)
8  enum Type { Yes, No, Maybe };
9  mDeclareEnumUtils(Type)
10 
11  // rest of class
12 };

in myclass.cc:

1 #include <myclass.h>
2 
3 mDefineEnumUtils(MyClass,State,"My class state")
4  { "Good", "Bad", "Not very handsome", 0 };
5 mDefineEnumUtils(MyClass,Type,"My class type")
6  { "Yes", "No", "Not sure", 0 };

This will expand to (added newlines, removed some superfluous stuff:

1 class MyClass
2 {
3 public:
4 
5  enum State { Good, Bad, Ugly };
6  static const EnumDefImpl<State>& StateDef();
7 
8 private:
9  static const PtrMan<EnumDefImpl<State> > StateDefinition_;
10 
11 // similar for Type
12 
13 };

and, in myclass.cc:

1 const PtrMan<EnumDefImpl<State> > MyClass::StateDefinition_ = 0;
2 const EnumDef& MyClass::StateDef()
3 { return *StateDefinition_.createIfNull(); }

Localization is separated from the selection. Hence, if you wish to add translated enum-strings, you can implement your own init() function:

1 template <>
2 void EnumDefImpl<MyClass::Type>::init()
3 {
4  uistrings_ += tr("Yes");
5  uistrings_ += tr("No");
6  uistrings_ += tr("Not sure");
7 }

Note that the selection will still be done on the non-translated string.

#define mDoArrayPtrOperation (   type,
  arr,
  operation,
  arrsz,
  ptrinc 
)
Value:
{ \
type* __curptr = arr; \
for ( const type* __stopptr = __curptr + arrsz; \
__curptr!=__stopptr; \
__curptr ptrinc ) \
{ \
*__curptr operation; \
} \
}

\ . Quicker than for-loops.

Instead of:

1 for ( int idx=0; idx<arrsz; idx++ )
2  arr[idx] /= 5;

You can do:

1 mDoArrayPtrOperation( float, arr, /= 5, arrsz, ++ );

Note that the last '++' is applied to the 'current' pointer called __curptr.

#define mLockerClassImpl (   mod,
  clssnm,
  clss,
  lockfn,
  unlockfn,
  trylockfn 
)
Value:
mExpClass(mod) clssnm \
{ \
public: \
clssnm( clss& thelock, bool wait=true ) \
: lock_( thelock ) \
, islocked_( true ) \
{ \
if ( wait ) thelock.lockfn; \
else islocked_ = thelock.trylockfn; \
} \
\
~clssnm() { if ( islocked_ ) lock_.unlockfn; } \
bool isLocked() const { return islocked_; } \
\
void unLock() { islocked_ = false; lock_.unlockfn; } \ \
void lock() { islocked_ = true; lock_.lockfn; } \ \
\
protected: \
\
clss& lock_; \
bool islocked_; \
};
#define mExpClass(module)
Definition: commondefs.h:157

Is an object that is convenient to use when a mutex should be locked and unlocked automatically when returning.

Example:

int function() { MutexLocker lock( myMutex ); Do whatever you want to do }


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