]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliRawEquipmentHeader.cxx
Test for Coverity
[u/mrichter/AliRoot.git] / RAW / AliRawEquipmentHeader.cxx
CommitLineData
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
d04aea32 16// @(#) $Id$
9edefa04 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"
12e921cc 28#include "AliDAQ.h"
29
30#include <Riostream.h>
a197a4ce 31
32ClassImp(AliRawEquipmentHeader)
33
c53ff744 34//______________________________________________________________________________
35AliRawEquipmentHeader::AliRawEquipmentHeader():
36 fSize(0),
37 fEquipmentType(0),
58d3c7c2 38 fEquipmentID(0xffffffff),
c53ff744 39 fBasicElementSizeType(0)
40{
41 // Default constructor
42 for(Int_t i = 0; i < kAttributeWords; i++)
43 fTypeAttribute[i] = 0;
44}
a197a4ce 45
e653e3e1 46//______________________________________________________________________________
47UInt_t AliRawEquipmentHeader::SwapWord(UInt_t x) const
48{
49 // Swap the endianess of the integer value 'x'
50
51 return (((x & 0x000000ffU) << 24) | ((x & 0x0000ff00U) << 8) |
52 ((x & 0x00ff0000U) >> 8) | ((x & 0xff000000U) >> 24));
53}
54
a197a4ce 55//______________________________________________________________________________
56void AliRawEquipmentHeader::Swap()
57{
58 // Swap equipment header data. There is no way to see if the data
59 // has already been swapped. This method is only called when the
60 // header is read from the DATE event builder (GDC).
61
e653e3e1 62 fSize = SwapWord(fSize);
63 fEquipmentType = SwapWord(fEquipmentType);
64 fEquipmentID = SwapWord(fEquipmentID);
65 fBasicElementSizeType = SwapWord(fBasicElementSizeType);
a197a4ce 66 for (int i = 0; i < kAttributeWords; i++)
e653e3e1 67 fTypeAttribute[i] = SwapWord(fTypeAttribute[i]);
a197a4ce 68}
6bc85955 69
70//______________________________________________________________________________
71void AliRawEquipmentHeader::Reset()
72{
73 // Reset the contents of the equipment
74 // header data
58d3c7c2 75 fSize = fEquipmentType = fBasicElementSizeType = 0;
76 fEquipmentID = 0xffffffff;
6bc85955 77
78 for(Int_t i = 0; i < kAttributeWords; i++)
79 fTypeAttribute[i] = 0;
80}
12e921cc 81
82//_____________________________________________________________________________
83void AliRawEquipmentHeader::Print( const Option_t* opt ) const
84{
85 // Dumps the equipment header
86 // fields
87
88 cout << opt << " Equipment size: " << fSize << endl;
89 cout << opt << " Equipment type: " << fEquipmentType << endl;
90 Int_t ddlIndex;
91 cout << opt << " Equipment ID: " << fEquipmentID << " ( " << AliDAQ::DetectorNameFromDdlID(fEquipmentID,ddlIndex) << " )" << endl;
92 cout << opt << " Type attribute: " << fTypeAttribute[0] << "-" << fTypeAttribute[1] << "-" << fTypeAttribute[2] << endl;
93 cout << opt << " Basic element size type: " << fBasicElementSizeType << endl;
94}