42 TLeafB::TLeafB(TBranch *parent,
const char* name,
const char* type)
43 : TLeaf(parent, name, type)
57 if (ResetAddress(0, kTRUE)) {
68 void TLeafB::Export(TClonesArray* list, Int_t n)
70 for (Int_t i = 0, j = 0; i < n; i++, j += fLen) {
71 memcpy(((
char*) list->UncheckedAt(i)) + fOffset, &fValue[j], fLen);
78 void TLeafB::FillBasket(TBuffer& b)
85 if (fValue[0] > fMaximum) {
90 for (Int_t i = 0; i < len; i++) {
91 b << (UChar_t) fValue[i];
94 b.WriteFastArray(fValue, len);
101 const char *TLeafB::GetTypeName()
const
112 Bool_t TLeafB::IncludeRange(TLeaf *input)
115 if (input->GetMaximum() > this->GetMaximum())
116 this->SetMaximum( input->GetMaximum() );
117 if (input->GetMinimum() < this->GetMinimum())
118 this->SetMinimum( input->GetMinimum() );
128 void TLeafB::Import(TClonesArray *list, Int_t n)
130 for (Int_t i = 0, j = 0; i < n; i++, j+= fLen) {
131 memcpy(&fValue[j], ((
char*) list->UncheckedAt(i)) + fOffset, fLen);
138 void TLeafB::PrintValue(Int_t l)
const
141 UChar_t *uvalue = (UChar_t*) GetValuePointer();
142 printf(
"%u", uvalue[l]);
144 Char_t *value = (Char_t*) GetValuePointer();
145 printf(
"%d", value[l]);
152 void TLeafB::ReadBasket(TBuffer &b)
154 if (!fLeafCount && (fNdata == 1)) {
155 b.ReadChar(fValue[0]);
158 Long64_t entry = fBranch->GetReadEntry();
159 if (fLeafCount->GetBranch()->GetReadEntry() != entry) {
160 fLeafCount->GetBranch()->GetEntry(entry);
162 Int_t len = Int_t(fLeafCount->GetValue());
163 if (len > fLeafCount->GetMaximum()) {
164 Error(
"ReadBasket",
"leaf: '%s' len: %d max: %d", GetName(), len, fLeafCount->GetMaximum());
165 len = fLeafCount->GetMaximum();
168 b.ReadFastArray(fValue, len*fLen);
170 b.ReadFastArray(fValue, fLen);
179 void TLeafB::ReadBasketExport(TBuffer& b, TClonesArray* list, Int_t n)
181 b.ReadFastArray(fValue, n*fLen);
183 for (Int_t i = 0, j = 0; i < n; i++, j += fLen) {
184 memcpy(((
char*) list->UncheckedAt(i)) + fOffset, &fValue[j], fLen);
191 void TLeafB::ReadValue(std::istream &s, Char_t )
194 UChar_t *uvalue = (UChar_t*)GetValuePointer();
195 for (Int_t i=0;i<fLen;i++) {
201 Char_t *value = (Char_t*)GetValuePointer();
202 for (Int_t i=0;i<fLen;i++) {
213 void TLeafB::SetAddress(
void *addr)
217 if (ResetAddress(addr)) {
224 if (TestBit(kIndirectAddress)) {
226 fPointer = (Char_t**) addr;
229 Int_t ncountmax = fLen;
231 ncountmax = (fLeafCount->GetMaximum() + 1) * fLen;
234 if ((fLeafCount && (Int_t(fLeafCount->GetValue()) < ncountmax)) ||
235 (fNdata < ncountmax) ||
258 if (fNdata < ncountmax) {
263 *fPointer =
new Char_t[fNdata];
269 fValue = (
char*) addr;
274 fValue =
new char[fNdata];