thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
ThePEG::Parameter< T, Type > Class Template Reference

The Parameter and its base classes ParameterTBase and ParameterBase defines an interface to a class derived from the InterfacedBase, through which simple member variables can be manuipulated. More...

#include <Parameter.h>

Inheritance diagram for ThePEG::Parameter< T, Type >:

Public Types

typedef void(T::* SetFn) (Type)
 The declaration of member functions which can be used by this Switch interface for the 'set' action.
 
typedef Type(T::* GetFn) () const
 The declaration of member functions which can be used by this Switch interface for the 'get', 'def', 'min' and 'max' actions.
 
typedef Type T::* Member
 Declaration of a direct pointer to the member variable.
 

Public Member Functions

 Parameter (string newName, string newDescription, Member newMember, Type newDef, Type newMin, Type newMax, bool depSafe=false, bool readonly=false, bool limits=true, SetFn newSetFn=0, GetFn newGetFn=0, GetFn newMinFn=0, GetFn newMaxFn=0, GetFn newDefFn=0)
 Standard constructor.
 
 Parameter (string newName, string newDescription, Member newMember, Type newUnit, Type newDef, Type newMin, Type newMax, bool depSafe=false, bool readonly=false, bool limits=true, SetFn newSetFn=0, GetFn newGetFn=0, GetFn newMinFn=0, GetFn newMaxFn=0, GetFn newDefFn=0)
 Standard constructor.
 
 Parameter (string newName, string newDescription, Member newMember, Type newDef, Type newMin, Type newMax, bool depSafe=false, bool readonly=false, int limits=Interface::limited, SetFn newSetFn=0, GetFn newGetFn=0, GetFn newMinFn=0, GetFn newMaxFn=0, GetFn newDefFn=0)
 Standard constructor.
 
 Parameter (string newName, string newDescription, Member newMember, Type newUnit, Type newDef, Type newMin, Type newMax, bool depSafe=false, bool readonly=false, int limits=Interface::limited, SetFn newSetFn=0, GetFn newGetFn=0, GetFn newMinFn=0, GetFn newMaxFn=0, GetFn newDefFn=0)
 Standard constructor.
 
virtual ~Parameter ()
 Default dtor.
 
virtual void tset (InterfacedBase &ib, Type val) const
 Set the member variable of ib to val.
 
virtual Type tget (const InterfacedBase &ib) const
 Return the value of the member variable of ib.
 
virtual Type tminimum (const InterfacedBase &ib) const
 Return the minimum value allowed for the member variable of ib.
 
virtual Type tmaximum (const InterfacedBase &ib) const
 Return the miaximum value allowed for the member variable of ib.
 
virtual Type tdef (const InterfacedBase &ib) const
 Return the default value for the member variable of ib.
 
void setSetFunction (SetFn sf)
 Give a pointer to a member function to be used by tset().
 
void setGetFunction (GetFn gf)
 Give a pointer to a member function to be used by tget().
 
void setDefaultFunction (GetFn df)
 Give a pointer to a member function to be used by tdef().
 
void setMinFunction (GetFn mf)
 Give a pointer to a member function to be used by tminimum().
 
void setMaxFunction (GetFn mf)
 Give a pointer to a member function to be used by tmaximum().
 
virtual void doxygenDescription (ostream &stream) const
 Print a description to be included in the Doxygen documentation to the given stream.
 
- Public Member Functions inherited from ThePEG::ParameterTBase< Type >
 ParameterTBase (string newName, string newDescription, string newClassName, const type_info &newTypeInfo, Type newUnit, bool depSafe, bool readonly, int limits)
 Standard constructor.
 
virtual ~ParameterTBase ()
 Destructor.
 
virtual string type () const
 Return a code for the type of this parameter.
 
virtual void set (InterfacedBase &ib, string newValue) const
 Set the member variables of ib to val.
 
virtual void tset (InterfacedBase &ib, Type) const =0
 Set the member variables of ib to val.
 
virtual string get (const InterfacedBase &ib) const
 Return the value of the member variable of ib.
 
