3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
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 **************************************************************************/
19 /** @file AliHLTModuleAgent.cxx
20 @author Matthias Richter
22 @brief Agent helper class for component libraries.
23 @note The class is used in Offline (AliRoot) context
26 #include "AliHLTModuleAgent.h"
27 #include "AliHLTOUTHandler.h"
29 /** ROOT macro for the implementation of ROOT specific class methods */
30 ClassImp(AliHLTModuleAgent)
32 AliHLTModuleAgent::AliHLTModuleAgent(const char* id)
35 fpComponentHandler(NULL),
38 // see header file for class documentation
40 // refer to README to build package
42 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
46 AliHLTModuleAgent::~AliHLTModuleAgent()
48 // see header file for function documentation
52 const char* AliHLTModuleAgent::GetModuleId() const
54 // see header file for function documentation
55 return fModuleId.Data();
58 void AliHLTModuleAgent::PrintStatus(const char* agent)
60 // see header file for function documentation
63 AliHLTModuleAgent* pCurrent=fAnchor;
64 while (pCurrent!=NULL && strcmp(pCurrent->GetName(), agent)!=0) pCurrent=pCurrent->fpNext;
66 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
67 "agent %s available", pCurrent->GetName());
69 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
70 "agent %s not found", agent);
73 AliHLTModuleAgent* pCurrent=fAnchor;
74 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
75 log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents");
77 log.Logging(kHLTLogInfo, "AliHLT", "", " none");
80 msg.Form(" %s : %p", pCurrent->GetName(), pCurrent);
81 log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data());
82 pCurrent=pCurrent->fpNext;
84 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
88 int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
89 AliRawReader* /*rawReader*/,
90 AliRunLoader* /*runloader*/) const
92 // default method, nothing to be done, child classes can overload
96 const char* AliHLTModuleAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
97 AliRunLoader* /*runloader*/) const
99 // default method, nothing to be done, child classes can overload
103 const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
105 // default method, nothing to be done, child classes can overload
109 int AliHLTModuleAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
110 AliHLTUInt32_t /*spec*/,
111 AliHLTOUTHandlerDesc& /*desc*/) const
113 // default method, nothing to be done, child classes can overload
117 AliHLTOUTHandler* AliHLTModuleAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/,
118 AliHLTUInt32_t /*spec*/)
120 // default method, nothing to be done, child classes can overload
124 int AliHLTModuleAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
126 // default method, simply deletes object
127 if (pInstance) return -EINVAL;
133 // likely to be moved to AliHLTOUTHandler
134 // AliRawStream* AliHLTModuleAgent::GetRawStream(AliHLTComponentDataType /*dt*/,
135 // AliHLTUInt32_t /*spec*/,
136 // const AliHLTOUT* /*pData*/) const
138 // // default method, nothing to be done, child classes can overload
142 int AliHLTModuleAgent::ActivateComponentHandler(AliHLTComponentHandler* pHandler)
145 if (pHandler==NULL) {
146 if (fpComponentHandler!=NULL) {
147 // reset and think about deregistration
148 fpComponentHandler=NULL;
149 HLTWarning("deregistration of components not yet implemented");
153 if (fpComponentHandler!=NULL) {
154 if (pHandler!=fpComponentHandler) {
155 HLTError("only one component handler can be activated per agent");
160 if ((iResult=RegisterComponents(pHandler))>=0) {
161 fpComponentHandler=pHandler;
166 int AliHLTModuleAgent::RegisterComponents(AliHLTComponentHandler* /*pHandler*/) const
168 // default method, nothing to be done, child classes can overload
172 AliHLTModulePreprocessor* AliHLTModuleAgent::GetPreprocessor()
174 // default method, nothing to be done, child classes can overload
178 AliHLTModuleAgent* AliHLTModuleAgent::fAnchor=NULL;
179 AliHLTModuleAgent* AliHLTModuleAgent::fCurrent=NULL;
180 int AliHLTModuleAgent::fCount=0;
182 AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
184 // see header file for function documentation
189 AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
191 // see header file for function documentation
192 if (fCurrent!=NULL) fCurrent=fCurrent->fpNext;
196 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
198 // see header file for function documentation
200 if (!pAgent) return -EINVAL;
204 pAgent->fpNext=fAnchor;
207 // log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
212 int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
214 // see header file for function documentation
216 if (!pAgent) return -EINVAL;
218 AliHLTModuleAgent* prev=NULL;
219 AliHLTModuleAgent* handler=fAnchor;
220 while (handler!=NULL && handler!=pAgent) {
222 handler=handler->fpNext;
226 fAnchor=handler->fpNext;
228 prev->fpNext=handler->fpNext;
230 //log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %p removed", pAgent);