]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataTypes.h
Refactoring of classes + cleanup + documentaion.
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDataTypes.h
1 // @(#) $Id$
2
3 #ifndef ALIHLTDATATYPES_H
4 #define ALIHLTDATATYPES_H
5 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6  * See cxx source for full Copyright notice                               */
7
8 /** @file   AliHLTDataTypes.h
9     @author Matthias Richter, Timm Steinbeck
10     @date   
11     @brief  Data type declaration for the HLT module.
12 */
13
14 using namespace std;
15
16 extern "C" {
17
18   typedef unsigned char AliHLTUInt8_t;
19
20   typedef unsigned short AliHLTUInt16_t;
21
22   typedef unsigned int AliHLTUInt32_t;
23
24   typedef unsigned long long AliHLTUInt64_t;
25
26   typedef AliHLTUInt64_t AliHLTEventID_t;
27
28   enum AliHLTComponentLogSeverity { kHLTLogNone=0, kHLTLogBenchmark=1, kHLTLogDebug=2, kHLTLogInfo=4, kHLTLogWarning=8, kHLTLogError=16, kHLTLogFatal=32, kHLTLogAll=0x3f, kHLTLogDefault=0x3d };
29
30   struct AliHLTComponentEventData
31   {
32     AliHLTUInt32_t fStructSize;
33     AliHLTEventID_t fEventID;
34     AliHLTUInt32_t fEventCreation_s;
35     AliHLTUInt32_t fEventCreation_us;
36     AliHLTUInt32_t fBlockCnt;
37   };
38
39   const AliHLTEventID_t kAliHLTVoidEventID=~(AliHLTEventID_t)0;
40   struct AliHLTComponentShmData
41   {
42     AliHLTUInt32_t fStructSize;
43     AliHLTUInt32_t fShmType;
44     AliHLTUInt64_t fShmID;
45   };
46
47     const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
48     const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
49
50   const int kAliHLTComponentDataTypefIDsize=8;
51   const int kAliHLTComponentDataTypefOriginSize=4;
52   struct AliHLTComponentDataType
53   {
54     AliHLTUInt32_t fStructSize;
55     char fID[kAliHLTComponentDataTypefIDsize];
56     char fOrigin[kAliHLTComponentDataTypefOriginSize];
57   };
58
59 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
60 # define kAliHLTVoidDataOrigin "\0\0\0"
61 # define kAliHLTAnyDataTypeID "*******"
62 # define kAliHLTAnyDataOrigin "***"
63   const AliHLTComponentDataType kAliHLTVoidDataType = {sizeof(AliHLTComponentDataType), kAliHLTVoidDataTypeID, kAliHLTVoidDataOrigin};
64   const AliHLTComponentDataType kAliHLTAnyDataType  = {sizeof(AliHLTComponentDataType), kAliHLTAnyDataTypeID, kAliHLTAnyDataOrigin};
65   const AliHLTUInt32_t kAliHLTVoidDataSpec = ~(AliHLTUInt32_t)0;
66   
67   struct AliHLTComponentBlockData
68   {
69     AliHLTUInt32_t fStructSize;
70     AliHLTComponentShmData fShmKey;
71     AliHLTUInt32_t fOffset;
72     void* fPtr;
73     AliHLTUInt32_t fSize;
74     AliHLTComponentDataType fDataType;
75     AliHLTUInt32_t fSpecification;
76   };
77
78   struct AliHLTComponentTriggerData
79   {
80     AliHLTUInt32_t fStructSize;
81     AliHLTUInt32_t fDataSize;
82     void* fData;
83   };
84   
85   struct AliHLTComponentEventDoneData
86   {
87     AliHLTUInt32_t fStructSize;
88     AliHLTUInt32_t fDataSize;
89     void* fData;
90   };
91
92   typedef int (*AliHLTfctLogging)( void* param, AliHLTComponentLogSeverity severity, const char* origin, const char* keyword, const char* message );
93
94   struct AliHLTComponentEnvironment
95   {
96     AliHLTUInt32_t fStructSize;
97     void* fParam;
98     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
99 #if 0
100     int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation ); // future addition already foreseen/envisioned
101 #endif
102     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
103     AliHLTfctLogging fLoggingFunc;
104   };
105 }
106
107 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
108     {
109     for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
110         if ( dt1.fID[i] != dt2.fID[i] )
111             return false;
112     for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
113         if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
114             return false;
115     return true;
116     }
117
118 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
119     {
120     for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
121         if ( dt1.fID[i] != dt2.fID[i] )
122             return true;
123     for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
124         if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
125             return true;
126     return false;
127     }
128
129 #endif