OpendTect  6.6
Classes | Macros
Basic

Basic purpose utilities. More...

Classes

class  MonitoredObject::AccessLocker
 
class  Coords::AnchorBasedXY
 
class  ApplicationData
 Wrapper class around the QCoreApplicaiton. More...
 
class  OD::JSON::Array
 ValueSet where the values and subsets have no key. More...
 
class  Array1D< T >
 Array1D ( Subclass of ArrayND ) is a one dimensional array. More...
 
class  Array1DImpl< T >
 Implementation of Array1D. 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  Array1DInfoImpl
 Implementation of Array1DInfo. More...
 
class  Array1DSlice< T >
 Subclass of Array1D and ArrayNDSliceBase. More...
 
class  Array2D< T >
 Array2D ( Subclass of ArrayND ) is a two dimensional array. More...
 
class  Array2DImpl< T >
 Implementation of Array2D. 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  Array2DInfoImpl
 Implementation of Array2DInfo. More...
 
class  Array2DSlice< T >
 Subclass of Array2D and ArrayNDSliceBase. More...
 
class  Array3D< T >
 Array3D ( Subclass of ArrayND ) is a three dimensional array. More...
 
class  Array3DImpl< T >
 Implementation of Array3D. 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  Array3DInfoImpl
 Implementation of Array3DInfo. More...
 
class  Array3DSlice< T >
 Subclass of Array3D and ArrayNDSliceBase. More...
 
class  Array3DWrapper< T >
 Subclass of ArrayNDWrapper. More...
 
class  Array4D< T >
 4-Dim ArrayND More...
 
class  Array4DImpl< T >
 Flat-array implementation of Array4D. More...
 
class  Array4DInfo
 Contains the information about the size of Array4D, and in what order the data is stored (if accessable via a pointer). More...
 
class  Array4DInfoImpl
 Implementation of Array4DInfo. More...
 
class  ArrayImplBase< T >
 
class  ArrayND< T >
 An ArrayND is an array with a given number of dimensions and a size. More...
 
class  ArrayNDDataExtracter< T >
 Gets a one dimensional array from an ArrayND. More...
 
class  ArrayNDImpl< T >
 
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  ArrayNDInfoImpl
 Implementation of ArrayNDInfo. More...
 
class  ArrayNDIter
 Iterates through all samples in an ArrayND. More...
 
class  ArrayNDSliceBase
 Base class of Array1DSlice and Array2DSlice. Access-tool to another ArrayND with higher dimensionality. More...
 
class  ArrayNDValseriesAdapter< T >
 Adapter that makes any ArrayND to a (slow) value series. More...
 
class  ArrayNDWrapper
 Access tool to another array with a lower number of dimensions. More...
 
class  ArraySelector< T >
 Selector based on array. 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  ArrPtrMan< T >
 
class  ascbinistream
 reads from a stream that was created in ascbinostream style.
More...
 
class  ascbinostream
 writes to a stream that can be Ascii or Binary. More...
 
class  ascistream
 OpendTect standard ascii format file reading. More...
 
class  ascostream
 OpendTect standard ascii format file writing. 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  MonitoredObject::ChangeData::AuxData
 
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  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  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  BoolTypeSetType
 Needed because the std lib has a crazy specialisation vector<bool>. More...
 
class  BufferDataPack
 Simple DataPack based on an unstructured char array buffer. More...
 
class  BufferString
 OD::String with its own variable length buffer. The buffer has a guaranteed minimum size. More...
 
class  BufferStringSet
 Set of BufferString objects. More...
 
class  CallBack
 CallBacks object-oriented (object + method). More...
 
class  CallBacker
 Inherit from this class to be able to send and/or receive CallBacks. More...
 
class  CallBackSet
 TypeSet of CallBacks with a few extras.
More...
 
class  CBCapsule< T >
 Capsule class to wrap any class into a CallBacker. More...
 
class  MonitoredObject::ChangeData
 
class  ChangeNotifyBlocker
 prevents change notifications coming out of a MonitoredObject. More...
 
