]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTControlTask.h
Fixing generation of bit mask for TObject::fBits field.
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTControlTask.h
CommitLineData
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
18class AliHLTComponentHandler;
19class 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 */
37class 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:
3baf1595 49 AliHLTControlEventGuard(AliHLTControlTask* me, AliHLTComponentBlockDataList& list) :
afad6dde 50 fTask(me) {
51 if (!fTask) return;
3baf1595 52 fTask->SetBlocks(list);
53 }
54 ~AliHLTControlEventGuard() {
55 if (!fTask) return;
56 fTask->ResetBlocks();
afad6dde 57 }
afad6dde 58
59 private:
60 /** standard constructor prohibited */
61 AliHLTControlEventGuard();
62 /** copy constructor prohibited */
63 AliHLTControlEventGuard(const AliHLTControlEventGuard&);
64 /** assignment operator prohibited */
65 AliHLTControlEventGuard& operator=(const AliHLTControlEventGuard&);
66
67 /** by the guard controlled task */
68 AliHLTControlTask* fTask; //! transient
69 };
70
71 /**
72 * Source component producing the data blocks
73 */
74 class AliHLTControlEventComponent : public AliHLTDataSource {
75 public:
76 AliHLTControlEventComponent(const AliHLTControlTask* pParent);
77 ~AliHLTControlEventComponent();
78
79 // AliHLTComponent interface functions
80 const char* GetComponentID() {return "__priv_AliHLTControlTask";}
81 AliHLTComponentDataType GetOutputDataType();
82 int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
83 void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
84 AliHLTComponent* Spawn() {return NULL;}
85
86 private:
87 /** standard constructor prohibited */
88 AliHLTControlEventComponent();
89 /** copy constructor prohibited */
90 AliHLTControlEventComponent(const AliHLTControlEventComponent&);
91 /** assignment operator prohibited */
92 AliHLTControlEventComponent& operator=(const AliHLTControlEventComponent&);
93
94 // AliHLTDataSource interface function
95 int GetEvent(const AliHLTComponentEventData& evtData,
96 AliHLTComponentTriggerData& trigData,
97 AliHLTUInt8_t* outputPtr,
98 AliHLTUInt32_t& size,
99 vector<AliHLTComponentBlockData>& outputBlocks );
100
101 const AliHLTControlTask* fpParent; //! transient
102 };
103
104 protected:
3baf1595 105 /// to be used from the guard
106 void SetBlocks(const AliHLTComponentBlockDataList& list);
107 /// to be used from the guard
108 void ResetBlocks();
afad6dde 109
110 private:
111 /** copy constructor prohibited */
112 AliHLTControlTask(const AliHLTControlTask&);
113 /** assignment operator prohibited */
114 AliHLTControlTask& operator=(const AliHLTControlTask&);
115
3baf1595 116 /** list of control blocks */
117 AliHLTComponentBlockDataList fBlocks; //! transient
118 /** payload buffer for all control blocks */
afad6dde 119 AliHLTUInt8_t* fpData; //! transient
120 /** payload size */
121 AliHLTUInt32_t fSize; //!transient
122
123 ClassDef(AliHLTControlTask, 0)
3baf1595 124};
afad6dde 125#endif