4 #ifndef ALIHLTCONFIGURATION_H
5 #define ALIHLTCONFIGURATION_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 AliHLTConfiguration.h
11 @author Matthias Richter
13 @brief Base class and handling of HLT configurations.
14 @note The class is used in Offline (AliRoot) context
17 // see below for class documentation
19 // refer to README to build package
21 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
26 #include "AliHLTDataTypes.h"
27 #include "AliHLTLogging.h"
28 #include "AliHLTDataBuffer.h"
30 class AliHLTConfigurationHandler;
33 * @class AliHLTConfiguration
34 * @brief Description of HLT processing chains.
36 * This class describes a certain configuration af an HLT processing step
37 * by the following parameters:
38 * - a unique id string/name
39 * - the id of the component
40 * - the ids of the configurations it requires input from
41 * - the arguments, which are passed to the component when it is initialized
43 * The setup of a configuration requires simply the creation of a global object
44 * of @ref AliHLTConfiguration. The Configuration is automatically registered
45 * in the list of available configurations maintained by the @ref
46 * AliHLTConfigurationHandler. The list is used by to resolve the dependencies
47 * on other configurations. Hierarchies can be built up in an easy way.
49 * A configuration is interpreted by the @ref AliHLTConfigurationHandler and
50 * transformed into a Task List.
52 * @note This class is only used for the @ref alihlt_system.
54 * @ingroup alihlt_system
56 class AliHLTConfiguration : public TObject, public AliHLTLogging {
59 * standard constructor. The configuration is automatically registered in the
60 * global configuration manager
62 AliHLTConfiguration();
64 * constructor. The configuration is automatically registered in the
65 * global configuration manager
66 * @param id unique id of the configuration
67 * @param component component id
68 * @param sources blank separated list of source configuration ids
69 * @param arguments argument string passed to the component at initialization
71 AliHLTConfiguration(const char* id, const char* component,
72 const char* sources, const char* arguments);
73 /** copy constructor */
74 AliHLTConfiguration(const AliHLTConfiguration& src);
76 AliHLTConfiguration& operator=(const AliHLTConfiguration& src);
78 virtual ~AliHLTConfiguration();
80 /*****************************************************************************
81 * global initialization
85 * Global initialization of the configuration handler.
87 static int GlobalInit(AliHLTConfigurationHandler* pHandler);
90 * Global de-init and cleanup of the global configuration handler
92 static int GlobalDeinit(AliHLTConfigurationHandler* pHandler);
94 /*****************************************************************************
95 * properties of the configuration
99 * Get configuration id, a unique name
100 * This is an overridden TObject function in order to return the configuration
101 * name instead of the class name. Enables use of TList standard functions.
102 * @return configuration id
104 const char *GetName() const;
107 * Get id of the component.
108 * The id is a unique string.
109 * @return id of the component
111 const char* GetComponentID() const {return fComponent;}
115 * Short summary on id, component, sources and unresolved sources.
120 * Get a certain source.
121 * @param id of the source configuration
122 * @result pointer to the corresponding configuration descriptor
124 AliHLTConfiguration* GetSource(const char* id);
127 * Try to find a dependency recursively in the list of sources.
128 * @param id the source to search for
129 * @param pTgtList (optional) target list to receive the dependency tree
132 * n found in the n-th level
133 * dependency list in the target list
135 int FollowDependency(const char* id, TList* pTgtList=NULL);
138 * Get the number of resolved sources.
139 * @return number of resolved sources
141 int GetNofSources() {return fListSources.size();}
144 * Check resolving status.
145 * @param bAuto resolve if ==1
146 * @return 1 if all sources resolved
148 int SourcesResolved(int bAuto=0);
151 * Start iteration and get the first source.
152 * @result pointer to the first configuration descriptor
154 AliHLTConfiguration* GetFirstSource();
157 * Continue iteration and get the next source.
158 * @result pointer to the next configuration descriptor in the list
160 AliHLTConfiguration* GetNextSource();
163 * Invalidate a dependency and mark the configuration to be re-evaluted.
164 * @param pConf pointer to configuration descriptor
166 int InvalidateSource(AliHLTConfiguration* pConf);
169 * Mark the configuration to be re-evaluted.
171 int InvalidateSources() {fNofSources=-1; return 0;}
174 * Get the arguments array.
175 * @param pArgv pointer to receive argument array pointer
176 * @return argc if succeeded, neg. error code if failed
178 int GetArguments(const char*** pArgv);
184 /* extract the source configurations from the sources string
186 int ExtractSources();
188 /* extract arguments from the argument string
190 int ExtractArguments();
193 * Helper function to build a vector from an argument string
194 * @param arg pointer to argument string
195 * @param argList target to receive the argument list
197 int InterpreteString(const char* arg, vector<char*>& argList);
199 /** id of this configuration */
200 TString fID; // see above
201 /** component id of this configuration */
202 TString fComponent; // see above
204 /** the <i>sources</i> string as passed to the constructor */
205 TString fStringSources; // see above
206 /** number of resolved sources, -1 indicates re-evaluation */
207 int fNofSources; // see above
208 /** list of sources */
209 vector<AliHLTConfiguration*> fListSources; // see above
210 /** iterator for the above list */
211 vector<AliHLTConfiguration*>::iterator fListSrcElement; // see above
214 * The argument string as passed to the constructor.
215 * Specifies the arguments for the Analysys component. The string will
216 * be parsed and the separated arguments stored in the @ref fArgv array
217 * and @ref fArgc member.
219 TString fArguments; // see above
220 /** number of arguments */
221 int fArgc; // see above
222 /** argument array */
223 char** fArgv; // see above
225 /** the instance of the global configuration handler */
226 static AliHLTConfigurationHandler* fgConfigurationHandler; //! transient
228 ClassDef(AliHLTConfiguration, 0);