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"
28 /** ROOT macro for the implementation of ROOT specific class methods */
29 ClassImp(AliHLTModuleAgent)
31 AliHLTModuleAgent::AliHLTModuleAgent()
34 fpComponentHandler(NULL)
36 // see header file for class documentation
38 // refer to README to build package
40 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 AliHLTModuleAgent::~AliHLTModuleAgent()
46 // see header file for function documentation
50 void AliHLTModuleAgent::PrintStatus(const char* agent)
52 // see header file for function documentation
55 AliHLTModuleAgent* pCurrent=fAnchor;
56 while (pCurrent!=NULL && strcmp(pCurrent->GetName(), agent)!=0) pCurrent=pCurrent->fpNext;
58 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
59 "agent %s available", pCurrent->GetName());
61 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
62 "agent %s not found", agent);
65 AliHLTModuleAgent* pCurrent=fAnchor;
66 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
67 log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents");
69 log.Logging(kHLTLogInfo, "AliHLT", "", " none");
72 msg.Form(" %s : %p", pCurrent->GetName(), pCurrent);
73 log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data());
74 pCurrent=pCurrent->fpNext;
76 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
80 int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* /*handler*/,
81 AliRawReader* /*rawReader*/,
82 AliRunLoader* /*runloader*/) const
84 // default method, nothing to be done, child classes can overload
88 const char* AliHLTModuleAgent::GetReconstructionChains(AliRawReader* /*rawReader*/,
89 AliRunLoader* /*runloader*/) const
91 // default method, nothing to be done, child classes can overload
95 const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
97 // default method, nothing to be done, child classes can overload
101 int AliHLTModuleAgent::ActivateComponentHandler(AliHLTComponentHandler* pHandler)
104 if (pHandler==NULL) {
105 if (fpComponentHandler!=NULL) {
106 // reset and think about deregistration
107 fpComponentHandler=NULL;
108 HLTWarning("deregistration of components not yet implemented");
112 if (fpComponentHandler!=NULL) {
113 if (pHandler!=fpComponentHandler) {
114 HLTError("only one component handler can be activated per agent");
119 if ((iResult=RegisterComponents(pHandler))>=0) {
120 fpComponentHandler=pHandler;
125 int AliHLTModuleAgent::RegisterComponents(AliHLTComponentHandler* /*pHandler*/) const
127 // default method, nothing to be done, child classes can overload
131 AliHLTModuleAgent* AliHLTModuleAgent::fAnchor=NULL;
132 AliHLTModuleAgent* AliHLTModuleAgent::fCurrent=NULL;
133 int AliHLTModuleAgent::fCount=0;
135 AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
137 // see header file for function documentation
142 AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
144 // see header file for function documentation
145 if (fCurrent!=NULL) fCurrent=fCurrent->fpNext;
149 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
151 // see header file for function documentation
153 if (!pAgent) return -EINVAL;
157 pAgent->fpNext=fAnchor;
160 // log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
165 int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
167 // see header file for function documentation
169 if (!pAgent) return -EINVAL;
171 AliHLTModuleAgent* prev=NULL;
172 AliHLTModuleAgent* handler=fAnchor;
173 while (handler!=NULL && handler!=pAgent) {
175 handler=handler->fpNext;
179 fAnchor=handler->fpNext;
181 prev->fpNext=handler->fpNext;
183 //log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %p removed", pAgent);