]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTMisc.cxx
Corrected pragma: no need for newObj to access the target data members
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTMisc.cxx
1 // $Id$
2
3 //**************************************************************************
4 //* This file is property of and copyright by the                          * 
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   AliHLTMisc.h
20 /// @author Matthias Richter
21 /// @date   2009-07-07
22 /// @brief  Definition of various glue functions implemented in dynamically
23 ///         loaded libraries
24
25 #include "AliHLTMisc.h"
26
27 /** ROOT macro for the implementation of ROOT specific class methods */
28 ClassImp(AliHLTMisc);
29
30 AliHLTMisc::AliHLTMisc()
31 {
32   // Abstract interface of various glue functions implemented in dynamically
33   // loaded libraries.
34   //
35   // The HLT base library is independent from AliRoot and binds AliRoot
36   // functionality via dynamic libraries. The provided methods can be used
37   // from any module library without introducing additional dependencies.
38 }
39
40 AliHLTMisc::~AliHLTMisc()
41 {
42   // destructor
43 }
44
45 AliHLTMisc* AliHLTMisc::fgInstance=NULL;
46
47 AliHLTMisc& AliHLTMisc::Instance()
48 {
49   // get global instance of the interface implementation
50   if (!fgInstance) {
51     fgInstance=LoadInstance((AliHLTMisc*)NULL, "AliHLTMiscImplementation", ALIHLTMISC_LIBRARY);
52   }
53   if (!fgInstance) {
54     AliHLTLogging log;
55     fgInstance=new AliHLTMisc;
56     log.Logging(kHLTLogError, "AliHLTMisc::Instance", "HLT Analysis", "falling back to default AliHLTMisc instance");
57   }
58   return *fgInstance;
59 }
60
61 int AliHLTMisc::InitCDB(const char* /*cdbpath*/)
62 {
63   // default method, functionality is implemented in the child class
64   return -EFAULT;
65 }
66
67 int AliHLTMisc::SetCDBRunNo(int /*runNo*/)
68 {
69   // default method, functionality is implemented in the child class
70   return -EFAULT;
71 }
72
73 int AliHLTMisc::GetCDBRunNo() const
74 {
75   // default method, functionality is implemented in the child class
76   return -1;
77 }
78
79 AliCDBEntry* AliHLTMisc::LoadOCDBEntry(const char* /*path*/, int /*runNo*/) const
80 {
81   // default method, functionality is implemented in the child class
82   return NULL;
83 }
84
85 TObject* AliHLTMisc::ExtractObject(AliCDBEntry* /*entry*/) const
86 {
87   // default method, functionality is implemented in the child class
88   return NULL;
89 }
90
91 int AliHLTMisc::CheckOCDBEntries(const TMap* const /*pMap*/) const
92 {
93   // default method, functionality is implemented in the child class
94   return -ENOENT;
95 }
96
97 int AliHLTMisc::InitMagneticField() const
98 {
99   // default method, functionality is implemented in the child class
100   return -EFAULT;
101 }
102
103 AliHLTTriggerMask_t AliHLTMisc::GetTriggerMask(AliRawReader* /*rawReader*/) const
104 {
105   // default method, functionality is implemented in the child class
106   return AliHLTTriggerMask_t(0);
107 }
108
109 AliHLTUInt32_t AliHLTMisc::GetTimeStamp(AliRawReader* /*rawReader*/) const
110 {
111   // default method, functionality is implemented in the child class
112   return kMaxUInt;
113 }
114
115 AliHLTUInt32_t AliHLTMisc::GetEventType(AliRawReader* /*rawReader*/) const
116 {
117   // default method, functionality is implemented in the child class
118   return 0;
119 }
120
121 Double_t AliHLTMisc::GetBz()
122 {
123   // default method, functionality is implemented in the child class
124   return 0.0;
125 }
126
127 Double_t AliHLTMisc::GetBz(const Double_t */*r*/)
128 {
129   // default method, functionality is implemented in the child class
130   return 0.0;
131 }
132
133 void AliHLTMisc::GetBxByBz(const Double_t r[3], Double_t b[3])
134 {
135   // default method, functionality is implemented in the child class
136   if (!r || !b) return;
137   return;
138 }
139
140 const TClass* AliHLTMisc::IsAliESDHLTDecision() const
141 {
142   // default method, functionality is implemented in the child class
143   return NULL;
144 }
145
146 int AliHLTMisc::Copy(const AliHLTGlobalTriggerDecision* /*pDecision*/, TObject* /*pESDHLTDecision*/) const
147 {
148   // default method, functionality is implemented in the child class
149   return -EFAULT;
150 }
151
152 int AliHLTMisc::InitStreamerInfos(const char* /*ocdbEntry*/) const
153 {
154   // default method, functionality is implemented in the child class
155   return -EFAULT;
156 }
157
158 int AliHLTMisc::InitStreamerInfos(TObjArray* /*pSchemas*/) const
159 {
160   // default method, functionality is implemented in the child class
161   return -EFAULT;
162 }
163
164 int AliHLTMisc::MergeStreamerInfo(TObjArray* /*tgt*/, const TObjArray* /*src*/, int /*iVerbosity*/) const
165 {
166   // default method, functionality is implemented in the child class
167   return 0;
168 }
169
170 void AliHLTMisc::SetAliESDtrackOnlineModeFlag(bool /*mode*/) const
171 {
172   // default method, functionality is implemented in the child class
173 }
174
175 bool AliHLTMisc::GetAliESDtrackOnlineModeFlag() const
176 {
177   // default method, functionality is implemented in the child class
178   return false;
179 }
180
181 AliHLTMisc::AliOnlineGuard::AliOnlineGuard(bool mode)
182   : fMode(false)
183 {
184   // store the current value and set the flag
185   fMode=AliHLTMisc::Instance().GetAliESDtrackOnlineModeFlag();
186   AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(mode);
187 }
188
189 AliHLTMisc::AliOnlineGuard::~AliOnlineGuard()
190 {
191   // restore old value of the flag
192   AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(fMode);
193 }
194
195 ostream  &operator<<(ostream &out, const AliHLTComponentDataType &dt)
196 {
197   // printout of AliHLTComponentDataType struct
198   char id[kAliHLTComponentDataTypefIDsize+1];
199   strncpy(id, dt.fID, kAliHLTComponentDataTypefIDsize);
200   id[kAliHLTComponentDataTypefIDsize]=0;
201   char origin[kAliHLTComponentDataTypefOriginSize+1];
202   strncpy(origin, dt.fOrigin, kAliHLTComponentDataTypefOriginSize);
203   origin[kAliHLTComponentDataTypefOriginSize]=0;
204   out << "{" << id << ":" << origin << "}";
205   return out;
206 }