9 #ifndef ThePEG_Parameter_H
10 #define ThePEG_Parameter_H
15 #include "ThePEG/Config/ThePEG.h"
16 #include "InterfaceBase.h"
17 #include "Parameter.xh"
18 #include "Parameter.fh"
19 #include "ThePEG/Utilities/StringUtils.h"
30 inline void putUnitImpl(ostream & os, T v, T u,
DimensionT) {
38 inline void putUnitImpl(ostream & os, T v, T u,
StandardT) {
94 const type_info & newTypeInfo,
bool depSafe,
95 bool readonly,
int limits)
97 newClassName, newTypeInfo, depSafe,
98 readonly),
limit(limits) {}
113 string arguments)
const;
216 template <
typename Type>
250 const type_info & newTypeInfo, Type newUnit,
251 bool depSafe,
bool readonly,
int limits)
253 newClassName, newTypeInfo, depSafe,
254 readonly, limits),
theUnit(newUnit) {}
264 virtual string type()
const;
417 template <
typename T,
typename Type>
483 Member newMember, Type newDef, Type newMin,
484 Type newMax,
bool depSafe =
false,
bool readonly =
false,
485 bool limits =
true,
SetFn newSetFn = 0,
489 typeid(T), Type(), depSafe, readonly, limits),
540 Member newMember, Type newUnit, Type newDef, Type newMin,
541 Type newMax,
bool depSafe =
false,
bool readonly =
false,
542 bool limits =
true,
SetFn newSetFn = 0,
546 typeid(T), newUnit, depSafe, readonly, limits),
595 Member newMember, Type newDef, Type newMin,
596 Type newMax,
bool depSafe =
false,
bool readonly =
false,
601 typeid(T), Type(), depSafe, readonly, limits),
653 Member newMember, Type newUnit, Type newDef, Type newMin,
654 Type newMax,
bool depSafe =
false,
bool readonly =
false,
659 typeid(T), newUnit, depSafe, readonly, limits),
826 const type_info & newTypeInfo,
827 bool depSafe,
bool readonly)
829 newClassName, newTypeInfo, depSafe,
830 readonly, false), isFileType(NoFile) {
844 case File:
return "PF";
845 case Directory:
return "PD";
846 default:
return "Ps";
945 virtual string doxygenType()
const {
return "Character string parameter"; }
962 template <
typename T>
1015 Member newMember,
string newDef,
1016 bool depSafe =
false,
bool readonly =
false,
1020 typeid(T), depSafe, readonly),
1101 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
1102 #include "Parameter.tcc"
virtual void doxygenDescription(ostream &stream) const
Print a description to be included in the Doxygen documentation to the given stream.
void(T::* SetFn)(Type)
The declaration of member functions which can be used by this Switch interface for the 'set' action...
Member theMember
The pointer to the member variable.
GetFn theMinFn
Pointer to member function to be used by tminimum().
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.
The Parameter and its base classes ParameterTBase and ParameterBase defines an interface to a class d...
void directoryType()
Indicate that this parameter corresponds to a directory.
void setGetFunction(GetFn gf)
Give a pointer to a member function to be used by tget().
virtual string maximum(const InterfacedBase &ib) const =0
Return the maximum value allowed for the member variable of ib.
virtual void set(InterfacedBase &ib, string newValue) const
Set the member variables of ib to val.
virtual Type tdef(const InterfacedBase &ib) const
Return the default value for the member variable of ib.
virtual ~ParameterTBase()
Destructor.
virtual string exec(InterfacedBase &ib, string action, string arguments) const
The general interface method overriding the one in InterfaceBase.
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.
The InterfaceBase class defines a generic interface to any class derived from the InterfacedBase clas...
void setDefaultFunction(GetFn df)
Give a pointer to a member function to be used by tdef().
virtual ~Parameter()
Default dtor.
bool hasDefault
A flag indicating whether this interface has a default setting.
virtual ~ParameterBase()
The destructor.
virtual string maximum(const InterfacedBase &ib) const
Return the maximum value allowed for the member variable of ib.
GetFn theDefFn
Pointer to member function to be used by tdef().
void setDefaultFunction(GetFn df)
Give a pointer to a member function to be used by tdef().
ParameterBase(string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe, bool readonly, int limits)
Standard constructor.
FileType isFileType
Indicates if this parameter corresponds to a file or directory.
Conversion between integers and types.
virtual string doxygenType() const
Return a string describing the type of interface to be included in the Doxygen documentation.
virtual ~Parameter()
Default dtor.
Type theMin
Minimum value to be used if no corresponding member function pointer is given.
int limit
Determines if the values of the parameters are limited from above and/or below.
virtual string def(const InterfacedBase &ib) const =0
Return the default value for the member variable of ib.
SetFn theSetFn
A pointer to a member function to be used by tset().
void setUnlimited()
Set flag indicating that there are no limits associated with the variable.
virtual Type tminimum(const InterfacedBase &ib) const
Return the minimum value allowed for the member variable of ib.
virtual void setDef(InterfacedBase &i) const
set the member variable of ib to its default value.
virtual void tset(InterfacedBase &ib, Type val) const
Set the member variable of ib to val.
This is the main namespace within which all identifiers in ThePEG are declared.
Neither file nor directory.
Type theMax
Maximum value to be used if no corresponding member function pointer is given.
void file(FileType t)
Indicate if this parameter corresponds to a file or directory.
Type T::* Member
Declaration of a direct pointer to the member variable.
string theDef
Default, minimum and maximum values to be used if no corresponding member function pointers are given...
static string stripws(string str)
Return the string str stripped from leading and trailing white space.
virtual void set(InterfacedBase &ib, string newValue) const
Set the member variables of ib to val.
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.
string T::* Member
Declaration of a direct pointer to the member variable.
virtual string minimum(const InterfacedBase &ib) const =0
Return the minimum value allowed for the member variable of ib.
GetFn theDefFn
Pointer to member function to be used by tdef().
Type theDef
Default value to be used if no corresponding member function pointer is given.
virtual string maximum(const InterfacedBase &) const
Return the maximum value allowed for the member variable of ib.
Int2Type< Dimensioned > DimensionT
Typedef for dimensioned types.
ParameterTBase(string newName, string newDescription, string newClassName, const type_info &newTypeInfo, Type newUnit, bool depSafe, bool readonly, int limits)
Standard constructor.
bool limited() const
True if there the variable is limited from above and below.
virtual string def(const InterfacedBase &ib) const
Return the default value for the member variables of ib.
FileType
Enumerated variables to determine of a string parameter corresponds to a file or a directory...
void setMinFunction(GetFn mf)
Give a pointer to a member function to be used by tminimum().
The Parameter and its base classes ParameterTBase and ParameterBase defines an interface to a class d...
virtual string type() const
Return a code for the type of this parameter.
string className() const
Return the class name for the class this interface is defined for.
GetFn theGetFn
Pointer to member function to be used by tget().
virtual void setDef(InterfacedBase &ib) const
set the member variable of ib to its default value.
virtual Type tmaximum(const InterfacedBase &ib) const
Return the miaximum value allowed for the member variable of ib.
void putUnit(ostream &os, Type val) const
Write a number to a stream with the unit specified with unit().
GetFn theMaxFn
Pointer to member function to be used by tmaximum().
The parameter is not limited.
virtual Type tget(const InterfacedBase &ib) const
Return the value of the member variable of ib.
virtual Type tdef(const InterfacedBase &ib) const =0
Return the default value for the member variables of ib.
virtual string fullDescription(const InterfacedBase &ib) const
Return a complete description of this parameter.
virtual Type tmaximum(const InterfacedBase &ib) const =0
Return the maximum value allowed for the member variable of ib.
void unit(Type u)
Set the unit which an Type object is divided (multiplied) by when written to (read from) a stream via...
InterfacedBase is the base class of all Interfaced objects to be handled by the BaseRepository class...
void setGetFunction(GetFn gf)
Give a pointer to a member function to be used by tget().
void setImpl(InterfacedBase &i, string newValue, StandardT) const
Implementation of set() for standard types.
virtual void setDef(InterfacedBase &ib) const =0
Set the member variable of ib to its default value.
virtual string type() const
Return a code for the type of this parameter.
virtual void tset(InterfacedBase &ib, Type) const =0
Set the member variables of ib to val.
virtual ~ParameterTBase()
Destructor.
virtual string doxygenType() const
Return a string describing the type of interface to be included in the Doxygen documentation.
GetFn theGetFn
Pointer to member function to be used by tget().
The parameter has only an upper limit.
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.
Member theMember
The pointer to the member variable.
The parameter has only an lower limit.
The parameter corresponds to a file.
virtual void set(InterfacedBase &ib, string) const =0
Set the member variable of ib to val.
virtual Type tget(const InterfacedBase &ib) const =0
Return the value of the member variable of ib.
SetFn theSetFn
A pointer to a member function to be used by tset().
The default concrete implementation of ClassTraitsBase.
void setSetFunction(SetFn sf)
Give a pointer to a member function to be used by tset().
The parameter is limited (both up- and downwards.
void setLimited()
Set flag indicating that there are limits associated with the variable.
void fileType()
Indicate that this parameter corresponds to a file.
void setMaxFunction(GetFn mf)
Give a pointer to a member function to be used by tmaximum().
virtual Type tminimum(const InterfacedBase &ib) const =0
Return the minimum value allowed for the member variable of ib.
bool lowerLimit() const
True if there the variable is limited from below.
Int2Type< Standard > StandardT
Typedef for non-dimensioned types.
virtual string def(const InterfacedBase &ib) const
Return the default value for the member variables of ib.
virtual string minimum(const InterfacedBase &) const
Return the minimum value allowed for the member variable of ib.
Type unit() const
Get the unit which an Type object is divided (multiplied) by when written to (read from) a stream via...
Parameter(string newName, string newDescription, Member newMember, string newDef, bool depSafe=false, bool readonly=false, SetFn newSetFn=0, GetFn newGetFn=0, GetFn newDefFn=0)
Standard constructor.
virtual string minimum(const InterfacedBase &ib) const
Return the minimum value allowed for the member variable of ib.
The Parameter and its base classes ParameterTBase and ParameterBase defines an interface to a class d...
FileType file() const
See if this parameter corresponds to a file or directory.
Type(T::* GetFn)() const
The declaration of member functions which can be used by this Switch interface for the 'get'...
Type theUnit
The unit which an Type object is divided (multiplied) by when written to (read from) a stream via a d...
ParameterTBase(string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe, bool readonly)
Standard constructor.
void setSetFunction(SetFn sf)
Give a pointer to a member function to be used by tset().
bool upperLimit() const
True if there the variable is limited from abovew.