]>
Commit | Line | Data |
---|---|---|
242bb794 | 1 | // @(#) $Id$ |
2 | ||
3 | /************************************************************************** | |
9be2600f | 4 | * This file is property of and copyright by the ALICE HLT Project * |
5 | * ALICE Experiment at CERN, All rights reserved. * | |
242bb794 | 6 | * * |
9be2600f | 7 | * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * |
8 | * for The ALICE HLT Project. * | |
242bb794 | 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 AliHLTModuleAgent.cxx | |
20 | @author Matthias Richter | |
21 | @date | |
22 | @brief Agent helper class for component libraries. | |
23 | @note The class is used in Offline (AliRoot) context | |
24 | */ | |
25 | ||
26 | #include "AliHLTModuleAgent.h" | |
27 | ||
28 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
29 | ClassImp(AliHLTModuleAgent) | |
30 | ||
31 | AliHLTModuleAgent::AliHLTModuleAgent() | |
79c114b5 | 32 | : |
33 | fpNext(NULL) | |
242bb794 | 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 | Register(this); | |
41 | } | |
42 | ||
43 | AliHLTModuleAgent::AliHLTModuleAgent(const AliHLTModuleAgent&) | |
44 | : | |
45 | TObject(), | |
79c114b5 | 46 | AliHLTLogging(), |
47 | fpNext(NULL) | |
242bb794 | 48 | { |
49 | // see header file for function documentation | |
50 | } | |
51 | ||
52 | AliHLTModuleAgent& AliHLTModuleAgent::operator=(const AliHLTModuleAgent&) | |
53 | { | |
54 | // see header file for function documentation | |
55 | return *this; | |
56 | } | |
57 | ||
242bb794 | 58 | AliHLTModuleAgent::~AliHLTModuleAgent() |
59 | { | |
60 | // see header file for function documentation | |
61 | Unregister(this); | |
62 | } | |
63 | ||
64 | void AliHLTModuleAgent::PrintStatus(const char* agent) | |
65 | { | |
66 | // see header file for function documentation | |
67 | AliHLTLogging log; | |
7617ca1e | 68 | if (agent) { |
69 | AliHLTModuleAgent* pCurrent=fAnchor; | |
70 | while (pCurrent!=NULL && strcmp(pCurrent->GetName(), agent)!=0) pCurrent=pCurrent->fpNext; | |
71 | if (pCurrent) { | |
72 | log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", | |
73 | "agent %s available", pCurrent->GetName()); | |
74 | } else { | |
75 | log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", | |
76 | "agent %s not found", agent); | |
77 | } | |
242bb794 | 78 | } else { |
7617ca1e | 79 | AliHLTModuleAgent* pCurrent=fAnchor; |
80 | log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------"); | |
81 | log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents"); | |
82 | if (pCurrent==NULL) | |
83 | log.Logging(kHLTLogInfo, "AliHLT", "", " none"); | |
84 | while (pCurrent) { | |
85 | TString msg; | |
86 | msg.Form(" %s : %p", pCurrent->GetName(), pCurrent); | |
87 | log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data()); | |
88 | pCurrent=pCurrent->fpNext; | |
89 | } | |
90 | log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------"); | |
242bb794 | 91 | } |
92 | } | |
93 | ||
04a939f7 | 94 | int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/, |
95 | AliRunLoader* /*runloader*/) const | |
242bb794 | 96 | { |
97 | // default method, nothing to be done, child classes can overload | |
242bb794 | 98 | return 0; |
99 | } | |
100 | ||
04a939f7 | 101 | const char* AliHLTModuleAgent::GetLocalRecConfigurations(AliRunLoader* /*runloader*/) const |
90ebac25 | 102 | { |
103 | // default method, nothing to be done, child classes can overload | |
90ebac25 | 104 | return NULL; |
105 | } | |
106 | ||
04a939f7 | 107 | const char* AliHLTModuleAgent::GetEventRecConfigurations(AliRunLoader* /*runloader*/) const |
242bb794 | 108 | { |
109 | // default method, nothing to be done, child classes can overload | |
242bb794 | 110 | return NULL; |
111 | } | |
112 | ||
113 | const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const | |
114 | { | |
115 | // default method, nothing to be done, child classes can overload | |
116 | return NULL; | |
117 | } | |
118 | ||
04a939f7 | 119 | int AliHLTModuleAgent::RegisterComponents(AliRunLoader* /*runloader*/) const |
242bb794 | 120 | { |
242bb794 | 121 | // default method, nothing to be done, child classes can overload |
122 | return 0; | |
123 | } | |
124 | ||
7617ca1e | 125 | AliHLTModuleAgent* AliHLTModuleAgent::fAnchor=NULL; |
126 | AliHLTModuleAgent* AliHLTModuleAgent::fCurrent=NULL; | |
127 | int AliHLTModuleAgent::fCount=0; | |
128 | ||
242bb794 | 129 | AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent() |
130 | { | |
131 | // see header file for function documentation | |
7617ca1e | 132 | fCurrent=fAnchor; |
133 | return fAnchor; | |
242bb794 | 134 | } |
135 | ||
136 | AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent() | |
137 | { | |
138 | // see header file for function documentation | |
7617ca1e | 139 | if (fCurrent!=NULL) fCurrent=fCurrent->fpNext; |
140 | return fCurrent; | |
242bb794 | 141 | } |
142 | ||
143 | int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent) | |
144 | { | |
145 | // see header file for function documentation | |
146 | AliHLTLogging log; | |
147 | if (!pAgent) return -EINVAL; | |
7617ca1e | 148 | if (fAnchor==NULL) { |
149 | fAnchor=pAgent; | |
150 | } else { | |
151 | pAgent->fpNext=fAnchor; | |
152 | fAnchor=pAgent; | |
242bb794 | 153 | } |
7617ca1e | 154 | // log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent); |
155 | fCount++; | |
156 | return 0; | |
242bb794 | 157 | } |
158 | ||
159 | int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent) | |
160 | { | |
161 | // see header file for function documentation | |
162 | AliHLTLogging log; | |
163 | if (!pAgent) return -EINVAL; | |
7617ca1e | 164 | fCurrent=NULL; |
165 | AliHLTModuleAgent* prev=NULL; | |
166 | AliHLTModuleAgent* handler=fAnchor; | |
167 | while (handler!=NULL && handler!=pAgent) { | |
168 | prev=handler; | |
169 | handler=handler->fpNext; | |
170 | } | |
171 | if (handler) { | |
172 | if (prev==NULL) { | |
173 | fAnchor=handler->fpNext; | |
174 | } else { | |
175 | prev->fpNext=handler->fpNext; | |
176 | } | |
80e562fa | 177 | //log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %p removed", pAgent); |
7617ca1e | 178 | fCount--; |
242bb794 | 179 | } |
180 | return 0; | |
181 | } |