9 #ifndef ThePEG_Switch_H 10 #define ThePEG_Switch_H 13 #include "ThePEG/Config/ThePEG.h" 16 #include "InterfaceBase.h" 55 string newDescription,
long newValue);
75 operator long ()
const;
152 string newClassName,
const type_info & newTypeInfo,
153 bool depSafe,
bool readonly)
155 newTypeInfo, depSafe, readonly) {}
165 string arguments)
const;
175 virtual string type()
const;
205 bool check(
long newValue)
const {
return member(theOptions, newValue); }
210 const OptionMap &
options()
const {
return theOptions; }
216 virtual string doxygenType()
const;
221 string opttag(
long opt)
const;
229 theOptions[o.
value()] = o;
230 theOptionNames[o.
name()] = o;
271 template <
typename T,
typename Int>
280 typedef void (T::*SetFn)(Int);
285 typedef Int (T::*GetFn)()
const;
323 Switch(
string newName,
string newDescription,
324 Member newMember, Int newDef,
bool depSafe =
false,
325 bool readonly =
false, SetFn newSetFn = 0, GetFn newGetFn = 0,
328 typeid(T), depSafe, readonly),
329 theMember(newMember), theDef(newDef), theSetFn(newSetFn),
330 theGetFn(newGetFn), theDefFn(newDefFn) {}
367 virtual void doxygenDescription(ostream & stream)
const;
401 #ifndef ThePEG_TEMPLATES_IN_CC_FILE 402 #include "Switch.tcc" map< string, SwitchOption > StringMap
A map with SwitchOptions indexed by their names.
const OptionMap & options() const
Return the map relating options to their values.
SwitchOption is used by the Switch class and its base class SwitchBase to define valid options in a s...
map< long, SwitchOption > OptionMap
A map with SwitchOptions indexed by their values.
The Switch class and its base class SwitchBase defines an interface to a class derived from the Inter...
void setDefaultFunction(GetFn df)
Give a pointer to a member function to be used by 'def()'.
The InterfaceBase class defines a generic interface to any class derived from the InterfacedBase clas...
Int theDef
Default value to be used if no corresponding member function pointers are given.
bool member(const Container &c, const Key &k)
Check if a given object is a part of a container.
bool check(long newValue) const
Check if val is among the listed options.
void registerOption(const SwitchOption &o)
Register a new option.
The Switch class and its base class SwitchBase defines an interface to a class derived from the Inter...
Member theMember
The pointer to the member variable.
This is the main namespace within which all identifiers in ThePEG are declared.
The Named class is a simple concrete base class to used by classes of objects with a name...
const string & name() const
Return name.
SetFn theSetFn
A pointer to a member function to be used by 'set()'.
SwitchOption()
Default constructor.
const string & description() const
The description of this option.
GetFn theGetFn
Pointer to member function to be used by get().
OptionMap theOptions
The map relating options to their values.
Switch(string newName, string newDescription, Member newMember, Int newDef, bool depSafe=false, bool readonly=false, SetFn newSetFn=0, GetFn newGetFn=0, GetFn newDefFn=0)
Standard constructor.
void setSetFunction(SetFn sf)
Give a pointer to a member function to be used by 'set()'.
InterfacedBase is the base class of all Interfaced objects to be handled by the BaseRepository class...
StringMap theOptionNames
The map relating options to their names.
GetFn theDefFn
Pointer to member function to be used by def().
SwitchBase(string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe, bool readonly)
Standard constructor.
string theDescription
The description of this option.
void setGetFunction(GetFn gf)
Give a pointer to a member function to be used by 'get()'.
void setDef(InterfacedBase &i) const
Set the member variable of ib to its default value.
Int T::* Member
Declaration of a direct pointer to the member variable.
The default concrete implementation of ClassTraitsBase.
long value() const
The value of this option.
long theValue
The value of this option.