class  ChangeRecorder
 base class for recorder of changes in a MonitoredObject More...
 
class  RefCount::WeakPtrSetBase::CleanupBlocker
 
class  CNotifier< T, PayLoad >
 Notifier with automatic capsule creation. 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  CommandDefs
 
class  OS::CommandExecPars
 Specifies how to execute a command. More...
 
class  OS::CommandLauncher
 Launches machine commands. More...
 
class  CommandLineParser
 
class  CompoundKey
 Concatenated short keys separated by dots. Used for Object identifiers in the Object Manager, or stratigraphic IDs. More...
 
class  Threads::ConditionVar
 Is an object that faciliates many threads to wait for something to happen. More...
 
class  ConstArrPtrMan< T >
 
class  ConstDataPackRef< T >
 
class  ConstPtrMan< T >
 
class  ConstPtrManBase< T >
 
class  ConstRefMan< T >
 
class  Coord
 A cartesian coordinate in 2D space. More...
 
class  Coord3
 A cartesian coordinate in 3D space. More...
 
class  Coords::CoordSystem
 
class  Time::Counter
 
class  RefCount::Counter
 
class  System::CrashDumper
 
class  PosInfo::CubeData
 Position info for an entire 3D cube. The LineData's are not sorted. More...
 
class  PosInfo::CubeDataFiller
 Fills CubeData object. Requires inline- and crossline-sorting. More...
 
class  PosInfo::CubeDataIterator
 Iterates through CubeData. More...
 
class  PosInfo::CubeDataPos
 Position in a CubeData. More...
 
class  ProcDesc::Data
 
class  ProcDesc::DataEntry
 
class  DataPack
 A data packet: data+positioning and more that needs to be shared. More...
 
class  DataPackMgr
 Manages DataPacks. More...
 
class  DataPackRef< T >
 
class  DateInfo
 A date info class. More...
 
class  DBKey
 
class  DBKeySet
 
class  ZDomain::Def
 Definition of z-domain. More...
 
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  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  FactoryBase
 Base class for Factories ( Factory, Factory1Param, Factory2Param and Factory3Param. ) More...
 
class  FileMultiString
 SeparString with backquotes as separators, use in most ascii files. More...
 
class  FilePath
 File pathname tools. More...
 
class  Repos::FileProvider
 
class  FileSpec
 Specification for one or more files. More...
 
class  FileSystemWatcher
 Class for monitoring a file system. More...
 
class  std::fixedstreambuf
 Adapter to use a fixed buffer as a stream. More...
 
class  FixedString
 OD::String that holds an existing text string. More...
 
class  Survey::Geometry
 A Geometry which holds trace positions. More...
 
class  Survey::Geometry2D
 Geometry of a 2D Line. More...
 
class  Survey::Geometry3D
 Scaled down survey geometry for an inl/crl geometry. More...
 
class  Survey::GeometryManager
 Makes geometries accessible from a geometry ID, or a MultiID.
More...
 
class  Survey::GeometryReader
 
class  Survey::GeometryWriter
 
class  GlobExpr
 Glob-expression matching like UNIX shells. More...
 
class  HiddenParam< O, V >
 Workaround manager when you cannot add class members to a class due to binary compability issues. More...
 
class  Pos::IdxPair
 IdxPair with position indices; base class for BinID et al. More...
 
class  IdxPair
 A pair of numbers; base class for BinID et al. More...
 
class  Pos::IdxPair2Coord
 Encapsulates linear transform from (i,j) index to (x,y) coordinates. More...
 
class  Pos::IdxPairValues< IPT, FT >
 IdxPair with 0-N values. More...
 
class  IndexInfo
 Info on (floating-point) position in an array or StepInterval. More...
 
class  ZDomain::Info
 Information of z-domain. More...
 
class  Interval< T >
 Interval of values. More...
 
class  IntervalND< T >
 Class to store ranges in N dimensions. More...
 
class  IOPar
 Generalized set of parameters of the keyword-value type. More...
 
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  iqstream
 Does everything a std::istream does, but also deletes the streambuf. More...
 
