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()
35 fpComponentHandler(NULL)
37 // see header file for class documentation
39 // refer to README to build package
41 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
45 AliHLTModuleAgent::~AliHLTModuleAgent()
47 // see header file for function documentation
51 void AliHLTModuleAgent::PrintStatus(const char* agent)
53 // see header file for function documentation
56 AliHLTModuleAgent* pCurrent=fAnchor;
57 while (pCurrent!=NULL && strcmp(pCurrent->GetName(), agent)!=0) pCurrent=pCurrent->fpNext;
59 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
60 "agent %s available", pCurrent->GetName());
62 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
63 "agent %s not found", agent);
66 AliHLTModuleAgent* pCurrent=fAnchor;
67 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
68 log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents");
70 log.Logging(kHLTLogInfo, "AliHLT", "", " none");
73 msg.Form(" %s : %p", pCurrent->GetName(), pCurrent);
74 log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data());
75 pCurrent=pCurrent->fpNext;
77 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
81 int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
82 AliRawReader* /*rawReader*/,
83 AliRunLoader* /*runloader*/) const
85 // default method, nothing to be done, child classes can overload
89 const char* AliHLTModuleAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
90 AliRunLoader* /*runloader*/) const
92 // default method, nothing to be done, child classes can overload
96 const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
98 // default method, nothing to be done, child classes can overload
102 int AliHLTModuleAgent::GetHandlerDescription(AliHLTComponentDataType /*dt*/,
103 AliHLTUInt32_t /*spec*/,
104 AliHLTOUTHandlerDesc* /*pDesc*/) const
106 // default method, nothing to be done, child classes can overload
110 AliHLTOUTHandler* AliHLTModuleAgent::GetOutputHandler(AliHLTComponentDataType /*dt*/,
111 AliHLTUInt32_t /*spec*/)
113 // default method, nothing to be done, child classes can overload
117 int AliHLTModuleAgent::DeleteOutputHandler(AliHLTOUTHandler* pInstance)
119 // default method, simply deletes object
120 if (pInstance) return -EINVAL;
126 // likely to be moved to AliHLTOUTHandler
127 // AliRawStream* AliHLTModuleAgent::GetRawStream(AliHLTComponentDataType /*dt*/,
128 // AliHLTUInt32_t /*spec*/,
129 // const AliHLTOUT* /*pData*/) const
131 // // default method, nothing to be done, child classes can overload
135 int AliHLTModuleAgent::ActivateComponentHandler(AliHLTComponentHandler* pHandler)
138 if (pHandler==NULL) {
139 if (fpComponentHandler!=NULL) {
140 // reset and think about deregistration
141 fpComponentHandler=NULL;
142 HLTWarning("deregistration of components not yet implemented");
146 if (fpComponentHandler!=NULL) {
147 if (pHandler!=fpComponentHandler) {
148 HLTError("only one component handler can be activated per agent");
153 if ((iResult=RegisterComponents(pHandler))>=0) {
154 fpComponentHandler=pHandler;
159 int AliHLTModuleAgent::RegisterComponents(AliHLTComponentHandler* /*pHandler*/) const
161 // default method, nothing to be done, child classes can overload
165 AliHLTModuleAgent* AliHLTModuleAgent::fAnchor=NULL;
166 AliHLTModuleAgent* AliHLTModuleAgent::fCurrent=NULL;
167 int AliHLTModuleAgent::fCount=0;
169 AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
171 // see header file for function documentation
176 AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
178 // see header file for function documentation
179 if (fCurrent!=NULL) fCurrent=fCurrent->fpNext;
183 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
185 // see header file for function documentation
187 if (!pAgent) return -EINVAL;
191 pAgent->fpNext=fAnchor;
194 // log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
199 int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
201 // see header file for function documentation
203 if (!pAgent) return -EINVAL;
205 AliHLTModuleAgent* prev=NULL;
206 AliHLTModuleAgent* handler=fAnchor;
207 while (handler!=NULL && handler!=pAgent) {
209 handler=handler->fpNext;
213 fAnchor=handler->fpNext;
215 prev->fpNext=handler->fpNext;
217 //log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %p removed", pAgent);