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.
17 #include "AliHLTDataTypes.h"
18 #include "AliHLTLogging.h"
19 #include "AliHLTDataBuffer.h"
21 class AliHLTConfigurationHandler;
24 * @class AliHLTConfiguration
25 * @brief Description of HLT processing chains.
27 * This class describes a certain configuration af an HLT processing step
28 * by the following parameters:
29 * - a unique id string/name
30 * - the id of the component
31 * - the ids of the configurations it requires input from
32 * - the arguments, which are passed to the component when it is initialized
34 * The setup of a configuration requires simply the creation of a global object
35 * of @ref AliHLTConfiguration. The Configuration is automatically registered
36 * in the list of available configurations maintained by the @ref
37 * AliHLTConfigurationHandler. The list is used by to resolve the dependencies
38 * on other configurations. Hierarchies can be built up in an easy way.
40 * A configuration is interpreted by the @ref AliHLTConfigurationHandler and
41 * transformed into a Task List.
44 class AliHLTConfiguration : public TObject, public AliHLTLogging {
47 * standard constructor. The configuration is automatically registered in the
48 * global configuration manager
50 AliHLTConfiguration();
52 * constructor. The configuration is automatically registered in the
53 * global configuration manager
54 * @param id unique id of the configuration
55 * @param component component id
56 * @param sources blank separated list of source configuration ids
57 * @param arguments argument string passed to the component at initialization
59 AliHLTConfiguration(const char* id, const char* component,
60 const char* sources, const char* arguments);
62 virtual ~AliHLTConfiguration();
64 /*****************************************************************************
65 * global initialization
69 * Global initialization of the configuration handler.
71 static int GlobalInit(AliHLTConfigurationHandler* pHandler);
74 * Global de-init and cleanup of the global configuration handler
76 static int GlobalDeinit();
78 /*****************************************************************************
79 * properties of the configuration
83 * Get configuration id, a unique name
84 * This is an overridden TObject function in order to return the configuration
85 * name instead of the class name. Enables use of TList standard functions.
86 * @return configuration id
88 const char *GetName() const;
91 * Get id of the component.
92 * The id is a unique string.
93 * @return id of the component
95 const char* GetComponentID() {return fComponent;}
99 * Short summary on id, component, sources and unresolved sources.
104 * Get a certain source.
105 * @param id of the source configuration
106 * @result pointer to the corresponding configuration descriptor
108 AliHLTConfiguration* GetSource(const char* id);
111 * Try to find a dependency recursively in the list of sources.
112 * @param id the source to search for
113 * @param pTgtList (optional) target list to receive the dependency tree
116 * n found in the n-th level
117 * dependency list in the target list
119 int FollowDependency(const char* id, TList* pTgtList=NULL);
122 * Get the number of resolved sources.
123 * @return number of resolved sources
125 int GetNofSources() {return fListSources.size();}
128 * Check resolving status.
129 * @param bAuto resolve if ==1
130 * @return 1 if all sources resolved
132 int SourcesResolved(int bAuto=0);
135 * Start iteration and get the first source.
136 * @result pointer to the first configuration descriptor
138 AliHLTConfiguration* GetFirstSource();
141 * Continue iteration and get the next source.
142 * @result pointer to the next configuration descriptor in the list
144 AliHLTConfiguration* GetNextSource();
147 * Invalidate a dependency and mark the configuration to be re-evaluted.
148 * @param pConf pointer to configuration descriptor
150 int InvalidateSource(AliHLTConfiguration* pConf);
153 * Mark the configuration to be re-evaluted.
155 int InvalidateSources() {fNofSources=-1; return 0;}
158 * Get the arguments array.
159 * @param pArgv pointer to receive argument array pointer
160 * @return argc if succeeded, neg. error code if failed
162 int GetArguments(const char*** pArgv);
168 /* extract the source configurations from the sources string
170 int ExtractSources();
172 /* extract arguments from the argument string
174 int ExtractArguments();
176 /* helper function to build a vector from an argument string
178 int InterpreteString(const char* arg, vector<char*>& argList);
180 /** id of this configuration */
182 /** component id of this configuration */
183 const char* fComponent;
185 /** the <i>sources</i> string as passed to the constructor */
186 const char* fStringSources;
187 /** number of resolved sources, -1 indicates re-evaluation */
189 /** list of sources */
190 vector<AliHLTConfiguration*> fListSources;
191 /** iterator for the above list */
192 vector<AliHLTConfiguration*>::iterator fListSrcElement;
195 * The argument string as passed to the constructor.
196 * Specifies the arguments for the Analysys component. The string will
197 * be parsed and the separated arguments stored in the @ref fArgv array
198 * and @ref fArgc member.
200 const char* fArguments;
201 /** number of arguments */
203 /** argument array */
206 static AliHLTConfigurationHandler* fConfigurationHandler;
208 ClassDef(AliHLTConfiguration, 0);