Classes | Namespaces | Macros | Typedefs
GFluxDriverFactory.h File Reference

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. More...

#include <string>
#include <vector>
#include <map>
#include "Framework/EventGen/GFluxI.h"

Go to the source code of this file.

Classes

class  genie::flux::GFluxDriverFactory
 
struct  genie::flux::GFluxDriverFactory::Cleaner
 

Namespaces

 genie
 THE MAIN GENIE PROJECT NAMESPACE
 
 genie::flux
 GENIE flux drivers.
 

Macros

#define FLUXDRIVERREG(_name)
 
#define FLUXDRIVERREG3(_ns, _name, _fqname)
 
#define FLUXDRIVERREG4(_nsa, _nsb, _name, _fqname)
 

Typedefs

typedef genie::GFluxI *(* genie::flux::GFluxICtorFuncPtr_t) ()
 

Detailed Description

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.

Implemented as a singleton holding a map between names and pointers-to-functions (that call a class default constructor). The functions pointers must return GFluxI*.

Version
Author
Robert Hatcher <rhatcher fnal.gov> Fermi National Accelerator Laboratory

Definition in file GFluxDriverFactory.h.

Macro Definition Documentation

#define FLUXDRIVERREG (   _name)
Value:
genie::GFluxI* _name ## _ctor_function () { return new _name; } \
static bool _name ## _creator_registered = \
genie::flux::GFluxDriverFactory::Instance().RegisterCreator(# _name, \
& _name ## _ctor_function, \
& _name ## _creator_registered );
GENIE Interface for user-defined flux classes.
Definition: GFluxI.h:37

Definition at line 130 of file GFluxDriverFactory.h.

#define FLUXDRIVERREG3 (   _ns,
  _name,
  _fqname 
)
Value:
namespace _ns { \
genie::GFluxI* _name ## _ctor_function () { return new _fqname; } \
static bool _name ## _creator_registered = \
genie::flux::GFluxDriverFactory::Instance().RegisterCreator(# _fqname, \
& _fqname ## _ctor_function, \
& _fqname ## _creator_registered );}

Definition at line 137 of file GFluxDriverFactory.h.

#define FLUXDRIVERREG4 (   _nsa,
  _nsb,
  _name,
  _fqname 
)
Value:
namespace _nsa { \
namespace _nsb { \
genie::GFluxI* _name ## _ctor_function () { return new _fqname; } \
static bool _name ## _creator_registered = \
genie::flux::GFluxDriverFactory::Instance().RegisterCreator(# _fqname, \
& _fqname ## _ctor_function, \
& _fqname ## _creator_registered );}}

Definition at line 145 of file GFluxDriverFactory.h.