class  LargeValVec< T >
 
class  LatLong
 Geographical coordinates in Decimal Degrees but with conv to deg, min, sec. More...
 
class  LatLong2Coord
 Estimates to/from LatLong coordinates. 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::Line2DPos
 One position on a 2D line. More...
 
class  PosInfo::Line2DPos3D
 Line2DPos with a z value. 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  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  OS::MachineCommand
 Encapsulates an actual command to execute + the machine to run it on. More...
 
class  ManagedObjectSet< T >
 ObjectSet where the objects contained are owned by this set. More...
 
class  ManagedObjectSetBase< T >
 Helper class to RefObjectSet and ManagedObjectSet. More...
 
class  MemCopier< T >
 ValueSeries Copier. More...
 
class  MemSetter< T >
 Sets large amounts of values to a constant using multiple threads. More...
 
class  MemValReplacer< T >
 Goes through some mem or a ValSeries and replaces one value with another. More...
 
class  OD::ModDep
 Module Dependency. More...
 
class  OD::ModDepMgr
 Dependency manager - provides tools for the dependencies between the different OpendTect 'modules'. More...
 
class  MonitorableIter4Read< ITyp >
 base class for const MonitoredObject iterator. More...
 
class  MonitorableIter4Write< ITyp >
 base class for non-const MonitoredObject iterator. More...
 
class  MonitorableIterBase< ITyp >
 base class for MonitoredObject iterators. Inherit from one of its subclasses. More...
 
class  MonitoredObject
 Object that can be MT-safely monitored from cradle to grave. More...
 
class  MonitorLock
 protects a MonitoredObject against change. More...
 
class  MsgClass
 Class to encapsulate a message to the user. 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). More...
 
class  MultiID
 Compound key consisting of ints. More...
 
class  Threads::Mutex
 Is a lock that allows a thread to have exlusive rights to something. More...
 
class  Threads::MutexLocker
 
class  NamedMonitoredObject::NameChgData
 
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  NamedMonitoredObject
 MonitoredObject with a name. All but name() are MT-safe. More...
 
class  NamedObject
 object with a name. More...
 
class  NonConstPtrManBase< T >
 
class  Notifier< T >
 Class to help setup a callback handling. More...
 
class  NotifierAccess
 Interface class for Notifier. See comments there.
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  OD::JSON::Object
 ValueSet where the values and subsets have a key. More...
 
class  ObjectSet< T >
 Set of pointers to objects. More...
 
class  ObjectWithName
 object with a name. More...
 
class  ObjQueue< T >
 Queue of objects. More...
 
class  od_istream
 OD class for stream read common access to the std::cin. More...
 
class  od_istrstream
 OD class for streaming from string. More...
 
class  od_ostream
 OD class for stream write common access to the user log file, or std::cout in other than od_main. More...
 
class  od_ostrstream
 OD class for stream write into string. More...
 
class  od_stream
 OD base class for stream read/write. More...
 
class  OffsetValueSeries< T >
 ValueSeries of offsets. More...
 
class  oqstream
 Does everything a std::ostream does, but also deletes the streambuf. More...
 
class  OD::Pair< T1, T2 >
 
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  Geom::PixRectangle< T >
 Integer rectangle class. More...
 
class  OD::Platform
 Platform or Operating System. More...
 
class  PluginManager
 Plugin manager - loads plugins: shared libs or DLLs. More...
 
class  Geom::Point2D< T >
 Basic point class. More...
 
class  Geom::Point3D< T >
 
class  Geom::PosRectangle< T >
 Floating-point rectangle class. More...
 
class  ProgressMeter
 is an interface where processes can report their progress. More...
 
class  ProgressRecorder
 ProgressMeter that helps unifying different tasks. More...
 
class  PtrMan< T >
 
class  PtrManBase< T >
 
class  OD::PythonAccess
 
class  qstreambuf
 Adapter to use a qprocess as a stream. More...
 
class  QueueEntry< T >
 One single queue entry. More...
 
