EvtTimeDistFactory.h File Reference

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

Go to the source code of this file.

Classes

class  simb::EvtTimeDistFactory
struct  simb::EvtTimeDistFactory::Cleaner

Namespaces

namespace  simb

Defines

#define TIMEDISTREG(_name)
#define TIMEDISTREG3(_ns, _name, _fqname)
#define TIMEDISTREG4(_nsa, _nsb, _name, _fqname)

Typedefs

typedef simb::EvtTimeDistI *(* simb::EvtTimeDistICtorFuncPtr_t )(const std::string &)

Detailed Description

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

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

Definition in file EvtTimeDistFactory.h.


Define Documentation

#define TIMEDISTREG ( _name   ) 
Value:
simb::EvtTimeDistI* _name ## _ctor_function (const std::string& config) { return new _name(config); } \
  static bool _name ## _creator_registered =                            \
    simb::EvtTimeDistFactory::Instance().RegisterCreator(# _name, \
                                        & _name ## _ctor_function,        \
                                        & _name ## _creator_registered );

Definition at line 123 of file EvtTimeDistFactory.h.

#define TIMEDISTREG3 ( _ns,
_name,
_fqname   ) 
Value:
namespace _ns { \
  simb::EvtTimeDistI* _name ## _ctor_function (const std::string& config) { return new _fqname(config); } \
  static bool _name ## _creator_registered =                                \
    simb::EvtTimeDistFactory::Instance().RegisterCreator(# _fqname, \
                                        & _fqname ## _ctor_function,          \
                                        & _fqname ## _creator_registered );}

Definition at line 130 of file EvtTimeDistFactory.h.

#define TIMEDISTREG4 ( _nsa,
_nsb,
_name,
_fqname   ) 
Value:
namespace _nsa { \
 namespace _nsb { \
   simb::EvtTimeDistI* _name ## _ctor_function (const std::string& config) { return new _fqname(config); } \
  static bool _name ## _creator_registered =                                \
    simb::EvtTimeDistFactory::Instance().RegisterCreator(# _fqname, \
                                        & _fqname ## _ctor_function,          \
                                        & _fqname ## _creator_registered );}}

Definition at line 138 of file EvtTimeDistFactory.h.


Generated on 22 Nov 2017 for loon by  doxygen 1.6.1