Proposed changes to BrAppOptionManager

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Fri Mar 02 2001 - 10:16:20 EST

  • Next message: Hironori Ito: "new dN/deta"

    Hi all, 
    
    I'd very much like to change BrAppOptionManager quite a lot, so that
    it may be used with BrMainModule and TestMainModule. What I propose to
    do, is to change the interface from 
    
    
        BrAppOptionManager(Int_t major, Int_t minor, 
    		       const Char_t* versionStr, 
    		       const Char_t* helpStr
        void ProcessCommandLine(Int_t argc, Char_t** argv) 
    
    to  
         
       BrAppOptionManager()
       static BrAppOptionManager* Instance()
       void                       SetVersion(Int_t major, Int_t minor, 
                   		                 const Char_t* versionStr)
       void                       SetHelp(const Char_t* versionStr) 
       void                       SetCommandLine()
       Bool_t                     ProcessCommandLine() 
    
    and not use exceptions. So if you had before
    
      try {
    1     BrAppOptionManager* oM = new BrAppOptionManager(0,1,"Hello", "World")
    2     ... Add options
    3     om->ProcessCommandLine(argc, argv)
          ...
       } catch (BrException* e) {
         ...
       }
    
    you would now have 
    
    1  BrAppOptionManager* oM = BrAppOptionManager::Instance();
    2  oM->SetCommandLine(argc, argv); 
    3  oM->SetVersion(0,1,"Hello");
    4  oM->SetHelp("World");
    5  ... Add options 
    6  if (!oM->ProcessCommandLine()) 
    7    return 1;
    
    You might, say "Oh, that's 4 more lines then before!" but, the point
    is that you can move the first two line into TestMainModule, and have
    a copy of line 1 along with lines 3 to 7 in a configuration script
    like Config.C!!! Now that is neat isn't it. 
    
    I thought I should give you some time to react, since I believe a
    whole bunch of you is using the option manager, so I will not update
    the changes until mid-next week, conditional on no serious objections 
    ofcourse.  
    
    Yours, 
    
    Christian  -----------------------------------------------------------
    Holm Christensen                             Phone:  (+45) 35 35 96 91 
      Sankt Hansgade 23, 1. th.                  Office: (+45) 353  25 305 
      DK-2200 Copenhagen N                       Web:    www.nbi.dk/~cholm    
      Denmark                                    Email:       cholm@nbi.dk
    



    This archive was generated by hypermail 2b29 : Fri Mar 02 2001 - 10:17:35 EST