thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
ThePEG::CurrentGenerator Class Reference

This CurrentGenerator class keeps a static stack of EventGenerators which can be used anywhere by any class. More...

#include <CurrentGenerator.h>

Classes

class  Redirect
 Class used to temporarily redirect a given ostream to the misc() stream of the current EventGenerator. More...
 

Public Member Functions

 CurrentGenerator ()
 Default constructor does nothing.
 
 CurrentGenerator (const CurrentGenerator &)
 Copy-constructor does nothing.
 
 CurrentGenerator (const EGPtr &eg)
 Construct a new object specifying a new EventGenerator, eg, to be used during this objects lifetime.
 
 ~CurrentGenerator ()
 The destructor removing the EventGenerator specified in the constructor from the stack.
 
EventGeneratoroperator* () const
 Return a reference to the currently chosen object.
 
EventGeneratoroperator-> () const
 Return a pointer to the currently chosen object.
 
 operator bool () const
 Test for existance.
 
bool operator! () const
 Test for existance.
 

Static Public Member Functions

static bool isVoid ()
 Returns true if there is no currently chosen EventGenerator object.
 
static EventGeneratorcurrent ()
 Return a reference to the currently chosen EventGenerator object.
 
static EventGeneratorptr ()
 Pointer to the stack.
 
static tSMPtr standardModel ()
 Return a pointer to the standard model parameters used by the current generator.
 
static tStrategyPtr strategy ()
 Return a pointer to the strategy object containing eg.
 
static ostream & out ()
 Get the current standard output stream.
 
static ostream & log ()
 Get the current standard log stream.
 
static ostream & ref ()
 Get the current standard ref stream.
 
template<typename T >
static Ptr< T >::pointer getPtr (const T &t)
 Get object.
 
static IBPtr getPointer (string name)
 Get object.
 
template<typename T >
static Ptr< T >::pointer getObject (string name)
 Get object.
 
template<typename T >
static Ptr< T >::pointer getDefault ()
 Get default object.
 

Private Member Functions

CurrentGeneratoroperator= (const CurrentGenerator &)=delete
 Private and non-existent assignment operator.
 

Private Attributes

bool generatorPushed
 True if this object is responsible for pushing a EventGenerator onto the stack.
 

Static Private Attributes

static vector< EGPtrtheGeneratorStack
 The stack of EventGenerators requested.
 

Detailed Description

This CurrentGenerator class keeps a static stack of EventGenerators which can be used anywhere by any class.

When an EventGenerator is initialized or run it adds itself to the stack which can be used by any other object being initialized or run through the static functions of the CurrentGenerator class. If someone needs to use an alternative EventGenerator object a new CurrentGenerator object can be constructed with a pointer to the desired EventGenerator object as argument and that object will the be used by the static CurrentGenerator functions until the CurrentGenerator object is destructed.

See also
EventGenerator

Definition at line 33 of file CurrentGenerator.h.

Constructor & Destructor Documentation

◆ CurrentGenerator() [1/3]

ThePEG::CurrentGenerator::CurrentGenerator ( )
inline

Default constructor does nothing.

Definition at line 40 of file CurrentGenerator.h.

◆ CurrentGenerator() [2/3]

ThePEG::CurrentGenerator::CurrentGenerator ( const CurrentGenerator )
inline

Copy-constructor does nothing.

Definition at line 45 of file CurrentGenerator.h.

◆ CurrentGenerator() [3/3]

ThePEG::CurrentGenerator::CurrentGenerator ( const EGPtr eg)
inline

Construct a new object specifying a new EventGenerator, eg, to be used during this objects lifetime.

Definition at line 52 of file CurrentGenerator.h.

References generatorPushed, and theGeneratorStack.

◆ ~CurrentGenerator()

ThePEG::CurrentGenerator::~CurrentGenerator ( )
inline

The destructor removing the EventGenerator specified in the constructor from the stack.

Definition at line 63 of file CurrentGenerator.h.

References generatorPushed, and theGeneratorStack.

Member Function Documentation

◆ current()

static EventGenerator & ThePEG::CurrentGenerator::current ( )
inlinestatic

◆ getDefault()

template<typename T >
static Ptr< T >::pointer ThePEG::CurrentGenerator::getDefault ( )
inlinestatic

Get default object.

Return the default object for class T in the current EventGenerator. Returns the null pointer if non-existent.

Definition at line 191 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::getDefault().

