]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 1 | //////////////////////////////////////////////// |
2 | // RawData classes for set:ITS // | |
3 | //////////////////////////////////////////////// | |
4 | ||
5 | ||
6 | #include "AliITSRawData.h" | |
7 | ||
8 | ClassImp(AliITSRawData) | |
9 | ||
10 | ClassImp(AliITSInStream) | |
11 | ||
12 | //_____________________________________________________________________________ | |
13 | ||
14 | AliITSInStream::AliITSInStream() | |
15 | { | |
16 | //default constructor | |
17 | fStreamLen=0; | |
18 | fInStream=0; | |
19 | } | |
20 | //_____________________________________________________________________________ | |
21 | ||
a8a6107b | 22 | AliITSInStream::AliITSInStream(UInt_t length) |
b0f5e3fc | 23 | { |
24 | // | |
25 | // Creates a stream of unsigned chars | |
26 | // | |
27 | ||
28 | fStreamLen = length; | |
29 | fInStream = new UChar_t[length]; | |
30 | ||
31 | ClearStream(); | |
32 | ||
33 | } | |
34 | ||
35 | //_____________________________________________________________________________ | |
36 | AliITSInStream::~AliITSInStream() | |
37 | { | |
38 | //destructor | |
39 | if (fInStream) delete[] fInStream; | |
40 | } | |
41 | ||
42 | //__________________________________________________________________________ | |
ac74f489 | 43 | AliITSInStream::AliITSInStream(const AliITSInStream &source) : TObject(source){ |
b0f5e3fc | 44 | // Copy Constructor |
45 | if(&source == this) return; | |
46 | this->fStreamLen = source.fStreamLen; | |
47 | this->fInStream = source.fInStream; | |
48 | return; | |
49 | } | |
50 | ||
51 | //_________________________________________________________________________ | |
52 | AliITSInStream& | |
53 | AliITSInStream::operator=(const AliITSInStream &source) { | |
54 | // Assignment operator | |
55 | if(&source == this) return *this; | |
56 | this->fStreamLen = source.fStreamLen; | |
57 | this->fInStream = source.fInStream; | |
58 | return *this; | |
59 | } | |
60 | ||
61 | //_____________________________________________________________________________ | |
62 | void AliITSInStream::ClearStream() | |
63 | { | |
64 | //clear the array | |
65 | memset(fInStream,0,sizeof(UChar_t)*fStreamLen); | |
66 | } | |
67 | ||
68 | ||
69 | //_____________________________________________________________________________ | |
a8a6107b | 70 | Bool_t AliITSInStream::CheckCount(UInt_t count) { |
b0f5e3fc | 71 | //check boundaries |
a8a6107b | 72 | if (count <= (UInt_t)fStreamLen) return kTRUE; |
b0f5e3fc | 73 | else { |
74 | Error("CheckCount", "actual size is %d, the necessary size is %d",fStreamLen,count); | |
75 | return kFALSE; | |
76 | } | |
77 | } | |
78 | ||
b0f5e3fc | 79 | |
80 | ClassImp(AliITSOutStream) | |
81 | ||
82 | //_______________________________________________________________________ | |
83 | ||
84 | AliITSOutStream::AliITSOutStream() { | |
85 | //default constructor | |
86 | fStreamLen=0; | |
87 | fOutStream=0; | |
88 | } | |
89 | ||
90 | //__________________________________________________________________________ | |
91 | ||
a8a6107b | 92 | AliITSOutStream::AliITSOutStream(UInt_t length) { |
b0f5e3fc | 93 | // |
94 | // Creates a stream of unsigned chars | |
95 | // | |
96 | ||
97 | fStreamLen = length; | |
a8a6107b | 98 | fOutStream = new UInt_t[length]; |
b0f5e3fc | 99 | ClearStream(); |
100 | ||
101 | } | |
102 | ||
103 | //_____________________________________________________________________________ | |
104 | AliITSOutStream::~AliITSOutStream() | |
105 | { | |
106 | //destructor | |
107 | if (fOutStream) delete[] fOutStream; | |
108 | } | |
109 | ||
110 | //__________________________________________________________________________ | |
ac74f489 | 111 | AliITSOutStream::AliITSOutStream(const AliITSOutStream &source):TObject(source){ |
b0f5e3fc | 112 | // Copy Constructor |
113 | if(&source == this) return; | |
114 | this->fStreamLen = source.fStreamLen; | |
115 | this->fOutStream = source.fOutStream; | |
116 | return; | |
117 | } | |
118 | ||
119 | //_________________________________________________________________________ | |
120 | AliITSOutStream& | |
121 | AliITSOutStream::operator=(const AliITSOutStream &source) { | |
122 | // Assignment operator | |
123 | if(&source == this) return *this; | |
124 | this->fStreamLen = source.fStreamLen; | |
125 | this->fOutStream = source.fOutStream; | |
126 | return *this; | |
127 | } | |
128 | ||
129 | //_____________________________________________________________________________ | |
130 | void AliITSOutStream::ClearStream() | |
131 | { | |
132 | // clear stream | |
a8a6107b | 133 | memset(fOutStream,0,sizeof(UInt_t)*fStreamLen); |
b0f5e3fc | 134 | } |
135 | ||
136 | //_____________________________________________________________________________ | |
a8a6107b | 137 | Bool_t AliITSOutStream::CheckCount(UInt_t count) |
b0f5e3fc | 138 | { |
139 | //check boundaries | |
140 | if (count < fStreamLen) return kTRUE; | |
141 | else { | |
142 | Error("CheckCount", "actual size is %d, the necessary size is %d",fStreamLen,count); | |
143 | return kFALSE; | |
144 | } | |
145 | } |