]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTComponentHandler.h
added code documentation for BASE, SampleLib, TPCLib and build system
[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 /** @file   AliHLTComponentHandler.h
9     @author Matthias Richter, Timm Steinbeck
10     @date   
11     @brief  Global handling of HLT processing components
12     @note   The handler is part of the interface and both used in the
13             Online (PubSub) and Offline (AliRoot) context.
14                                                                           */
15    
16
17 #include "TObject.h"
18 #include "AliHLTDataTypes.h"
19 #include "AliHLTLogging.h"
20
21 class AliHLTComponent;
22 struct AliHLTComponentEnvironment;
23 struct AliHLTComponent_DataType;
24
25 typedef void* AliHLTLibHandle;
26
27 class AliHLTComponentHandler : public AliHLTLogging {
28  public:
29   AliHLTComponentHandler();
30   virtual ~AliHLTComponentHandler();
31
32   void SetEnvironment(AliHLTComponentEnvironment* pEnv);
33
34   // Load a component shared library
35   int LoadLibrary( const char* libraryPath );
36   int UnloadLibrary( const char* libraryPath );
37
38   /* Component registration funcions
39    * registration is done by passing a sample object of the component to the handler
40    * the object has to be valid during the whole runtime and should thus be a global object
41    */
42   // Schedule a component for registration, full registration will be done
43   // after successfull loading of the shared library
44   int ScheduleRegister(AliHLTComponent* pSample );
45
46   // Register a component with the list of available components
47   int RegisterComponent(AliHLTComponent* pSample );
48   int DeregisterComponent( const char* componentID );
49
50   // Find the ID of a component with the given output data
51   // prevType can be used to iterate if there are multiple components with the same output data type.
52   const char* FindComponentType( AliHLTComponent_DataType, const char* prevType = NULL ) { return NULL;}
53
54   // Create a component of the given name
55   int CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponent*& component );
56   int CreateComponent( const char* componentType, void* environ_param, AliHLTComponent*& component ) {
57     return CreateComponent( componentType, environ_param, 0, NULL, component );
58   }
59
60   /* print registered components to stdout
61    */
62   void List();
63  protected:
64
65  private:
66   /* find a component
67      return index
68   */
69   int FindComponentIndex(const char* componentID);
70
71   /* find a component
72      return descriptor
73   */
74   AliHLTComponent* FindComponent(const char* componentID);
75
76   int InsertComponent(AliHLTComponent* pSample);
77
78   // close all libraries
79   int UnloadLibraries();
80
81   /* list of registered components
82    */
83   vector<AliHLTComponent*> fComponentList;
84
85   /* list of scheduled components
86    */
87   vector<AliHLTComponent*> fScheduleList;
88
89   /* list of libraries
90    */
91   vector<AliHLTLibHandle> fLibraryList;
92
93   AliHLTComponentEnvironment fEnvironment;
94
95   ClassDef(AliHLTComponentHandler, 0)
96
97     };
98 #endif
99