class  RangeSelector< T >
 Selector based on range specification (an Interval). More...
 
class  Threads::ReadLockLocker
 
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  ChangeRecorder::Record
 
class  Geom::Rectangle< T >
 Basic 2D rectangle class. More...
 
class  ReferenceCounter
 
class  RefCount::Referenced
 
class  RefMan< T >
 
class  RefObjectSet< T >
 
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  RowCol
 IdxPair used for its row() and col().
More...
 
class  RuntimeLibLoader
 Gives access to any runtime library (DLL/so), from a full filepath. The library does thus no need to be inside the current path. This library stays loaded until the object is destroyed. 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  SampledTrcKeyCollection
 
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  SeparString
 
class  SeparStringSB
 List encoded in a string. 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  OD::Set
 Base class for all sets used in OpendTect. 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  SingleSelector< T >
 Selector selecting only a single value. More...
 
class  Geom::Size2D< T >
 Basic 2D sizes (width/height) class. More...
 
class  PosInfo::SortedCubeData
 Position info for an entire 3D cube. The LineData's are sorted. 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  StepInterval< T >
 Interval with step. More...
 
class  StreamData
 Holds data to use and close an iostream. Usually created by StreamProvider. More...
 
class  StreamData::StreamDataImpl
 
class  StreamProvider
 Provides I/O stream for file or system command. More...
 
class  OD::String
 encapsulates the read-access-only part of strings in OD. More...
 
class  StringBuilder
 Builds a string by adding strings. Much faster than string manipulation. Only supports adding. More...
 
class  StringPair
 A StringPair has two strings, first() and second(). More...
 
class  PosInfo::Survey2D
 Repository for 2D line geometries. More...
 
class  SurveyDiskLocation
 Survey location on disk. More...
 
class  SurveyInfo
 Holds survey general information. More...
 
class  TableTrcKeySelection
 
class  Task
 Generalization of something (e.g. a computation) that needs to be done in multiple steps. More...
 
class  TaskGroup
 A collection of tasks, that behave as a single task.
More...
 
class  TaskRunner
 Class that can execute a task. More...
 
class  TextStreamProgressMeter
 Textual progress indicator for batch programs. More...
 
class  TextTaskRunner
 TaskRunner to show progress of a Task in text format. More...
 
class  TextTranslateMgr
 
class  TextTranslatorLanguage
 
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  Timer
 Timer class. More...
 
class  TrcKey
 Represents a unique trace position in one of the surveys that OpendTect is managing. More...
 
class  TrcKeyCollection
 
class  TrcKeySampling
 Horizontal sampling (inline and crossline range and steps). More...
 
class  TrcKeySamplingIterator
 Finds next BinID in TrcKeySampling; initializes to first position. More...
 
class  TrcKeySamplingSet
 
class  TrcKeyValue
 
class  TrcKeyZSampling
 Hor+Vert sampling in 3D surveys. More...
 
class  TrcKeyZSamplingSet
 
class  TypeQueue< T >
 Queue of basic data types. More...
 
class  TypeSet< T >
 Sets of (small) copyable elements. More...
 
class  uiRetVal
 
class  uiString
 String that is able to hold international (UTF-8) strings for the user interface. More...
 
class  uiStrings
 
class  uiStringSet
 
class  Values::Undef< T >
 Templatized undefined values. More...
 
class  Values::Undef< bool >
 Undefined bool. More...
 
class  Values::Undef< char * >
 Undefined char*. More...
 
class  Values::Undef< char >
 Undefined char. More...
 
class  Values::Undef< Color >
 Undefined Color. More...
 
class  Values::Undef< const char * >
 Undefined const char*. More...
 
class  Values::Undef< Coord >
 Undefined Coord. More...
 
class  Values::Undef< Coord3 >
 Undefined Coord3. More...
 
class  Values::Undef< double >
 Undefined double. More...
 
class  Values::Undef< FixedString >
 
class  Values::Undef< float >
 Undefined float. More...
 
class  Values::Undef< float_complex >
 Undefined float_complex. More...
 