virtual Type tget (const InterfacedBase &ib) const =0
 Return the value of the member variable of ib.
 
virtual string minimum (const InterfacedBase &ib) const
 Return the minimum value allowed for the member variable of ib.
 
virtual Type tminimum (const InterfacedBase &ib) const =0
 Return the minimum value allowed for the member variable of ib.
 
virtual string maximum (const InterfacedBase &ib) const
 Return the maximum value allowed for the member variable of ib.
 
virtual Type tmaximum (const InterfacedBase &ib) const =0
 Return the maximum value allowed for the member variable of ib.
 
virtual string def (const InterfacedBase &ib) const
 Return the default value for the member variables of ib.
 
virtual Type tdef (const InterfacedBase &ib) const =0
 Return the default value for the member variables of ib.
 
virtual void setDef (InterfacedBase &ib) const
 set the member variable of ib to its default value.
 
Type unit () const
 Get the unit which an Type object is divided (multiplied) by when written to (read from) a stream via a double.
 
void unit (Type u)
 Set the unit which an Type object is divided (multiplied) by when written to (read from) a stream via a double.
 
virtual string doxygenType () const
 Return a string describing the type of interface to be included in the Doxygen documentation.
 
- Public Member Functions inherited from ThePEG::ParameterBase
 ParameterBase (string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe, bool readonly, int limits)
 Standard constructor.
 
virtual ~ParameterBase ()
 The destructor.
 
virtual string exec (InterfacedBase &ib, string action, string arguments) const
 The general interface method overriding the one in InterfaceBase.
 
virtual string fullDescription (const InterfacedBase &ib) const
 Return a complete description of this parameter.
 
virtual void set (InterfacedBase &ib, string) const =0
 Set the member variable of ib to val.
 
virtual string minimum (const InterfacedBase &ib) const =0
 Return the minimum value allowed for the member variable of ib.
 
virtual string maximum (const InterfacedBase &ib) const =0
 Return the maximum value allowed for the member variable of ib.
 
virtual string get (const InterfacedBase &ib) const =0
 Return the value of the member variable of ib.
 
virtual string def (const InterfacedBase &ib) const =0
 Return the default value for the member variable of ib.
 
virtual void setDef (InterfacedBase &ib) const =0
 Set the member variable of ib to its default value.
 
bool limited () const
 True if there the variable is limited from above and below.
 
bool upperLimit () const
 True if there the variable is limited from abovew.
 
bool lowerLimit () const
 True if there the variable is limited from below.
 
void setLimited ()
 Set flag indicating that there are limits associated with the variable.
 
void setUnlimited ()
 Set flag indicating that there are no limits associated with the variable.
 
- Public Member Functions inherited from ThePEG::InterfaceBase
 InterfaceBase (string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe, bool readonly)
 Standard constructor.
 
virtual ~InterfaceBase ()
 The destructor.
 
string tag (int pos=-1) const
 Create a tag for this interface using its name and optional poisitional argument.
 
virtual string exec (InterfacedBase &ib, string action, string arguments) const =0
 Manipulate an object of the corresponding class.
 
virtual string type () const =0
 Return a code for the type of this interface.
 
virtual bool notDefault (InterfacedBase &) const
 Returns true if the setting for this interface has been changed from its default value.
 
map< string, string > & objectDefaults (InterfacedBase &) const
 Returns the map of objectDefaults of the given object.
 
virtual void rebind (InterfacedBase &, const TranslationMap &, const IVector &=IVector()) const
 Rebind all references in ib according to the translation map.
 
virtual IVector getReferences (const InterfacedBase &) const
 For derived classes interfacing references between Interfaced objects, return the references for this interface.
 
string description () const
 Return the description of this interface.
 
virtual string fullDescription (const InterfacedBase &ib) const
 Return a complete description of this interface.
 
virtual void doxygenDescription (ostream &stream) const
 Print a description to be included in the Doxygen documentation to the given stream.
 
virtual string doxygenType () const =0
 Return a string describing the type of interface to be included in the Doxygen documentation.
 
