42 TTreeRow::TTreeRow(Int_t nfields)
44 fColumnCount = nfields;
54 TTreeRow::TTreeRow(Int_t nfields,
const Int_t *fields,
const char *row)
56 fColumnCount = nfields;
67 TTreeRow::TTreeRow(TSQLRow *original)
75 Error(
"TTreeRow",
"original may not be 0");
78 if (original->IsA() != TTreeRow::Class()) {
79 Error(
"TTreeRow",
"original must be a TTreeRow");
83 fOriginal = (TTreeRow*) original;
84 fColumnCount = fOriginal->fColumnCount;
99 void TTreeRow::Close(Option_t *)
101 if (fRow)
delete [] fRow;
102 if (fFields)
delete [] fFields;
110 Bool_t TTreeRow::IsValid(Int_t field)
112 if (!fFields && !fOriginal) {
113 Error(
"IsValid",
"row closed");
116 if (field < 0 || field >= fColumnCount) {
117 Error(
"IsValid",
"field index out of bounds");
126 ULong_t TTreeRow::GetFieldLength(Int_t field)
132 return fOriginal->GetFieldLength(field);
134 if (field > 0)
return fFields[field] - fFields[field-1] -1;
135 else return fFields[0] -1;
141 const char *TTreeRow::GetField(Int_t field)
147 return fOriginal->GetField(field);
149 if (field > 0)
return fRow +fFields[field-1];
156 void TTreeRow::SetRow(
const Int_t *fields,
const char *row)
158 if (!fColumnCount)
return;
159 if (fFields)
delete [] fFields;
160 Int_t nch = fields[fColumnCount-1];
161 fFields =
new Int_t[fColumnCount];
163 fRow =
new char[nch];
164 for (Int_t i=0;i<fColumnCount;i++) fFields[i] = fields[i];
165 memcpy(fRow,row,nch);
171 void TTreeRow::Streamer(TBuffer &R__b)
174 if (R__b.IsReading()) {
175 R__b.ReadVersion(&R__s, &R__c);
176 TSQLRow::Streamer(R__b);
177 R__b >> fColumnCount;
178 fFields =
new Int_t[fColumnCount];
179 R__b.ReadFastArray(fFields,fColumnCount);
182 fRow =
new char[nch];
183 R__b.ReadFastArray(fRow,nch);
184 R__b.CheckByteCount(R__s, R__c, TTreeRow::IsA());
186 R__c = R__b.WriteVersion(TTreeRow::Class(),kTRUE);
187 TSQLRow::Streamer(R__b);
188 R__b << fColumnCount;
189 R__b.WriteFastArray(fFields,fColumnCount);
190 Int_t nch = fFields ? fFields[fColumnCount-1] : 0;
192 R__b.WriteFastArray(fRow,nch);
193 R__b.SetByteCount(R__c,kTRUE);