]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTComponentHandler.h
started the new framework module supporting PubSub and AliRoot
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTComponentHandler.h
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"
14
15 class AliHLTComponent;
16 struct AliHLTComponentEnvironment;
17 struct AliHLTComponent_DataType;
18
19 typedef void* AliHLTLibHandle;
20
21 class AliHLTComponentHandler {
22  public:
23   AliHLTComponentHandler();
24   virtual ~AliHLTComponentHandler();
25
26   void SetEnvironment(AliHLTComponentEnvironment* pEnv);
27
28   // Load a component shared library
29   int LoadLibrary( const char* libraryPath );
30   int UnloadLibrary( const char* libraryPath );
31
32   /* Component registration funcions
33    * registration is done by passing a sample object of the component to the handler
34    * the object has to be valid during the whole runtime and should thus be a global object
35    */
36   // Schedule a component for registration, full registration will be done
37   // after successfull loading of the shared library
38   int ScheduleRegister(AliHLTComponent* pSample );
39
40   // Register a component with the list of available components
41   int RegisterComponent(AliHLTComponent* pSample );
42   int DeregisterComponent( const char* componentID );
43
44   // Find the ID of a component with the given output data
45   // prevType can be used to iterate if there are multiple components with the same output data type.
46   const char* FindComponentType( AliHLTComponent_DataType, const char* prevType = NULL ) { return NULL;}
47
48   // Create a component of the given name
49   int CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponent*& component );
50   int CreateComponent( const char* componentType, void* environ_param, AliHLTComponent*& component ) {
51     return CreateComponent( componentType, environ_param, 0, NULL, component );
52   }
53
54   /* print registered components to stdout
55    */
56   void List();
57  protected:
58   int Logging( AliHLTComponent_LogSeverity severity, const char* origin, const char* keyword, const char* message, ... );
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)
91     };
92 #endif
93