Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DbmCmdOptions.h

Go to the documentation of this file.
00001 // $Id: DbmCmdOptions.h,v 1.7 2009/02/28 21:46:12 gmieg Exp $
00002 
00003 #ifndef DBMCMDOPTIONS
00004 #define DBMCMDOPTIONS
00005 
00007 // DbmCmdOptions                                                     //
00008 //                                                                    //
00009 // Package: Dbm (Database Maintenance).                               //
00010 //                                                                    //
00011 // N. West 12/2001                                                    //
00012 //                                                                    //
00013 // Concept: Collection of command options.                            //
00014 //                                                                    //
00015 // Purpose: To simplify command option processing; options come both  //
00016 //          from user and DbmLogFile.                                 //
00017 //                                                                    //
00019 
00020 #include <list>
00021 #include <map>
00022 #include <string>
00023 
00024 #include "Rtypes.h"
00025 
00026 class JobCommand;
00027 
00028 class DbmCmdOptions
00029 {
00030 
00031 public:
00032 
00033 // Constructors and destructors.
00034   DbmCmdOptions(const std::string& validOpts = "",
00035                 JobCommand* jcmd = 0,
00036                 const std::list<std::string>* defaultOpts =0);
00037 
00038   virtual ~DbmCmdOptions();
00039 
00040 // State testing member functions
00041               void GetOptIntList(const std::string& opt, std::list<int>& nos) const;
00042              Int_t GetOptInt(const std::string& opt) const;
00043        std::string GetOptString(const std::string& opt) const;
00044        std::string GetOpts() const;
00045        Bool_t IsValid() const { return fIsValid; }
00046        Bool_t IsValid(const std::string& opt) const;
00047        UInt_t NumOpts() const { return fOptsMap.size(); }
00048        Bool_t TestOpt(const std::string& opt) const;
00049 
00050 // State changing member functions
00051        Bool_t AddOpt(const std::string& opt, JobCommand& jcmd);
00052        Bool_t AddOpt(const std::string& opt, const std::string& val);
00053        Bool_t ProcessCmd(JobCommand& jcmd,
00054                          const std::list<std::string>* defaultOpts =0);
00055 
00056 
00057 // Data members
00058 
00059   Bool_t fIsValid;            // Set kFALSE if any invalid option found.
00060   std::string fValidOpts;     // Colon delimited list of options.
00061   std::map<std::string,std::string> fOptsMap; // Look-up option -> value.  
00062                               // If opt takes no value store "yes"
00063 
00064  ClassDef(DbmCmdOptions,0)    // Collection of command options.
00065 
00066 };
00067 
00068 
00069 #endif  // DBMCMDOPTIONS

Generated on Mon Feb 15 11:06:35 2010 for loon by  doxygen 1.3.9.1