ThePEG::Command< T > Class Template Reference

The CommandBase and its templated Command sub-class defines an interface to a class derived from the InterfacedBase, through which arbitratry command strings can be sent and received. More...

#include <Command.h>

Inheritance diagram for ThePEG::Command< T >:

ThePEG::CommandBase ThePEG::InterfaceBase ThePEG::Named

List of all members.

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.


Detailed Description

template<class T>
class ThePEG::Command< T >

The CommandBase and its templated Command sub-class defines an interface to a class derived from the InterfacedBase, through which arbitratry command strings can be sent and received.

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.

See also:
InterfacedBase

InterfaceBase

BaseRepository

Definition at line 143 of file Command.h.


Constructor & Destructor Documentation

template<class T>
ThePEG::Command< T >::Command ( string  newName,
string  newDescription,
ExeFn  newExeFn,
bool  depSafe = false 
) [inline]

Standard constructor.

Parameters:
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.

Definition at line 169 of file Command.h.


Member Function Documentation

template<class T>
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.


The documentation for this class was generated from the following file:

Generated on Thu Apr 29 12:43:06 2010 for ThePEG by  doxygen 1.5.5