Changeset 293 in Sophya for trunk/SophyaPI/PIext/piacmd.h


Ignore:
Timestamp:
May 11, 1999, 6:04:58 AM (26 years ago)
Author:
ercodmgr
Message:

Adaptation aux "normes DPC", introduction des classes CmdExecutor, ...
Fenetre d'aide en lignes, gestion de modules, ... Reza 11/05/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/piacmd.h

    r174 r293  
    77#define PIACMD_H_SEEN
    88
    9 #include "defs.h"
    10 
     9#include "machdefs.h"
     10#include <iostream.h>
    1111#include <fstream.h>
    1212#include <string>
     13#include <vector>
    1314#include <map>
    1415#if defined(__KCC__)
    1516using std::string ;
     17#include <vector.h>
    1618#include <map.h>
    1719#endif
    1820
    19 #include "pdlmgr.h"
    20 
    21 #include "ctimer.h"
    2221#include "dlftypes.h"
    2322
     23
     24// Classe definissant l'interface pour un executeur de commande
     25class CmdExecutor {
     26public:
     27  virtual       ~CmdExecutor() {} ;
     28  // keyw : Le mot cle associe , args: Arguments de la commande
     29  virtual int   Execute(string& keyw, vector<string>& args)=0;
     30};
     31
     32// Classe definissant l'interface pour un interpreteur de commande
     33class CmdInterpreter {
     34public:
     35  virtual               ~CmdInterpreter() {} ;
     36  virtual string        Name()=0;
     37  virtual int           Interpret(string& line)=0;
     38};
     39
     40
     41
     42// Forward declaration of some classes ...
    2443class NamedObjMgr;
    2544class PIStdImgApp;
     45class Timer;
     46class PDynLinkMgr;
     47class PIAHelpWind;
    2648
     49// ---------------------------------------------------------------------
     50// Classe Interpreteur de commande, gestionnaire de module chargeable,
     51// et de fonctions dynamiquement linke pour PIStdImgApp
     52// Permet de gerer plusieurs Interpreter differents
     53// ---------------------------------------------------------------------
    2754
    28 class PIACmd {
     55class PIACmd : public CmdInterpreter  {
    2956public:
    30                 PIACmd(NamedObjMgr* omg=NULL, PIStdImgApp* app=NULL);
    31                 ~PIACmd();
    32   int           Exec(string& file);
    33   int           Do(string& line);
     57  static PIACmd*        GetInterpreter();
    3458
    35 //  Link dynamique de fonction user
    36   int           LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3);
    37 //                            string& func4, string& func5);   compil avec g++ 2.7.2
     59                        PIACmd(NamedObjMgr* omg, PIStdImgApp* app);
     60  virtual               ~PIACmd();
     61  virtual string        Name();
     62
     63  virtual void          RegisterCommand(string& keyw, string& usage, CmdExecutor * ce);
     64  virtual void          LoadModule(string& fnameso, string& name);
     65
     66  virtual void          AddInterpreter(CmdInterpreter * cl);
     67  virtual void          SelInterpreter(string& name);
     68
     69  virtual int           Interpret(string& line);
     70  virtual int           ExecFile(string& file);
     71
     72  virtual string&       GetUsage(const string& kw);
     73  virtual void          ShowHelpWindow();
     74
     75  inline  CmdInterpreter* CurrentInterpreter() { return(curcmdi); }
     76  inline  CmdExecutor*    BaseExecutor()  { return(basexec); }
     77  inline  PIStdImgApp*    GetImgApp() { return(mImgApp); }
     78
     79protected:
    3880  NamedObjMgr* mObjMgr;
    3981  PIStdImgApp* mImgApp;
    40   bool mOmg;
    4182
     83  CmdInterpreter* curcmdi;
     84  CmdExecutor* basexec;
     85
     86// Pour enregistrer la liste de commandes et leurs executeurs
     87  struct cmdex {string us; CmdExecutor * cex; } ;
     88  typedef map<string, cmdex, less<string> > CmdExmap;
     89  CmdExmap cmdexmap;
     90
     91// Pour garder la liste des modules
     92  typedef map<string, PDynLinkMgr* , less<string> > Modmap;
     93  Modmap modmap;
     94
     95// Pour garder la liste des interpreteur
     96  typedef map<string, CmdInterpreter*, less<string> > InterpMap;
     97  InterpMap interpmap;
     98 
    4299//  Pour stocker les variables definies par l'interpreteur
    43 typedef map<string, string, less<string> > CmdVarList;
    44 
     100  typedef map<string, string, less<string> > CmdVarList;
    45101  CmdVarList mVars;    // Liste des variables
    46102  ofstream hist;       //  History file
     
    49105  Timer* gltimer;      // pour Display CPU Time
    50106
    51 // g++ n'arrive pas a avaler ca (lignes trop longues)  on utilise donc des DlFunction  (Reza 20/08/98)
    52 // typedef map<string, DlUserProcFunction, less<string> > UsFmap;
    53 typedef map<string, DlFunction, less<string> > UsFmap;
    54   PDynLinkMgr* dynlink;
    55   UsFmap usfmap;
     107// Fenetre d'aide interactive
     108  PIAHelpWind* helpwin;
    56109
    57110};
    58111
     112
     113
    59114#endif
Note: See TracChangeset for help on using the changeset viewer.