◆ getObject()

template<typename T >
static Ptr< T >::pointer ThePEG::CurrentGenerator::getObject ( string  name)
inlinestatic

Get object.

Return a pointer to an object of type T present in the current EventGenerator given its full name. Return the null pointer if non-existent.

Definition at line 182 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::getObject().

◆ getPointer()

static IBPtr ThePEG::CurrentGenerator::getPointer ( string  name)
inlinestatic

Get object.

Return a pointer to an object present in the current EventGenerator given its full name. Return the null pointer if non-existent.

Definition at line 172 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::getPointer().

◆ getPtr()

template<typename T >
static Ptr< T >::pointer ThePEG::CurrentGenerator::getPtr ( const T &  t)
inlinestatic

Get object.

Return a garbage collected pointer to a given object in the current EventGenerator. If the object is not found, a null pointer will be returned.

Definition at line 163 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::getPtr().

◆ isVoid()

static bool ThePEG::CurrentGenerator::isVoid ( )
inlinestatic

Returns true if there is no currently chosen EventGenerator object.

Definition at line 73 of file CurrentGenerator.h.

References theGeneratorStack.

Referenced by ThePEG::Throw< Ex >::writeWarning().

◆ log()

static ostream & ThePEG::CurrentGenerator::log ( )
inlinestatic

Get the current standard log stream.

Return a reference to the stream connected to the file for logging information of the current generator. If no file is connected, the BaseRepository::clog() will be used instead.

Definition at line 147 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::log().

◆ operator bool()

ThePEG::CurrentGenerator::operator bool ( ) const
inline

Test for existance.

Definition at line 108 of file CurrentGenerator.h.

References ptr().

◆ operator!()

bool ThePEG::CurrentGenerator::operator! ( ) const
inline

Test for existance.

Definition at line 115 of file CurrentGenerator.h.

References ptr().

◆ operator*()

EventGenerator & ThePEG::CurrentGenerator::operator* ( ) const
inline

Return a reference to the currently chosen object.

Definition at line 87 of file CurrentGenerator.h.

References theGeneratorStack.

◆ operator->()

EventGenerator * ThePEG::CurrentGenerator::operator-> ( ) const
inline

Return a pointer to the currently chosen object.

Definition at line 94 of file CurrentGenerator.h.

References theGeneratorStack.

◆ out()

static ostream & ThePEG::CurrentGenerator::out ( )
inlinestatic

Get the current standard output stream.

Return a reference to the stream connected to the file for general output of the current generator. If no file is connected, the BaseRepository::cout() will be used instead.

Definition at line 139 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::out().

◆ ptr()

static EventGenerator * ThePEG::CurrentGenerator::ptr ( )
inlinestatic

Pointer to the stack.

Definition at line 101 of file CurrentGenerator.h.

References theGeneratorStack.

Referenced by operator bool(), and operator!().

◆ ref()

static ostream & ThePEG::CurrentGenerator::ref ( )
inlinestatic

Get the current standard ref stream.

Return a reference to the stream connected to the file for references from used objects of the current generator. If no file is connected, the BaseRepository::cout() will be used instead.

Definition at line 155 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::ref().

◆ standardModel()

static tSMPtr ThePEG::CurrentGenerator::standardModel ( )
inlinestatic

Return a pointer to the standard model parameters used by the current generator.

Definition at line 123 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::standardModel().

◆ strategy()

static tStrategyPtr ThePEG::CurrentGenerator::strategy ( )
inlinestatic

Return a pointer to the strategy object containing eg.

a set of non-default particles to be used by the current generator.

Definition at line 131 of file CurrentGenerator.h.

References current(), and ThePEG::EventGenerator::strategy().

Member Data Documentation

◆ generatorPushed

bool ThePEG::CurrentGenerator::generatorPushed
private

True if this object is responsible for pushing a EventGenerator onto the stack.

Definition at line 265 of file CurrentGenerator.h.

Referenced by CurrentGenerator(), and ~CurrentGenerator().

◆ theGeneratorStack

vector<EGPtr> ThePEG::CurrentGenerator::theGeneratorStack
staticprivate

The stack of EventGenerators requested.

Definition at line 259 of file CurrentGenerator.h.

Referenced by current(), CurrentGenerator(), isVoid(), operator*(), operator->(), ptr(), and ~CurrentGenerator().


The documentation for this class was generated from the following file: