Action_Thermostats
        Adding_Graph_to_ChangeBondActions
        Adding_MD_integration_tests
        Adding_StructOpt_integration_tests
        AutomationFragmentation_failures
        Candidate_v1.6.1
        Candidate_v1.7.0
        ChemicalSpaceEvaluator
        Enhanced_StructuralOptimization
        Enhanced_StructuralOptimization_continued
        Exclude_Hydrogens_annealWithBondGraph
        Fix_Verbose_Codepatterns
        ForceAnnealing_with_BondGraph
        ForceAnnealing_with_BondGraph_continued
        ForceAnnealing_with_BondGraph_continued_betteresults
        ForceAnnealing_with_BondGraph_contraction-expansion
        Gui_displays_atomic_force_velocity
        JobMarket_RobustOnKillsSegFaults
        JobMarket_StableWorkerPool
        PythonUI_with_named_parameters
        Recreated_GuiChecks
        StoppableMakroAction
        TremoloParser_IncreasedPrecision
        stable
      
      
      
| Line |  | 
|---|
| 1 | /* $Id: GetLongOpt.h,v 2.2 2003/02/06 01:02:13 cljanss Exp $ */ | 
|---|
| 2 | /* S Manoharan. Advanced Computer Research Institute. Lyon. France */ | 
|---|
| 3 |  | 
|---|
| 4 | #ifdef __GNUC__ | 
|---|
| 5 | #pragma interface | 
|---|
| 6 | #endif | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef _GetLongOpt_h_ | 
|---|
| 9 | #define _GetLongOpt_h_ | 
|---|
| 10 |  | 
|---|
| 11 | #include <iostream> | 
|---|
| 12 | #include <string.h> | 
|---|
| 13 |  | 
|---|
| 14 | namespace sc { | 
|---|
| 15 |  | 
|---|
| 16 | class GetLongOpt { | 
|---|
| 17 | public: | 
|---|
| 18 | enum OptType { | 
|---|
| 19 | NoValue, OptionalValue, MandatoryValue | 
|---|
| 20 | }; | 
|---|
| 21 | private: | 
|---|
| 22 | struct Cell { | 
|---|
| 23 | const char *option;       // option name | 
|---|
| 24 | OptType type;             // option type | 
|---|
| 25 | const char *description;  // a description of option | 
|---|
| 26 | const char *value;        // value of option (string) | 
|---|
| 27 | Cell *next;               // pointer to the next cell | 
|---|
| 28 |  | 
|---|
| 29 | Cell() { option = description = value = 0; next = 0; } | 
|---|
| 30 | }; | 
|---|
| 31 | private: | 
|---|
| 32 | Cell *table;                          // option table | 
|---|
| 33 | const char *ustring;                  // usage message | 
|---|
| 34 | char *pname;                          // program basename | 
|---|
| 35 | char optmarker;                       // option marker | 
|---|
| 36 |  | 
|---|
| 37 | int enroll_done;                      // finished enrolling | 
|---|
| 38 | Cell *last;                           // last entry in option table | 
|---|
| 39 |  | 
|---|
| 40 | private: | 
|---|
| 41 | char *basename(char * const p) const; | 
|---|
| 42 | int setcell(Cell *c, const char *valtoken, const char *nexttoken, const char *p); | 
|---|
| 43 | public: | 
|---|
| 44 | GetLongOpt(const char optmark = '-'); | 
|---|
| 45 | ~GetLongOpt(); | 
|---|
| 46 |  | 
|---|
| 47 | int parse(int argc, char * const *argv); | 
|---|
| 48 | int parse(char * const str, char * const p); | 
|---|
| 49 |  | 
|---|
| 50 | int enroll(const char * const opt, const OptType t, | 
|---|
| 51 | const char * const desc, const char * const val); | 
|---|
| 52 | const char *retrieve(const char * const opt) const; | 
|---|
| 53 |  | 
|---|
| 54 | void usage(std::ostream &outfile = std::cout) const; | 
|---|
| 55 | void usage(const char *str)          { ustring = str; } | 
|---|
| 56 | }; | 
|---|
| 57 |  | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | #endif /* _GetLongOpt_h_ */ | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.