casa  $Rev:20696$
stdBaseInterface.h
Go to the documentation of this file.
00001 #ifndef CASA_BASEINTERFACE_H
00002 #define CASA_BASEINTERFACE_H
00003 //
00004 //BaseInterface class, uses a Record to produce a simple readline based Command Shell
00005 //for a task or method.
00006 //
00007 
00008 #include <casa/aips.h>
00009 #include <vector>
00010 #include <string>
00011 #include <map>
00012 #include <xmlcasa/record.h>
00013 #include <iostream>
00014 
00015 using std::vector;
00016 using std::string;
00017 using std::map;
00018 using std::ostream;
00019 
00020 namespace casa {
00021         class LogIO;
00022 };
00023 
00024 namespace casac {
00025 
00026 void dumpRecord(ostream &oss, const record &theRec, string spaces = "    ");
00027 
00028 struct COMMAND {
00029         char *name;
00030         char *doc; }; 
00031 
00032 class stdBaseInterface {
00033    public :
00034         stdBaseInterface(record &);
00035        ~stdBaseInterface();
00036         int inputs(record &);
00037         bool go(const record &);
00038         static vector<string> &getcommands(){return commands;}
00039         static vector<string> commands;
00040         static bool verify(record &theRec, record &theContraints, casa::LogIO &itsLog);
00041         static bool verifyOne(record &theRec, record &theContraints, casa::LogIO &itsLog, bool silent=true);
00042         static bool checkme(const string &name, variant &user, record &constraint, casa::LogIO &itsLog, bool silent=false);
00043         static bool checkQuanta(const string &name, variant &user, record &constraint, casa::LogIO &itsLog, bool silent=false);
00044         static variant *expandEnum(variant &allowed, const variant &value, casa::LogIO &itsLog, bool silent=false);
00045    private :
00046         void init();
00047         void parse_it(record &params, const char *line);
00048         bool done;
00049         record xmldescribes;  // Name
00050                               // Scope
00051                               // Help text
00052                               // parameters - record
00053         //map< string, int (runfunction *)(record &) > stand_alones;
00054         map< string, int> stand_alones;
00055 };
00056 
00057 
00058 }
00059 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines