]>
Commit | Line | Data |
---|---|---|
81929b85 | 1 | // -*- Mode: C++ -*- |
2 | // @(#) $Id$ | |
3 | ||
4 | #ifndef ALIHLTDATAGENERATOR_H | |
5 | #define ALIHLTDATAGENERATOR_H | |
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 */ | |
9 | ||
10 | /** @file AliHLTDataGenerator.h | |
11 | @author Matthias Richter | |
12 | @date | |
13 | @brief An HLT file publishing (data source) component. | |
14 | @note The class is used in Offline (AliRoot) context | |
15 | */ | |
16 | ||
17 | #include "AliHLTDataSource.h" | |
18 | ||
19 | /** | |
20 | * @class AliHLTDataGenerator | |
21 | * An HLT data source component to produce random data. | |
22 | * | |
23 | * Component ID: \b DataGenerator <br> | |
24 | * Library: \b libAliHLTUtil. | |
25 | * | |
26 | * Mandatory arguments: <br> | |
27 | * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating --> | |
28 | * \li -datatype <i> datatype dataorigin </i> <br> | |
29 | * data type ID and origin, e.g. <tt>-datatype 'CLUSTERS' 'TPC ' </tt> | |
30 | * \li -dataspec <i> specification </i> <br> | |
31 | * data specification treated as decimal number or hex number if | |
32 | * prepended by '0x' | |
33 | * \li -minsize <i> size </i> <br> | |
34 | * the minimum size of the data to be produced | |
35 | * \li -maxsize <i> size </i> <br> | |
36 | * the maximum size of the data to be produced, default = minsize | |
37 | * | |
38 | * Optional arguments:<br> | |
39 | * \li -disisor <i> m </i> <br> | |
40 | * a disisor to shrink the size after \em modulo events | |
41 | * \li -offset <i> m </i> <br> | |
42 | * an offset to subtract from the size after \em modulo events | |
43 | * \li -modulo <i> n </i> <br> | |
44 | * size manipulated by the disisor or subtractor after \em n events | |
45 | * | |
46 | * The component produces data blocks of random content and random size in the | |
47 | * range of [\em minsize , \em maxsize ]. The size arguments can contain 'k' or | |
48 | * 'M' to indicate kByte or MByte. | |
49 | * @ingroup alihlt_component | |
50 | */ | |
51 | class AliHLTDataGenerator : public AliHLTDataSource { | |
52 | public: | |
53 | /** standard constructor */ | |
54 | AliHLTDataGenerator(); | |
55 | /** destructor */ | |
56 | virtual ~AliHLTDataGenerator(); | |
57 | ||
58 | const char* GetComponentID(); | |
59 | AliHLTComponentDataType GetOutputDataType(); | |
56951e49 | 60 | int GetOutputDataTypes(vector<AliHLTComponentDataType>& tgtList); |
81929b85 | 61 | void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); |
62 | AliHLTComponent* Spawn(); | |
63 | ||
64 | protected: | |
65 | /** | |
66 | * Init method. | |
67 | */ | |
68 | int DoInit( int argc, const char** argv ); | |
69 | ||
70 | /** | |
71 | * Deinit method. | |
72 | */ | |
73 | int DoDeinit(); | |
74 | ||
75 | /** | |
76 | * Data processing method for the component. | |
77 | * @param evtData event data structure | |
78 | * @param trigData trigger data structure | |
79 | * @param outputPtr pointer to target buffer | |
80 | * @param size <i>input</i>: size of target buffer | |
81 | * <i>output</i>:size of produced data | |
82 | * @param outputBlocks list to receive output block descriptors | |
83 | * @return | |
84 | */ | |
85 | int GetEvent( const AliHLTComponentEventData& evtData, | |
86 | AliHLTComponentTriggerData& trigData, | |
87 | AliHLTUInt8_t* outputPtr, | |
88 | AliHLTUInt32_t& size, | |
89 | vector<AliHLTComponentBlockData>& outputBlocks ); | |
90 | ||
a8abc5d5 | 91 | using AliHLTDataSource::GetEvent; |
92 | ||
81929b85 | 93 | /** |
94 | * Scan one argument and adjacent parameters. | |
95 | * Can be overloaded by child classes in order to add additional arguments | |
96 | * beyond the standard arguments of the file publisher. The method is called | |
97 | * whenever a non-standard argument is recognized. | |
98 | * @param argc size of the argument array | |
99 | * @param argv agument array for component initialization | |
100 | * @return number of processed members of the argv <br> | |
101 | * -EINVAL unknown argument <br> | |
102 | * -EPROTO parameter for argument missing <br> | |
103 | */ | |
104 | virtual int ScanArgument(int argc, const char** argv); | |
105 | ||
106 | protected: | |
107 | /** | |
108 | * Scan a size argument. | |
109 | * The argument is expected to be an integer, which can be suffixed by 'k' | |
110 | * or 'M' in order to indicate the base, kByte or MByte. | |
111 | * @param size target to store the size | |
112 | * @param arg the argument to scan | |
113 | */ | |
114 | int ScanSizeArgument(AliHLTUInt32_t &size, const char* arg); | |
115 | ||
116 | private: | |
117 | /** prohibit copy constructor */ | |
118 | AliHLTDataGenerator(const AliHLTDataGenerator&); | |
119 | /** prohibit assignment operator */ | |
120 | AliHLTDataGenerator& operator=(const AliHLTDataGenerator&); | |
121 | ||
122 | /** data type */ | |
123 | AliHLTComponentDataType fDataType; //! transient | |
124 | ||
125 | /** specification */ | |
126 | AliHLTUInt32_t fSpecification; //! transient | |
127 | ||
128 | /** the original size size */ | |
129 | AliHLTUInt32_t fSize; //! transient | |
130 | ||
131 | /** the manipulated size */ | |
132 | AliHLTUInt32_t fCurrSize; //! transient | |
133 | ||
134 | /** range */ | |
135 | AliHLTUInt32_t fRange; //! transient | |
136 | ||
137 | /** divisor */ | |
138 | AliHLTUInt32_t fDivisor; //! transient | |
139 | ||
140 | /** subtractor */ | |
141 | AliHLTUInt32_t fSubtractor; //! transient | |
142 | ||
143 | /** modulo for size manipulation */ | |
144 | AliHLTUInt32_t fModulo; //! transient | |
145 | ||
146 | ClassDef(AliHLTDataGenerator, 0) | |
147 | }; | |
148 | #endif |