![]() |
OpendTect
7.0
|
Generalized static factory that can deliver instances of T, when no variable is needed in the creation. More...
Public Types | |
| typedef T *(* | Creator) () |
Public Member Functions | |
| void | addCreator (Creator, const char *nm, const uiString &username=uiString::emptyString()) |
| T * | create (const char *nm) const |
| Name may be not be null. More... | |
| bool | moveAfter (int from, int to) |
| void | removeCreator (Creator) |
Public Member Functions inherited from FactoryBase | |
| virtual | ~FactoryBase () |
| const char * | currentName () const |
| BufferString & | errMsg () const |
| const char * | getDefaultName () const |
| const BufferStringSet & | getNames () const |
| const uiStringSet & | getUserNames () const |
| bool | hasName (const char *nm) const |
| bool | isEmpty () const |
| void | setDefaultName (int idx) |
| int | size () const |
Protected Attributes | |
| TypeSet< Creator > | creators_ |
Protected Attributes inherited from FactoryBase | |
| StaticStringManager | currentname_ |
| StaticStringManager | errmsgs_ |
Additional Inherited Members | |
Static Public Member Functions inherited from FactoryBase | |
| static char | cSeparator () |
Protected Member Functions inherited from FactoryBase | |
| void | addNames (const char *, const uiString &) |
| int | indexOf (const char *) const |
| bool | moveAfter_ (int, int) |
| void | removeByIndex (int) |
| void | setNames (int, const char *, const uiString &) |
Generalized static factory that can deliver instances of T, when no variable is needed in the creation.
Usage. Each implementation of the base class T must add themselves to the factory when application starts up, e.g. in an initClass() function:
Two macros are available to make a static accessfuncion for the factory:
that will create a static function that returns an instance to Factory<ClassName>. If the function is a static member of a class, it has to be defined with the mDefineFactoryInClass macro.
The static function must be implemented in a src-file with the macro
<>
| typedef T*(* Factory< T >::Creator) () |
|
inline |
Name may be not be null If nm is found, old creator is replaced. nm can be a SeparString, separated by cSeparator(), allowing multiple names, where the first name will be the main name that is returned in getNames.
|
inline |
Name may be not be null.
|
inline |
Moves an item at the index from, after the index to
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024