]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTModuleAgent.cxx
aliroot integration
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModuleAgent.cxx
1 // @(#) $Id$
2
3 /**************************************************************************
4  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  *                                                                        *
6  * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
7  *          for The ALICE Off-line Project.                               *
8  *                                                                        *
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  **************************************************************************/
17
18 /** @file   AliHLTModuleAgent.cxx
19     @author Matthias Richter
20     @date   
21     @brief  Agent helper class for component libraries.
22     @note   The class is used in Offline (AliRoot) context
23 */
24
25 #include "AliHLTModuleAgent.h"
26
27 /** ROOT macro for the implementation of ROOT specific class methods */
28 ClassImp(AliHLTModuleAgent)
29
30 AliHLTModuleAgent::AliHLTModuleAgent()
31 {
32   // see header file for class documentation
33   // or
34   // refer to README to build package
35   // or
36   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
37   Register(this);
38 }
39
40 AliHLTModuleAgent::AliHLTModuleAgent(const AliHLTModuleAgent&)
41   :
42   TObject(),
43   AliHLTLogging()
44 {
45   // see header file for function documentation
46 }
47
48 AliHLTModuleAgent& AliHLTModuleAgent::operator=(const AliHLTModuleAgent&)
49 {
50   // see header file for function documentation
51   return *this;
52 }
53
54 TList AliHLTModuleAgent::fgAgentList;
55 TObjLink* AliHLTModuleAgent::fgCurrentLnk=NULL;
56
57 AliHLTModuleAgent::~AliHLTModuleAgent()
58 {
59   // see header file for function documentation
60   Unregister(this);
61 }
62
63 void AliHLTModuleAgent::PrintStatus(const char* agent)
64 {
65   // see header file for function documentation
66   AliHLTLogging log;
67   if (agent) {
68     TObject* pAgent=fgAgentList.FindObject(agent);
69     if (pAgent) {
70       log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
71                   "agent %s available", pAgent->GetName());
72     } else {
73       log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
74                   "agent %s not found", agent);
75     }
76   } else {
77   TObjLink* lnk=fgAgentList.FirstLink();
78   while (lnk) {
79     log.Logging(kHLTLogInfo, "AliHLTModuleAgent::PrintStatus", "module agents", 
80                 ((AliHLTModuleAgent*)lnk->GetObject())->GetName());
81     lnk=lnk->Next();
82   }
83   }
84 }
85
86 int AliHLTModuleAgent::CreateConfigurations(AliHLTConfigurationHandler* handler,
87                                             AliRunLoader* runloader) const
88 {
89   // default method, nothing to be done, child classes can overload
90   if (handler==NULL && runloader==NULL) {
91     // get rid of 'unused parameter' warning
92   }
93   return 0;
94 }
95
96 const char* AliHLTModuleAgent::GetTopConfigurations(AliRunLoader* runloader) const
97 {
98   // default method, nothing to be done, child classes can overload
99   if (runloader==NULL) {
100     // get rid of 'unused parameter' warning
101   }
102   return NULL;
103 }
104
105 const char* AliHLTModuleAgent::GetRequiredComponentLibraries() const
106 {
107   // default method, nothing to be done, child classes can overload
108   return NULL;
109 }
110
111 int AliHLTModuleAgent::RegisterComponents(AliRunLoader* runloader) const
112 {
113   if (runloader==NULL) {
114     // get rid of 'unused parameter' warning
115   }
116   // default method, nothing to be done, child classes can overload
117   return 0;
118 }
119
120 AliHLTModuleAgent* AliHLTModuleAgent::GetFirstAgent()
121 {
122   // see header file for function documentation
123   fgCurrentLnk=fgAgentList.FirstLink();
124   if (fgCurrentLnk==NULL) return NULL;
125   return (AliHLTModuleAgent*)fgCurrentLnk->GetObject();
126 }
127
128 AliHLTModuleAgent* AliHLTModuleAgent::GetNextAgent()
129 {
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();
135 }
136
137 int AliHLTModuleAgent::Register(AliHLTModuleAgent* pAgent)
138 {
139   // see header file for function documentation
140   AliHLTLogging log;
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);
145   }
146   return 0;
147 }
148
149 int AliHLTModuleAgent::Unregister(AliHLTModuleAgent* pAgent)
150 {
151   // see header file for function documentation
152   AliHLTLogging log;
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);
157   } else {
158   }
159   return 0;
160 }