]>
Commit | Line | Data |
---|---|---|
5045badf | 1 | //-*- Mode: C++ -*- |
c5318542 | 2 | // @(#) $Id$ |
c5318542 | 3 | #ifndef ALIHLTSAMPLECOMPONENT1_H |
4 | #define ALIHLTSAMPLECOMPONENT1_H | |
5045badf | 5 | |
6 | //* This file is property of and copyright by the ALICE HLT Project * | |
7 | //* ALICE Experiment at CERN, All rights reserved. * | |
8 | //* See cxx source for full Copyright notice */ | |
c5318542 | 9 | |
b22e91eb | 10 | /** @file AliHLTSampleComponent1.h |
11 | @author Matthias Richter, Timm Steinbeck | |
12 | @date | |
5045badf | 13 | @brief A sample processing component for the HLT. |
14 | */ | |
c5318542 | 15 | |
16 | #include "AliHLTProcessor.h" | |
17 | ||
b22e91eb | 18 | /** |
19 | * @class AliHLTSampleComponent1 | |
5045badf | 20 | * An HLT sample component. |
aa7f26de | 21 | * This component does not any data processing at all. It just |
22 | * illustrates the existence of several components in ine library and | |
23 | * allows to set up a very simple chain with different components. | |
5045badf | 24 | * |
8f30c1ea | 25 | * <h2>General properties:</h2> |
26 | * | |
5045badf | 27 | * Component ID: \b Sample-component1 <br> |
8f30c1ea | 28 | * Library: \b libAliHLTSample.so <br> |
29 | * Input Data Types: @ref kAliHLTAnyDataType <br> | |
30 | * Output Data Types: none <br> | |
5045badf | 31 | * |
8f30c1ea | 32 | * <h2>Mandatory arguments:</h2> |
1ac82ce6 | 33 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> |
5045badf | 34 | * \li -mandatory1 <i> teststring </i> <br> |
35 | * an argument with one parameter | |
36 | * \li -mandatory2 <br> | |
37 | * an argument without parameters | |
38 | * | |
8f30c1ea | 39 | * <h2>Optional arguments:</h2> |
1ac82ce6 | 40 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> |
5045badf | 41 | * \li -optional1 <i> teststring </i> <br> |
42 | * an argument with one parameter | |
43 | * \li -optional2 <br> | |
44 | * an argument without parameters | |
45 | * | |
8f30c1ea | 46 | * <h2>Configuration:</h2> |
1ac82ce6 | 47 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting --> |
5045badf | 48 | * \li -config1 <i> teststring </i> <br> |
49 | * a configuration argument with one parameter | |
50 | * \li -config2 <br> | |
51 | * a configuration argument without parameters | |
52 | * | |
8f30c1ea | 53 | * <h2>Default CDB entries:</h2> |
54 | * The component has just one default CDB entry in | |
55 | * <tt>HLT/ConfigSample/SampleComponent1</tt>. | |
56 | * It does not load any configuration from the global <tt>ConfigHLT</tt> | |
57 | * folder. | |
58 | * \li -TObjString object holding a string with the configuration parameters | |
59 | * explained above | |
60 | * | |
61 | * <h2>Performance:</h2> | |
62 | * The component does not any event data processing. | |
63 | * | |
64 | * <h2>Memory consumption:</h2> | |
65 | * The component does not any event data processing. | |
66 | * | |
67 | * <h2>Output size:</h2> | |
68 | * The component has no output data. | |
69 | * | |
5045badf | 70 | * Furthermore it illustrates the component argument scanning and the |
71 | * component configuration. There are actually two methods to init/ | |
72 | * configure a component: | |
73 | * - via command line arguments. The arguments are specified in the HLT | |
74 | * chain configuration and are passed to the component during | |
75 | * initialization in @ref DoInit() | |
76 | * - from a CDB entry. The CDB can contain configuration objects for a | |
77 | * component and the component can implement the handling | |
78 | * | |
79 | * The component implements the @ref alihltcomponent-low-level-interface. | |
80 | * for data processing. | |
81 | * | |
82 | * Using the latter case, a component can also be reconfigured. Special | |
83 | * events are propageted through the chain in order to trigger the re- | |
84 | * configuration. The component needs to implement the function | |
85 | * @ref Reconfigure(). The simplest version of a configuration object is | |
86 | * a string object (TObjString) containing configuration arguments. | |
87 | * | |
b22e91eb | 88 | * @ingroup alihlt_tutorial |
89 | */ | |
c5318542 | 90 | class AliHLTSampleComponent1 : public AliHLTProcessor { |
91 | public: | |
92 | AliHLTSampleComponent1(); | |
93 | virtual ~AliHLTSampleComponent1(); | |
94 | ||
5045badf | 95 | // AliHLTComponent interface functions |
c5318542 | 96 | const char* GetComponentID() { return "Sample-component1";} |
8ede8717 | 97 | void GetInputDataTypes( vector<AliHLTComponentDataType>& list) { |
f79c8e02 | 98 | list.push_back(kAliHLTAnyDataType); |
c5318542 | 99 | } |
f644d3f1 | 100 | AliHLTComponentDataType GetOutputDataType() {return kAliHLTVoidDataType;} |
71d7c760 | 101 | virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {constBase = 0;inputMultiplier = 0;}; |
c5318542 | 102 | |
103 | // Spawn function, return new class instance | |
104 | AliHLTComponent* Spawn() {return new AliHLTSampleComponent1;}; | |
105 | ||
106 | protected: | |
5045badf | 107 | // AliHLTComponent interface functions |
c5318542 | 108 | int DoInit( int argc, const char** argv ); |
109 | int DoDeinit(); | |
8ede8717 | 110 | int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, |
111 | AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, | |
112 | AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks ); | |
5045badf | 113 | int Reconfigure(const char* cdbEntry, const char* chainId); |
b543e186 | 114 | int ReadPreprocessorValues(const char* modules); |
c5318542 | 115 | |
d76bc02a | 116 | using AliHLTProcessor::DoEvent; |
117 | ||
c5318542 | 118 | private: |
5045badf | 119 | /** |
120 | * Configure the component. | |
121 | * Parse a string for the configuration arguments and set the component | |
122 | * properties. | |
123 | * | |
124 | * This function illustrates the scanning of an argument string. The string | |
125 | * was presumably fetched from the CDB. | |
126 | */ | |
127 | int Configure(const char* arguments); | |
c5318542 | 128 | |
5045badf | 129 | ClassDef(AliHLTSampleComponent1, 1) |
c5318542 | 130 | }; |
131 | #endif |