string className () const
 Return the class name for the class this interface is defined for.
 
bool dependencySafe () const
 Get the flag saying whether changing an object with this interface may change the state of a dependent object .
 
void setDependencySafe ()
 Set the flag saying whether changing an object with this interface may change the state of a dependent object .
 
void setDependencySensitive ()
 Set the flag saying whether changing an object with this interface may change the state of a dependent object .
 
bool readOnly () const
 Get the flag saying whether this interface is allowed to change an object.
 
void setReadOnly ()
 Set the flag saying that this interface is allowed to change an object.
 
void setReadWrite ()
 Unset the flag saying that this interface is allowed to change an object.
 
bool anonymous () const
 Return true if this interface is anonyous, ie.
 
double rank () const
 Get the rank for this interface.
 
void rank (double r)
 Set the rank for this interface.
 
void setHasDefault (bool b)
 Indicate that this interface has a default value.
 
- Public Member Functions inherited from ThePEG::Named
 Named (const string &newName=string())
 Constructor with name.
 
 Named (const Named &)=default
 Explicit default copy-constructor (too avoid compiler warnings)
 
const string & name () const
 Return name.
 
bool operator== (const Named &other) const
 Test for equality.
 
bool operator< (const Named &other) const
 Lexicographical comparison.
 

Private Attributes

Member theMember
 The pointer to the member variable.
 
Type theDef
 Default value to be used if no corresponding member function pointer is given.
 
Type theMin
 Minimum value to be used if no corresponding member function pointer is given.
 
Type theMax
 Maximum value to be used if no corresponding member function pointer is given.
 
SetFn theSetFn
 A pointer to a member function to be used by tset().
 
GetFn theGetFn
 Pointer to member function to be used by tget().
 
GetFn theDefFn
 Pointer to member function to be used by tdef().
 
GetFn theMinFn
 Pointer to member function to be used by tminimum().
 
GetFn theMaxFn
 Pointer to member function to be used by tmaximum().
 

Additional Inherited Members

- Static Public Attributes inherited from ThePEG::InterfaceBase
static bool NoReadOnly
 If set to true, all read-only interfaces can be changed.
 
- Protected Member Functions inherited from ThePEG::ParameterTBase< Type >
void putUnit (ostream &os, Type val) const
 Write a number to a stream with the unit specified with unit().
 
- Protected Member Functions inherited from ThePEG::Named
const Namedoperator= (const Named &other)
 Assignment.
 
const string & name (const string &newName)
 Set new name.
 
- Protected Attributes inherited from ThePEG::InterfaceBase
bool hasDefault
 A flag indicating whether this interface has a default setting.
 
bool isDependencySafe
 The flag saying whether changing an object with this interface may change the state of a dependent object .
 
bool isReadOnly
 The flag saying whether this interface is allowed to change an object.
 

Detailed Description

template<typename T, typename Type>
class ThePEG::Parameter< T, Type >

The Parameter and its base classes ParameterTBase and ParameterBase defines an interface to a class derived from the InterfacedBase, through which simple member variables can be manuipulated.

Parameter is templated on the type of the member variable and the type of the InterfacedBase class, and is derived from the InterfaceBase class via ParameterTBase (which is templated only on the type of the member variable) and ParameterBase.

For each InterfacedBase class exactly one static Parameter object should created for each member variable which should be interfaced. This object will automatically register itself with the BaseRepository class.

See also
InterfacedBase
InterfaceBase

Definition at line 452 of file Parameter.h.

Member Typedef Documentation

◆ GetFn

template<typename T , typename Type >
typedef Type(T::* ThePEG::Parameter< T, Type >::GetFn) () const

The declaration of member functions which can be used by this Switch interface for the 'get', 'def', 'min' and 'max' actions.

Definition at line 465 of file Parameter.h.

◆ Member

template<typename T , typename Type >
typedef Type T::* ThePEG::Parameter< T, Type >::Member

Declaration of a direct pointer to the member variable.

Definition at line 470 of file Parameter.h.

◆ SetFn

template<typename T , typename Type >
typedef void(T::* ThePEG::Parameter< T, Type >::SetFn) (Type)

