#include <Command.h>
Public Types | |
typedef string(T::* | ExeFn )(string) |
The declaration of member functions which can be used by this Command interface. | |
Public Member Functions | |
Command (string newName, string newDescription, ExeFn newExeFn, bool depSafe=false) | |
Standard constructor. | |
virtual string | cmd (InterfacedBase &ib, string) const |
Execute the member function. | |
Private Attributes | |
ExeFn | theExeFn |
The pointer to the member function. |
Command
is templated and is derived from the InterfaceBase class via CommandBase
.
For each command interface to be defined for a class T
, exactly one static object of the Command<T> must be created and initialized as follows:
Command<T> comint(name, description, &T::memberfn, depsafe);
Where name
is an identifier std::string
which should only contain letters [a-zA-z0-9_], description
is an arbitrary std::string
, memberfn
should be a non-static member function of T
and defined as std::string T::memberfn(std::string)
. Finally if depsafe
is true it can be assumed that a call to the memberfn
for an object does not influence other objects which may depend on the first.
The Command
class, as all other InterfaceBase classes are mainly used in the BaseRepository class.
Definition at line 143 of file Command.h.
ThePEG::Command< T >::Command | ( | string | newName, | |
string | newDescription, | |||
ExeFn | newExeFn, | |||
bool | depSafe = false | |||
) | [inline] |
Standard constructor.
newName | the name of the interface, may only contain letters [a-zA-z0-9_]. | |
newDescription | a brief description of the interface. | |
newExeFn | pointer to the function to be called in the corresponding class. | |
depSafe | set to true if calls to this interface for one object does not influence other objects. |
virtual string ThePEG::Command< T >::cmd | ( | InterfacedBase & | ib, | |
string | ||||
) | const [virtual] |
Execute the member function.
For the object ib execute the memberfunction with c as argument and return the return value.
Implements ThePEG::CommandBase.