4 #ifndef ALIHLTCONFIGURATIONHANDLER_H
5 #define ALIHLTCONFIGURATIONHANDLER_H
6 ///* This file is property of and copyright by the ALICE HLT Project *
7 ///* ALICE Experiment at CERN, All rights reserved. *
8 ///* See cxx source for full Copyright notice *
10 /// @file AliHLTConfigurationHandler.h
11 /// @author Matthias Richter
13 /// @brief Global handling of HLT configurations.
18 #include "AliHLTLogging.h"
19 class AliHLTConfiguration;
23 * @class AliHLTConfigurationHandler
24 * @brief Global Handling of HLT configurations.
26 * This class implements the global handling of @ref AliHLTConfiguration objects.
27 * It is a list of all configuration descriptors currently available in the system.
28 * Each @ref AliHLTConfiguration object is registered automatically with the
29 * handler and put into the list.
31 * @note This class is only used for the @ref alihlt_system.
33 * @ingroup alihlt_system
35 class AliHLTConfigurationHandler : public AliHLTLogging {
37 /** standard constructor */
38 AliHLTConfigurationHandler();
41 virtual ~AliHLTConfigurationHandler();
43 /*****************************************************************************
48 * Create an instance from the global sigleton.
49 * Instance has to be destroyed by the Destroy function
51 static AliHLTConfigurationHandler* CreateHandler();
54 * Destroy an instance of the global singleton retrieved by
55 * AliHLTConfigurationHandler::CreateHandler()
60 * Get the instance of the global singleton.
61 * Does not create the global instance.
63 static AliHLTConfigurationHandler* Instance() {
64 if (!fgpInstance) return NULL;
68 /*****************************************************************************
69 * activation, affects if the handler will accept new registrations
73 * Deactivate the handler, AliHLTConfiguration objects will not register
74 * @param schedule Store and schedule registrations pending reactivation
76 int Deactivate(bool schedule=false);
79 * Activate the handler, AliHLTConfiguration objects will register again
84 bool IsActive() const {return (fFlags&kInactive)==0;}
86 /// check if scheduling
87 bool IsScheduling() const {return (fFlags&kScheduling)>0;}
89 /// clear scheduled registrations
90 void ClearScheduledRegistrations() {fgListScheduledRegistrations.Delete();}
92 /// signal a missed registration
93 static int MissedRegistration(const char* name=NULL);
95 /*****************************************************************************
100 * Register a configuration to the global list of configurations.
101 * @param pConf The configuration to register
103 int RegisterConfiguration(AliHLTConfiguration* pConf);
106 * Create a configuration and register it.
112 int CreateConfiguration(const char* id, const char* component, const char* sources, const char* arguments);
115 * Remove a configuration from the global list.
116 * @param pConf The configuration to remove
118 int RemoveConfiguration(AliHLTConfiguration* pConf);
121 * Remove a configuration from the global list.
122 * @param id The configuration to remove
124 int RemoveConfiguration(const char* id);
127 * Find a configuration from the global list.
128 * @param id Id of the configuration to find
130 AliHLTConfiguration* FindConfiguration(const char* id);
133 * Print the registered configurations to the logging function.
135 void PrintConfigurations();
140 * - treeroot=configuration print the dependency tree for a configuration
141 * default PrintConfigurations
143 void Print(const char* option="");
146 * Add a component substitution by component id.
147 * All components of the specified component id will be replaced by the
148 * substitution component, the component arguments are replaced accordingly.
149 * Component substitution is in particular useful if the input to a specific
150 * component should be written to file.
152 static int AddSubstitution(const char* componentId, const AliHLTConfiguration& subst);
155 * Add a component substitution by configuration id.
156 * The component of the specified configuration will be replaced by the
157 * substitution component, the component arguments are replaced accordingly.
158 * Component substitution is in particular useful if the input to a specific
159 * component should be written to file.
161 static int AddSubstitution(const AliHLTConfiguration& conf , const AliHLTConfiguration& subst);
164 * Find component substitution.
166 static const AliHLTConfiguration* FindSubstitution(const AliHLTConfiguration& conf);
174 /** the list of registered configurations */
175 TList fgListConfigurations; // see above
177 /** list of configurations scheduled to be registered */
178 TList fgListScheduledRegistrations; // see above
180 /** status of the handler */
181 unsigned fFlags; //! transient
183 /** the global singleton */
184 static AliHLTConfigurationHandler* fgpInstance; //!transient
185 /** number of used instances of the global singleton */
186 static int fgNofInstances; //!transient
188 /// component substitution map
189 /// key: either TObjString with component id or AliHLTConfiguration object
190 static TMap* fgpSubstitutions; //!transient
192 ClassDef(AliHLTConfigurationHandler, 0);