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();
79 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
80 ((AliHLTModuleAgent*)lnk->GetObject())->GetName());
86 int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
87 AliRunLoader* runloader) const
89 // default method, nothing to be done, child classes can overload
90 if (handler==NULL && runloader==NULL) {
91 // get rid of 'unused parameter' warning
96 const char* AliHLTModuleAgent::GetTopConfigurations(AliRunLoader* runloader) const
98 // default method, nothing to be done, child classes can overload
99 if (runloader==NULL) {
100 // get rid of 'unused parameter' warning
105 const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
107 // default method, nothing to be done, child classes can overload
111 int AliHLTModuleAgent::RegisterComponents(AliRunLoader* runloader) const
113 if (runloader==NULL) {
114 // get rid of 'unused parameter' warning
116 // default method, nothing to be done, child classes can overload
120 AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
122 // see header file for function documentation
123 fgCurrentLnk=fgAgentList.FirstLink();
124 if (fgCurrentLnk==NULL) return NULL;
125 return (AliHLTModuleAgent*)fgCurrentLnk->GetObject();
128 AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
130 // see header file for function documentation
131 if (fgCurrentLnk==NULL) return NULL;
132 fgCurrentLnk=fgCurrentLnk->Next();
133 if (fgCurrentLnk==NULL) return NULL;
134 return (AliHLTModuleAgent*)fgCurrentLnk->GetObject();
137 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
139 // see header file for function documentation
141 if (!pAgent) return -EINVAL;
142 if (fgAgentList.FindObject(pAgent)==NULL) {
143 log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
144 fgAgentList.Add(pAgent);
149 int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
151 // see header file for function documentation
153 if (!pAgent) return -EINVAL;
154 if (fgAgentList.FindObject(pAgent)!=NULL) {
155 log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %s (%p) unregistered", pAgent->GetName(), pAgent);
156 fgAgentList.Remove(pAgent);