OpendTect-6_4
6.4
|
Generalized static factory that can deliver instances of T, when a variable is needed in the creation. More...
Public Types | |
typedef T *(* | Creator) (P) |
Public Member Functions | |
void | addCreator (Creator, const char *nm=0, const uiString &usernm=uiString::emptyString()) |
T * | create (const char *nm, P, bool chknm=true) const |
Public Member Functions inherited from FactoryBase | |
virtual | ~FactoryBase () |
int | size () const |
bool | isEmpty () const |
bool | hasName (const char *n) |
const BufferStringSet & | getNames () const |
const uiStringSet & | getUserNames () const |
void | setDefaultName (int idx) |
const char * | getDefaultName () const |
BufferString & | errMsg () const |
const char * | currentName () const |
Protected Attributes | |
TypeSet< Creator > | creators_ |
Protected Attributes inherited from FactoryBase | |
StaticStringManager | errmsgs_ |
StaticStringManager | currentname_ |
Static Private Member Functions | |
static uiString | tr (const char *text, const char *disambiguation=0, int pluralnr=-1) |
static uiString | legacyTr (const char *text, const char *disambiguation=0, int pluralnr=-1) |
Additional Inherited Members | |
Static Public Member Functions inherited from FactoryBase | |
static char | cSeparator () |
Protected Member Functions inherited from FactoryBase | |
int | indexOf (const char *) const |
void | addNames (const char *, const uiString &) |
void | setNames (int, const char *, const uiString &) |
Generalized static factory that can deliver instances of T, when a 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 Factory1Param<ClassName,ParamExpClass>. The static function must be implemented in a src-file with the macro.
typedef T*(* Factory1Param< T, P >::Creator) (P) |
|
inline |
Name may be 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 be null, if null name is given chknm will be forced to false
|
inlinestaticprivate |
|
inlinestaticprivate |
|
protected |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019