1 #ifndef ALIHLTCDHWRAPPER_H
2 #define ALIHLTCDHWRAPPER_H
5 #include "AliRawDataHeader.h"
6 #include "AliRawDataHeaderV3.h"
8 #define CHECK_AND_CALL(func, args...) \
9 ( GetVersion() == 2 ? \
10 reinterpret_cast<const AliRawDataHeader*>(fCDH)->func(args) : \
11 reinterpret_cast<const AliRawDataHeaderV3*>(fCDH)->func(args) )
14 class AliHLTCDHWrapper {
16 AliHLTCDHWrapper() : fCDH(NULL) {}
17 AliHLTCDHWrapper(const AliHLTCDHWrapper& other) : fCDH(other.fCDH) { CheckVersion(); }
18 AliHLTCDHWrapper(const void* cdh) : fCDH(cdh) { CheckVersion(); }
20 ~AliHLTCDHWrapper() {}
22 inline AliHLTCDHWrapper& operator=(const AliHLTCDHWrapper& other) {
28 inline AliHLTCDHWrapper& operator=(const void*& cdh) {
34 inline void CheckVersion() {
36 assert(GetVersion() == 2 || GetVersion() == 3);
39 inline UChar_t GetVersion() const {
40 return (reinterpret_cast<const AliRawDataHeader*>(fCDH))->GetVersion();
43 inline UInt_t GetHeaderSize() {
44 return (GetVersion() == 2 ?
45 sizeof(AliRawDataHeader) : sizeof(AliRawDataHeaderV3) );
48 inline const void* GetHeader() const {
52 inline UInt_t GetDataSize() const {
53 //first word, independent of Version
54 return *((UInt_t*)fCDH);
57 inline UShort_t GetEventID1() const {
58 return CHECK_AND_CALL(GetEventID1);
61 inline UInt_t GetEventID2() const {
62 return CHECK_AND_CALL(GetEventID2);
65 inline UChar_t GetL1TriggerMessage() const {
66 return CHECK_AND_CALL(GetL1TriggerMessage);
69 inline UChar_t GetAttributes() const {
70 return CHECK_AND_CALL(GetAttributes);
73 inline Bool_t TestAttribute(Int_t index) const {
74 return CHECK_AND_CALL(TestAttribute, index);
78 inline void SetAttribute(Int_t index) {
79 CHECK_AND_CALL(SetAttribute, index);
84 inline void ResetAttribute(Int_t index) {
85 CHECK_AND_CALL(ResetAttribute, index);
89 inline UInt_t GetSubDetectors() const {
90 return CHECK_AND_CALL(GetSubDetectors);
93 inline UInt_t GetStatus() const {
94 return CHECK_AND_CALL(GetStatus);
97 inline UInt_t GetMiniEventID() const {
98 return CHECK_AND_CALL(GetMiniEventID);
101 inline ULong64_t GetTriggerClasses() const {
102 return CHECK_AND_CALL(GetTriggerClasses);
105 inline ULong64_t GetTriggerClassesNext50() const {
106 return CHECK_AND_CALL(GetTriggerClassesNext50);
109 inline ULong64_t GetROI() const {
110 return CHECK_AND_CALL(GetROI);
114 inline void SetTriggerClass(ULong64_t mask) {
115 CHECK_AND_CALL(SetTriggerClass, mask);