#include <Command.h>
Public Member Functions | |
CommandBase (string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe) | |
Standard constructor. | |
virtual string | exec (InterfacedBase &ib, string action, string arguments) const |
The general interface method overriding the one in InterfaceBase. | |
virtual string | doxygenType () const |
Return a string describing the type of interface to be included in the Doxygen documentation. | |
virtual string | type () const |
Return a code for the type of this interface. | |
virtual string | cmd (InterfacedBase &ib, string c) const =0 |
Execute 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 53 of file Command.h.
ThePEG::CommandBase::CommandBase | ( | string | newName, | |
string | newDescription, | |||
string | newClassName, | |||
const type_info & | newTypeInfo, | |||
bool | depSafe | |||
) | [inline] |
Standard constructor.
newName | the name of the interface, may only contain letters [a-zA-z0-9_]. | |
newDescription | a brief description of the interface. | |
newClassName | the name of the corresponding class. | |
newTypeInfo | the type_info object of the corresponding class. | |
depSafe | set to true if calls to this interface for one object does not influence other objects. |
virtual string ThePEG::CommandBase::exec | ( | InterfacedBase & | ib, | |
string | action, | |||
string | arguments | |||
) | const [virtual] |
The general interface method overriding the one in InterfaceBase.
For this class, the action and argument arguments are concatenated (with a space character inserted) and sent to the cmd() function.
Implements ThePEG::InterfaceBase.
virtual string ThePEG::CommandBase::cmd | ( | InterfacedBase & | ib, | |
string | c | |||
) | const [pure virtual] |
Execute the member function.
For the object ib execute the memberfunction (defined in the derived class) with c as argument and return the return value.
Implemented in ThePEG::Command< T >.