2 // splitted from AliHLTConfiguration.cxx,v 1.25 2007/10/12 13:24:47
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 AliHLTConfigurationHandler.cxx
20 @author Matthias Richter
22 @brief Implementation of HLT tasks.
25 // see header file for class documentation
27 // refer to README to build package
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
38 #include "AliHLTConfigurationHandler.h"
39 #include "AliHLTConfiguration.h"
41 /** ROOT macro for the implementation of ROOT specific class methods */
42 ClassImp(AliHLTConfigurationHandler)
44 AliHLTConfigurationHandler::AliHLTConfigurationHandler()
46 fgListConfigurations()
48 // see header file for class documentation
50 // refer to README to build package
52 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
53 SetLocalLoggingLevel(kHLTLogInfo);
56 AliHLTConfigurationHandler::~AliHLTConfigurationHandler()
58 // see header file for function documentation
60 while ((lnk=fgListConfigurations.FirstLink())!=NULL) {
61 AliHLTConfiguration* pConf=(AliHLTConfiguration*)lnk->GetObject();
62 HLTDebug("delete configuration \"%s\"", pConf->GetName());
63 fgListConfigurations.Remove(lnk);
68 int AliHLTConfigurationHandler::RegisterConfiguration(AliHLTConfiguration* pConf)
70 // see header file for function documentation
73 if (FindConfiguration(pConf->GetName()) == NULL) {
74 AliHLTConfiguration* pClone=new AliHLTConfiguration(*pConf);
75 fgListConfigurations.Add(pClone);
76 HLTDebug("configuration \"%s\" (%p) registered from %p", pClone->GetName(), pClone, pConf);
78 // mark all configurations with unresolved dependencies for re-evaluation
79 TObjLink* lnk=fgListConfigurations.FirstLink();
81 AliHLTConfiguration* pSrc=(AliHLTConfiguration*)lnk->GetObject();
82 if (pSrc && pSrc!=pClone && pSrc->SourcesResolved()!=1) {
83 pSrc->InvalidateSources();
89 HLTWarning("configuration \"%s\" already registered", pConf->GetName());
97 int AliHLTConfigurationHandler::CreateConfiguration(const char* id, const char* component, const char* sources, const char* arguments)
99 // see header file for function documentation
101 AliHLTConfiguration* pConf= new AliHLTConfiguration(id, component, sources, arguments);
103 // the configuration will be registered automatically, if this failes the configuration
104 // is missing -> delete it
105 if (FindConfiguration(id)==NULL) {
111 HLTError("system error: object allocation failed");
117 void AliHLTConfigurationHandler::PrintConfigurations()
119 // see header file for function documentation
120 HLTLogKeyword("configuration listing");
121 HLTMessage("registered configurations:");
122 TObjLink *lnk = fgListConfigurations.FirstLink();
124 TObject *obj = lnk->GetObject();
125 HLTMessage(" %s", obj->GetName());
130 int AliHLTConfigurationHandler::RemoveConfiguration(const char* id)
132 // see header file for function documentation
135 AliHLTConfiguration* pConf=NULL;
136 if ((pConf=FindConfiguration(id))!=NULL) {
137 iResult=RemoveConfiguration(pConf);
141 HLTWarning("can not find configuration \"%s\"", id);
150 int AliHLTConfigurationHandler::RemoveConfiguration(AliHLTConfiguration* pConf)
152 // see header file for function documentation
155 // remove the configuration from the list
156 HLTDebug("remove configuration \"%s\"", pConf->GetName());
157 fgListConfigurations.Remove(pConf);
158 // remove cross links in the remaining configurations
159 TObjLink* lnk=fgListConfigurations.FirstLink();
160 while (lnk && iResult>=0) {
161 AliHLTConfiguration* pRem=(AliHLTConfiguration*)lnk->GetObject();
163 pRem->InvalidateSource(pConf);
173 AliHLTConfiguration* AliHLTConfigurationHandler::FindConfiguration(const char* id)
175 // see header file for function documentation
176 AliHLTConfiguration* pConf=NULL;
178 pConf=(AliHLTConfiguration*)fgListConfigurations.FindObject(id);