00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 #ifndef ACLVIS_INTERP_H 00012 #define ACLVIS_INTERP_H 00013 00014 // include files 00015 #include "aclvis/InterpNamedObj.h" 00016 00017 // forward references 00018 class InterpCmd; 00019 00020 00021 class Interp : public InterpNamedObj { 00022 00023 public: 00024 // Constructor - nm is the name of the interpreter, and is used 00025 // as the string presented at the prompt (if you want a >, as in 00026 // cmd>, you must include it in the name) 00027 Interp(const char *); 00028 00029 // Destructor 00030 virtual ~Interp(); 00031 00032 // Add a new command callback to the interpreter, by providing a InterpCmd. 00033 virtual void addCommand(InterpCmd&) = 0; 00034 00035 // Take the given string and have the interpreter evaluate it as a command. 00036 // Return true if OK, false if an error occurred. 00037 virtual bool evalCommand(const char *) = 0; 00038 00039 // Bind a given variable to the given string variable name ... modifying 00040 // the interpreter variable should then modify the bound variable. 00041 // This is available for integer and double variables. 00042 virtual void bindVar(const char *, int &) = 0; 00043 virtual void bindVar(const char *, double &) = 0; 00044 00045 // Provide a prompt and input a command from the user. Return only 00046 // when the command "go" is given. If the timeout vlaue is < 0, this 00047 // routine will only return if the user types "go". Otherwise, it will 00048 // return when a timeout occurs. 00049 virtual void interact(int timeoutseconds = (-1)); 00050 }; 00051 00052 #endif // ACLVIS_INTERP_H 00053 00054 /*************************************************************************** 00055 * $RCSfile: Interp.h,v $ $Author: adelmann $ 00056 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:34 $ 00057 * IPPL_VERSION_ID: $Id: Interp.h,v 1.1.1.1 2003/01/23 07:40:34 adelmann Exp $ 00058 ***************************************************************************/