26 #ifndef GENIE_FLUX_GFLUXDRIVERFACTORY_H
27 #define GENIE_FLUX_GFLUXDRIVERFACTORY_H
138 #define FLUXDRIVERREG( _name ) \
139 genie::GFluxI* _name ## _ctor_function () { return new _name; } \
140 static bool _name ## _creator_registered = \
141 genie::flux::GFluxDriverFactory::Instance().RegisterCreator(# _name, \
142 & _name ## _ctor_function, \
143 & _name ## _creator_registered );
145 #define FLUXDRIVERREG3( _ns, _name, _fqname ) \
147 genie::GFluxI* _name ## _ctor_function () { return new _fqname; } \
148 static bool _name ## _creator_registered = \
149 genie::flux::GFluxDriverFactory::Instance().RegisterCreator(# _fqname, \
150 & _fqname ## _ctor_function, \
151 & _fqname ## _creator_registered );}
153 #define FLUXDRIVERREG4( _nsa, _nsb, _name, _fqname ) \
156 genie::GFluxI* _name ## _ctor_function () { return new _fqname; } \
157 static bool _name ## _creator_registered = \
158 genie::flux::GFluxDriverFactory::Instance().RegisterCreator(# _fqname, \
159 & _fqname ## _ctor_function, \
160 & _fqname ## _creator_registered );}}
virtual ~GFluxDriverFactory()
static GFluxDriverFactory * fgTheInstance
const std::vector< std::string > & AvailableFluxDrivers() const
std::vector< std::string > listnames
A class for generating concrete GFluxI derived classes based on the factory pattern. This code supplies a CPP macro which allows the classes to self-register and thus no modification of this class is needed in order to expand the list of classes it knows about.
static GFluxDriverFactory & Instance()
std::map< std::string, GFluxICtorFuncPtr_t > fFunctionMap
bool RegisterCreator(std::string name, GFluxICtorFuncPtr_t ctorptr, bool *ptr)
std::map< std::string, bool * > fBoolPtrMap
bool IsKnownFluxDriver(const std::string &)
genie::GFluxI *(* GFluxICtorFuncPtr_t)()
void operator=(const GFluxDriverFactory &)
genie::GFluxI * GetFluxDriver(const std::string &)
GENIE Interface for user-defined flux classes.