1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // @(#)alimdc:$Name$:$Id$
17 // Author: Fons Rademakers 26/11/99
19 //////////////////////////////////////////////////////////////////////////
21 // AliRawEquipmentHeader //
23 //////////////////////////////////////////////////////////////////////////
27 #include "AliRawEquipmentHeader.h"
29 ClassImp(AliRawEquipmentHeader)
31 //______________________________________________________________________________
32 AliRawEquipmentHeader::AliRawEquipmentHeader():
35 fEquipmentID(0xffffffff),
36 fBasicElementSizeType(0)
38 // Default constructor
39 for(Int_t i = 0; i < kAttributeWords; i++)
40 fTypeAttribute[i] = 0;
43 //______________________________________________________________________________
44 UInt_t AliRawEquipmentHeader::SwapWord(UInt_t x) const
46 // Swap the endianess of the integer value 'x'
48 return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
49 ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24));
52 //______________________________________________________________________________
53 void AliRawEquipmentHeader::Swap()
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).
59 fSize = SwapWord(fSize);
60 fEquipmentType = SwapWord(fEquipmentType);
61 fEquipmentID = SwapWord(fEquipmentID);
62 fBasicElementSizeType = SwapWord(fBasicElementSizeType);
63 for (int i = 0; i < kAttributeWords; i++)
64 fTypeAttribute[i] = SwapWord(fTypeAttribute[i]);
67 //______________________________________________________________________________
68 void AliRawEquipmentHeader::Reset()
70 // Reset the contents of the equipment
72 fSize = fEquipmentType = fBasicElementSizeType = 0;
73 fEquipmentID = 0xffffffff;
75 for(Int_t i = 0; i < kAttributeWords; i++)
76 fTypeAttribute[i] = 0;