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

A class for generating concrete EvtTimeShiftI 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 "EvtTimeShiftI.h"

Go to the source code of this file.

Classes

class  evgb::EvtTimeShiftFactory
 
struct  evgb::EvtTimeShiftFactory::Cleaner
 

Namespaces

 evgb
 Physics generators for neutrinos, cosmic rays, and others.
 

Macros

#define TIMESHIFTREG(_name)
 
#define TIMESHIFTREG3(_ns, _name, _fqname)
 
#define TIMESHIFTREG4(_nsa, _nsb, _name, _fqname)
 

Typedefs

typedef evgb::EvtTimeShiftI *(* evgb::EvtTimeShiftICtorFuncPtr_t) (const std::string &)
 

Detailed Description

A class for generating concrete EvtTimeShiftI 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 EvtTimeShiftI*.

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

Definition in file EvtTimeShiftFactory.h.

Macro Definition Documentation

#define TIMESHIFTREG (   _name)
Value:
evgb::EvtTimeShiftI* _name ## _ctor_function (const std::string& config) { return new _name(config); } \
static bool _name ## _creator_registered = \
evgb::EvtTimeShiftFactory::Instance().RegisterCreator(# _name, \
& _name ## _ctor_function, \
& _name ## _creator_registered );
std::string string
Definition: nybbler.cc:12
interface for event time distribution
Definition: EvtTimeShiftI.h:29
static Config * config
Definition: config.cpp:1054

Definition at line 127 of file EvtTimeShiftFactory.h.

#define TIMESHIFTREG3 (   _ns,
  _name,
  _fqname 
)
Value:
namespace _ns { \
evgb::EvtTimeShiftI* _name ## _ctor_function (const std::string& config) { return new _fqname(config); } \
static bool _name ## _creator_registered = \
evgb::EvtTimeShiftFactory::Instance().RegisterCreator(# _fqname, \
& _fqname ## _ctor_function, \
& _fqname ## _creator_registered );}
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054

Definition at line 134 of file EvtTimeShiftFactory.h.

#define TIMESHIFTREG4 (   _nsa,
  _nsb,
  _name,
  _fqname 
)
Value:
namespace _nsa { \
namespace _nsb { \
evgb::EvtTimeShiftI* _name ## _ctor_function (const std::string& config) { return new _fqname(config); } \
static bool _name ## _creator_registered = \
evgb::EvtTimeShiftFactory::Instance().RegisterCreator(# _fqname, \
& _fqname ## _ctor_function, \
& _fqname ## _creator_registered );}}
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054

Definition at line 142 of file EvtTimeShiftFactory.h.