]>
Commit | Line | Data |
---|---|---|
7c4d1228 | 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 AliHLTDAQ.cxx | |
20 | @author Matthias Richter | |
21 | @date 24.10.2008 | |
22 | @brief Virtual Interface to the AliDAQ class. | |
23 | */ | |
24 | ||
25 | #include "AliHLTDAQ.h" | |
26 | #include "AliHLTLogging.h" | |
27 | #include "TClass.h" | |
28 | #include "TSystem.h" | |
29 | ||
30 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
31 | ClassImp(AliHLTDAQ) | |
32 | ||
33 | AliHLTDAQ::AliHLTDAQ() | |
34 | { | |
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 | } | |
41 | ||
42 | AliHLTDAQ* AliHLTDAQ::fgpInstance=NULL; | |
43 | const char* AliHLTDAQ::fgkImplName="AliHLTDAQInterfaceImplementation"; | |
44 | const char* AliHLTDAQ::fgkImplLibrary="libHLTrec.so"; | |
45 | ||
46 | AliHLTDAQ::~AliHLTDAQ() | |
47 | { | |
48 | // see header file for class documentation | |
49 | } | |
50 | ||
84221957 | 51 | Int_t AliHLTDAQ::NumberOfDetectors() |
52 | { | |
53 | // see header file for class documentation | |
54 | if (!fgpInstance) GetInstance(); | |
55 | if (fgpInstance) return fgpInstance->VirtNumberOfDetectors(); | |
56 | return -1; | |
57 | } | |
58 | ||
7c4d1228 | 59 | Int_t AliHLTDAQ::DetectorID(const char *detectorName) |
60 | { | |
61 | // see header file for class documentation | |
62 | if (!fgpInstance) GetInstance(); | |
63 | if (fgpInstance) return fgpInstance->VirtDetectorID(detectorName); | |
64 | return -1; | |
65 | } | |
66 | ||
67 | const char *AliHLTDAQ::DetectorName(Int_t detectorID) | |
68 | { | |
69 | // see header file for class documentation | |
70 | if (!fgpInstance) GetInstance(); | |
71 | if (fgpInstance) return fgpInstance->VirtDetectorName(detectorID); | |
72 | return NULL; | |
73 | } | |
74 | ||
75 | Int_t AliHLTDAQ::DdlIDOffset(const char *detectorName) | |
76 | { | |
77 | // see header file for class documentation | |
78 | if (!fgpInstance) GetInstance(); | |
79 | if (fgpInstance) return fgpInstance->VirtDdlIDOffset(detectorName); | |
80 | return -1; | |
81 | } | |
82 | ||
83 | Int_t AliHLTDAQ::DdlIDOffset(Int_t detectorID) | |
84 | { | |
85 | // see header file for class documentation | |
86 | if (!fgpInstance) GetInstance(); | |
87 | if (fgpInstance) return fgpInstance->VirtDdlIDOffset(detectorID); | |
88 | return -1; | |
89 | } | |
90 | ||
91 | const char *AliHLTDAQ::DetectorNameFromDdlID(Int_t ddlID, Int_t &ddlIndex) | |
92 | { | |
93 | // see header file for class documentation | |
94 | if (!fgpInstance) GetInstance(); | |
95 | if (fgpInstance) return fgpInstance->VirtDetectorNameFromDdlID(ddlID, ddlIndex); | |
96 | return NULL; | |
97 | } | |
98 | ||
99 | Int_t AliHLTDAQ::DetectorIDFromDdlID(Int_t ddlID, Int_t &ddlIndex) | |
100 | { | |
101 | // see header file for class documentation | |
102 | if (!fgpInstance) GetInstance(); | |
103 | if (fgpInstance) return fgpInstance->VirtDetectorIDFromDdlID(ddlID, ddlIndex); | |
104 | return -1; | |
105 | } | |
106 | ||
107 | Int_t AliHLTDAQ::DdlID(const char *detectorName, Int_t ddlIndex) | |
108 | { | |
109 | // see header file for class documentation | |
110 | if (!fgpInstance) GetInstance(); | |
111 | if (fgpInstance) return fgpInstance->VirtDdlID(detectorName, ddlIndex); | |
112 | return -1; | |
113 | } | |
114 | ||
115 | Int_t AliHLTDAQ::DdlID(Int_t detectorID, Int_t ddlIndex) | |
116 | { | |
117 | // see header file for class documentation | |
118 | if (!fgpInstance) GetInstance(); | |
119 | if (fgpInstance) return fgpInstance->VirtDdlID(detectorID, ddlIndex); | |
120 | return -1; | |
121 | } | |
122 | ||
123 | const char *AliHLTDAQ::DdlFileName(const char *detectorName, Int_t ddlIndex) | |
124 | { | |
125 | // see header file for class documentation | |
126 | if (!fgpInstance) GetInstance(); | |
127 | if (fgpInstance) return fgpInstance->VirtDdlFileName(detectorName, ddlIndex); | |
128 | return NULL; | |
129 | } | |
130 | ||
131 | const char *AliHLTDAQ::DdlFileName(Int_t detectorID, Int_t ddlIndex) | |
132 | { | |
133 | // see header file for class documentation | |
134 | if (!fgpInstance) GetInstance(); | |
135 | if (fgpInstance) return fgpInstance->VirtDdlFileName(detectorID, ddlIndex); | |
136 | return NULL; | |
137 | } | |
138 | ||
139 | Int_t AliHLTDAQ::NumberOfDdls(const char *detectorName) | |
140 | { | |
141 | // see header file for class documentation | |
142 | if (!fgpInstance) GetInstance(); | |
143 | if (fgpInstance) return fgpInstance->VirtNumberOfDdls(detectorName); | |
144 | return -1; | |
145 | } | |
146 | ||
147 | Int_t AliHLTDAQ::NumberOfDdls(Int_t detectorID) | |
148 | { | |
149 | // see header file for class documentation | |
150 | if (!fgpInstance) GetInstance(); | |
151 | if (fgpInstance) return fgpInstance->VirtNumberOfDdls(detectorID); | |
152 | return -1; | |
153 | } | |
154 | ||
84221957 | 155 | const char *AliHLTDAQ::ListOfTriggeredDetectors(UInt_t detectorPattern) |
156 | { | |
157 | // see header file for class documentation | |
158 | if (!fgpInstance) GetInstance(); | |
159 | if (fgpInstance) return fgpInstance->VirtListOfTriggeredDetectors(detectorPattern); | |
160 | return NULL; | |
161 | } | |
162 | ||
163 | UInt_t AliHLTDAQ::DetectorPattern(const char *detectorList) | |
164 | { | |
165 | // see header file for class documentation | |
166 | if (!fgpInstance) GetInstance(); | |
167 | if (fgpInstance) return fgpInstance->VirtDetectorPattern(detectorList); | |
168 | return 0; | |
169 | } | |
170 | ||
171 | const char *AliHLTDAQ::OfflineModuleName(const char *detectorName) | |
172 | { | |
173 | // see header file for class documentation | |
174 | if (!fgpInstance) GetInstance(); | |
175 | if (fgpInstance) return fgpInstance->VirtOfflineModuleName(detectorName); | |
176 | return NULL; | |
177 | } | |
178 | const char *AliHLTDAQ::OfflineModuleName(Int_t detectorID) | |
179 | { | |
180 | // see header file for class documentation | |
181 | if (!fgpInstance) GetInstance(); | |
182 | if (fgpInstance) return fgpInstance->VirtOfflineModuleName(detectorID); | |
183 | return NULL; | |
184 | } | |
185 | ||
186 | const char *AliHLTDAQ::OnlineName(const char *detectorName) | |
187 | { | |
188 | // see header file for class documentation | |
189 | if (!fgpInstance) GetInstance(); | |
190 | if (fgpInstance) return fgpInstance->VirtOnlineName(detectorName); | |
191 | return NULL; | |
192 | } | |
193 | const char *AliHLTDAQ::OnlineName(Int_t detectorID) | |
194 | { | |
195 | // see header file for class documentation | |
196 | if (!fgpInstance) GetInstance(); | |
197 | if (fgpInstance) return fgpInstance->VirtOnlineName(detectorID); | |
198 | return NULL; | |
199 | } | |
200 | ||
7c4d1228 | 201 | AliHLTDAQ* AliHLTDAQ::GetInstance() |
202 | { | |
203 | // see header file for class documentation | |
204 | int iLibResult=0; | |
205 | if (!fgpInstance) { | |
206 | AliHLTLogging log; | |
207 | TClass* pCl=NULL; | |
208 | ROOT::NewFunc_t pNewFunc=NULL; | |
209 | do { | |
210 | pCl=TClass::GetClass(fgkImplName); | |
211 | } while (!pCl && (iLibResult=gSystem->Load(fgkImplLibrary))==0); | |
212 | if (iLibResult>=0) { | |
213 | if (pCl && (pNewFunc=pCl->GetNew())!=NULL) { | |
214 | void* p=(*pNewFunc)(NULL); | |
215 | if (p) { | |
216 | fgpInstance=reinterpret_cast<AliHLTDAQ*>(p); | |
217 | if (!fgpInstance) { | |
218 | log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "type cast to AliHLTDAQ instance failed"); | |
219 | } | |
220 | } else { | |
221 | log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not create AliHLTDAQ instance from class descriptor"); | |
222 | } | |
223 | } else { | |
224 | log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not find AliHLTDAQ class descriptor"); | |
225 | } | |
226 | } else { | |
227 | log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not load libHLTrec library"); | |
228 | } | |
229 | } | |
230 | return fgpInstance; | |
231 | } |