ThePEG::CommandBase Class 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::CommandBase:

ThePEG::InterfaceBase ThePEG::Named ThePEG::Command< T >

List of all members.

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.


Detailed Description

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 53 of file Command.h.


Constructor & Destructor Documentation

ThePEG::CommandBase::CommandBase ( string  newName,
string  newDescription,
string  newClassName,
const type_info &  newTypeInfo,
bool  depSafe 
) [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.
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.

Definition at line 73 of file Command.h.


Member Function Documentation

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


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