class  Values::Undef< int >
 Undefined od_int32. More...
 
class  Values::Undef< int64_t >
 Undefined od_int64. More...
 
class  Values::Undef< long double >
 Undefined long double. More...
 
class  Values::Undef< short >
 Undefined od_int16. More...
 
class  Values::Undef< uint64_t >
 Undefined od_uint64. More...
 
class  Values::Undef< unsigned int >
 Undefined od_uint32. More...
 
class  Values::Undef< unsigned short >
 Undefined od_uint16. More...
 
class  Coords::UnlocatedXY
 
class  OD::JSON::ValArr
 
class  Pos::ValueIdxPair< IPT, FT >
 IdxPair with a value. More...
 
class  ValueSeries< T >
 Interface to a series of values. More...
 
class  ValueSeriesGetAll< T >
 Gets ValueSeries. More...
 
class  OD::JSON::ValueSet
 holds values and sets of values. Is base class for either Array or Object. More...
 
class  OD::ValVec< T, IT >
 
class  VectorAccess< T, IT >
 Simple vector-based container simplifying index-based work. More...
 
class  File::ViewPars
 
class  WeakPtr< T >
 
class  RefCount::WeakPtrBase
 
class  WeakPtrSet< T >
 
class  RefCount::WeakPtrSetBase
 
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...
 
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  Threads::WorkManager
 Takes work and puts it on a queue for execution either in parallel, singlethread or manual. More...
 
class  Threads::WriteLockLocker
 

Macros

#define mCBCapsuleGet(PayLoadType, var, cb)   CBCapsule<PayLoadType>* var = dynamic_cast< CBCapsule<PayLoadType>* >( cb );
 
#define mDeclareEnumUtils(enm)
 Some utilities surrounding the often needed enum <-> string table. More...
 
#define mDoArrayPtrOperation(type, arr, operation, arrsz, ptrinc)
 
#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 purpose utilities.

Introduction

This module handles all things that are so basic to all other modules that they can be seen as a layer of common services to the entire system. One of the tasks is to provide platform-independence of file, date&time, threads, and more.

The difference with the 'General' module was, traditionally, that Basic utilities could in principle be insteresting outside OpendTect. This distinction is not enforced (see e.g. the survey info class). We place things in Basic that feel more basic than General. Note that General depends on Basic, not vice versa. Basic algorithm-type things go in Algo.

You'll find that many of these tools can be found in other packages in some form or another. But, the problems of management of dependencies are usually much bigger than having to maintain a bunch of lean-and-mean specially made objects that do selected things in a way that fits our system.

Content

We'll just name a few groups of services. There are many more isolated useful objects, defines, functions and so forth.

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
};
Definition: refcount.h:160

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);
Set of pointers to objects.
Definition: objectset.h:35
void set(T &_to, const F &fr)
template based type conversion
Definition: convert.h:27

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;
Definition: ptrman.h:206

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
static void unRef(T *p)
Definition: ptrman.h:512
static void ref(T *p)
Definition: ptrman.h:501
Definition: refcount.h:300

Macro Definition Documentation

◆ mCBCapsuleGet

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

\ .

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

mCBCapsuleUnpack(const uiMouseEvent&,ev,cb)

would result in the availability of:

const uiMouseEvent& ev

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

mCBCapsuleGet(const uiMouseEvent&,caps,cb)
#define mCBCapsuleGet(PayLoadType, var, cb)
Definition: callback.h:291

would result in the availability of:

Capsule class to wrap any class into a CallBacker.
Definition: callback.h:255

◆ mDeclareEnumUtils

