]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTModuleAgent.cxx
documentation
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModuleAgent.cxx
CommitLineData
242bb794 1// @(#) $Id$
2
3/**************************************************************************
9be2600f 4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
242bb794 6 * *
9be2600f 7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
242bb794 9 * *
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 **************************************************************************/
18
19/** @file AliHLTModuleAgent.cxx
20 @author Matthias Richter
21 @date
22 @brief Agent helper class for component libraries.
23 @note The class is used in Offline (AliRoot) context
24*/
25
26#include "AliHLTModuleAgent.h"
27
28/** ROOT macro for the implementation of ROOT specific class methods */
29ClassImp(AliHLTModuleAgent)
30
31AliHLTModuleAgent::AliHLTModuleAgent()
32{
33 // see header file for class documentation
34 // or
35 // refer to README to build package
36 // or
37 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
38 Register(this);
39}
40
41AliHLTModuleAgent::AliHLTModuleAgent(const AliHLTModuleAgent&)
42 :
43 TObject(),
44 AliHLTLogging()
45{
46 // see header file for function documentation
47}
48
49AliHLTModuleAgent& AliHLTModuleAgent::operator=(const AliHLTModuleAgent&)
50{
51 // see header file for function documentation
52 return *this;
53}
54
242bb794 55AliHLTModuleAgent::~AliHLTModuleAgent()
56{
57 // see header file for function documentation
58 Unregister(this);
59}
60
61void AliHLTModuleAgent::PrintStatus(const char* agent)
62{
63 // see header file for function documentation
64 AliHLTLogging log;
7617ca1e 65 if (agent) {
66 AliHLTModuleAgent* pCurrent=fAnchor;
67 while (pCurrent!=NULL && strcmp(pCurrent->GetName(), agent)!=0) pCurrent=pCurrent->fpNext;
68 if (pCurrent) {
69 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
70 "agent %s available", pCurrent->GetName());
71 } else {
72 log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents",
73 "agent %s not found", agent);
74 }
242bb794 75 } else {
7617ca1e 76 AliHLTModuleAgent* pCurrent=fAnchor;
77 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
78 log.Logging(kHLTLogInfo, "AliHLT", "", "available module agents");
79 if (pCurrent==NULL)
80 log.Logging(kHLTLogInfo, "AliHLT", "", " none");
81 while (pCurrent) {
82 TString msg;
83 msg.Form(" %s : %p", pCurrent->GetName(), pCurrent);
84 log.Logging(kHLTLogInfo, "AliHLT", "", msg.Data());
85 pCurrent=pCurrent->fpNext;
86 }
87 log.Logging(kHLTLogInfo, "AliHLT", "", "-----------------------");
242bb794 88 }
89}
90
91int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
92 AliRunLoader* runloader) const
93{
94 // default method, nothing to be done, child classes can overload
95 if (handler==NULL && runloader==NULL) {
96 // get rid of 'unused parameter' warning
97 }
98 return 0;
99}
100
90ebac25 101const char* AliHLTModuleAgent::GetLocalRecConfigurations(AliRunLoader* runloader) const
102{
103 // default method, nothing to be done, child classes can overload
104 if (runloader==NULL) {
105 // get rid of 'unused parameter' warning
106 }
107 return NULL;
108}
109
110const char* AliHLTModuleAgent::GetEventRecConfigurations(AliRunLoader* runloader) const
242bb794 111{
112 // default method, nothing to be done, child classes can overload
113 if (runloader==NULL) {
114 // get rid of 'unused parameter' warning
115 }
116 return NULL;
117}
118
119const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
120{
121 // default method, nothing to be done, child classes can overload
122 return NULL;
123}
124
125int AliHLTModuleAgent::RegisterComponents(AliRunLoader* runloader) const
126{
127 if (runloader==NULL) {
128 // get rid of 'unused parameter' warning
129 }
130 // default method, nothing to be done, child classes can overload
131 return 0;
132}
133
7617ca1e 134AliHLTModuleAgent* AliHLTModuleAgent::fAnchor=NULL;
135AliHLTModuleAgent* AliHLTModuleAgent::fCurrent=NULL;
136int AliHLTModuleAgent::fCount=0;
137
242bb794 138AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
139{
140 // see header file for function documentation
7617ca1e 141 fCurrent=fAnchor;
142 return fAnchor;
242bb794 143}
144
145AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
146{
147 // see header file for function documentation
7617ca1e 148 if (fCurrent!=NULL) fCurrent=fCurrent->fpNext;
149 return fCurrent;
242bb794 150}
151
152int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
153{
154 // see header file for function documentation
155 AliHLTLogging log;
156 if (!pAgent) return -EINVAL;
7617ca1e 157 if (fAnchor==NULL) {
158 fAnchor=pAgent;
159 } else {
160 pAgent->fpNext=fAnchor;
161 fAnchor=pAgent;
242bb794 162 }
7617ca1e 163 // log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Register", "", "module agent %p registered", pAgent);
164 fCount++;
165 return 0;
242bb794 166}
167
168int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
169{
170 // see header file for function documentation
171 AliHLTLogging log;
172 if (!pAgent) return -EINVAL;
7617ca1e 173 fCurrent=NULL;
174 AliHLTModuleAgent* prev=NULL;
175 AliHLTModuleAgent* handler=fAnchor;
176 while (handler!=NULL && handler!=pAgent) {
177 prev=handler;
178 handler=handler->fpNext;
179 }
180 if (handler) {
181 if (prev==NULL) {
182 fAnchor=handler->fpNext;
183 } else {
184 prev->fpNext=handler->fpNext;
185 }
80e562fa 186 //log.Logging(kHLTLogDebug, "AliHLTModuleAgent::Unregister", "", "module agent %p removed", pAgent);
7617ca1e 187 fCount--;
242bb794 188 }
189 return 0;
190}