]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add methods to get access to names of files used in merging. Correct memory leak...
authorjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Jul 2002 13:48:39 +0000 (13:48 +0000)
committerjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Jul 2002 13:48:39 +0000 (13:48 +0000)
STEER/AliStream.cxx
STEER/AliStream.h

index 8fa30c95e502520c71c70f1e262f88c70f8accf0..2f8937816235ad8646d5624a51e88b0ce306aaa8 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.5  2002/04/09 13:38:47  jchudoba
+Add const to the filename argument
+
 Revision 1.4  2001/12/03 07:10:13  jchudoba
 Default ctor cannot create new objects, create dummy default ctor which leaves object in not well defined state - to be used only by root for I/O
 
@@ -77,7 +80,10 @@ AliStream::AliStream(Option_t *option)
 AliStream::~AliStream()
 {
 // default dtor
-  if (fFileNames) delete fFileNames;
+  if (fFileNames) {
+    fFileNames->Delete();
+    delete fFileNames;
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////
@@ -172,3 +178,16 @@ Bool_t AliStream::ImportgAlice()
   if (!gAlice)  return kFALSE;
   return kTRUE;
 }
+////////////////////////////////////////////////////////////////////////
+TString AliStream::GetFileName(const Int_t order) const
+// returns name of the order-th file
+// returns empty string if such file does not exist
+// first file in the input stream is 0
+{
+  TString fileName("");
+  if (order > fFileNames->GetLast()) return fileName;
+  TObjString *fileNameStored = dynamic_cast<TObjString*>(fFileNames->At(order));
+  if (fileNameStored) fileName = fileNameStored->GetString();
+  return fileName;
+}
+////////////////////////////////////////////////////////////////////////
index 32e4bc7e91805571e0e61d5b607302c69c87a1c7..426e9d44fe7ce9ceee126ae338d1751b155dca5a 100644 (file)
@@ -16,6 +16,7 @@
 // --- ROOT system ---
 #include "TNamed.h"
 #include "TObjString.h"
+#include "TString.h"
 #include "TArrayI.h"
 #include "TClonesArray.h"
 #include "TFile.h"
@@ -34,15 +35,17 @@ public:
   Bool_t ImportgAlice();
   TFile* CurrentFile() { return fCurrentFile;}
   void ChangeMode(Option_t* option);     // reset READ or UPDATE mode
+  Int_t GetNInputFiles() const {return fFileNames->GetLast()+1;}          
+  TString GetFileName(const Int_t order) const; 
   
 private:  
   Int_t fLastEventSerialNr;
   Int_t fLastEventNr;
   Int_t fCurrentFileIndex;
   Int_t fEvents;                //! nr. of events in the current file
-  TString fMode;                  // = 0 for READONLY, = 1 for READWRITE
+  TString fMode;                // = 0 for READONLY, = 1 for READWRITE
   TFile *fCurrentFile;          //! pointer to current open file
-  TObjArray * fFileNames;
+  TObjArray * fFileNames;       // storage for TStrings with file names
   
   ClassDef(AliStream,1)
 };