#define mDeclareEnumUtils (   enm)
Value:
public: \
static const EnumDefImpl<enm>& enm##Def(); \
static const char** enm##Names();\
static bool parseEnum##enm(const char*,enm&); /*legacy */ \
static bool parseEnum(const char*,enm&); \
static bool parseEnum(const IOPar&,const char*,enm&); \
static enm parseEnum##enm(const char*); \
static const char* toString(enm); \
static uiString toUiString(enm); \
static const char* get##enm##String(enm); /*legacy */ \
protected: \
static const char* enm##Keys_[]; \
static ConstPtrMan<EnumDefImpl<enm> > enm##Definition_; \
public:
Definition: ptrman.h:141
Definition: enums.h:86
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
bool parseEnum(const IOPar &, const char *, ViewStyle &)
uiString toUiString(ViewStyle)
@ String
Definition: odjson.h:40
FixedString Names()
Definition: keystrs.h:104

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

The function EnumDef::convert returns the enum (integer) value from a text string. The first arg is string you wish to convert to the enum, the second is the array with enum names. Then, the integer value of the first enum value (also returned when no match is found) and the number of characters to be matched (0=all). Make absolutely sure the char** definition has a closing ' ... ,0 };'.

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:

#include <enums.h>
class MyClass
{
public:
enum State { Good, Bad, Ugly };
enum Type { Yes, No, Maybe };
// rest of class
};
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:257
Type
Definition: angles.h:26
FixedString No()
Definition: keystrs.h:106
FixedString Yes()
Definition: keystrs.h:201

in myclass.cc:

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

Note the '1' in the first one telling the EnumDef that only one character needs to be matched when converting string -> enum. The '0' in the second indicates that the entire string must match.

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

class MyClass
{
public:
enum State { Good, Bad, Ugly };
static const EnumDef& StateDef();
static const char** StateNames();
static bool parseEnum(const char*, State& );
static bool parseEnum(const IOPar&,const char*key,State&);
static int parseEnumState(const char*);
static const char* toString(State);
static uiString toUiString(State);
protected:
static const char* StateKeys_[];
static const EnumDef StateDefinition_;
// similar for Type
};
Holds data pertinent to a certain enum. It does not know the enum values themselves,...
Definition: enums.h:45

and, in myclass.cc:

const EnumDef& MyClass::StateDef() { return StateDefinition_; }
const EnumDef MyClass::StateDefinition_("My class state",
MyClass::Statenames,1);
bool MyClass::parseEnum(const char* txt, State& res ) \
{ \
const int idx = StateDef().isValidName( txt ) \
? StateDef().convert( txt ) \
: -1; \
if ( idx<0 ) \
return false; \
\
res = (State) idx; \
return true; \
} \
bool MyClass::parseEnum( const IOPar& par, const char* key, State& res ) \
{ return parseEnum( par.find( key ), res ); } \
MyClass::State MyClass::parseEnumState(const char* txt) \
{ \
return (MyClass::State) StateDef().convert( txt ); \
} \
const char* MyClass::StateKeys_[] =
{ "Good", "Bad", "Not very handsome", 0 };
const EnumDef& MyClass::TypeDef() { return TypeDefinition_; }
const EnumDef MyClass::TypeDefinition_("My class type",MyClass::Typenames, 0);
bool MyClass::parseEnum(const char* txt, Type& res ) \
{ \
const int idx = TypeDef().isValidName( txt ) \
? TypeDef().convert( txt ) \
: -1; \
if ( idx<0 ) \
return false; \
\
res = (Type) idx; \
return true; \
} \
bool MyClass::parseEnum( const IOPar& par, const char* key, Type& res ) \
{ return parseEnum( par.find( key ), res ); } \
MyClass::Type MyClass::parseEnumType(const char* txt) \
{ \
return (MyClass::Type) TypeDef().convert( txt ); \
} \
const char* MyClass::TypeKeys_[] =
{ "Yes", "No", "Not sure", 0 };

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

template <>
{
uistrings_ += tr("Yes");
uistrings_ += tr("No");
uistrings_ += tr("Not sure");
}
void init()
Definition: enums.h:421

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

◆ mDoArrayPtrOperation

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

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

You can do:

mDoArrayPtrOperation( float, arr, /= 5, arrsz, ++ );
#define mDoArrayPtrOperation(type, arr, operation, arrsz, ptrinc)
Definition: commondefs.h:295

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

◆ mLockerClassImpl

#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_; \
};

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. 1995-2022