3 #ifndef ALIHLTCONFIGURATION_H
4 #define ALIHLTCONFIGURATION_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * See cxx source for full Copyright notice */
8 /** @file AliHLTConfiguration.h
9 @author Matthias Richter
11 @brief Base class and handling of HLT configurations.
12 @note The class is used in Offline (AliRoot) context
19 #include "AliHLTDataTypes.h"
20 #include "AliHLTLogging.h"
21 #include "AliHLTDataBuffer.h"
23 class AliHLTConfigurationHandler;
26 * @class AliHLTConfiguration
27 * @brief Description of HLT processing chains.
29 * This class describes a certain configuration af an HLT processing step
30 * by the following parameters:
31 * - a unique id string/name
32 * - the id of the component
33 * - the ids of the configurations it requires input from
34 * - the arguments, which are passed to the component when it is initialized
36 * The setup of a configuration requires simply the creation of a global object
37 * of @ref AliHLTConfiguration. The Configuration is automatically registered
38 * in the list of available configurations maintained by the @ref
39 * AliHLTConfigurationHandler. The list is used by to resolve the dependencies
40 * on other configurations. Hierarchies can be built up in an easy way.
42 * A configuration is interpreted by the @ref AliHLTConfigurationHandler and
43 * transformed into a Task List.
45 * @note This class is only used for the @ref alihlt_system.
47 * @ingroup alihlt_system
49 class AliHLTConfiguration : public TObject, public AliHLTLogging {
52 * standard constructor. The configuration is automatically registered in the
53 * global configuration manager
55 AliHLTConfiguration();
57 * constructor. The configuration is automatically registered in the
58 * global configuration manager
59 * @param id unique id of the configuration
60 * @param component component id
61 * @param sources blank separated list of source configuration ids
62 * @param arguments argument string passed to the component at initialization
64 AliHLTConfiguration(const char* id, const char* component,
65 const char* sources, const char* arguments);
66 /** not a valid copy constructor, defined according to effective C++ style */
67 AliHLTConfiguration(const AliHLTConfiguration&);
68 /** not a valid assignment op, but defined according to effective C++ style */
69 AliHLTConfiguration& operator=(const AliHLTConfiguration&);
72 virtual ~AliHLTConfiguration();
74 /*****************************************************************************
75 * global initialization
79 * Global initialization of the configuration handler.
81 static int GlobalInit(AliHLTConfigurationHandler* pHandler);
84 * Global de-init and cleanup of the global configuration handler
86 static int GlobalDeinit();
88 /*****************************************************************************
89 * properties of the configuration
93 * Get configuration id, a unique name
94 * This is an overridden TObject function in order to return the configuration
95 * name instead of the class name. Enables use of TList standard functions.
96 * @return configuration id
98 const char *GetName() const;
101 * Get id of the component.
102 * The id is a unique string.
103 * @return id of the component
105 const char* GetComponentID() const {return fComponent;}
109 * Short summary on id, component, sources and unresolved sources.
114 * Get a certain source.
115 * @param id of the source configuration
116 * @result pointer to the corresponding configuration descriptor
118 AliHLTConfiguration* GetSource(const char* id);
121 * Try to find a dependency recursively in the list of sources.
122 * @param id the source to search for
123 * @param pTgtList (optional) target list to receive the dependency tree
126 * n found in the n-th level
127 * dependency list in the target list
129 int FollowDependency(const char* id, TList* pTgtList=NULL);
132 * Get the number of resolved sources.
133 * @return number of resolved sources
135 int GetNofSources() {return fListSources.size();}
138 * Check resolving status.
139 * @param bAuto resolve if ==1
140 * @return 1 if all sources resolved
142 int SourcesResolved(int bAuto=0);
145 * Start iteration and get the first source.
146 * @result pointer to the first configuration descriptor
148 AliHLTConfiguration* GetFirstSource();
151 * Continue iteration and get the next source.
152 * @result pointer to the next configuration descriptor in the list
154 AliHLTConfiguration* GetNextSource();
157 * Invalidate a dependency and mark the configuration to be re-evaluted.
158 * @param pConf pointer to configuration descriptor
160 int InvalidateSource(AliHLTConfiguration* pConf);
163 * Mark the configuration to be re-evaluted.
165 int InvalidateSources() {fNofSources=-1; return 0;}
168 * Get the arguments array.
169 * @param pArgv pointer to receive argument array pointer
170 * @return argc if succeeded, neg. error code if failed
172 int GetArguments(const char*** pArgv);
178 /* extract the source configurations from the sources string
180 int ExtractSources();
182 /* extract arguments from the argument string
184 int ExtractArguments();
187 * Helper function to build a vector from an argument string
188 * @param arg pointer to argument string
189 * @param argList target to receive the argument list
191 int InterpreteString(const char* arg, vector<char*>& argList);
193 /** id of this configuration */
194 const char* fID; //! transient
195 /** component id of this configuration */
196 const char* fComponent; //! transient
198 /** the <i>sources</i> string as passed to the constructor */
199 const char* fStringSources; //! transient
200 /** number of resolved sources, -1 indicates re-evaluation */
201 int fNofSources; // see above
202 /** list of sources */
203 vector<AliHLTConfiguration*> fListSources; // see above
204 /** iterator for the above list */
205 vector<AliHLTConfiguration*>::iterator fListSrcElement; // see above
208 * The argument string as passed to the constructor.
209 * Specifies the arguments for the Analysys component. The string will
210 * be parsed and the separated arguments stored in the @ref fArgv array
211 * and @ref fArgc member.
213 const char* fArguments; // see above
214 /** number of arguments */
215 int fArgc; // see above
216 /** argument array */
217 char** fArgv; // see above
219 /** the instance of the global configuration handler */
220 static AliHLTConfigurationHandler* fgConfigurationHandler; //! transient
222 ClassDef(AliHLTConfiguration, 0);