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;
221 string opttag(
long opt)
const;
271 template <
typename T,
typename Int>
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),
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...
virtual string exec(InterfacedBase &ib, string action, string arguments) const
The general interface method overriding the one in InterfaceBase.
const string & name() const
Return name.
string opttag(long opt) const
Return a string with the option index and its associated tag.
virtual long 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 'set()'.
SwitchOption()
Default constructor.
virtual string doxygenType() const
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.
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.
virtual void set(InterfacedBase &ib, long val) const
Set the member variable of ib to val.
void(T::* SetFn)(Int)
The declaration of member functions which can be used by this Switch interface for the 'set' action...
virtual string type() const
Return a code for the type of this switch.
void setGetFunction(GetFn gf)
Give a pointer to a member function to be used by 'get()'.
Int(T::* GetFn)() const
The declaration of member functions which can be used by this Switch interface for the 'get' action...
virtual string fullDescription(const InterfacedBase &ib) const
Return a complete description of this switch.
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.
virtual long def(const InterfacedBase &ib) const
Return the default value for the member variable of ib.
long value() const
The value of this option.
virtual void set(InterfacedBase &ib, long val) const =0
Set the member variable of ib to val.
long theValue
The value of this option.
virtual void doxygenDescription(ostream &stream) const
Print a description to be included in the Doxygen documentation to the given stream.