]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/SampleLib/AliHLTAgentSample.h
Test for Coverity
[u/mrichter/AliRoot.git] / HLT / SampleLib / AliHLTAgentSample.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTAGENTSAMPLE_H
4 #define ALIHLTAGENTSAMPLE_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 /** @file   AliHLTAgentSample.h
9     @author Matthias Richter
10     @date   
11     @brief  Agent of the libAliHLTSample library
12 */
13
14 #include "AliHLTModuleAgent.h"
15
16 /**
17  * @class AliHLTAgentSample
18  * This is the agent for the AliHLTSample library.<br>
19  * The AliHLTSample library illustrates usage of the HLT framework. The
20  * agent provides information on the features of the sample components
21  * and the configuration which should be run during AliRoot reconstruction.
22  *
23  * The sample agent implements all interface function provided by @ref
24  * AliHLTModuleAgent :
25  * - CreateConfigurations() <br>
26  *   The method gets an instance of the AliHLTConfigurationHanler to add
27  *   configurations, e.g. 
28  *   <pre>
29  *   handler->CreateConfiguration("my-puplisher"  , "FilePublisher", NULL , "data.bin");
30  *   ...
31  *   handler->CreateConfiguration("my-analysis-chain"  , "FileWriter", "my-processor" , "my arguments");
32  *   </pre>
33  * - GetReconstructionChains() <br>
34  *   returns a string of blank separated configurations to be run during
35  *   local event reconstruction.
36  *   <pre>
37  *   return "my-data-sink my-analysis-chain";
38  *   </pre>
39  * - GetRequiredComponentLibraries() <br>
40  *   returns a string of blank separated libraries which have to be loaded
41  *   in addition in order to load all required components. <br>
42  *   @note Not the right place for library dependencies.
43  *   <pre>
44  *   return "libAliHLTUtil.so";
45  *   </pre>
46  * - RegisterComponents() <br>
47  *   registers the components: AliHLTDummyComponent, AliHLTSampleComponent1,
48  *   AliHLTSampleComponent2, and AliHLTSampleMonitoringComponent<br>
49  * - GetHandlerDescription() <br>
50  *   Handles HLTOUT data blocks of type {DDL_RAW,SMPL}
51  *   <pre>
52  *   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginSample)) {
53  *     desc=AliHLTOUTHandlerDesc(kRawReader, dt, GetModuleId());
54  *     return 1;
55  *   }
56  *   </pre>
57  * - GetOutputHandler() <br>
58  *   Returns handler AliHLTOUTHandlerEquId for HLTOUT data blocks of
59  *   type {DDL_RAW,SMPL}
60  *   <pre>
61  *   if (dt==(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginSample)) {
62  *     return new AliHLTOUTHandlerEquId;
63  *   }
64  *   </pre>
65  * - DeleteOutputHandler() <br>
66  *   Deletes the output handler. In this case there is no special handling
67  *   needed.
68  *
69  * In order to hook the sample library up to the HLT system on global object
70  * @ref gAliHLTAgentSample of the agent is defined in the source code.
71  * 
72  * @ingroup alihlt_system
73  */
74 class AliHLTAgentSample : public AliHLTModuleAgent {
75  public:
76   /**
77    * standard constructor. The agent is automatically registered in the
78    * global agent manager
79    */
80   AliHLTAgentSample();
81   /** destructor */
82   virtual ~AliHLTAgentSample();
83
84   /**
85    * Register all configurations belonging to the sample library with the
86    * AliHLTConfigurationHandler. The agent can adapt the configurations
87    * to be registered to the current AliRoot setup by checking the
88    * runloader.
89    * @param handler   [in] the configuration handler
90    * @param rawReader [in] AliRoot RawReader instance 
91    * @param runloader [in] AliRoot runloader
92    * @return neg. error code if failed
93    */
94   int CreateConfigurations(AliHLTConfigurationHandler* handler,
95                            AliRawReader* rawReader=NULL,
96                            AliRunLoader* runloader=NULL) const;
97
98   /**
99    * Get the top configurations for local event reconstruction.
100    * A top configuration describes a processing chain. It can simply be
101    * described by the last configuration(s) in the chain. 
102    * The agent can adapt the configurations to be registered to the current
103    * AliRoot setup by checking the runloader.
104    * @param rawReader [in] AliRoot RawReader instance 
105    * @param runloader [in] AliRoot runloader
106    * @return string containing the top configurations separated by blanks
107    */
108   const char* GetReconstructionChains(AliRawReader* rawReader=NULL,
109                                       AliRunLoader* runloader=NULL) const;
110
111   /**
112    * Component libraries which the configurations of this agent depend on.
113    * @return list of component libraries as a blank-separated string.
114    */
115   const char* GetRequiredComponentLibraries() const;
116
117   /**
118    * Register components for the AliHLTSample library.
119    * @param pHandler  [in] instance of the component handler          
120    */
121   int RegisterComponents(AliHLTComponentHandler* pHandler) const;
122
123   int GetHandlerDescription(AliHLTComponentDataType dt,
124                             AliHLTUInt32_t spec,
125                             AliHLTOUTHandlerDesc& desc) const;
126   AliHLTOUTHandler* GetOutputHandler(AliHLTComponentDataType dt,
127                                      AliHLTUInt32_t spec);
128   int DeleteOutputHandler(AliHLTOUTHandler* pInstance);
129
130   AliHLTModulePreprocessor* GetPreprocessor();
131  protected:
132
133  private:
134   /** file name of the generated test data*/
135   static const char* fgkAliHLTAgentSampleData;                      //!transient
136
137   /** file name of the output file */
138   static const char* fgkAliHLTAgentSampleOut;                       //!transient
139
140   /** ROOT specific member definition */
141   ClassDef(AliHLTAgentSample, 1);
142 };
143
144 #endif