Ignore:
Timestamp:
02/12/09 20:07:51 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mfileio
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r9318 r9328  
    192192//
    193193// comp:        Compression Level (see TFile, TBranch)
    194 // rule:        Rule to create output file name (see GetNewFileName())
     194// rule:        Rule to create output file name (see SubstituteName())
    195195// overwrite:   Allow newly created file to overwrite old files ("RECREATE")
    196196// ftitle:      File title stored in the file (see TFile)
     
    849849//   "s/source/destination/"
    850850//
    851 // For more details on regular expression see a proper documentation.
     851// For more details on regular expression see a proper documentation,
     852// for example, "man 7 regex" if installed, or TPRegexp.
    852853//
    853854// Here is an example:
     
    862863// your set in your program it must look \\/.
    863864//
    864 TString MWriteRootFile::GetNewFileName(const char *inname) const
     865// Note, that this function has been made static to allow your to
     866// test your split rules, i.e. regular expressions.
     867//
     868TString MWriteRootFile::SubstituteName(const char *regexp, TString fname)
    865869{
    866870    // Remove the path from the filename
    867     TString fname(inname);
    868871    if (fname.Last('/')>=0)
    869872        fname.Remove(0, fname.Last('/')+1);
     
    873876
    874877    // Do splitting
    875     TObjArray *subStrL = TPRegexp(sed).MatchS(fSplitRule);
     878    TObjArray *subStrL = TPRegexp(sed).MatchS(regexp);
    876879    if (subStrL->GetEntries()!=6)
    877880    {
    878         *fLog << err << "ERROR - GetNewFileName: Evaluating split rule " << fSplitRule << " failed." << endl;
     881        gLog << err << "ERROR - SubstituteName: Evaluating regexp " << regexp << " failed." << endl;
    879882        subStrL->Print();
    880883        delete subStrL;
     
    10451048
    10461049    const TString oldname = read->GetFullFileName();
    1047     const TString newname = GetNewFileName(oldname);
     1050    const TString newname = SubstituteName(fSplitRule, oldname);
    10481051    if (!ChangeFile(newname))
    10491052        return kFALSE;
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h

    r8933 r9328  
    9494    // File handling
    9595    void    Close();
    96     TString GetNewFileName(const char *inname) const;
    9796    Bool_t  ChangeFile(const char *fname);
    9897    TFile  *OpenFile(const char *name, Option_t *option, const char *title, Int_t comp);
     
    145144    void RecursiveRemove(TObject *obj);
    146145
     146    static TString SubstituteName(const char *regexp, TString fname);
     147
    147148    ClassDef(MWriteRootFile, 1) // Task to write data into a root file
    148149};
Note: See TracChangeset for help on using the changeset viewer.