30 virtual ~FactoryBase();
38 void setDefaultName(
int idx);
41 const char* getDefaultName()
const;
48 const char* currentName()
const;
60 void setNames(
int,
const char*,
const uiString&);
121 typedef T* (*Creator)();
122 inline void addCreator(Creator,
const char* nm,
132 inline T*
create(
const char* nm)
const;
188 template <
class T,
class P>
192 typedef T* (*Creator)(
P);
193 inline void addCreator(Creator,
const char* nm=0,
202 inline T*
create(
const char* nm,
P,
bool chknm=
true)
const;
215 template <
class T,
class P0,
class P1>
219 typedef T* (*Creator)(P0,P1);
220 inline void addCreator(Creator,
const char* nm=0,
228 inline T*
create(
const char* nm, P0, P1,
229 bool chknm=
true)
const;
242 template <
class T,
class P0,
class P1,
class P2>
246 typedef T* (*Creator)(P0,P1,P2);
247 inline void addCreator(Creator,
const char* nm=0,
255 inline T*
create(
const char* nm, P0, P1, P2,
256 bool chknm=
true)
const;
265 #define mDefaultFactoryStringImpl \ 266 const char* factoryKeyword() const { return sFactoryKeyword(); } \ 267 uiString factoryDisplayName() const \ 268 { return sFactoryDisplayName(); } 270 #define mDefaultStaticFactoryStringDeclaration \ 271 static const char* sFactoryKeyword(); \ 272 static uiString sFactoryDisplayName() 274 #define mDefaultFactoryInitClassImpl( baseclss, createfunc ) \ 276 baseclss::factory().addCreator(createfunc,sFactoryKeyword(), \ 277 sFactoryDisplayName()); \ 280 #define mDefaultFactoryInstanciationBase( keywrd, usernm ) \ 281 mDefaultFactoryStringImpl \ 282 static const char* sFactoryKeyword() { return keywrd; } \ 283 static uiString sFactoryDisplayName() { return usernm; } \ 284 static void initClass() 286 #define mDefaultFactoryCreatorImpl( baseclss, clss ) \ 287 static baseclss* createInstance() { return new clss; } \ 289 #define mDefaultFactoryInstantiation( baseclss, clss, keywrd, usernm ) \ 290 mDefaultFactoryCreatorImpl( baseclss, clss ); \ 291 mDefaultFactoryInstanciationBase( keywrd, usernm ) \ 292 mDefaultFactoryInitClassImpl( baseclss, createInstance ) 295 #define mDefaultFactoryCreatorImpl1Param( baseclss, clss, parclss ) \ 296 static baseclss* createInstance( parclss p1 ) \ 297 { return new clss( p1 ); } 299 #define mDefaultFactoryInstantiation1Param( baseclss, clss, parclss,\ 301 mDefaultFactoryCreatorImpl1Param( baseclss, clss, parclss ) \ 302 mDefaultFactoryInstanciationBase( keywrd, usernm ) \ 303 mDefaultFactoryInitClassImpl( baseclss, createInstance ) 305 #define mDefaultFactoryCreatorImpl2Param( baseclss, clss, parclss1, parclss2 ) \ 306 static baseclss* createInstance( parclss1 p1, parclss2 p2 ) \ 307 { return new clss( p1, p2 ); } 309 #define mDefaultFactoryInstantiation2Param( baseclss, clss, parclss1,\ 310 parclss2, keywrd, usernm ) \ 311 mDefaultFactoryCreatorImpl2Param( baseclss, clss, parclss1, parclss2 ) \ 312 mDefaultFactoryInstanciationBase( keywrd, usernm ) \ 313 mDefaultFactoryInitClassImpl( baseclss, createInstance ) 316 #define mCreateImpl( donames, createfunc ) \ 317 currentname_.getObject() = name; \ 320 const int idx = indexOf( name ); \ 323 errmsgs_.getObject() = "Name "; \ 324 errmsgs_.getObject().add( name ).add(" not found.\n" ) \ 325 .add( "Perhaps all plugins are not loaded\n" );\ 331 for ( int idx=0; idx<creators_.size(); idx++ ) \ 333 T* res = createfunc; \ 334 if ( res ) return res; \ 340 #define mAddCreator \ 341 const int idx = indexOf( name );\ 345 addNames( name, username ); \ 350 setNames( idx, name, username ); \ 351 creators_[idx] = cr;\ 354 template <
class T>
inline 358 if ( !name )
return;\
363 template <
class T>
inline 370 template <
class T,
class P>
inline 378 template <
class T,
class P>
inline 385 template <
class T,
class P0,
class P1>
inline 393 template <
class T,
class P0,
class P1>
inline 401 template <
class T,
class P0,
class P1,
class P2>
inline 409 template <
class T,
class P0,
class P1,
class P2>
inline 417 #define mDefineFactory( mod, T, funcname ) \ 418 mGlobal(mod) ::Factory<T>& funcname() 421 #define mDefineFactoryInClasswKW( T, funcname, kw ) \ 422 static ::Factory<T>& funcname(); \ 423 virtual uiString factoryDisplayName() const \ 424 { return ::toUiString( factoryKeyword() ); } \ 425 virtual const char* factoryKeyword() const { return kw; } 426 #define mDefineFactoryInClass( T, funcname ) \ 427 mDefineFactoryInClasswKW( T, funcname, 0 ) 430 #define mImplFactory( T, funcname ) \ 431 ::Factory<T>& funcname() \ 433 mDefineStaticLocalObject(PtrMan< ::Factory<T> >,inst,(new ::Factory<T>)); \ 438 #define mDefineFactory1Param( mod, T, P, funcname ) \ 439 mGlobal(mod) ::Factory1Param<T,P>& funcname() 442 #define mDefineFactory1ParamInClasswKW( T, P, funcname, kw ) \ 443 static ::Factory1Param<T,P>& funcname(); \ 444 virtual uiString factoryDisplayName() const \ 445 { return ::toUiString(factoryKeyword()); } \ 446 virtual const char* factoryKeyword() const { return kw; } 447 #define mDefineFactory1ParamInClass( T, P, funcname ) \ 448 mDefineFactory1ParamInClasswKW( T, P, funcname, 0 ) 450 #define mImplFactory1Param( T, P, funcname ) \ 451 ::Factory1Param<T,P>& funcname() \ 453 mLockStaticInitLock( static_inst_lck__ ); \ 454 static PtrMan< ::Factory1Param<T,P> > \ 455 inst(new ::Factory1Param<T,P>); \ 456 mUnlockStaticInitLock( static_inst_lck__ ); \ 462 #define mDefineFactory2Param( mod, T, P0, P1, funcname ) \ 463 mGlobal(mod) ::Factory2Param<T,P0,P1>& funcname() 466 #define mDefineFactory2ParamInClasswKW( T, P0, P1, funcname, kw ) \ 467 static ::Factory2Param<T,P0,P1>& funcname(); \ 468 virtual uiString factoryDisplayName() const \ 469 { return ::toUiString( factoryKeyword() ); } \ 470 virtual const char* factoryKeyword() const { return kw; } 471 #define mDefineFactory2ParamInClass( T, P0, P1, funcname ) \ 472 mDefineFactory2ParamInClasswKW( T, P0, P1, funcname, 0 ) 475 #define mImplFactory2Param( T, P0, P1, funcname ) \ 476 ::Factory2Param<T,P0,P1>& funcname() \ 478 mLockStaticInitLock( static_inst_lck__ ); \ 479 static PtrMan< ::Factory2Param<T,P0,P1> > \ 480 inst(new ::Factory2Param<T,P0,P1>); \ 481 mUnlockStaticInitLock( static_inst_lck__ ); \ 487 #define mDefineFactory3Param( mod, T, P0, P1, P2, funcname ) \ 488 mGlobal(mod) ::Factory3Param<T,P0,P1,P2>& funcname() 491 #define mDefineFactory3ParamInClasswKW( T, P0, P1, P2, funcname, kw ) \ 492 static ::Factory3Param<T,P0,P1,P2>& funcname(); \ 493 virtual uiString factoryDisplayName() const \ 494 { return ::toUiString( factoryKeyword() ); } \ 495 virtual const char* factoryKeyword() const { return kw; } 496 #define mDefineFactory3ParamInClass( T, P0, P1, P2, funcname ) \ 497 mDefineFactory3ParamInClasswKW( T, P0, P1, P2, funcname, 0 ) 500 #define mImplFactory3Param( T, P0, P1, P2,funcname ) \ 501 ::Factory3Param<T,P0,P1,P2>& funcname() \ 503 mLockStaticInitLock( static_inst_lck__ ); \ 504 static PtrMan< ::Factory3Param<T,P0,P1,P2> > \ 505 inst(new ::Factory3Param<T,P0,P1,P2>); \ 506 mUnlockStaticInitLock( static_inst_lck__ ); \ #define mExpClass(module)
Definition: commondefs.h:160
Subclass of FactoryBase.
Definition: factory.h:216
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
TypeSet< Creator > creators_
Definition: factory.h:136
void addCreator(Creator, const char *nm=0, const uiString &usernm=uiString::emptyString())
Definition: factory.h:371
Generalized static factory that can deliver instances of T, when no variable is needed in the creatio...
Definition: factory.h:118
BufferString defaultname_
Definition: factory.h:70
T * create(const char *nm, P0, P1, P2, bool chknm=true) const
Definition: factory.h:410
#define mAddCreator
Definition: factory.h:340
static const uiString & emptyString()
Definition: uistring.h:109
BufferStringSet names_
Definition: factory.h:67
Definition: uistring.h:89
Set of BufferString objects.
Definition: bufstringset.h:28
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
T * create(const char *nm, P0, P1, bool chknm=true) const
Definition: factory.h:394
static char cSeparator()
Definition: factory.h:42
TypeSet< Creator > creators_
Definition: factory.h:207
BufferStringSet aliases_
Definition: factory.h:69
Definition: seistype.h:61
TypeSet< Creator > creators_
Definition: factory.h:261
void addCreator(Creator, const char *nm, const uiString &username=uiString::emptyString())
Definition: factory.h:355
uiStringSet usernames_
Definition: factory.h:68
Generalized static factory that can deliver instances of T, when a variable is needed in the creation...
Definition: factory.h:189
bool hasName(const char *n)
Definition: factory.h:35
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Base class for Factories ( Factory, Factory1Param, Factory2Param and Factory3Param. )
Definition: factory.h:27
T * create(const char *nm, P, bool chknm=true) const
Definition: factory.h:379
StaticStringManager currentname_
Definition: factory.h:63
static uiHor3DInterpol * create(uiParent *)
#define mCreateImpl(donames, createfunc)
Definition: factory.h:316
Definition: uistring.h:218
StaticStringManager errmsgs_
Definition: factory.h:62
void addCreator(Creator, const char *nm=0, const uiString &usernm=uiString::emptyString())
Definition: factory.h:402
const char * errMsg() const
Definition: horizontracker.h:61
void addNames(const ODSET &inp, WITHADD &withadd)
Adds all names from a set to another set with an add() function (typically a BufferStringSet) ...
Definition: odset.h:67
T * create(const char *nm) const
Name may be not be null.
Definition: factory.h:364
#define mClass(module)
Definition: commondefs.h:164
bool isEmpty(const NLAModel *mdl)
Subclass of FactoryBase.
Definition: factory.h:243
TypeSet< Creator > creators_
Definition: factory.h:234
void addCreator(Creator, const char *nm=0, const uiString &usernm=uiString::emptyString())
Definition: factory.h:386