Line data Source code
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 AliHLTPluginBase.cxx
20 : @author Matthias Richter
21 : @date
22 : @brief Base class for AliRoot HLT plugins.
23 : */
24 :
25 : #include "AliHLTPluginBase.h"
26 : #include "AliHLTSystem.h"
27 : #include "AliHLTDataBuffer.h"
28 : #include "TSystem.h"
29 :
30 : /** ROOT macro for the implementation of ROOT specific class methods */
31 126 : ClassImp(AliHLTPluginBase)
32 :
33 : AliHLTPluginBase::AliHLTPluginBase()
34 12 : {
35 : // see header file for class documentation
36 : // or
37 : // refer to README to build package
38 : // or
39 : // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
40 3 : fNofInstances++;
41 6 : }
42 :
43 : AliHLTPluginBase::~AliHLTPluginBase()
44 18 : {
45 : // see header file for class documentation
46 3 : if (--fNofInstances<=0) {
47 6 : delete fpSystem;
48 3 : fpSystem=NULL;
49 :
50 : // 2010-04-07 not sure whether this is the best place for
51 : // the global cleanup of memory pages. In case of AliReconstruction
52 : // there is no cleanup method for the reconstructor plugins. They
53 : // are just deleted at the end.
54 : // However, here we can assume that some global cleanup takes place
55 : // when we arrive at this point.
56 3 : AliHLTDataBuffer::AliHLTRawPage::GlobalClean();
57 : }
58 9 : }
59 :
60 : void AliHLTPluginBase::InitInstance()
61 : {
62 : // see header file for class documentation
63 6 : if (fNofInstances == 0)
64 : {
65 0 : gSystem->Load("libHLTbase");
66 0 : gSystem->Load("libHLTrec");
67 0 : }
68 9 : if (!fpSystem) fpSystem=new AliHLTSystem;
69 3 : }
70 :
71 : AliHLTSystem* AliHLTPluginBase::GetInstance()
72 : {
73 : // see header file for class documentation
74 65 : if (!fpSystem) InitInstance();
75 31 : return fpSystem;
76 : }
77 :
78 :
79 : AliHLTSystem* AliHLTPluginBase::fpSystem=NULL;
80 :
81 : int AliHLTPluginBase::fNofInstances=0;
|