The declaration of member functions which can be used by this Switch interface for the 'set' action.

Definition at line 460 of file Parameter.h.

Constructor & Destructor Documentation

◆ Parameter() [1/4]

template<typename T , typename Type >
ThePEG::Parameter< T, Type >::Parameter ( string  newName,
string  newDescription,
Member  newMember,
Type  newDef,
Type  newMin,
Type  newMax,
bool  depSafe = false,
bool  readonly = false,
bool  limits = true,
SetFn  newSetFn = 0,
GetFn  newGetFn = 0,
GetFn  newMinFn = 0,
GetFn  newMaxFn = 0,
GetFn  newDefFn = 0 
)
inline

Standard constructor.

Parameters
newNamethe name of the interface, may only contain letters [a-zA-z0-9_].
newDescriptiona brief description of the interface.
newMembera pointer to the member variable. May be null if corresponding set/get functions are provided.
newDefthe default value for the member variable.
newMinthe minimum value for the member variable.
newMaxthe maximum value for the member variable.
depSafeset to true if calls to this interface for one object does not influence other objects.
readonlyif this is set true the interface will not be able to manipulate objects of the corresponding class, but will still be able to access information.
limitsdetermines if the values of the parameters are limited from above and below.
newSetFnoptional pointer to the member function for the 'set' action.
newGetFnoptional pointer to the member function for the 'get' action.
newMinFnoptional pointer to the member function for the 'min' action.
newMaxFnoptional pointer to the member function for the 'max' action.
newDefFnoptional pointer to the member function for the 'def' action.

Definition at line 516 of file Parameter.h.

◆ Parameter() [2/4]

template<typename T , typename Type >
ThePEG::Parameter< T, Type >::Parameter ( string  newName,
string  newDescription,
Member  newMember,
Type  newUnit,
Type  newDef,
Type  newMin,
Type  newMax,
bool  depSafe = false,
bool  readonly = false,
bool  limits = true,
SetFn  newSetFn = 0,
GetFn  newGetFn = 0,
GetFn  newMinFn = 0,
GetFn  newMaxFn = 0,
GetFn  newDefFn = 0 
)
inline

Standard constructor.

Parameters
newNamethe name of the interface, may only contain letters [a-zA-z0-9_].
newDescriptiona brief description of the interface.
newMembera pointer to the member variable. May be null if corresponding set/get functions are provided.
newUnitthe unit assumed when a number is read or written to a stream.
newDefthe default value for the member variable.
newMinthe minimum value for the member variable.
newMaxthe maximum value for the member variable.
depSafeset to true if calls to this interface for one object does not influence other objects.
readonlyif this is set true the interface will not be able to manipulate objects of the corresponding class, but will still be able to access information.
limitsdetermines if the values of the parameters are limited from above and below.
newSetFnoptional pointer to the member function for the 'set' action.
newGetFnoptional pointer to the member function for the 'get' action.
newMinFnoptional pointer to the member function for the 'min' action.
newMaxFnoptional pointer to the member function for the 'max' action.
newDefFnoptional pointer to the member function for the 'def' action.

Definition at line 573 of file Parameter.h.

◆ Parameter() [3/4]

template<typename T , typename Type >
ThePEG::Parameter< T, Type >::Parameter ( string  newName,
string  newDescription,
Member  newMember,
Type  newDef,
Type  newMin,
Type  newMax,
bool  depSafe = false,
bool  readonly = false,
int  limits = Interface::limited,
SetFn  newSetFn = 0,
GetFn  newGetFn = 0,
GetFn  newMinFn = 0,
GetFn  newMaxFn = 0,
GetFn  newDefFn = 0 
)
inline

Standard constructor.

