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
27 #include "AliHLTDataTypes.h"
28 #include "AliHLTLogging.h"
29 #include "AliHLTDataBuffer.h"
31 class AliHLTConfigurationHandler;
34 * @class AliHLTConfiguration
35 * @brief Description of HLT processing chains.
37 * This class describes a certain configuration af an HLT processing step
38 * by the following parameters:
39 * - a unique id string/name
40 * - the id of the component
41 * - the ids of the configurations it requires input from
42 * - the arguments, which are passed to the component when it is initialized
44 * The setup of a configuration requires simply the creation of a global object
45 * of @ref AliHLTConfiguration. The Configuration is automatically registered
46 * in the list of available configurations maintained by the @ref
47 * AliHLTConfigurationHandler. The list is used by to resolve the dependencies
48 * on other configurations. Hierarchies can be built up in an easy way.
50 * A configuration is interpreted by the @ref AliHLTConfigurationHandler and
51 * transformed into a Task List.
53 * @note This class is only used for the @ref alihlt_system.
55 * @ingroup alihlt_system
57 class AliHLTConfiguration : public TObject, public AliHLTLogging {
60 * standard constructor. The configuration is automatically registered in the
61 * global configuration manager
63 AliHLTConfiguration();
65 * constructor. The configuration is automatically registered in the
66 * global configuration manager
67 * @param id unique id of the configuration
68 * @param component component id
69 * @param sources blank separated list of source configuration ids
70 * @param arguments argument string passed to the component at initialization
72 AliHLTConfiguration(const char* id, const char* component,
73 const char* sources, const char* arguments);
74 /** copy constructor */
75 AliHLTConfiguration(const AliHLTConfiguration& src);
77 AliHLTConfiguration& operator=(const AliHLTConfiguration& src);
79 virtual ~AliHLTConfiguration();
81 /*****************************************************************************
82 * global initialization
86 * Global initialization of the configuration handler.
88 static int GlobalInit(AliHLTConfigurationHandler* pHandler);
91 * Global de-init and cleanup of the global configuration handler
93 static int GlobalDeinit(AliHLTConfigurationHandler* pHandler);
95 /*****************************************************************************
96 * properties of the configuration
100 * Get configuration id, a unique name
101 * This is an overridden TObject function in order to return the configuration
102 * name instead of the class name. Enables use of TList standard functions.
103 * @return configuration id
105 const char *GetName() const;
108 * Get id of the component.
109 * The id is a unique string.
110 * @return id of the component
112 const char* GetComponentID() const {return fComponent;}
116 * Short summary on id, component, sources and unresolved sources.
121 * Get a certain source.
122 * @param id of the source configuration
123 * @result pointer to the corresponding configuration descriptor
125 AliHLTConfiguration* GetSource(const char* id);
128 * Try to find a dependency recursively in the list of sources.
129 * @param id the source to search for
130 * @param pTgtList (optional) target list to receive the dependency tree
133 * n found in the n-th level
134 * dependency list in the target list
136 int FollowDependency(const char* id, TList* pTgtList=NULL);
139 * Get the number of resolved sources.
140 * @return number of resolved sources
142 int GetNofSources() {return fListSources.size();}
145 * Check resolving status.
146 * @param bAuto resolve if ==1
147 * @return 1 if all sources resolved
149 int SourcesResolved(int bAuto=0);
152 * Start iteration and get the first source.
153 * @result pointer to the first configuration descriptor
155 AliHLTConfiguration* GetFirstSource();
158 * Continue iteration and get the next source.
159 * @result pointer to the next configuration descriptor in the list
161 AliHLTConfiguration* GetNextSource();
164 * Invalidate a dependency and mark the configuration to be re-evaluted.
165 * @param pConf pointer to configuration descriptor
167 int InvalidateSource(AliHLTConfiguration* pConf);
170 * Mark the configuration to be re-evaluted.
172 int InvalidateSources() {fNofSources=-1; return 0;}
175 * Get the arguments array.
176 * @param pArgv pointer to receive argument array pointer
177 * @return argc if succeeded, neg. error code if failed
179 int GetArguments(const char*** pArgv);
185 /* extract the source configurations from the sources string
187 int ExtractSources();
189 /* extract arguments from the argument string
191 int ExtractArguments();
194 * Helper function to build a vector from an argument string
195 * @param arg pointer to argument string
196 * @param argList target to receive the argument list
198 int InterpreteString(const char* arg, vector<char*>& argList);
200 /** id of this configuration */
201 TString fID; // see above
202 /** component id of this configuration */
203 TString fComponent; // see above
205 /** the <i>sources</i> string as passed to the constructor */
206 TString fStringSources; // see above
207 /** number of resolved sources, -1 indicates re-evaluation */
208 int fNofSources; // see above
209 /** list of sources */
210 vector<AliHLTConfiguration*> fListSources; // see above
211 /** iterator for the above list */
212 vector<AliHLTConfiguration*>::iterator fListSrcElement; // see above
215 * The argument string as passed to the constructor.
216 * Specifies the arguments for the Analysys component. The string will
217 * be parsed and the separated arguments stored in the @ref fArgv array
218 * and @ref fArgc member.
220 TString fArguments; // see above
221 /** number of arguments */
222 int fArgc; // see above
223 /** argument array */
224 char** fArgv; // see above
226 /** the instance of the global configuration handler */
227 static AliHLTConfigurationHandler* fgConfigurationHandler; //! transient
229 ClassDef(AliHLTConfiguration, 0);