if (fgEvolution || fEvolution) {
if (!fInfos) fInfos = new TList();
- fInfos->Add(info);
+ if (fInfos->FindObject(info->GetName())==NULL) {
+ fInfos->Add(info);
+ }
}
}
TBufferFile::IncrementLevel(info);
+ if (!info) return;
if (fgEvolution || fEvolution) {
if (!fInfos) fInfos = new TList();
- fInfos->Add(info);
+
+ // add the streamer info, but only once
+ // this assumes that there is only one version
+ if (fInfos->FindObject(info->GetName())==NULL) {
+ fInfos->Add(info);
+ }
}
}
Int_t buflen;
Int_t hdrlen = 2*sizeof(UInt_t);
- UChar_t *bufcur = (UChar_t*)fBufComp + hdrlen;
- frombuf((char *&)bufcur, &buflen);
+ char *bufcur1 = fBufComp + hdrlen;
+ frombuf(bufcur1, &buflen);
+ UChar_t *bufcur = (UChar_t*)bufcur1;
fBuffer = new char[buflen];
fBufUncompressed = fBuffer;
fBufSize = buflen;
}
return NULL;
}
+
+TObject* AliHLTMessage::Extract(const char* filename, unsigned verbosity)
+{
+ /// Helper function to extract an object from a file containing the streamed object.
+ /// The returned object must be cleaned by the caller
+ if (!filename) return NULL;
+
+ AliHLTLogging log;
+ TString input=filename;
+ input+="?filetype=raw";
+ TFile* pFile=new TFile(input);
+ if (!pFile) return NULL;
+ TObject* pObject=NULL;
+ if (!pFile->IsZombie()) {
+ pFile->Seek(0);
+ TArrayC buffer;
+ buffer.Set(pFile->GetSize());
+ if (pFile->ReadBuffer(buffer.GetArray(), buffer.GetSize())==0) {
+ pObject=Extract(buffer.GetArray(), buffer.GetSize(), verbosity);
+ } else {
+ log.LoggingVarargs(kHLTLogError, "AliHLTMessage", "Extract" , __FILE__ , __LINE__ , "failed reading %d byte(s) from file %s", pFile->GetSize(), filename);
+ }
+ }
+
+ delete pFile;
+ return pObject;
+}