Parameters
newNamethe name of the interface, may only contain letters [a-zA-z0-9_].
newDescriptiona brief description of the interface.
newMembera pointer to the member variable. May be null if corresponding set/get functions are provided.
newDefthe default value for the member variable.
newMinthe minimum value for the member variable.
newMaxthe maximum value for the member variable.
depSafeset to true if calls to this interface for one object does not influence other objects.
readonlyif this is set true the interface will not be able to manipulate objects of the corresponding class, but will still be able to access information.
limitsdetermines if the values of the parameters are limited from above and/or below. The possible values are given by Interface::Limits.
newSetFnoptional pointer to the member function for the 'set' action.
newGetFnoptional pointer to the member function for the 'get' action.
newMinFnoptional pointer to the member function for the 'min' action.
newMaxFnoptional pointer to the member function for the 'max' action.
newDefFnoptional pointer to the member function for the 'def' action.

Definition at line 628 of file Parameter.h.

◆ Parameter() [4/4]

template<typename T , typename Type >
ThePEG::Parameter< T, Type >::Parameter ( string  newName,
string  newDescription,
Member  newMember,
Type  newUnit,
Type  newDef,
Type  newMin,
Type  newMax,
bool  depSafe = false,
bool  readonly = false,
int  limits = Interface::limited,
SetFn  newSetFn = 0,
GetFn  newGetFn = 0,
GetFn  newMinFn = 0,
GetFn  newMaxFn = 0,
GetFn  newDefFn = 0 
)
inline

Standard constructor.

Parameters
newNamethe name of the interface, may only contain letters [a-zA-z0-9_].
newDescriptiona brief description of the interface.
newMembera pointer to the member variable. May be null if corresponding set/get functions are provided.
newUnitthe unit assumed when a number is read or written to a stream.
newDefthe default value for the member variable.
newMinthe minimum value for the member variable.
newMaxthe maximum value for the member variable.
depSafeset to true if calls to this interface for one object does not influence other objects.
readonlyif this is set true the interface will not be able to manipulate objects of the corresponding class, but will still be able to access information.
limitsdetermines if the values of the parameters are limited from above and/or below. The possible values are given by Interface::Limits.
newSetFnoptional pointer to the member function for the 'set' action.
newGetFnoptional pointer to the member function for the 'get' action.
newMinFnoptional pointer to the member function for the 'min' action.
newMaxFnoptional pointer to the member function for the 'max' action.
newDefFnoptional pointer to the member function for the 'def' action.

Definition at line 686 of file Parameter.h.

◆ ~Parameter()

template<typename T , typename Type >
virtual ThePEG::Parameter< T, Type >::~Parameter ( )
inlinevirtual

Default dtor.

Definition at line 701 of file Parameter.h.

Member Function Documentation

◆ doxygenDescription()

template<typename T , typename Type >
virtual void ThePEG::Parameter< T, Type >::doxygenDescription ( ostream &  stream) const
virtual

Print a description to be included in the Doxygen documentation to the given stream.

Reimplemented from ThePEG::InterfaceBase.

◆ setDefaultFunction()

template<typename T , typename Type >
void ThePEG::Parameter< T, Type >::setDefaultFunction ( GetFn  df)
inline

Give a pointer to a member function to be used by tdef().

Definition at line 745 of file Parameter.h.

References ThePEG::Parameter< T, Type >::theDefFn.

◆ setGetFunction()

template<typename T , typename Type >
void ThePEG::Parameter< T, Type >::setGetFunction ( GetFn  gf)
inline

Give a pointer to a member function to be used by tget().

Definition at line 740 of file Parameter.h.

References ThePEG::Parameter< T, Type >::theGetFn.

◆ setMaxFunction()

template<typename T , typename Type >
void ThePEG::Parameter< T, Type >::setMaxFunction ( GetFn  mf)
inline

Give a pointer to a member function to be used by tmaximum().

Definition at line 755 of file Parameter.h.

References ThePEG::Parameter< T, Type >::theMaxFn.

◆ setMinFunction()

template<typename T , typename Type >
void ThePEG::Parameter< T, Type >::setMinFunction ( GetFn  mf)
inline

Give a pointer to a member function to be used by tminimum().

Definition at line 750 of file Parameter.h.

References ThePEG::Parameter< T, Type >::theMinFn.

◆ setSetFunction()

