f23a6e1a |
1 | // @(#) $Id$ |
2 | |
3 | #ifndef ALIHLTCOMPONENTHANDLER_H |
4 | #define ALIHLTCOMPONENTHANDLER_H |
5 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
6 | * See cxx source for full Copyright notice */ |
7 | |
8 | /* AliHltcomponentHandler |
9 | handler of HLT processing components |
10 | */ |
11 | |
12 | #include "TObject.h" |
13 | #include "AliHLTDataTypes.h" |
5ec8e281 |
14 | #include "AliHLTLogging.h" |
f23a6e1a |
15 | |
16 | class AliHLTComponent; |
17 | struct AliHLTComponentEnvironment; |
18 | struct AliHLTComponent_DataType; |
19 | |
20 | typedef void* AliHLTLibHandle; |
21 | |
5ec8e281 |
22 | class AliHLTComponentHandler : public AliHLTLogging { |
f23a6e1a |
23 | public: |
24 | AliHLTComponentHandler(); |
25 | virtual ~AliHLTComponentHandler(); |
26 | |
27 | void SetEnvironment(AliHLTComponentEnvironment* pEnv); |
28 | |
29 | // Load a component shared library |
30 | int LoadLibrary( const char* libraryPath ); |
31 | int UnloadLibrary( const char* libraryPath ); |
32 | |
33 | /* Component registration funcions |
34 | * registration is done by passing a sample object of the component to the handler |
35 | * the object has to be valid during the whole runtime and should thus be a global object |
36 | */ |
37 | // Schedule a component for registration, full registration will be done |
38 | // after successfull loading of the shared library |
39 | int ScheduleRegister(AliHLTComponent* pSample ); |
40 | |
41 | // Register a component with the list of available components |
42 | int RegisterComponent(AliHLTComponent* pSample ); |
43 | int DeregisterComponent( const char* componentID ); |
44 | |
45 | // Find the ID of a component with the given output data |
46 | // prevType can be used to iterate if there are multiple components with the same output data type. |
47 | const char* FindComponentType( AliHLTComponent_DataType, const char* prevType = NULL ) { return NULL;} |
48 | |
49 | // Create a component of the given name |
50 | int CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponent*& component ); |
51 | int CreateComponent( const char* componentType, void* environ_param, AliHLTComponent*& component ) { |
52 | return CreateComponent( componentType, environ_param, 0, NULL, component ); |
53 | } |
54 | |
55 | /* print registered components to stdout |
56 | */ |
57 | void List(); |
58 | protected: |
f23a6e1a |
59 | |
60 | private: |
61 | /* find a component |
62 | return index |
63 | */ |
64 | int FindComponentIndex(const char* componentID); |
65 | |
66 | /* find a component |
67 | return descriptor |
68 | */ |
69 | AliHLTComponent* FindComponent(const char* componentID); |
70 | |
71 | int InsertComponent(AliHLTComponent* pSample); |
72 | |
73 | // close all libraries |
74 | int UnloadLibraries(); |
75 | |
76 | /* list of registered components |
77 | */ |
78 | vector<AliHLTComponent*> fComponentList; |
79 | |
80 | /* list of scheduled components |
81 | */ |
82 | vector<AliHLTComponent*> fScheduleList; |
83 | |
84 | /* list of libraries |
85 | */ |
86 | vector<AliHLTLibHandle> fLibraryList; |
87 | |
88 | AliHLTComponentEnvironment fEnvironment; |
89 | |
90 | ClassDef(AliHLTComponentHandler, 0) |
fa2e9b7c |
91 | |
f23a6e1a |
92 | }; |
93 | #endif |
94 | |