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