Changeset 19760 for trunk/Mars/mfileio


Ignore:
Timestamp:
10/11/19 19:22:02 (5 years ago)
Author:
tbretz
Message:
They are added to the ListOfCleanups. This is implemented as a THashTable. According to the root documentation, it is required to rehash the table whenever the name of an object in the table changes. This is now guranteed if name change happens via SetName
Location:
trunk/Mars/mfileio
Files:
2 edited

Legend:

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

    r17867 r19760  
    6666#include <TTree.h>
    6767#include <TPRegexp.h>
     68#include <THashList.h>
    6869
    6970#include "MLog.h"
     
    324325{
    325326    Close();
     327}
     328
     329void MWriteRootFile::SetName(const char *name)
     330{
     331    MWriteFile::SetName(name);
     332
     333    // From the documentation of THashList::THashList
     334    //
     335    // WARNING !!!
     336    // If the name of an object in the HashList is modified, The hashlist
     337    // must be Rehashed
     338    //
     339    auto table = dynamic_cast<THashList*>(gROOT->GetListOfCleanups());
     340    if (table)
     341        table->Rehash(THashList::kInitHashTableCapacity);
    326342}
    327343
  • trunk/Mars/mfileio/MWriteRootFile.h

    r19722 r19760  
    130130    ~MWriteRootFile();
    131131
     132    void SetName(const char *name);
     133
    132134    void AddContainer(const char *cname,   const char *tname=NULL, Bool_t must=kTRUE, Long64_t max=-1);
    133135    void AddContainer(MParContainer *cont, const char *tname=NULL, Bool_t must=kTRUE, Long64_t max=-1);
Note: See TracChangeset for help on using the changeset viewer.