]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRawData.cxx
Automatic streamer used and forward declarations added
[u/mrichter/AliRoot.git] / ITS / AliITSRawData.cxx
CommitLineData
b0f5e3fc 1////////////////////////////////////////////////
2// RawData classes for set:ITS //
3////////////////////////////////////////////////
4
5
6#include "AliITSRawData.h"
7
8ClassImp(AliITSRawData)
9
10ClassImp(AliITSInStream)
11
12//_____________________________________________________________________________
13
14AliITSInStream::AliITSInStream()
15{
16 //default constructor
17 fStreamLen=0;
18 fInStream=0;
19}
20//_____________________________________________________________________________
21
22AliITSInStream::AliITSInStream(ULong_t length)
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//_____________________________________________________________________________
36AliITSInStream::~AliITSInStream()
37{
38 //destructor
39 if (fInStream) delete[] fInStream;
40}
41
42//__________________________________________________________________________
43AliITSInStream::AliITSInStream(const AliITSInStream &source){
44 // Copy Constructor
45 if(&source == this) return;
46 this->fStreamLen = source.fStreamLen;
47 this->fInStream = source.fInStream;
48 return;
49}
50
51//_________________________________________________________________________
52AliITSInStream&
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//_____________________________________________________________________________
62void AliITSInStream::ClearStream()
63{
64 //clear the array
65 memset(fInStream,0,sizeof(UChar_t)*fStreamLen);
66}
67
68
69//_____________________________________________________________________________
70Bool_t AliITSInStream::CheckCount(ULong_t count) {
71 //check boundaries
72 if (count <= (ULong_t)fStreamLen) return kTRUE;
73 else {
74 Error("CheckCount", "actual size is %d, the necessary size is %d",fStreamLen,count);
75 return kFALSE;
76 }
77}
78
79//____________________________________________________________________________
80void AliITSInStream::Streamer(TBuffer &R__b){
81 // Stream an object of class AliITSInStream.
82
83 static unsigned char *array;
84 static Bool_t make=kTRUE;
85
86 if (R__b.IsReading()) {
87 R__b >> fStreamLen;
88 //printf("Streamer: fStreamLen %d\n",fStreamLen);
89 if (make) array=new unsigned char[fStreamLen];
90 make=kFALSE;
91 memset(array,0,sizeof(UChar_t)*fStreamLen);
92 fInStream=array;
93 R__b.ReadFastArray(fInStream,fStreamLen);
94
95 } else {
96 R__b << fStreamLen;
97 R__b.WriteFastArray(fInStream,fStreamLen);
98 }
99}
100
101
102
103ClassImp(AliITSOutStream)
104
105 //_______________________________________________________________________
106
107 AliITSOutStream::AliITSOutStream() {
108 //default constructor
109 fStreamLen=0;
110 fOutStream=0;
111}
112
113//__________________________________________________________________________
114
115AliITSOutStream::AliITSOutStream(ULong_t length) {
116 //
117 // Creates a stream of unsigned chars
118 //
119
120 fStreamLen = length;
121 fOutStream = new ULong_t[length];
122 ClearStream();
123
124}
125
126//_____________________________________________________________________________
127AliITSOutStream::~AliITSOutStream()
128{
129 //destructor
130 if (fOutStream) delete[] fOutStream;
131}
132
133//__________________________________________________________________________
134AliITSOutStream::AliITSOutStream(const AliITSOutStream &source){
135 // Copy Constructor
136 if(&source == this) return;
137 this->fStreamLen = source.fStreamLen;
138 this->fOutStream = source.fOutStream;
139 return;
140}
141
142//_________________________________________________________________________
143AliITSOutStream&
144 AliITSOutStream::operator=(const AliITSOutStream &source) {
145 // Assignment operator
146 if(&source == this) return *this;
147 this->fStreamLen = source.fStreamLen;
148 this->fOutStream = source.fOutStream;
149 return *this;
150}
151
152//_____________________________________________________________________________
153void AliITSOutStream::ClearStream()
154{
155 // clear stream
156 memset(fOutStream,0,sizeof(ULong_t)*fStreamLen);
157}
158
159//_____________________________________________________________________________
160Bool_t AliITSOutStream::CheckCount(ULong_t count)
161{
162 //check boundaries
163 if (count < fStreamLen) return kTRUE;
164 else {
165 Error("CheckCount", "actual size is %d, the necessary size is %d",fStreamLen,count);
166 return kFALSE;
167 }
168}
169
170//____________________________________________________________________________
171void AliITSOutStream::Streamer(TBuffer &R__b){
172
173 // Stream an object of class AliITSOutStream.
174
175 static unsigned long *array;
176 static Bool_t make=kTRUE;
177
178 if (R__b.IsReading()) {
179 R__b >> fStreamLen;
180 //printf("Streamer: fStreamLen %d\n",fStreamLen);
181 if (make) array=new unsigned long[fStreamLen];
182 make=kFALSE;
183 memset(array,0,sizeof(ULong_t)*fStreamLen);
184 fOutStream=array;
185 R__b.ReadFastArray(fOutStream,fStreamLen);
186
187 } else {
188 R__b << fStreamLen;
189 R__b.WriteFastArray(fOutStream,fStreamLen);
190 }
191}
192