template<typename T , typename Type >
void ThePEG::Parameter< T, Type >::setSetFunction ( SetFn  sf)
inline

Give a pointer to a member function to be used by tset().

Definition at line 735 of file Parameter.h.

References ThePEG::Parameter< T, Type >::theSetFn.

◆ tdef()

template<typename T , typename Type >
virtual Type ThePEG::Parameter< T, Type >::tdef ( const InterfacedBase ib) const
virtual

Return the default value for the member variable of ib.

Implements ThePEG::ParameterTBase< Type >.

◆ tget()

template<typename T , typename Type >
virtual Type ThePEG::Parameter< T, Type >::tget ( const InterfacedBase ib) const
virtual

Return the value of the member variable of ib.

Implements ThePEG::ParameterTBase< Type >.

◆ tmaximum()

template<typename T , typename Type >
virtual Type ThePEG::Parameter< T, Type >::tmaximum ( const InterfacedBase ib) const
virtual

Return the miaximum value allowed for the member variable of ib.

Implements ThePEG::ParameterTBase< Type >.

◆ tminimum()

template<typename T , typename Type >
virtual Type ThePEG::Parameter< T, Type >::tminimum ( const InterfacedBase ib) const
virtual

Return the minimum value allowed for the member variable of ib.

Implements ThePEG::ParameterTBase< Type >.

◆ tset()

template<typename T , typename Type >
virtual void ThePEG::Parameter< T, Type >::tset ( InterfacedBase ib,
Type  val 
) const
virtual

Set the member variable of ib to val.

Implements ThePEG::ParameterTBase< Type >.

Member Data Documentation

◆ theDef

template<typename T , typename Type >
Type ThePEG::Parameter< T, Type >::theDef
private

Default value to be used if no corresponding member function pointer is given.

Definition at line 774 of file Parameter.h.

◆ theDefFn

template<typename T , typename Type >
GetFn ThePEG::Parameter< T, Type >::theDefFn
private

Pointer to member function to be used by tdef().

Definition at line 801 of file Parameter.h.

Referenced by ThePEG::Parameter< T, Type >::setDefaultFunction(), and ThePEG::Parameter< T, string >::setDefaultFunction().

◆ theGetFn

template<typename T , typename Type >
GetFn ThePEG::Parameter< T, Type >::theGetFn
private

Pointer to member function to be used by tget().

Definition at line 796 of file Parameter.h.

Referenced by ThePEG::Parameter< T, Type >::setGetFunction(), and ThePEG::Parameter< T, string >::setGetFunction().

◆ theMax

template<typename T , typename Type >
Type ThePEG::Parameter< T, Type >::theMax
private

Maximum value to be used if no corresponding member function pointer is given.

Definition at line 786 of file Parameter.h.

◆ theMaxFn

template<typename T , typename Type >
GetFn ThePEG::Parameter< T, Type >::theMaxFn
private

Pointer to member function to be used by tmaximum().

Definition at line 811 of file Parameter.h.

Referenced by ThePEG::Parameter< T, Type >::setMaxFunction().

◆ theMember

template<typename T , typename Type >
Member ThePEG::Parameter< T, Type >::theMember
private

The pointer to the member variable.

Definition at line 768 of file Parameter.h.

◆ theMin

template<typename T , typename Type >
Type ThePEG::Parameter< T, Type >::theMin
private

Minimum value to be used if no corresponding member function pointer is given.

Definition at line 780 of file Parameter.h.

◆ theMinFn

template<typename T , typename Type >
GetFn ThePEG::Parameter< T, Type >::theMinFn
private

Pointer to member function to be used by tminimum().

Definition at line 806 of file Parameter.h.

Referenced by ThePEG::Parameter< T, Type >::setMinFunction().

◆ theSetFn

template<typename T , typename Type >
SetFn ThePEG::Parameter< T, Type >::theSetFn
private

A pointer to a member function to be used by tset().

Definition at line 791 of file Parameter.h.

Referenced by ThePEG::Parameter< T, Type >::setSetFunction(), and ThePEG::Parameter< T, string >::setSetFunction().


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