3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * for The ALICE Off-line Project. *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
18 /** @file AliHLTModuleAgent.cxx
19 @author Matthias Richter
21 @brief Agent helper class for component libraries.
22 @note The class is used in Offline (AliRoot) context
25 #include "AliHLTModuleAgent.h"
27 /** ROOT macro for the implementation of ROOT specific class methods */
28 ClassImp(AliHLTModuleAgent)
30 AliHLTModuleAgent::AliHLTModuleAgent()
32 // see header file for class documentation
34 // refer to README to build package
36 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
40 AliHLTModuleAgent::AliHLTModuleAgent(const AliHLTModuleAgent&)
45 // see header file for function documentation
48 AliHLTModuleAgent& AliHLTModuleAgent::operator=(const AliHLTModuleAgent&)
50 // see header file for function documentation
54 TList AliHLTModuleAgent::fgAgentList;
55 TObjLink* AliHLTModuleAgent::fgCurrentLnk=NULL;
57 AliHLTModuleAgent::~AliHLTModuleAgent()
59 // see header file for function documentation
63 void AliHLTModuleAgent::PrintStatus(const char* agent)
65 // see header file for function documentation
68 TObject* pAgent=fgAgentList.FindObject(agent);
70 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
71 "agent %s available", pAgent->GetName());
73 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
74 "agent %s not found", agent);
77 TObjLink* lnk=fgAgentList.FirstLink();
78 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
79 log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents");
81 log.Logging(kHLTLogInfo, "AliHLT", "", " none");
84 msg.Form(" %s : %p", ((AliHLTModuleAgent*)lnk->GetObject())->GetName(), lnk->GetObject());
85 log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data());
88 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
92 int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
93 AliRunLoader* runloader) const
95 // default method, nothing to be done, child classes can overload
96 if (handler==NULL && runloader==NULL) {
97 // get rid of 'unused parameter' warning
102 const char* AliHLTModuleAgent::GetTopConfigurations(AliRunLoader* runloader) const
104 // default method, nothing to be done, child classes can overload
105 if (runloader==NULL) {
106 // get rid of 'unused parameter' warning
111 const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
113 // default method, nothing to be done, child classes can overload
117 int AliHLTModuleAgent::RegisterComponents(AliRunLoader* runloader) const
119 if (runloader==NULL) {
120 // get rid of 'unused parameter' warning
122 // default method, nothing to be done, child classes can overload
126 AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
128 // see header file for function documentation
129 fgCurrentLnk=fgAgentList.FirstLink();
130 if (fgCurrentLnk==NULL) return NULL;
131 return (AliHLTModuleAgent*)fgCurrentLnk->GetObject();
134 AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
136 // see header file for function documentation
137 if (fgCurrentLnk==NULL) return NULL;
138 fgCurrentLnk=fgCurrentLnk->Next();
139 if (fgCurrentLnk==NULL) return NULL;
140 return (AliHLTModuleAgent*)fgCurrentLnk->GetObject();
143 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
145 // see header file for function documentation
147 if (!pAgent) return -EINVAL;
148 if (fgAgentList.FindObject(pAgent)==NULL) {
149 log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
150 fgAgentList.Add(pAgent);
155 int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
157 // see header file for function documentation
159 if (!pAgent) return -EINVAL;
160 if (fgAgentList.FindObject(pAgent)!=NULL) {
161 log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %p removed", pAgent);
162 fgAgentList.Remove(pAgent);