9 #ifndef ThePEG_HandlerGroup_H
10 #define ThePEG_HandlerGroup_H
13 #include "ThePEG/Config/ThePEG.h"
173 virtual void clear();
248 void checkInsert(StepHintVector & current,
const StepVector & def);
320 template <
typename HDLR>
372 virtual void clear();
450 template <
typename HDLR>
458 template <
typename HDLR>
468 #define ThePEG_DECLARE_PREPOST_GROUP(HandlerClass,prepost) \
470 void interfaceSet##prepost##HandlerClass(StepHdlPtr, int); \
472 void interfaceInsert##prepost##HandlerClass(StepHdlPtr, int); \
474 void interfaceErase##prepost##HandlerClass(int); \
476 vector<StepHdlPtr> interfaceGet##prepost##HandlerClass() const
479 #define ThePEG_DECLARE_GROUPINTERFACE(HandlerClass,ptr) \
480 ThePEG_DECLARE_PREPOST_GROUP(HandlerClass,Pre); \
482 void interfaceSet##HandlerClass(ptr); \
484 ptr interfaceGet##HandlerClass() const; \
485 ThePEG_DECLARE_PREPOST_GROUP(HandlerClass,Post)
488 #define ThePEG_IMPLEMENT_PREPOST_GROUP(ThisClass,HandlerClass,member,pp) \
489 void ThisClass::interfaceSet##pp##HandlerClass(StepHdlPtr p , int i) { \
490 member.interfaceSet##pp##handler(p,i); \
492 void ThisClass::interfaceInsert##pp##HandlerClass(StepHdlPtr p, int i) { \
493 member.interfaceInsert##pp##handler(p,i); \
495 void ThisClass::interfaceErase##pp##HandlerClass(int i) { \
496 member.interfaceErase##pp##handler(i); \
498 vector<StepHdlPtr> ThisClass::interfaceGet##pp##HandlerClass() const { \
499 return member.interfaceGet##pp##handlers(); \
503 #define ThePEG_IMPLEMENT_GROUPINTERFACE(ThisClass,HandlerClass,member,ptr) \
504 ThePEG_IMPLEMENT_PREPOST_GROUP(ThisClass,HandlerClass,member,Pre) \
505 void ThisClass::interfaceSet##HandlerClass(ptr p) { \
506 member.interfaceSetHandler(p); \
508 ptr ThisClass::interfaceGet##HandlerClass() const { \
509 return member.interfaceGetHandler(); \
511 ThePEG_IMPLEMENT_PREPOST_GROUP(ThisClass,HandlerClass,member,Post) \
514 #define ThePEG_DECLARE_PREPOST_OBJECTS(ThisClass,HandlerClass,pp,ba) \
515 static RefVector<ThisClass,StepHandler> interface##pp##HandlerClass \
516 (#pp #HandlerClass "s", \
517 "A list of handlers to be called " #ba " the " #HandlerClass ". " \
518 "If handler objects are specified in a EventHandler and " \
519 "the SubProcessHandler chosen in a given collision also specifies some, " \
520 "the latter will caled first.", \
521 0, 0, false, false, true, false, \
522 &ThisClass::interfaceSet##pp##HandlerClass, \
523 &ThisClass::interfaceInsert##pp##HandlerClass, \
524 &ThisClass::interfaceErase##pp##HandlerClass, \
525 &ThisClass::interfaceGet##pp##HandlerClass)
528 #define ThePEG_DECLARE_GROUPINTERFACE_OBJECTS(ThisClass,HandlerClass) \
529 ThePEG_DECLARE_PREPOST_OBJECTS(ThisClass,HandlerClass,Pre, before); \
530 static Reference<ThisClass,HandlerClass> interface ## HandlerClass \
532 "The " #HandlerClass " object used in this " #ThisClass ". " \
533 "If a " #HandlerClass " object is specified in a EventHandler and " \
534 "the SubProcessHandler chosen in a given collision also specifies one," \
535 "the latter will be used.", \
536 0, false, false, true, true, \
537 &ThisClass::interfaceSet ## HandlerClass, \
538 &ThisClass::interfaceGet ## HandlerClass); \
539 ThePEG_DECLARE_PREPOST_OBJECTS(ThisClass,HandlerClass,Post, after)
541 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
542 #include "HandlerGroup.tcc"
PersistentIStream is used to read persistent objects from a stream where they were previously written...
void addPostHandler(tStepHdlPtr sh, tHintPtr hint, const HandlerGroupBase &)
Add a step handler, sh, to the current list of post-handlers.
virtual void write(PersistentOStream &) const
Write to persistent streams.
StepVector & preHandlers()
Return a reference to the list of default pre-handlers.
void interfaceSetHandler(HdlPtr)
Utility function used for the interface.
HdlPtr theDefaultHandler
The default main handler.
void interfaceErasePrehandler(int i)
Utility function used for the interface.
StepVector & postHandlers()
Return a reference to the list of default post-handlers.
deque< HintPtr > HintVector
A vector of Hint objects.
void init(const HandlerGroupBase &ext)
Initialize, taking the default StepHandlers as the current ones, possibly overridden by the default o...
HandlerGroupBase & operator=(const HandlerGroupBase &)
Assignment is private.
bool empty() const
Returns true if current selections in this group is empty.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
virtual void write(PersistentOStream &os) const
Write to persistent streams.
The CascadeHandler group.
void interfaceSetPosthandler(StepHdlPtr p, int i)
Utility function used for the interface.
virtual tStepHdlPtr handler() const =0
Return a pointer to the current main handler.
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
void interfaceSetPrehandler(StepHdlPtr p, int i)
Utility function used for the interface.
const StepVector & preHandlers() const
Return a reference to the list of default pre-handlers.
virtual void setHandler()=0
Unset the current main handler.
HdlPtr interfaceGetHandler() const
Utility function used for the interface.
vector< StepWithHint > StepHintVector
A vector of StepHandler objects associated with Hint objects.
void checkInsert(StepHintVector ¤t, const StepVector &def)
Add handlers from the def vector to the current, supplying them with default hints.
virtual tStepHdlPtr handler() const
Return a pointer to the current main handler.
T1 dynamic_ptr_cast(const T2 &t2)
Replacement for the standard dynamic_cast.
The HadronizationHandler group.
This is the main namespace within which all identifiers in ThePEG are declared.
void addHint(tHintPtr hint, const HandlerGroupBase &ext)
Add a hint to the currently selected main handler.
void interfaceErasePosthandler(int i)
Utility function used for the interface.
virtual tStepHdlPtr defaultHandler() const
Return a pointer to the default main handler.
virtual void read(PersistentIStream &)
Read from persistent streams.
Level
Enumeration for the type of step handler.
pair< StepHdlPtr, HintPtr > StepWithHint
Associate a StepHandler with a Hint object.
vector< StepHdlPtr > interfaceGetPosthandlers() const
Utility function used for the interface.
virtual string handlerClass() const
Return the base class name of the main handler type.
StepWithHint next()
Return the next step;.
virtual string handlerClass() const =0
Return the base class name of the main handler type.
virtual void clear()
Clear all current handlers, but don't touch the default ones.
void interfaceInsertPrehandler(StepHdlPtr p, int i)
Utility function used for the interface.
HdlPtr theHandler
The current main handler.
virtual void refillDefaultHandler(tStepHdlPtr)
Set the current main handler.
HandlerGroupBase is the base class for the templated HandlerGroup utility class to manage a group of ...
virtual void setHandler()
Unset the current main handler.
StepVector theDefaultPostHandlers
The default post-handlers with hints.
StepHintVector thePostHandlers
The current post-handlers with hints.
vector< T > & operator>>(vector< T > &tv, U &u)
Overload the right shift operator for vector to pop objects from a vector.
HintVector theHints
The current hints for the main handler.
Handler
Enumeration for the type of HandlerGroups.
RCPtr is a reference counted (smart) pointer.
virtual void read(PersistentIStream &is)
Read from persistent streams.
Ptr< HDLR >::pointer HdlPtr
A pointer to the template argument class.
virtual ~HandlerGroupBase()
Destructor.
const StepVector & postHandlers() const
Return a reference to the list of default post-handlers.
vector< StepHdlPtr > interfaceGetPrehandlers() const
Utility function used for the interface.
HandlerGroup is a templated utility class to manage a group of StepHandlers.
Ptr is a templated class to provide typedefs for pointers types ThePEG should use for a given type...
virtual ~HandlerGroup()
Destructor.
vector< T > & operator<<(vector< T > &tv, const U &u)
Overload the left shift operator for vector to push_back objects to a vector.
virtual void refillDefaultHandler(tStepHdlPtr)=0
Set the current main handler.
void refillDefaults(const HandlerGroupBase &)
Fill main, pre- and post- handlers with the default ones.
virtual tStepHdlPtr defaultHandler() const =0
Return a pointer to the default main handler.
StepVector theDefaultPreHandlers
The default pre-handlers with hints.
bool isEmpty
True if the current handlers are empty.
HandlerGroupBase()
Default constructor.
virtual void clear()
Clear all current handlers, but don't touch the default ones.
HandlerGroup< HDLR > & operator=(const HandlerGroup< HDLR > &)
Assignment is private.
The MultipleInteractionHandler group.
vector< StepHdlPtr > StepVector
A vector of StepHandler objects.
Ptr< HDLR >::transient_pointer tHdlPtr
A transient pointer to the template argument class.
StepHintVector thePreHandlers
The current pre-handlers with hints.
void interfaceInsertPosthandler(StepHdlPtr p, int i)
Utility function used for the interface.
void addPreHandler(tStepHdlPtr sh, tHintPtr hint, const HandlerGroupBase &ext)
Add a step handler, sh to the current list of pre-handlers.