]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTDataTypes.h
e71d5f92db7bb5391dd5749e67a74e5d0a13d9ad
[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=0x39 };
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   struct AliHLTComponentShmData
40   {
41     AliHLTUInt32_t fStructSize;
42     AliHLTUInt32_t fShmType;
43     AliHLTUInt64_t fShmID;
44   };
45
46     const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
47     const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
48
49   const int kAliHLTComponentDataTypefIDsize=8;
50   const int kAliHLTComponentDataTypefOriginSize=4;
51   struct AliHLTComponentDataType
52   {
53     AliHLTUInt32_t fStructSize;
54     char fID[kAliHLTComponentDataTypefIDsize];
55     char fOrigin[kAliHLTComponentDataTypefOriginSize];
56   };
57
58 # define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
59 # define kAliHLTVoidDataOrigin "\0\0\0"
60 # define kAliHLTAnyDataTypeID "*******"
61 # define kAliHLTAnyDataOrigin "***"
62   const AliHLTComponentDataType kAliHLTVoidDataType = {sizeof(AliHLTComponentDataType), kAliHLTVoidDataTypeID, kAliHLTVoidDataOrigin};
63   const AliHLTComponentDataType kAliHLTAnyDataType  = {sizeof(AliHLTComponentDataType), kAliHLTAnyDataTypeID, kAliHLTAnyDataOrigin};
64   
65   struct AliHLTComponentBlockData
66   {
67     AliHLTUInt32_t fStructSize;
68     AliHLTComponentShmData fShmKey;
69     AliHLTUInt32_t fOffset;
70     void* fPtr;
71     AliHLTUInt32_t fSize;
72     AliHLTComponentDataType fDataType;
73     AliHLTUInt32_t fSpecification;
74   };
75
76   struct AliHLTComponentTriggerData
77   {
78     AliHLTUInt32_t fStructSize;
79     AliHLTUInt32_t fDataSize;
80     void* fData;
81   };
82   
83   struct AliHLTComponentEventDoneData
84   {
85     AliHLTUInt32_t fStructSize;
86     AliHLTUInt32_t fDataSize;
87     void* fData;
88   };
89
90   typedef int (*AliHLTfctLogging)( void* param, AliHLTComponentLogSeverity severity, const char* origin, const char* keyword, const char* message );
91
92   struct AliHLTComponentEnvironment
93   {
94     AliHLTUInt32_t fStructSize;
95     void* fParam;
96     void* (*fAllocMemoryFunc)( void* param, unsigned long size );
97 #if 0
98     int (*fAllocShmMemoryFunc)( void* param, unsigned long size, AliHLTComponentBlockData* blockLocation ); // future addition already foreseen/envisioned
99 #endif
100     int (*fGetEventDoneDataFunc)( void* param, AliHLTEventID_t eventID, unsigned long size, AliHLTComponentEventDoneData** edd );
101     AliHLTfctLogging fLoggingFunc;
102   };
103 }
104
105 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
106     {
107     for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
108         if ( dt1.fID[i] != dt2.fID[i] )
109             return false;
110     for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
111         if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
112             return false;
113     return true;
114     }
115
116 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
117     {
118     for ( int i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
119         if ( dt1.fID[i] != dt2.fID[i] )
120             return true;
121     for ( int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
122         if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
123             return true;
124     return false;
125     }
126
127 #endif