]>
Commit | Line | Data |
---|---|---|
afad6dde | 1 | //-*- Mode: C++ -*- |
2 | // $Id$ | |
3 | #ifndef ALIHLTCONTROLTASK_H | |
4 | #define ALIHLTCONTROLTASK_H | |
5 | //* This file is property of and copyright by the ALICE HLT Project * | |
6 | //* ALICE Experiment at CERN, All rights reserved. * | |
7 | //* See cxx source for full Copyright notice * | |
8 | ||
9 | /** @file AliHLTControlTask.h | |
10 | @author Matthias Richter | |
11 | @date | |
12 | @brief Special task to produce the control events. | |
13 | */ | |
14 | ||
15 | #include "AliHLTTask.h" | |
16 | #include "AliHLTDataSource.h" | |
17 | ||
18 | class AliHLTComponentHandler; | |
19 | class AliHLTConfiguration; | |
20 | ||
21 | /** | |
22 | * @class AliHLTControlTask | |
23 | * This task is automatically added to the beginning of each chain and | |
24 | * produces the special steering events. The first component in every | |
25 | * branch get the special events from the task. | |
26 | * | |
27 | * This task gets initialized with data type, specification and payload | |
28 | * of the control event to be sent. It produces the data block if data | |
29 | * type differs from fAliHLTVoidDataType. The guard class can be used to | |
30 | * set the parameters. | |
31 | * <pre> | |
32 | * AliHLTControlEventGuard(task, kAliHLTDataTypeSOR, 0, payload, size); | |
33 | * </pre> | |
34 | * | |
35 | * @ingroup alihlt_system | |
36 | */ | |
37 | class AliHLTControlTask : public AliHLTTask { | |
38 | public: | |
39 | /** constructor */ | |
40 | AliHLTControlTask(); | |
41 | /** standard destructor */ | |
42 | virtual ~AliHLTControlTask(); | |
43 | ||
44 | // AliHLTTask interface function | |
45 | int CreateComponent(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH, AliHLTComponent*& pComponent) const; | |
46 | ||
47 | class AliHLTControlEventGuard { | |
48 | public: | |
49 | AliHLTControlEventGuard(AliHLTControlTask* me, AliHLTComponentDataType dt, AliHLTUInt32_t spec, AliHLTUInt8_t* pData, AliHLTUInt32_t size) : | |
50 | fTask(me) { | |
51 | if (!fTask) return; | |
52 | fTask->fEvent=dt; | |
53 | fTask->fSpecification=spec; | |
54 | fTask->fpData=pData; | |
55 | fTask->fSize=size; | |
56 | } | |
57 | ~AliHLTControlEventGuard() { | |
58 | if (!fTask) return; | |
59 | fTask->fEvent=kAliHLTVoidDataType; | |
60 | fTask->fSpecification=kAliHLTVoidDataSpec; | |
61 | fTask->fpData=NULL; | |
62 | fTask->fSize=0; | |
63 | } | |
64 | ||
65 | private: | |
66 | /** standard constructor prohibited */ | |
67 | AliHLTControlEventGuard(); | |
68 | /** copy constructor prohibited */ | |
69 | AliHLTControlEventGuard(const AliHLTControlEventGuard&); | |
70 | /** assignment operator prohibited */ | |
71 | AliHLTControlEventGuard& operator=(const AliHLTControlEventGuard&); | |
72 | ||
73 | /** by the guard controlled task */ | |
74 | AliHLTControlTask* fTask; //! transient | |
75 | }; | |
76 | ||
77 | /** | |
78 | * Source component producing the data blocks | |
79 | */ | |
80 | class AliHLTControlEventComponent : public AliHLTDataSource { | |
81 | public: | |
82 | AliHLTControlEventComponent(const AliHLTControlTask* pParent); | |
83 | ~AliHLTControlEventComponent(); | |
84 | ||
85 | // AliHLTComponent interface functions | |
86 | const char* GetComponentID() {return "__priv_AliHLTControlTask";} | |
87 | AliHLTComponentDataType GetOutputDataType(); | |
88 | int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList); | |
89 | void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ); | |
90 | AliHLTComponent* Spawn() {return NULL;} | |
91 | ||
92 | private: | |
93 | /** standard constructor prohibited */ | |
94 | AliHLTControlEventComponent(); | |
95 | /** copy constructor prohibited */ | |
96 | AliHLTControlEventComponent(const AliHLTControlEventComponent&); | |
97 | /** assignment operator prohibited */ | |
98 | AliHLTControlEventComponent& operator=(const AliHLTControlEventComponent&); | |
99 | ||
100 | // AliHLTDataSource interface function | |
101 | int GetEvent(const AliHLTComponentEventData& evtData, | |
102 | AliHLTComponentTriggerData& trigData, | |
103 | AliHLTUInt8_t* outputPtr, | |
104 | AliHLTUInt32_t& size, | |
105 | vector<AliHLTComponentBlockData>& outputBlocks ); | |
106 | ||
107 | const AliHLTControlTask* fpParent; //! transient | |
108 | }; | |
109 | ||
110 | protected: | |
111 | ||
112 | private: | |
113 | /** copy constructor prohibited */ | |
114 | AliHLTControlTask(const AliHLTControlTask&); | |
115 | /** assignment operator prohibited */ | |
116 | AliHLTControlTask& operator=(const AliHLTControlTask&); | |
117 | ||
118 | /** data type of the control event */ | |
119 | AliHLTComponentDataType fEvent; //! transient | |
120 | /** specification of the control evtent */ | |
121 | AliHLTUInt32_t fSpecification; //! transient | |
122 | /** payload to be sent with the control event */ | |
123 | AliHLTUInt8_t* fpData; //! transient | |
124 | /** payload size */ | |
125 | AliHLTUInt32_t fSize; //!transient | |
126 | ||
127 | ClassDef(AliHLTControlTask, 0) | |
128 | }; | |
129 | #endif |