]>
Commit | Line | Data |
---|---|---|
a197a4ce | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
9edefa04 | 16 | // @(#)alimdc:$Name$:$Id$ |
17 | // Author: Fons Rademakers 26/11/99 | |
18 | ||
a197a4ce | 19 | ////////////////////////////////////////////////////////////////////////// |
20 | // // | |
21 | // AliRawEquipmentHeader // | |
22 | // // | |
23 | ////////////////////////////////////////////////////////////////////////// | |
24 | ||
9edefa04 | 25 | #include <Bytes.h> |
a197a4ce | 26 | |
9edefa04 | 27 | #include "AliRawEquipmentHeader.h" |
a197a4ce | 28 | |
29 | ClassImp(AliRawEquipmentHeader) | |
30 | ||
c53ff744 | 31 | //______________________________________________________________________________ |
32 | AliRawEquipmentHeader::AliRawEquipmentHeader(): | |
33 | fSize(0), | |
34 | fEquipmentType(0), | |
58d3c7c2 | 35 | fEquipmentID(0xffffffff), |
c53ff744 | 36 | fBasicElementSizeType(0) |
37 | { | |
38 | // Default constructor | |
39 | for(Int_t i = 0; i < kAttributeWords; i++) | |
40 | fTypeAttribute[i] = 0; | |
41 | } | |
a197a4ce | 42 | |
e653e3e1 | 43 | //______________________________________________________________________________ |
44 | UInt_t AliRawEquipmentHeader::SwapWord(UInt_t x) const | |
45 | { | |
46 | // Swap the endianess of the integer value 'x' | |
47 | ||
48 | return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) | | |
49 | ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24)); | |
50 | } | |
51 | ||
a197a4ce | 52 | //______________________________________________________________________________ |
53 | void AliRawEquipmentHeader::Swap() | |
54 | { | |
55 | // Swap equipment header data. There is no way to see if the data | |
56 | // has already been swapped. This method is only called when the | |
57 | // header is read from the DATE event builder (GDC). | |
58 | ||
e653e3e1 | 59 | fSize = SwapWord(fSize); |
60 | fEquipmentType = SwapWord(fEquipmentType); | |
61 | fEquipmentID = SwapWord(fEquipmentID); | |
62 | fBasicElementSizeType = SwapWord(fBasicElementSizeType); | |
a197a4ce | 63 | for (int i = 0; i < kAttributeWords; i++) |
e653e3e1 | 64 | fTypeAttribute[i] = SwapWord(fTypeAttribute[i]); |
a197a4ce | 65 | } |
6bc85955 | 66 | |
67 | //______________________________________________________________________________ | |
68 | void AliRawEquipmentHeader::Reset() | |
69 | { | |
70 | // Reset the contents of the equipment | |
71 | // header data | |
58d3c7c2 | 72 | fSize = fEquipmentType = fBasicElementSizeType = 0; |
73 | fEquipmentID = 0xffffffff; | |
6bc85955 | 74 | |
75 | for(Int_t i = 0; i < kAttributeWords; i++) | |
76 | fTypeAttribute[i] = 0; | |
77 | } |