00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_Command_H
00010 #define ThePEG_Command_H
00011
00012
00013 #include "ThePEG/Config/ThePEG.h"
00014 #include "InterfaceBase.h"
00015 #include "Command.fh"
00016 #include "Command.xh"
00017
00018 namespace ThePEG {
00019
00053 class CommandBase: public InterfaceBase {
00054
00055 public:
00056
00073 CommandBase(string newName, string newDescription, string newClassName,
00074 const type_info & newTypeInfo, bool depSafe)
00075 : InterfaceBase(newName, newDescription, newClassName,
00076 newTypeInfo, depSafe, false) {}
00077
00084 virtual string
00085 exec(InterfacedBase &ib, string action, string arguments) const
00086 ;
00087
00092 virtual string doxygenType() const;
00093
00097 virtual string type() const;
00098
00104 virtual string cmd(InterfacedBase & ib, string c) const
00105 = 0;
00106
00107 };
00108
00142 template <class T>
00143 class Command: public CommandBase {
00144
00145 public:
00146
00151 typedef string (T::*ExeFn)(string);
00152
00153 public:
00154
00169 Command(string newName, string newDescription,
00170 ExeFn newExeFn, bool depSafe = false)
00171 : CommandBase(newName, newDescription,
00172 ClassTraits<T>::className(), typeid(T), depSafe),
00173 theExeFn(newExeFn) {}
00174
00179 virtual string cmd(InterfacedBase & ib, string)
00180 const;
00181
00182
00183 private:
00184
00188 ExeFn theExeFn;
00189
00190 };
00191
00192 }
00193
00194 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
00195 #include "Command.tcc"
00196 #endif
00197
00198 #endif