]>
Commit | Line | Data |
---|---|---|
3495cce2 | 1 | // @(#) $Id$ |
2 | ||
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 */ | |
7 | ||
0c0c9d99 | 8 | /** @file AliHLTConfiguration.h |
9 | @author Matthias Richter | |
10 | @date | |
11 | @brief base class and handling of HLT configurations. | |
12 | */ | |
3495cce2 | 13 | |
3b35e87c | 14 | #include <cerrno> |
3495cce2 | 15 | #include <TObject.h> |
16 | #include <TList.h> | |
17 | #include "AliHLTDataTypes.h" | |
18 | #include "AliHLTLogging.h" | |
0c0c9d99 | 19 | #include "AliHLTDataBuffer.h" |
3495cce2 | 20 | |
85465857 | 21 | class AliHLTConfigurationHandler; |
0c0c9d99 | 22 | |
23 | /** | |
24 | * @class AliHLTConfiguration | |
bfccbf68 | 25 | * @brief Description of HLT processing chains. |
26 | * @note Definition: | |
0c0c9d99 | 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 | |
3495cce2 | 33 | * |
0c0c9d99 | 34 | * The setup of a configuration requires simply the creation of a global object |
bfccbf68 | 35 | * of @ref AliHLTConfiguration. The Configuration is automatically registered |
36 | * in the list of available configurations maintained by the @ref | |
0c0c9d99 | 37 | * AliHLTConfigurationHandler. The list is used by to resolve the dependencies |
38 | * on other configurations. Hierarchies can be built up in an easy way. | |
3495cce2 | 39 | * |
bfccbf68 | 40 | * A configuration is interpreted by the @ref AliHLTConfigurationHandler and |
0c0c9d99 | 41 | * transformed into a Task List. |
42 | * @ingroup AliHLTbase | |
3495cce2 | 43 | */ |
44 | class AliHLTConfiguration : public TObject, public AliHLTLogging { | |
45 | public: | |
0c0c9d99 | 46 | /** |
47 | * standard constructor. The configuration is automatically registered in the | |
48 | * global configuration manager | |
49 | */ | |
3495cce2 | 50 | AliHLTConfiguration(); |
0c0c9d99 | 51 | /** |
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 | |
58 | */ | |
59 | AliHLTConfiguration(const char* id, const char* component, | |
60 | const char* sources, const char* arguments); | |
61 | /** destructor */ | |
3495cce2 | 62 | virtual ~AliHLTConfiguration(); |
63 | ||
0c0c9d99 | 64 | /***************************************************************************** |
85465857 | 65 | * global initialization |
66 | */ | |
0c0c9d99 | 67 | |
68 | /** | |
69 | * Global initialization of the configuration handler. | |
70 | */ | |
85465857 | 71 | static int GlobalInit(AliHLTConfigurationHandler* pHandler); |
72 | ||
0c0c9d99 | 73 | /** |
74 | * Global de-init and cleanup of the global configuration handler | |
75 | */ | |
85465857 | 76 | static int GlobalDeinit(); |
77 | ||
0c0c9d99 | 78 | /***************************************************************************** |
79 | * properties of the configuration | |
3495cce2 | 80 | */ |
81 | ||
0c0c9d99 | 82 | /** |
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 | |
87 | */ | |
3495cce2 | 88 | const char *GetName() const; |
89 | ||
0c0c9d99 | 90 | /** |
91 | * Get id of the component. | |
92 | * The id is a unique string. | |
93 | * @return id of the component | |
94 | */ | |
014d39ce | 95 | const char* GetComponentID() {return fComponent;} |
3495cce2 | 96 | |
0c0c9d99 | 97 | /** |
98 | * Print status info. | |
99 | * Short summary on id, component, sources and unresolved sources. | |
100 | */ | |
3495cce2 | 101 | void PrintStatus(); |
102 | ||
0c0c9d99 | 103 | /** |
104 | * Get a certain source. | |
105 | * @param id of the source configuration | |
106 | * @result pointer to the corresponding configuration descriptor | |
107 | */ | |
3495cce2 | 108 | AliHLTConfiguration* GetSource(const char* id); |
109 | ||
0c0c9d99 | 110 | /** |
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 | |
114 | * @return | |
115 | * 0 if not found | |
116 | * n found in the n-th level | |
117 | * dependency list in the target list | |
118 | */ | |
3495cce2 | 119 | int FollowDependency(const char* id, TList* pTgtList=NULL); |
120 | ||
0c0c9d99 | 121 | /** |
122 | * Get the number of resolved sources. | |
123 | * @return number of resolved sources | |
124 | */ | |
3495cce2 | 125 | int GetNofSources() {return fListSources.size();} |
126 | ||
0c0c9d99 | 127 | /** |
128 | * Check resolving status. | |
129 | * @param bAuto resolve if ==1 | |
130 | * @return 1 if all sources resolved | |
131 | */ | |
3495cce2 | 132 | int SourcesResolved(int bAuto=0); |
133 | ||
0c0c9d99 | 134 | /** |
135 | * Start iteration and get the first source. | |
136 | * @result pointer to the first configuration descriptor | |
137 | */ | |
3495cce2 | 138 | AliHLTConfiguration* GetFirstSource(); |
139 | ||
0c0c9d99 | 140 | /** |
141 | * Continue iteration and get the next source. | |
142 | * @result pointer to the next configuration descriptor in the list | |
143 | */ | |
3495cce2 | 144 | AliHLTConfiguration* GetNextSource(); |
145 | ||
0c0c9d99 | 146 | /** |
147 | * Invalidate a dependency and mark the configuration to be re-evaluted. | |
148 | * @param pConf pointer to configuration descriptor | |
149 | */ | |
3495cce2 | 150 | int InvalidateSource(AliHLTConfiguration* pConf); |
151 | ||
0c0c9d99 | 152 | /** |
153 | * Mark the configuration to be re-evaluted. | |
154 | */ | |
3495cce2 | 155 | int InvalidateSources() {fNofSources=-1; return 0;} |
156 | ||
0c0c9d99 | 157 | /** |
158 | * Get the arguments array. | |
159 | * @param pArgv pointer to receive argument array pointer | |
160 | * @return argc if succeeded, neg. error code if failed | |
161 | */ | |
162 | int GetArguments(const char*** pArgv); | |
3495cce2 | 163 | |
164 | protected: | |
165 | ||
3495cce2 | 166 | |
167 | private: | |
168 | /* extract the source configurations from the sources string | |
169 | */ | |
170 | int ExtractSources(); | |
171 | ||
172 | /* extract arguments from the argument string | |
173 | */ | |
174 | int ExtractArguments(); | |
175 | ||
176 | /* helper function to build a vector from an argument string | |
177 | */ | |
178 | int InterpreteString(const char* arg, vector<char*>& argList); | |
179 | ||
0c0c9d99 | 180 | /** id of this configuration */ |
181 | const char* fID; | |
182 | /** component id of this configuration */ | |
183 | const char* fComponent; | |
3495cce2 | 184 | |
0c0c9d99 | 185 | /** the <i>sources</i> string as passed to the constructor */ |
186 | const char* fStringSources; | |
187 | /** number of resolved sources, -1 indicates re-evaluation */ | |
3495cce2 | 188 | int fNofSources; |
0c0c9d99 | 189 | /** list of sources */ |
190 | vector<AliHLTConfiguration*> fListSources; | |
191 | /** iterator for the above list */ | |
192 | vector<AliHLTConfiguration*>::iterator fListSrcElement; | |
193 | ||
194 | /** | |
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. | |
199 | */ | |
200 | const char* fArguments; | |
201 | /** number of arguments */ | |
202 | int fArgc; | |
203 | /** argument array */ | |
204 | char** fArgv; | |
3495cce2 | 205 | |
85465857 | 206 | static AliHLTConfigurationHandler* fConfigurationHandler; |
207 | ||
3495cce2 | 208 | ClassDef(AliHLTConfiguration, 0); |
209 | }; | |
210 | ||
3495cce2 | 211 | #endif |