]>
Commit | Line | Data |
---|---|---|
f1207f29 | 1 | // $Id$ |
2 | ||
3 | //************************************************************************** | |
4 | //* This file is property of and copyright by the ALICE HLT Project * | |
5 | //* ALICE Experiment at CERN, All rights reserved. * | |
6 | //* * | |
7 | //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
8 | //* for The ALICE HLT Project. * | |
9 | //* * | |
10 | //* Permission to use, copy, modify and distribute this software and its * | |
11 | //* documentation strictly for non-commercial purposes is hereby granted * | |
12 | //* without fee, provided that the above copyright notice appears in all * | |
13 | //* copies and that both the copyright notice and this permission notice * | |
14 | //* appear in the supporting documentation. The authors make no claims * | |
15 | //* about the suitability of this software for any purpose. It is * | |
16 | //* provided "as is" without express or implied warranty. * | |
17 | //************************************************************************** | |
18 | ||
19 | /** @file AliHLTEsdManager.cxx | |
20 | @author Matthias Richter | |
21 | @date | |
22 | @brief Manager for merging and writing of HLT ESDs | |
23 | */ | |
24 | ||
25 | #include "AliHLTEsdManager.h" | |
26 | #include "TSystem.h" | |
27 | #include "TClass.h" | |
28 | #include "TROOT.h" | |
29 | ||
30 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
31 | ClassImp(AliHLTEsdManager) | |
32 | ||
33 | AliHLTEsdManager::AliHLTEsdManager() | |
34 | : | |
35 | AliHLTLogging() | |
36 | { | |
37 | // see header file for class documentation | |
38 | // or | |
39 | // refer to README to build package | |
40 | // or | |
41 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
42 | } | |
43 | ||
44 | AliHLTEsdManager::~AliHLTEsdManager() | |
45 | { | |
46 | // see header file for class documentation | |
47 | } | |
48 | ||
49 | const char* AliHLTEsdManager::fgkImplName="AliHLTEsdManagerImplementation"; | |
50 | const char* AliHLTEsdManager::fgkImplLibrary="libHLTrec.so"; | |
51 | ||
52 | ||
53 | AliHLTEsdManager* AliHLTEsdManager::New() | |
54 | { | |
55 | // see header file for class documentation | |
56 | int iLibResult=0; | |
57 | AliHLTEsdManager* instance=NULL; | |
58 | AliHLTLogging log; | |
59 | TClass* pCl=NULL; | |
60 | ROOT::NewFunc_t pNewFunc=NULL; | |
61 | do { | |
62 | pCl=TClass::GetClass(fgkImplName); | |
63 | } while (!pCl && (iLibResult=gSystem->Load(fgkImplLibrary))==0); | |
64 | if (iLibResult>=0) { | |
65 | if (pCl && (pNewFunc=pCl->GetNew())!=NULL) { | |
66 | void* p=(*pNewFunc)(NULL); | |
67 | if (p) { | |
68 | instance=reinterpret_cast<AliHLTEsdManager*>(p); | |
69 | if (!instance) { | |
70 | log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "type cast to AliHLTEsdManager instance failed"); | |
71 | } | |
72 | } else { | |
73 | log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "can not create AliHLTEsdManager instance from class descriptor"); | |
74 | } | |
f1207f29 | 75 | } else { |
76 | log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "can not find AliHLTEsdManager class descriptor"); | |
77 | } | |
78 | } else { | |
79 | log.Logging(kHLTLogError, "AliHLTEsdManager::New", "ESD handling", "can not load libHLTrec library"); | |
80 | } | |
81 | return instance; | |
82 | } | |
83 | ||
84 | void AliHLTEsdManager::Delete(AliHLTEsdManager* instance) | |
85 | { | |
86 | // see header file for class documentation | |
87 | if (!instance) return; | |
88 | ||
89 | // check if the library is still there in order to have the | |
90 | // destructor available | |
acc2e692 | 91 | TClass* pCl=TClass::GetClass(fgkImplName); |
92 | if (!pCl) { | |
93 | AliHLTLogging log; | |
94 | log.Logging(kHLTLogError, "AliHLTEsdManager::Delete", "ESD handling", "potential memory leak: libHLTrec library not available, skipping destruction %p", instance); | |
95 | return; | |
96 | } | |
f1207f29 | 97 | |
98 | delete instance; | |
99 | } |