60 #define INSTANTIATE_READVAL(CLASS) \
61 template Double_t CLASS::ReadValueImpl<Double_t>(char*, Int_t); \
62 template Long64_t CLASS::ReadValueImpl<Long64_t>(char*, Int_t); \
63 template LongDouble_t CLASS::ReadValueImpl<LongDouble_t>(char*, Int_t) // no semicolon
66 #define INSTANTIATE_GETVAL(CLASS) \
67 template Double_t CLASS::GetValueImpl<Double_t>(TLeaf*, Int_t); \
68 template Long64_t CLASS::GetValueImpl<Long64_t>(TLeaf*, Int_t); \
69 template LongDouble_t CLASS::GetValueImpl<LongDouble_t>(TLeaf*, Int_t) // no semicolon
74 TFormLeafInfo::TFormLeafInfo(TClass* classptr, Long_t offset,
75 TStreamerElement* element) :
76 fClass(classptr),fOffset(offset),fElement(element),
77 fCounter(0), fNext(0),fMultiplicity(0)
79 if (fClass) fClassName = fClass->GetName();
81 fElementName = fElement->GetName();
88 TFormLeafInfo::TFormLeafInfo(
const TFormLeafInfo& orig) : TObject(orig),fClass(orig.fClass),fOffset(orig.fOffset),fElement(orig.fElement),fCounter(0),fNext(0),fClassName(orig.fClassName),fElementName(orig.fElementName),fMultiplicity(orig.fMultiplicity)
91 if (orig.fCounter) fCounter = orig.fCounter->DeepCopy();
92 if (orig.fNext) fNext = orig.fNext->DeepCopy();
98 TFormLeafInfo &TFormLeafInfo::operator=(
const TFormLeafInfo &other)
100 TFormLeafInfo tmp(other);
107 void TFormLeafInfo::Swap(TFormLeafInfo& other)
109 std::swap(fClass,other.fClass);
110 std::swap(fOffset,other.fOffset);
111 std::swap(fElement,other.fElement);
112 std::swap(fCounter,other.fCounter);
113 std::swap(fNext,other.fNext);
114 TString tmp(fClassName);
115 fClassName = other.fClassName;
116 other.fClassName = tmp;
119 fElementName = other.fElementName;
120 other.fElementName = tmp;
121 std::swap(fMultiplicity,other.fMultiplicity);
127 TFormLeafInfo* TFormLeafInfo::DeepCopy()
const
129 return new TFormLeafInfo(*
this);
135 TFormLeafInfo::~TFormLeafInfo()
145 void TFormLeafInfo::AddOffset(Int_t offset, TStreamerElement* element)
151 fElementName.Append(
".").Append(element->GetName());
158 Int_t TFormLeafInfo::GetArrayLength()
161 if (fNext) len = fNext->GetArrayLength();
163 Int_t elen = fElement->GetArrayLength();
164 if (elen || fElement->IsA() == TStreamerBasicPointer::Class() )
165 len *= fElement->GetArrayLength();
173 TClass* TFormLeafInfo::GetClass()
const
175 if (fNext)
return fNext->GetClass();
176 if (fElement)
return fElement->GetClassPointer();
184 char* TFormLeafInfo::GetObjectAddress(TLeafElement* leaf, Int_t& instance)
186 TBranchElement* branch = (TBranchElement*) leaf->GetBranch();
187 Int_t
id = branch->GetID();
190 if (branch->GetTree()->GetMakeClass()) {
192 return branch->GetAddress();
194 return branch->GetObject();
197 TStreamerInfo* info = branch->GetInfo();
201 offset = info->TStreamerInfo::GetElementOffset(
id);
205 if (branch->GetTree()->GetMakeClass()) {
207 address = (
char*) branch->GetAddress();
209 address = (
char*) branch->GetObject();
214 thisobj = branch->GetObject();
219 type = info->TStreamerInfo::GetElement(
id)->GetNewType();
222 case TStreamerInfo::kOffsetL + TStreamerInfo::kObjectp:
223 case TStreamerInfo::kOffsetL + TStreamerInfo::kObjectP:
224 case TStreamerInfo::kOffsetL + TStreamerInfo::kSTLp:
225 case TStreamerInfo::kOffsetL + TStreamerInfo::kAnyp:
226 case TStreamerInfo::kOffsetL + TStreamerInfo::kAnyP:
227 Error(
"GetValuePointer",
"Type (%d) not yet supported\n", type);
230 case TStreamerInfo::kOffsetL + TStreamerInfo::kObject:
231 case TStreamerInfo::kOffsetL + TStreamerInfo::kAny:
232 case TStreamerInfo::kOffsetL + TStreamerInfo::kSTL:
237 Int_t len = GetArrayLength();
239 index = instance / len;
240 sub_instance = instance % len;
245 thisobj = address + offset + (index * fClass->Size());
246 instance = sub_instance;
250 case TStreamerInfo::kBase:
251 case TStreamerInfo::kObject:
252 case TStreamerInfo::kTString:
253 case TStreamerInfo::kTNamed:
254 case TStreamerInfo::kTObject:
255 case TStreamerInfo::kAny:
256 case TStreamerInfo::kSTL:
258 thisobj = address + offset;
261 case TStreamerInfo::kBool:
262 case TStreamerInfo::kChar:
263 case TStreamerInfo::kUChar:
264 case TStreamerInfo::kShort:
265 case TStreamerInfo::kUShort:
266 case TStreamerInfo::kInt:
267 case TStreamerInfo::kUInt:
268 case TStreamerInfo::kLong:
269 case TStreamerInfo::kULong:
270 case TStreamerInfo::kLong64:
271 case TStreamerInfo::kULong64:
272 case TStreamerInfo::kFloat:
273 case TStreamerInfo::kFloat16:
274 case TStreamerInfo::kDouble:
275 case TStreamerInfo::kDouble32:
276 case TStreamerInfo::kLegacyChar:
277 case TStreamerInfo::kCounter:
278 case TStreamerInfo::kOffsetL + TStreamerInfo::kBool:
279 case TStreamerInfo::kOffsetL + TStreamerInfo::kChar:
280 case TStreamerInfo::kOffsetL + TStreamerInfo::kUChar:
281 case TStreamerInfo::kOffsetL + TStreamerInfo::kShort:
282 case TStreamerInfo::kOffsetL + TStreamerInfo::kUShort:
283 case TStreamerInfo::kOffsetL + TStreamerInfo::kInt:
284 case TStreamerInfo::kOffsetL + TStreamerInfo::kUInt:
285 case TStreamerInfo::kOffsetL + TStreamerInfo::kLong:
286 case TStreamerInfo::kOffsetL + TStreamerInfo::kULong:
287 case TStreamerInfo::kOffsetL + TStreamerInfo::kLong64:
288 case TStreamerInfo::kOffsetL + TStreamerInfo::kULong64:
289 case TStreamerInfo::kOffsetL + TStreamerInfo::kFloat:
290 case TStreamerInfo::kOffsetL + TStreamerInfo::kFloat16:
291 case TStreamerInfo::kOffsetL + TStreamerInfo::kDouble:
292 case TStreamerInfo::kOffsetL + TStreamerInfo::kDouble32:
293 case TStreamerInfo::kOffsetL + TStreamerInfo::kLegacyChar:
295 thisobj = address + offset;
300 thisobj = *((
char**) (address + offset));
314 Int_t TFormLeafInfo::GetMultiplicity()
317 return fMultiplicity;
320 Int_t TFormLeafInfo::GetNdata(TLeaf* leaf)
324 GetCounterValue(leaf);
332 Int_t TFormLeafInfo::GetNdata()
334 if (fNext)
return fNext->GetNdata();
341 Bool_t TFormLeafInfo::HasCounter()
const
343 Bool_t result = kFALSE;
344 if (fNext) result = fNext->HasCounter();
345 return fCounter!=0 || result;
351 Bool_t TFormLeafInfo::IsString()
const
353 if (fNext)
return fNext->IsString();
354 if (!fElement)
return kFALSE;
356 switch (fElement->GetNewType()) {
361 case TStreamerInfo::kOffsetL + kChar_t:
364 case TStreamerInfo::kCharStar:
374 Bool_t TFormLeafInfo::IsInteger()
const
376 if (fNext)
return fNext->IsInteger();
377 if (!fElement)
return kFALSE;
379 Int_t atype = fElement->GetNewType();
380 if (TStreamerInfo::kOffsetL < atype &&
381 atype < TStreamerInfo::kOffsetP ) {
382 atype -= TStreamerInfo::kOffsetL;
383 }
else if (TStreamerInfo::kOffsetP < atype &&
384 atype < TStreamerInfo::kObject) {
385 atype -= TStreamerInfo::kOffsetP;
390 case TStreamerInfo::kLegacyChar:
391 case TStreamerInfo::kBool:
392 case TStreamerInfo::kChar:
393 case TStreamerInfo::kUChar:
394 case TStreamerInfo::kShort:
395 case TStreamerInfo::kUShort:
396 case TStreamerInfo::kInt:
397 case TStreamerInfo::kUInt:
398 case TStreamerInfo::kLong:
399 case TStreamerInfo::kULong:
400 case TStreamerInfo::kLong64:
401 case TStreamerInfo::kULong64:
403 case TStreamerInfo::kCharStar:
405 case TStreamerInfo::kFloat:
406 case TStreamerInfo::kFloat16:
407 case TStreamerInfo::kDouble:
408 case TStreamerInfo::kDouble32:
418 Int_t TFormLeafInfo::GetPrimaryIndex()
420 if (fNext)
return fNext->GetPrimaryIndex();
428 Int_t TFormLeafInfo::GetVarDim()
430 if (fNext)
return fNext->GetVarDim();
438 Int_t TFormLeafInfo::GetVirtVarDim()
440 if (fNext)
return fNext->GetVirtVarDim();
448 Int_t TFormLeafInfo::GetSize(Int_t index)
450 if (fNext)
return fNext->GetSize(index);
458 Int_t TFormLeafInfo::GetSumOfSizes()
460 if (fNext)
return fNext->GetSumOfSizes();
467 void TFormLeafInfo::LoadSizes(TBranch* branch)
469 if (fNext) fNext->LoadSizes(branch);
475 void TFormLeafInfo::SetPrimaryIndex(Int_t index)
477 if (fNext) fNext->SetPrimaryIndex(index);
483 void TFormLeafInfo::SetSecondaryIndex(Int_t index)
485 if (fNext) fNext->SetSecondaryIndex(index);
491 void TFormLeafInfo::SetSize(Int_t index, Int_t val)
493 if (fNext) fNext->SetSize(index, val);
499 void TFormLeafInfo::UpdateSizes(TArrayI *garr)
501 if (fNext) fNext->UpdateSizes(garr);
509 Bool_t TFormLeafInfo::Update()
512 TClass * new_class = TClass::GetClass(fClassName);
513 if (new_class==fClass) {
514 if (fNext) fNext->Update();
515 if (fCounter) fCounter->Update();
520 if (fElement && fClass) {
524 TStreamerElement* element;
526 Int_t nchname = fElementName.Length();
527 char * work =
new char[nchname+2];
528 for (i=0, current = &(work[0]), fOffset=0; i<nchname+1;i++ ) {
529 if (i==nchname || fElementName[i]==
'.') {
533 element = ((TStreamerInfo*)cl->GetStreamerInfo())->GetStreamerElement(work,offset);
535 Int_t type = element->GetNewType();
538 }
else if (type == TStreamerInfo::kBase ||
539 type == TStreamerInfo::kAny ||
540 type == TStreamerInfo::kObject ||
541 type == TStreamerInfo::kTString ||
542 type == TStreamerInfo::kTNamed ||
543 type == TStreamerInfo::kTObject ||
544 type == TStreamerInfo::kObjectp ||
545 type == TStreamerInfo::kObjectP ||
546 type == TStreamerInfo::kOffsetL + TStreamerInfo::kObjectp ||
547 type == TStreamerInfo::kOffsetL + TStreamerInfo::kObjectP ||
548 type == TStreamerInfo::kAnyp ||
549 type == TStreamerInfo::kAnyP ||
550 type == TStreamerInfo::kOffsetL + TStreamerInfo::kAnyp ||
551 type == TStreamerInfo::kOffsetL + TStreamerInfo::kAnyP ||
552 type == TStreamerInfo::kOffsetL + TStreamerInfo::kSTLp ||
553 type == TStreamerInfo::kSTL ||
554 type == TStreamerInfo::kSTLp ) {
556 cl = element->GetClassPointer();
559 current = &(work[0]);
562 if (i<nchname) *current++ = fElementName[i];
567 if (fNext) fNext->Update();
568 if (fCounter) fCounter->Update();
575 Int_t TFormLeafInfo::GetCounterValue(TLeaf* leaf) {
577 if (fNext && fNext->HasCounter()) {
578 char *where = (
char*)GetLocalValuePointer(leaf,0);
579 return fNext->ReadCounterValue(where);
582 return (Int_t)fCounter->GetValue(leaf);
588 Int_t TFormLeafInfo::ReadCounterValue(
char* where)
592 char *next = (
char*)GetLocalValuePointer(where,0);
593 return fNext->ReadCounterValue(next);
596 return (Int_t)fCounter->ReadValue(where,0);
603 void* TFormLeafInfo::GetLocalValuePointer(TLeaf *leaf, Int_t instance)
606 if (leaf->InheritsFrom(TLeafObject::Class()) ) {
607 thisobj = (
char*)((TLeafObject*)leaf)->GetObject();
609 thisobj = GetObjectAddress((TLeafElement*)leaf, instance);
611 if (!thisobj)
return 0;
612 return GetLocalValuePointer(thisobj, instance);
619 void* TFormLeafInfo::GetValuePointer(TLeaf *leaf, Int_t instance)
621 char *thisobj = (
char*)GetLocalValuePointer(leaf,instance);
622 if (fNext)
return fNext->GetValuePointer(thisobj,instance);
630 void* TFormLeafInfo::GetValuePointer(
char *thisobj, Int_t instance)
632 char *where = (
char*)GetLocalValuePointer(thisobj,instance);
633 if (fNext)
return fNext->GetValuePointer(where,instance);
641 void* TFormLeafInfo::GetLocalValuePointer(
char *thisobj, Int_t instance)
643 if (fElement==0 || thisobj==0)
return thisobj;
645 switch (fElement->GetNewType()) {
647 case TStreamerInfo::kBool:
648 case TStreamerInfo::kChar:
649 case TStreamerInfo::kUChar:
650 case TStreamerInfo::kShort:
651 case TStreamerInfo::kUShort:
652 case TStreamerInfo::kInt:
653 case TStreamerInfo::kUInt:
654 case TStreamerInfo::kLong:
655 case TStreamerInfo::kULong:
656 case TStreamerInfo::kLong64:
657 case TStreamerInfo::kULong64:
658 case TStreamerInfo::kFloat:
659 case TStreamerInfo::kFloat16:
660 case TStreamerInfo::kDouble:
661 case TStreamerInfo::kDouble32:
662 case TStreamerInfo::kLegacyChar:
663 case TStreamerInfo::kCounter:
664 return (Int_t*)(thisobj+fOffset);
667 case TStreamerInfo::kOffsetL + TStreamerInfo::kBool:
668 {Bool_t *val = (Bool_t*)(thisobj+fOffset);
return &(val[instance]);}
669 case TStreamerInfo::kOffsetL + TStreamerInfo::kChar:
670 {Char_t *val = (Char_t*)(thisobj+fOffset);
return &(val[instance]);}
671 case TStreamerInfo::kOffsetL + TStreamerInfo::kShort:
672 {Short_t *val = (Short_t*)(thisobj+fOffset);
return &(val[instance]);}
673 case TStreamerInfo::kOffsetL + TStreamerInfo::kInt:
674 {Int_t *val = (Int_t*)(thisobj+fOffset);
return &(val[instance]);}
675 case TStreamerInfo::kOffsetL + TStreamerInfo::kLong:
676 {Long_t *val = (Long_t*)(thisobj+fOffset);
return &(val[instance]);}
677 case TStreamerInfo::kOffsetL + TStreamerInfo::kLong64:
678 {Long64_t *val = (Long64_t*)(thisobj+fOffset);
return &(val[instance]);}
679 case TStreamerInfo::kOffsetL + TStreamerInfo::kFloat:
680 {Float_t *val = (Float_t*)(thisobj+fOffset);
return &(val[instance]);}
681 case TStreamerInfo::kOffsetL + TStreamerInfo::kFloat16:
682 {Float_t *val = (Float_t*)(thisobj+fOffset);
return &(val[instance]);}
683 case TStreamerInfo::kOffsetL + TStreamerInfo::kDouble:
684 {Double_t *val = (Double_t*)(thisobj+fOffset);
return &(val[instance]);}
685 case TStreamerInfo::kOffsetL + TStreamerInfo::kDouble32:
686 {Double_t *val = (Double_t*)(thisobj+fOffset);
return &(val[instance]);}
687 case TStreamerInfo::kOffsetL + TStreamerInfo::kUChar:
688 {UChar_t *val = (UChar_t*)(thisobj+fOffset);
return &(val[instance]);}
689 case TStreamerInfo::kOffsetL + TStreamerInfo::kUShort:
690 {UShort_t *val = (UShort_t*)(thisobj+fOffset);
return &(val[instance]);}
691 case TStreamerInfo::kOffsetL + TStreamerInfo::kUInt:
692 {UInt_t *val = (UInt_t*)(thisobj+fOffset);
return &(val[instance]);}
693 case TStreamerInfo::kOffsetL + TStreamerInfo::kULong:
694 {ULong_t *val = (ULong_t*)(thisobj+fOffset);
return &(val[instance]);}
695 case TStreamerInfo::kOffsetL + TStreamerInfo::kULong64:
696 {ULong64_t *val = (ULong64_t*)(thisobj+fOffset);
return &(val[instance]);}
698 #define GET_ARRAY(TYPE_t) \
700 Int_t len, sub_instance, index; \
701 if (fNext) len = fNext->GetArrayLength(); \
704 index = instance / len; \
705 sub_instance = instance % len; \
710 TYPE_t **val = (TYPE_t**)(thisobj+fOffset); \
711 return &((val[sub_instance])[index]); \
715 case TStreamerInfo::kOffsetP + TStreamerInfo::kBool: GET_ARRAY(Bool_t)
716 case TStreamerInfo::kOffsetP + TStreamerInfo::kChar: GET_ARRAY(Char_t)
717 case TStreamerInfo::kOffsetP + TStreamerInfo::kShort: GET_ARRAY(Short_t)
718 case TStreamerInfo::kOffsetP + TStreamerInfo::kInt: GET_ARRAY(Int_t)
719 case TStreamerInfo::kOffsetP + TStreamerInfo::kLong: GET_ARRAY(Long_t)
720 case TStreamerInfo::kOffsetP + TStreamerInfo::kLong64: GET_ARRAY(Long64_t)
721 case TStreamerInfo::kOffsetP + TStreamerInfo::kFloat16:
722 case TStreamerInfo::kOffsetP + TStreamerInfo::kFloat: GET_ARRAY(Float_t)
723 case TStreamerInfo::kOffsetP + TStreamerInfo::kDouble32:
724 case TStreamerInfo::kOffsetP + TStreamerInfo::kDouble: GET_ARRAY(Double_t)
725 case TStreamerInfo::kOffsetP + TStreamerInfo::kUChar: GET_ARRAY(UChar_t)
726 case TStreamerInfo::kOffsetP + TStreamerInfo::kUShort: GET_ARRAY(UShort_t)
727 case TStreamerInfo::kOffsetP + TStreamerInfo::kUInt: GET_ARRAY(UInt_t)
728 case TStreamerInfo::kOffsetP + TStreamerInfo::kULong: GET_ARRAY(ULong_t)
729 case TStreamerInfo::kOffsetP + TStreamerInfo::kULong64: GET_ARRAY(ULong64_t)
731 case TStreamerInfo::kCharStar:
732 {
char **stringp = (
char**)(thisobj+fOffset);
return *stringp;}
734 case TStreamerInfo::kObjectp:
735 case TStreamerInfo::kObjectP:
736 case TStreamerInfo::kAnyp:
737 case TStreamerInfo::kAnyP:
738 case TStreamerInfo::kSTLp:
739 {TObject **obj = (TObject**)(thisobj+fOffset);
return *obj; }
741 case TStreamerInfo::kObject:
742 case TStreamerInfo::kTString:
743 case TStreamerInfo::kTNamed:
744 case TStreamerInfo::kTObject:
745 case TStreamerInfo::kAny:
746 case TStreamerInfo::kBase:
747 case TStreamerInfo::kSTL:
748 {TObject *obj = (TObject*)(thisobj+fOffset);
return obj; }
750 case TStreamerInfo::kOffsetL + TStreamerInfo::kTObject:
751 case TStreamerInfo::kOffsetL + TStreamerInfo::kSTL:
752 case TStreamerInfo::kOffsetL + TStreamerInfo::kAny: {
753 char *loc = thisobj+fOffset;
758 if (fNext) len = fNext->GetArrayLength();
761 index = instance / len;
768 loc += index*fElement->GetClassPointer()->Size();
770 TObject *obj = (TObject*)(loc);
774 case TStreamerInfo::kOffsetL + TStreamerInfo::kObjectp:
775 case TStreamerInfo::kOffsetL + TStreamerInfo::kObjectP:
776 case TStreamerInfo::kOffsetL + TStreamerInfo::kAnyp:
777 case TStreamerInfo::kOffsetL + TStreamerInfo::kAnyP:
778 case TStreamerInfo::kOffsetL + TStreamerInfo::kSTLp:
779 {TObject *obj = (TObject*)(thisobj+fOffset);
return obj; }
790 template <
typename T>
791 T TFormLeafInfo::GetValueImpl(TLeaf *leaf, Int_t instance)
794 if (leaf->InheritsFrom(TLeafObject::Class()) ) {
795 thisobj = (
char*)((TLeafObject*)leaf)->GetObject();
797 thisobj = GetObjectAddress((TLeafElement*)leaf, instance);
799 if (thisobj==0)
return 0;
800 return ReadTypedValue<T>(thisobj,instance);
803 INSTANTIATE_GETVAL(TFormLeafInfo);
804 INSTANTIATE_READVAL(TFormLeafInfo);
809 template <
typename T>
810 T TFormLeafInfo::ReadValueImpl(
char *thisobj, Int_t instance)
813 Error(
"ReadValue",
"Invalid data address: result will be wrong");
817 char *nextobj = thisobj+fOffset;
818 Int_t sub_instance = instance;
819 Int_t type = fElement->GetNewType();
820 if (type==TStreamerInfo::kOffsetL + TStreamerInfo::kObject ||
821 type==TStreamerInfo::kOffsetL + TStreamerInfo::kSTL ||
822 type==TStreamerInfo::kOffsetL + TStreamerInfo::kAny) {
824 Int_t len = fNext->GetArrayLength();
826 index = instance / len;
827 sub_instance = instance % len;
832 nextobj += index*fElement->GetClassPointer()->Size();
834 return fNext->ReadTypedValue<T>(nextobj,sub_instance);
837 switch (fElement->GetNewType()) {
839 case TStreamerInfo::kBool:
return (T)(*(Bool_t*)(thisobj+fOffset));
840 case TStreamerInfo::kChar:
return (T)(*(Char_t*)(thisobj+fOffset));
841 case TStreamerInfo::kUChar:
return (T)(*(UChar_t*)(thisobj+fOffset));
842 case TStreamerInfo::kShort:
return (T)(*(Short_t*)(thisobj+fOffset));
843 case TStreamerInfo::kUShort:
return (T)(*(UShort_t*)(thisobj+fOffset));
844 case TStreamerInfo::kInt:
return (T)(*(Int_t*)(thisobj+fOffset));
845 case TStreamerInfo::kUInt:
return (T)(*(UInt_t*)(thisobj+fOffset));
846 case TStreamerInfo::kLong:
return (T)(*(Long_t*)(thisobj+fOffset));
847 case TStreamerInfo::kULong:
return (T)(*(ULong_t*)(thisobj+fOffset));
848 case TStreamerInfo::kLong64:
return (T)(*(Long64_t*)(thisobj+fOffset));
849 case TStreamerInfo::kULong64:
return (T)(*(Long64_t*)(thisobj+fOffset));
850 case TStreamerInfo::kFloat:
return (T)(*(Float_t*)(thisobj+fOffset));
851 case TStreamerInfo::kFloat16:
return (T)(*(Float_t*)(thisobj+fOffset));
852 case TStreamerInfo::kDouble:
return (T)(*(Double_t*)(thisobj+fOffset));
853 case TStreamerInfo::kDouble32:
return (T)(*(Double_t*)(thisobj+fOffset));
854 case TStreamerInfo::kLegacyChar:
return (T)(*(
char*)(thisobj+fOffset));
855 case TStreamerInfo::kCounter:
return (T)(*(Int_t*)(thisobj+fOffset));
858 case TStreamerInfo::kOffsetL + TStreamerInfo::kBool:
859 {Bool_t *val = (Bool_t*)(thisobj+fOffset);
return T(val[instance]);}
860 case TStreamerInfo::kOffsetL + TStreamerInfo::kChar:
861 {Char_t *val = (Char_t*)(thisobj+fOffset);
return T(val[instance]);}
862 case TStreamerInfo::kOffsetL + TStreamerInfo::kShort:
863 {Short_t *val = (Short_t*)(thisobj+fOffset);
return T(val[instance]);}
864 case TStreamerInfo::kOffsetL + TStreamerInfo::kInt:
865 {Int_t *val = (Int_t*)(thisobj+fOffset);
return T(val[instance]);}
866 case TStreamerInfo::kOffsetL + TStreamerInfo::kLong:
867 {Long_t *val = (Long_t*)(thisobj+fOffset);
return T(val[instance]);}
868 case TStreamerInfo::kOffsetL + TStreamerInfo::kLong64:
869 {Long64_t *val = (Long64_t*)(thisobj+fOffset);
return T(val[instance]);}
870 case TStreamerInfo::kOffsetL + TStreamerInfo::kFloat16:
871 {Float_t *val = (Float_t*)(thisobj+fOffset);
return T(val[instance]);}
872 case TStreamerInfo::kOffsetL + TStreamerInfo::kFloat:
873 {Float_t *val = (Float_t*)(thisobj+fOffset);
return T(val[instance]);}
874 case TStreamerInfo::kOffsetL + TStreamerInfo::kDouble:
875 {Double_t *val = (Double_t*)(thisobj+fOffset);
return T(val[instance]);}
876 case TStreamerInfo::kOffsetL + TStreamerInfo::kDouble32:
877 {Double_t *val = (Double_t*)(thisobj+fOffset);
return T(val[instance]);}
878 case TStreamerInfo::kOffsetL + TStreamerInfo::kUChar:
879 {UChar_t *val = (UChar_t*)(thisobj+fOffset);
return T(val[instance]);}
880 case TStreamerInfo::kOffsetL + TStreamerInfo::kUShort:
881 {UShort_t *val = (UShort_t*)(thisobj+fOffset);
return T(val[instance]);}
882 case TStreamerInfo::kOffsetL + TStreamerInfo::kUInt:
883 {UInt_t *val = (UInt_t*)(thisobj+fOffset);
return T(val[instance]);}
884 case TStreamerInfo::kOffsetL + TStreamerInfo::kULong:
885 {ULong_t *val = (ULong_t*)(thisobj+fOffset);
return T(val[instance]);}
886 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
887 case TStreamerInfo::kOffsetL + TStreamerInfo::kULong64:
888 {Long64_t *val = (Long64_t*)(thisobj+fOffset);
return T(val[instance]);}
890 case TStreamerInfo::kOffsetL + kULong64_t:
891 {ULong64_t *val = (ULong64_t*)(thisobj+fOffset);
return T(val[instance]);}
894 #define READ_ARRAY(TYPE_t) \
896 Int_t len, sub_instance, index; \
897 len = GetArrayLength(); \
899 index = instance / len; \
900 sub_instance = instance % len; \
905 TYPE_t **val =(TYPE_t**)(thisobj+fOffset); \
906 return T((val[sub_instance])[index]); \
910 case TStreamerInfo::kOffsetP + TStreamerInfo::kBool: READ_ARRAY(Bool_t)
911 case TStreamerInfo::kOffsetP + TStreamerInfo::kChar: READ_ARRAY(Char_t)
912 case TStreamerInfo::kOffsetP + TStreamerInfo::kShort: READ_ARRAY(Short_t)
913 case TStreamerInfo::kOffsetP + TStreamerInfo::kInt: READ_ARRAY(Int_t)
914 case TStreamerInfo::kOffsetP + TStreamerInfo::kLong: READ_ARRAY(Long_t)
915 case TStreamerInfo::kOffsetP + TStreamerInfo::kLong64: READ_ARRAY(Long64_t)
916 case TStreamerInfo::kOffsetP + TStreamerInfo::kFloat16:
917 case TStreamerInfo::kOffsetP + TStreamerInfo::kFloat: READ_ARRAY(Float_t)
918 case TStreamerInfo::kOffsetP + TStreamerInfo::kDouble32:
919 case TStreamerInfo::kOffsetP + TStreamerInfo::kDouble: READ_ARRAY(Double_t)
920 case TStreamerInfo::kOffsetP + TStreamerInfo::kUChar: READ_ARRAY(UChar_t)
921 case TStreamerInfo::kOffsetP + TStreamerInfo::kUShort: READ_ARRAY(UShort_t)
922 case TStreamerInfo::kOffsetP + TStreamerInfo::kUInt: READ_ARRAY(UInt_t)
923 case TStreamerInfo::kOffsetP + TStreamerInfo::kULong: READ_ARRAY(ULong_t)
924 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
925 case TStreamerInfo::kOffsetP + TStreamerInfo::kULong64: READ_ARRAY(Long64_t)
927 case TStreamerInfo::kOffsetP + TStreamerInfo::kULong64: READ_ARRAY(ULong64_t)
943 TFormLeafInfoDirect::TFormLeafInfoDirect(TBranchElement * from) :
944 TFormLeafInfo(from->GetInfo()->GetClass(),0,
945 from->GetInfo()->GetElement(from->GetID()))
952 TFormLeafInfo* TFormLeafInfoDirect::DeepCopy()
const
954 return new TFormLeafInfoDirect(*
this);
960 Double_t TFormLeafInfoDirect::ReadValue(
char * , Int_t )
962 Error(
"ReadValue",
"Should not be used in a TFormLeafInfoDirect");
969 template <
typename T>
970 T TFormLeafInfoDirect::GetValueImpl(TLeaf *leaf, Int_t instance)
972 return leaf->GetTypedValue<T>(instance);
975 INSTANTIATE_GETVAL(TFormLeafInfoDirect);
980 void* TFormLeafInfoDirect::GetLocalValuePointer(TLeaf *leaf, Int_t instance)
982 if (leaf->IsA() != TLeafElement::Class()) {
983 return leaf->GetValuePointer();
985 return GetObjectAddress((TLeafElement*)leaf, instance);
992 void* TFormLeafInfoDirect::GetLocalValuePointer(
char *thisobj, Int_t instance)
994 return TFormLeafInfo::GetLocalValuePointer(thisobj,instance);
1004 TFormLeafInfoNumerical::TFormLeafInfoNumerical(EDataType kind) :
1005 TFormLeafInfo(0,0,0),
1006 fKind(kind), fIsBool(kFALSE)
1008 fElement =
new TStreamerElement(
"data",
"in collection", 0, fKind,
"");
1014 TFormLeafInfoNumerical::TFormLeafInfoNumerical(TVirtualCollectionProxy *collection) :
1015 TFormLeafInfo(0,0,0),
1016 fKind(kNoType_t), fIsBool(kFALSE)
1019 fKind = (EDataType)collection->GetType();
1020 if (fKind == TStreamerInfo::kOffsetL + TStreamerInfo::kChar) {
1022 if (strcmp( collection->GetCollectionClass()->GetName(),
"vector<bool>") == 0
1023 || strncmp( collection->GetCollectionClass()->GetName(),
"bitset<", strlen(
"bitset<") ) ==0 ) {
1025 fKind = (EDataType)18;
1029 fElement =
new TStreamerElement(
"data",
"in collection", 0, fKind,
"");
1035 TFormLeafInfoNumerical::TFormLeafInfoNumerical(
const TFormLeafInfoNumerical& orig) :
1036 TFormLeafInfo(orig),
1037 fKind(orig.fKind), fIsBool(kFALSE)
1039 fElement =
new TStreamerElement(
"data",
"in collection", 0, fKind,
"");
1045 void TFormLeafInfoNumerical::Swap(TFormLeafInfoNumerical& other)
1047 TFormLeafInfo::Swap(other);
1048 std::swap(fKind,other.fKind);
1049 std::swap(fIsBool,other.fIsBool);
1055 TFormLeafInfoNumerical &TFormLeafInfoNumerical::operator=(
const TFormLeafInfoNumerical &other)
1057 TFormLeafInfoNumerical tmp(other);
1065 TFormLeafInfo* TFormLeafInfoNumerical::DeepCopy()
const
1067 return new TFormLeafInfoNumerical(*
this);
1073 TFormLeafInfoNumerical::~TFormLeafInfoNumerical()
1081 Bool_t TFormLeafInfoNumerical::IsString()
const
1083 if (fIsBool)
return kFALSE;
1084 return TFormLeafInfo::IsString();
1092 Bool_t TFormLeafInfoNumerical::Update()
1096 if (fCounter)
return fCounter->Update();
1101 TStreamerElement *R__GetFakeClonesElem() {
1102 static TStreamerElement gFakeClonesElem(
"begin",
"fake",0,
1103 TStreamerInfo::kAny,
1105 return &gFakeClonesElem;
1117 TFormLeafInfoClones::TFormLeafInfoClones(TClass* classptr, Long_t offset) :
1118 TFormLeafInfo(classptr,offset,R__GetFakeClonesElem()),fTop(kFALSE)
1125 TFormLeafInfoClones::TFormLeafInfoClones(TClass* classptr, Long_t offset,
1127 TFormLeafInfo(classptr,offset,R__GetFakeClonesElem()),fTop(top)
1134 TFormLeafInfoClones::TFormLeafInfoClones(TClass* classptr, Long_t offset,
1135 TStreamerElement* element,
1137 TFormLeafInfo(classptr,offset,element),fTop(top)
1144 TFormLeafInfoClones::TFormLeafInfoClones(
const TFormLeafInfoClones &orig) :
1145 TFormLeafInfo(orig), fTop(orig.fTop)
1152 void TFormLeafInfoClones::Swap(TFormLeafInfoClones &other)
1154 TFormLeafInfo::Swap(other);
1155 std::swap(fTop,other.fTop);
1161 TFormLeafInfoClones &TFormLeafInfoClones::operator=(
const TFormLeafInfoClones &orig)
1163 TFormLeafInfoClones tmp(orig);
1171 Int_t TFormLeafInfoClones::GetCounterValue(TLeaf* leaf)
1174 TClass *clonesClass = TClonesArray::Class();
1176 TStreamerElement *counter = ((TStreamerInfo*)clonesClass->GetStreamerInfo())->GetStreamerElement(
"fLast",c_offset);
1177 fCounter =
new TFormLeafInfo(clonesClass,c_offset,counter);
1179 return (Int_t)fCounter->ReadValue((
char*)GetLocalValuePointer(leaf)) + 1;
1185 Int_t TFormLeafInfoClones::ReadCounterValue(
char* where)
1188 TClass *clonesClass = TClonesArray::Class();
1190 TStreamerElement *counter = ((TStreamerInfo*)clonesClass->GetStreamerInfo())->GetStreamerElement(
"fLast",c_offset);
1191 fCounter =
new TFormLeafInfo(clonesClass,c_offset,counter);
1193 return (Int_t)fCounter->ReadValue(where) + 1;
1200 template <
typename T>
1201 T TFormLeafInfoClones::ReadValueImpl(
char *where, Int_t instance)
1203 if (fNext==0)
return 0;
1204 Int_t len,index,sub_instance;
1205 len = fNext->GetArrayLength();
1207 index = instance / len;
1208 sub_instance = instance % len;
1213 TClonesArray * clones = (TClonesArray*)where;
1214 if (!clones)
return 0;
1217 char * obj = (
char*)clones->UncheckedAt(index);
1218 return fNext->ReadTypedValue<T>(obj,sub_instance);
1221 INSTANTIATE_GETVAL(TFormLeafInfoClones);
1222 INSTANTIATE_READVAL(TFormLeafInfoClones);
1227 void* TFormLeafInfoClones::GetLocalValuePointer(TLeaf *leaf, Int_t )
1229 TClonesArray * clones;
1231 if (leaf->InheritsFrom(TLeafObject::Class()) ) {
1232 clones = (TClonesArray*)((TLeafObject*)leaf)->GetObject();
1234 clones = (TClonesArray*)((TBranchElement*)leaf->GetBranch())->GetObject();
1237 clones = (TClonesArray*)TFormLeafInfo::GetLocalValuePointer(leaf);
1245 void* TFormLeafInfoClones::GetLocalValuePointer(
char *where, Int_t instance)
1247 return TFormLeafInfo::GetLocalValuePointer(where,instance);
1254 template <
typename T>
1255 T TFormLeafInfoClones::GetValueImpl(TLeaf *leaf, Int_t instance)
1257 if (fNext==0)
return 0;
1258 Int_t len,index,sub_instance;
1259 len = (fNext->fElement==0)? 0 : fNext->GetArrayLength();
1260 Int_t primary = fNext->GetPrimaryIndex();
1262 index = instance / len;
1263 sub_instance = instance % len;
1264 }
else if (primary>=0) {
1266 sub_instance = instance;
1271 TClonesArray *clones = (TClonesArray*)GetLocalValuePointer(leaf);
1272 if (clones==0)
return 0;
1276 char * obj = (
char*)clones->UncheckedAt(index);
1277 return fNext->ReadTypedValue<T>(obj,sub_instance);
1283 void * TFormLeafInfoClones::GetValuePointer(TLeaf *leaf, Int_t instance)
1285 TClonesArray * clones = (TClonesArray*)GetLocalValuePointer(leaf);
1286 if (fNext && clones) {
1288 Int_t len,index,sub_instance;
1289 len = (fNext->fElement==0)? 0 : fNext->GetArrayLength();
1291 index = instance / len;
1292 sub_instance = instance % len;
1297 return fNext->GetValuePointer((
char*)clones->UncheckedAt(index),
1306 void * TFormLeafInfoClones::GetValuePointer(
char *where, Int_t instance)
1308 TClonesArray * clones = (TClonesArray*) where;
1311 Int_t len,index,sub_instance;
1312 len = (fNext->fElement==0)? 0 : fNext->GetArrayLength();
1314 index = instance / len;
1315 sub_instance = instance % len;
1320 return fNext->GetValuePointer((
char*)clones->UncheckedAt(index),
1334 TFormLeafInfoCollectionObject::TFormLeafInfoCollectionObject(TClass* classptr, Bool_t top) :
1335 TFormLeafInfo(classptr,0,R__GetFakeClonesElem()),fTop(top)
1342 TFormLeafInfoCollectionObject::TFormLeafInfoCollectionObject(
const TFormLeafInfoCollectionObject &orig) :
1343 TFormLeafInfo(orig),fTop(orig.fTop)
1350 void TFormLeafInfoCollectionObject::Swap(TFormLeafInfoCollectionObject &other)
1352 TFormLeafInfo::Swap(other);
1353 std::swap(fTop,other.fTop);
1359 TFormLeafInfoCollectionObject &TFormLeafInfoCollectionObject::operator=(
const TFormLeafInfoCollectionObject &orig)
1361 TFormLeafInfoCollectionObject tmp(orig);
1369 Int_t TFormLeafInfoCollectionObject::GetCounterValue(TLeaf* )
1378 Double_t TFormLeafInfoCollectionObject::ReadValue(
char * , Int_t )
1387 void* TFormLeafInfoCollectionObject::GetLocalValuePointer(TLeaf *leaf, Int_t )
1391 if (leaf->InheritsFrom(TLeafObject::Class()) ) {
1392 collection = ((TLeafObject*)leaf)->GetObject();
1394 collection = ((TBranchElement*)leaf->GetBranch())->GetObject();
1397 collection = TFormLeafInfo::GetLocalValuePointer(leaf);
1405 void* TFormLeafInfoCollectionObject::GetLocalValuePointer(
char *where, Int_t instance)
1407 return TFormLeafInfo::GetLocalValuePointer(where,instance);
1414 template <
typename T>
1415 T TFormLeafInfoCollectionObject::GetValueImpl(TLeaf *leaf, Int_t instance)
1417 char * obj = (
char*)GetLocalValuePointer(leaf);
1419 if (fNext==0)
return 0;
1420 return fNext->ReadTypedValue<T>(obj,instance);
1423 INSTANTIATE_GETVAL(TFormLeafInfoCollectionObject);
1428 void * TFormLeafInfoCollectionObject::GetValuePointer(TLeaf *leaf, Int_t instance)
1430 void *collection = GetLocalValuePointer(leaf);
1432 return fNext->GetValuePointer((
char*)collection,instance);
1440 void * TFormLeafInfoCollectionObject::GetValuePointer(
char *where, Int_t instance)
1443 return fNext->GetValuePointer(where,instance);
1456 TFormLeafInfoCollection::TFormLeafInfoCollection(TClass* classptr,
1458 TStreamerElement* element,
1460 TFormLeafInfo(classptr,offset,element),
1467 fCollClass = element->GetClass();
1468 }
else if (classptr) {
1469 fCollClass = classptr;
1472 && fCollClass!=TClonesArray::Class()
1473 && fCollClass->GetCollectionProxy()) {
1475 fCollProxy = fCollClass->GetCollectionProxy()->Generate();
1476 fCollClassName = fCollClass->GetName();
1483 TFormLeafInfoCollection::TFormLeafInfoCollection(TClass* motherclassptr,
1485 TClass* elementclassptr,
1487 TFormLeafInfo(motherclassptr,offset,
1488 new TStreamerElement(
"collection",
"in class",
1490 TStreamerInfo::kAny,
1492 ? elementclassptr->GetName()
1494 ? motherclassptr->GetName()
1500 fLocalElement( fElement )
1502 if (elementclassptr) {
1503 fCollClass = elementclassptr;
1504 }
else if (motherclassptr) {
1505 fCollClass = motherclassptr;
1508 && fCollClass!=TClonesArray::Class()
1509 && fCollClass->GetCollectionProxy())
1511 fCollProxy = fCollClass->GetCollectionProxy()->Generate();
1512 fCollClassName = fCollClass->GetName();
1519 TFormLeafInfoCollection::TFormLeafInfoCollection() :
1531 TFormLeafInfoCollection::TFormLeafInfoCollection(
const TFormLeafInfoCollection& orig) :
1532 TFormLeafInfo(orig),
1534 fCollClass( orig.fCollClass ),
1535 fCollClassName( orig.fCollClassName ),
1536 fCollProxy( orig.fCollProxy ? orig.fCollProxy->Generate() : 0 ),
1544 void TFormLeafInfoCollection::Swap(TFormLeafInfoCollection &other)
1546 TFormLeafInfo::Swap(other);
1547 std::swap(fTop,other.fTop);
1548 std::swap(fClass,other.fClass);
1549 std::swap(fCollClassName,other.fCollClassName);
1550 std::swap(fCollProxy,other.fCollProxy);
1551 std::swap(fLocalElement,other.fLocalElement);
1557 TFormLeafInfoCollection &TFormLeafInfoCollection::operator=(
const TFormLeafInfoCollection &other)
1559 TFormLeafInfoCollection tmp(other);
1567 TFormLeafInfoCollection::~TFormLeafInfoCollection()
1570 delete fLocalElement;
1576 TFormLeafInfo* TFormLeafInfoCollection::DeepCopy()
const
1578 return new TFormLeafInfoCollection(*
this);
1586 Bool_t TFormLeafInfoCollection::Update()
1588 Bool_t changed = kFALSE;
1589 TClass * new_class = TClass::GetClass(fCollClassName);
1590 if (new_class!=fCollClass) {
1591 delete fCollProxy; fCollProxy = 0;
1592 fCollClass = new_class;
1593 if (fCollClass && fCollClass->GetCollectionProxy()) {
1594 fCollProxy = fCollClass->GetCollectionProxy()->Generate();
1598 return changed || TFormLeafInfo::Update();
1604 Bool_t TFormLeafInfoCollection::HasCounter()
const
1606 return fCounter!=0 || fCollProxy!=0;
1612 Int_t TFormLeafInfoCollection::GetCounterValue(TLeaf* leaf)
1614 void *ptr = GetLocalValuePointer(leaf);
1616 if (fCounter) {
return (Int_t)fCounter->ReadValue((
char*)ptr); }
1618 R__ASSERT(fCollProxy);
1619 if (ptr==0)
return 0;
1620 TVirtualCollectionProxy::TPushPop helper(fCollProxy, ptr);
1621 return (Int_t)fCollProxy->Size();
1627 Int_t TFormLeafInfoCollection::ReadCounterValue(
char* where)
1629 if (fCounter) {
return (Int_t)fCounter->ReadValue(where); }
1630 R__ASSERT(fCollProxy);
1631 if (where==0)
return 0;
1632 void *ptr = GetLocalValuePointer(where,0);
1633 TVirtualCollectionProxy::TPushPop helper(fCollProxy, ptr);
1634 return (Int_t)fCollProxy->Size();
1640 Int_t TFormLeafInfoCollection::GetCounterValue(TLeaf* leaf, Int_t instance)
1642 void *ptr = GetLocalValuePointer(leaf,instance);
1644 return (Int_t)fCounter->ReadValue((
char*)ptr);
1646 R__ASSERT(fCollProxy);
1647 if (ptr==0)
return 0;
1648 TVirtualCollectionProxy::TPushPop helper(fCollProxy, ptr);
1649 return (Int_t)fCollProxy->Size();
1656 template <
typename T>
1657 T TFormLeafInfoCollection::ReadValueImpl(
char *where, Int_t instance)
1659 if (fNext==0)
return 0;
1660 UInt_t len,index,sub_instance;
1661 len = (fNext->fElement==0)? 0 : fNext->GetArrayLength();
1662 Int_t primary = fNext->GetPrimaryIndex();
1664 index = instance / len;
1665 sub_instance = instance % len;
1666 }
else if (primary>=0) {
1668 sub_instance = instance;
1674 R__ASSERT(fCollProxy);
1675 void *ptr = GetLocalValuePointer(where,instance);
1676 TVirtualCollectionProxy::TPushPop helper(fCollProxy, ptr);
1681 char * obj = (
char*)fCollProxy->At(index);
1682 if (fCollProxy->HasPointers()) obj = *(
char**)obj;
1683 return fNext->ReadTypedValue<T>(obj,sub_instance);
1686 INSTANTIATE_GETVAL(TFormLeafInfoCollection);
1687 INSTANTIATE_READVAL(TFormLeafInfoCollection);
1692 void* TFormLeafInfoCollection::GetLocalValuePointer(TLeaf *leaf, Int_t )
1696 if (leaf->InheritsFrom(TLeafObject::Class()) ) {
1697 collection = ((TLeafObject*)leaf)->GetObject();
1699 collection = ((TBranchElement*)leaf->GetBranch())->GetObject();
1702 collection = TFormLeafInfo::GetLocalValuePointer(leaf);
1710 void* TFormLeafInfoCollection::GetLocalValuePointer(
char *where, Int_t instance)
1712 return TFormLeafInfo::GetLocalValuePointer(where,instance);
1719 template <
typename T>
1720 T TFormLeafInfoCollection::GetValueImpl(TLeaf *leaf, Int_t instance)
1722 if (fNext==0)
return 0;
1723 Int_t len,index,sub_instance;
1724 len = (fNext->fElement==0)? 0 : fNext->GetArrayLength();
1725 Int_t primary = fNext->GetPrimaryIndex();
1727 index = instance / len;
1728 sub_instance = instance % len;
1729 }
else if (primary>=0) {
1731 sub_instance = instance;
1737 R__ASSERT(fCollProxy);
1738 void *coll = GetLocalValuePointer(leaf);
1739 TVirtualCollectionProxy::TPushPop helper(fCollProxy,coll);
1743 char * obj = (
char*)fCollProxy->At(index);
1744 if (obj==0)
return 0;
1745 if (fCollProxy->HasPointers()) obj = *(
char**)obj;
1746 if (obj==0)
return 0;
1747 return fNext->ReadTypedValue<T>(obj,sub_instance);
1753 void * TFormLeafInfoCollection::GetValuePointer(TLeaf *leaf, Int_t instance)
1755 R__ASSERT(fCollProxy);
1757 void *collection = GetLocalValuePointer(leaf);
1761 Int_t len,index,sub_instance;
1762 if (fNext->fElement &&
1763 (fNext->fNext || !fNext->IsString()) ) {
1764 len = fNext->GetArrayLength();
1769 index = instance / len;
1770 sub_instance = instance % len;
1775 TVirtualCollectionProxy::TPushPop helper(fCollProxy,collection);
1776 char * obj = (
char*)fCollProxy->At(index);
1777 if (fCollProxy->HasPointers()) obj = *(
char**)obj;
1778 return fNext->GetValuePointer(obj,sub_instance);
1786 void * TFormLeafInfoCollection::GetValuePointer(
char *where, Int_t instance)
1788 R__ASSERT(fCollProxy);
1790 void *collection = where;
1794 Int_t len,index,sub_instance;
1795 len = (fNext->fElement==0)? 0 : fNext->GetArrayLength();
1797 index = instance / len;
1798 sub_instance = instance % len;
1803 TVirtualCollectionProxy::TPushPop helper(fCollProxy,collection);
1804 char * obj = (
char*)fCollProxy->At(index);
1805 if (fCollProxy->HasPointers()) obj = *(
char**)obj;
1806 return fNext->GetValuePointer(obj,sub_instance);
1818 TFormLeafInfoCollectionSize::TFormLeafInfoCollectionSize(TClass* classptr) :
1819 TFormLeafInfo(), fCollClass(classptr), fCollProxy(0)
1822 && fCollClass!=TClonesArray::Class()
1823 && fCollClass->GetCollectionProxy()) {
1825 fCollProxy = fCollClass->GetCollectionProxy()->Generate();
1826 fCollClassName = fCollClass->GetName();
1833 TFormLeafInfoCollectionSize::TFormLeafInfoCollectionSize(
1834 TClass* classptr,Long_t offset,TStreamerElement* element) :
1835 TFormLeafInfo(classptr,offset,element), fCollClass(element->GetClassPointer()), fCollProxy(0)
1838 && fCollClass!=TClonesArray::Class()
1839 && fCollClass->GetCollectionProxy()) {
1841 fCollProxy = fCollClass->GetCollectionProxy()->Generate();
1842 fCollClassName = fCollClass->GetName();
1849 TFormLeafInfoCollectionSize::TFormLeafInfoCollectionSize() :
1850 TFormLeafInfo(), fCollClass(0), fCollProxy(0)
1857 TFormLeafInfoCollectionSize::TFormLeafInfoCollectionSize(
1858 const TFormLeafInfoCollectionSize& orig) : TFormLeafInfo(),
1859 fCollClass(orig.fCollClass),
1860 fCollClassName(orig.fCollClassName),
1861 fCollProxy(orig.fCollProxy?orig.fCollProxy->Generate():0)
1868 TFormLeafInfoCollectionSize &TFormLeafInfoCollectionSize::operator=(
const TFormLeafInfoCollectionSize &other)
1870 TFormLeafInfoCollectionSize tmp(other);
1878 void TFormLeafInfoCollectionSize::Swap(TFormLeafInfoCollectionSize &other)
1880 TFormLeafInfo::Swap(other);
1881 std::swap(fCollClass,other.fCollClass);
1882 std::swap(fCollClassName,other.fCollClassName);
1883 std::swap(fCollProxy,other.fCollProxy);
1889 TFormLeafInfoCollectionSize::~TFormLeafInfoCollectionSize()
1897 TFormLeafInfo* TFormLeafInfoCollectionSize::DeepCopy()
const
1899 return new TFormLeafInfoCollectionSize(*
this);
1907 Bool_t TFormLeafInfoCollectionSize::Update()
1909 Bool_t changed = kFALSE;
1910 TClass *new_class = TClass::GetClass(fCollClassName);
1911 if (new_class!=fCollClass) {
1912 delete fCollProxy; fCollProxy = 0;
1913 fCollClass = new_class;
1914 if (fCollClass && fCollClass->GetCollectionProxy()) {
1915 fCollProxy = fCollClass->GetCollectionProxy()->Generate();
1925 void *TFormLeafInfoCollectionSize::GetValuePointer(TLeaf * , Int_t )
1927 Error(
"GetValuePointer",
"This should never be called");
1934 void *TFormLeafInfoCollectionSize::GetValuePointer(
char * , Int_t )
1936 Error(
"GetValuePointer",
"This should never be called");
1943 void *TFormLeafInfoCollectionSize::GetLocalValuePointer(TLeaf * , Int_t )
1945 Error(
"GetLocalValuePointer",
"This should never be called");
1952 void *TFormLeafInfoCollectionSize::GetLocalValuePointer(
char * , Int_t )
1954 Error(
"GetLocalValuePointer",
"This should never be called");
1961 Double_t TFormLeafInfoCollectionSize::ReadValue(
char *where, Int_t )
1963 R__ASSERT(fCollProxy);
1964 if (where==0)
return 0;
1965 void *ptr = fElement ? TFormLeafInfo::GetLocalValuePointer(where) : where;
1966 TVirtualCollectionProxy::TPushPop helper(fCollProxy, ptr);
1967 return (Int_t)fCollProxy->Size();
1978 TFormLeafInfoPointer::TFormLeafInfoPointer(TClass* classptr,
1980 TStreamerElement* element) :
1981 TFormLeafInfo(classptr,offset,element)
1988 TFormLeafInfo* TFormLeafInfoPointer::DeepCopy()
const
1990 return new TFormLeafInfoPointer(*
this);
1996 template <
typename T>
1997 T TFormLeafInfoPointer::ReadValueImpl(
char *where, Int_t instance)
1999 if (!fNext)
return 0;
2000 char * whereoffset = where+fOffset;
2001 switch (fElement->GetNewType()) {
2003 case TStreamerInfo::kObjectp:
2004 case TStreamerInfo::kObjectP:
2005 case TStreamerInfo::kAnyp:
2006 case TStreamerInfo::kAnyP:
2007 case TStreamerInfo::kSTLp:
2008 {TObject **obj = (TObject**)(whereoffset);
2009 return obj && *obj ? fNext->ReadTypedValue<T>((
char*)*obj,instance) : 0; }
2011 case TStreamerInfo::kObject:
2012 case TStreamerInfo::kTString:
2013 case TStreamerInfo::kTNamed:
2014 case TStreamerInfo::kTObject:
2015 case TStreamerInfo::kAny:
2016 case TStreamerInfo::kBase:
2017 case TStreamerInfo::kSTL:
2019 TObject *obj = (TObject*)(whereoffset);
2020 return fNext->ReadTypedValue<T>((
char*)obj,instance);
2023 case TStreamerInfo::kOffsetL + TStreamerInfo::kTObject:
2024 case TStreamerInfo::kOffsetL + TStreamerInfo::kSTL:
2025 case TStreamerInfo::kOffsetL + TStreamerInfo::kAny:
2027 Int_t len, index, sub_instance;
2029 if (fNext) len = fNext->GetArrayLength();
2032 index = instance / len;
2033 sub_instance = instance % len;
2039 whereoffset += index*fElement->GetClassPointer()->Size();
2041 TObject *obj = (TObject*)(whereoffset);
2042 return fNext->ReadTypedValue<T>((
char*)obj,sub_instance);
2045 case TStreamerInfo::kOffsetL + TStreamerInfo::kObjectp:
2046 case TStreamerInfo::kOffsetL + TStreamerInfo::kObjectP:
2047 case TStreamerInfo::kOffsetL + TStreamerInfo::kAnyp:
2048 case TStreamerInfo::kOffsetL + TStreamerInfo::kAnyP:
2049 case TStreamerInfo::kOffsetL + TStreamerInfo::kSTLp:
2051 TObject *obj = (TObject*)(whereoffset);
2052 return fNext->ReadTypedValue<T>((
char*)obj,instance);
2064 template <
typename T>
2065 T TFormLeafInfoPointer::GetValueImpl(TLeaf *leaf, Int_t instance)
2067 if (!fNext)
return 0;
2068 char * where = (
char*)GetLocalValuePointer(leaf,instance);
2069 if (where==0)
return 0;
2070 return fNext->ReadTypedValue<T>(where,instance);
2073 INSTANTIATE_GETVAL(TFormLeafInfoPointer);
2074 INSTANTIATE_READVAL(TFormLeafInfoPointer);
2084 TFormLeafInfoMethod::TFormLeafInfoMethod( TClass* classptr,
2085 TMethodCall *method) :
2086 TFormLeafInfo(classptr,0,0),fMethod(method),
2087 fResult(0), fCopyFormat(),fDeleteFormat(),fValuePointer(0),fIsByValue(kFALSE)
2090 fMethodName = method->GetMethodName();
2091 fParams = method->GetParams();
2092 TMethodCall::EReturnType r = fMethod->ReturnType();
2093 if (r == TMethodCall::kOther) {
2094 const char* rtype = fMethod->GetMethod()->GetReturnTypeName();
2095 Long_t rprop = fMethod->GetMethod()->Property();
2096 if (rtype[strlen(rtype)-1]!=
'*' &&
2097 rtype[strlen(rtype)-1]!=
'&' &&
2098 !(rprop & (kIsPointer|kIsReference)) ) {
2099 fCopyFormat =
"new ";
2100 fCopyFormat += rtype;
2101 fCopyFormat +=
"(*(";
2102 fCopyFormat += rtype;
2103 fCopyFormat +=
"*)0x%lx)";
2105 fDeleteFormat =
"delete (";
2106 fDeleteFormat += rtype;
2107 fDeleteFormat +=
"*)0x%lx";
2118 TFormLeafInfoMethod::TFormLeafInfoMethod(
const TFormLeafInfoMethod& orig)
2119 : TFormLeafInfo(orig)
2121 fMethodName = orig.fMethodName;
2122 fParams = orig.fParams ;
2123 fResult = orig.fResult;
2125 fMethod =
new TMethodCall();
2126 fMethod->Init(orig.fMethod->GetMethod());
2130 fCopyFormat = orig.fCopyFormat;
2131 fDeleteFormat = orig.fDeleteFormat;
2133 fIsByValue = orig.fIsByValue;
2140 void TFormLeafInfoMethod::Swap(TFormLeafInfoMethod &other)
2142 TFormLeafInfo::Swap(other);
2143 std::swap(fMethod,other.fMethod);
2144 std::swap(fMethodName,other.fMethodName);
2145 std::swap(fParams,other.fParams);
2146 std::swap(fResult,other.fResult);
2147 std::swap(fCopyFormat,other.fCopyFormat);
2148 std::swap(fDeleteFormat,other.fDeleteFormat);
2149 std::swap(fValuePointer,other.fValuePointer);
2150 std::swap(fIsByValue,other.fIsByValue);
2156 TFormLeafInfoMethod &TFormLeafInfoMethod::operator=(
const TFormLeafInfoMethod &other)
2158 TFormLeafInfoMethod tmp(other);
2166 TFormLeafInfoMethod::~TFormLeafInfoMethod()
2168 if (fValuePointer) {
2169 gInterpreter->Calc(Form(fDeleteFormat.Data(),fValuePointer));
2177 TFormLeafInfo* TFormLeafInfoMethod::DeepCopy()
const
2179 return new TFormLeafInfoMethod(*
this);
2187 TClass *TFormLeafInfoMethod::ReturnTClass(TMethodCall *mc)
2189 if (!mc || !mc->GetMethod())
2192 std::string return_type;
2194 if (0 == strcmp(mc->GetMethod()->GetReturnTypeName(),
"void"))
2197 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
2200 TInterpreter::SuspendAutoloadingRAII autoloadOff(gInterpreter);
2201 TClassEdit::GetNormalizedName(return_type, mc->GetMethod()->GetReturnTypeName());
2208 return_type = gInterpreter->TypeName(return_type.c_str());
2210 if (return_type ==
"void")
2213 return TClass::GetClass(return_type.c_str());
2219 TClass* TFormLeafInfoMethod::GetClass()
const
2221 if (fNext)
return fNext->GetClass();
2222 TMethodCall::EReturnType r = fMethod->ReturnType();
2223 if (r!=TMethodCall::kOther)
return 0;
2225 return ReturnTClass(fMethod);
2231 Bool_t TFormLeafInfoMethod::IsInteger()
const
2233 TMethodCall::EReturnType r = fMethod->ReturnType();
2234 if (r == TMethodCall::kLong) {
2236 }
else return kFALSE;
2242 Bool_t TFormLeafInfoMethod::IsString()
const
2244 if (fNext)
return fNext->IsString();
2246 TMethodCall::EReturnType r = fMethod->ReturnType();
2247 return (r==TMethodCall::kString);
2255 Bool_t TFormLeafInfoMethod::Update()
2257 if (!TFormLeafInfo::Update())
return kFALSE;
2259 fMethod =
new TMethodCall(fClass, fMethodName, fParams);
2267 void *TFormLeafInfoMethod::GetLocalValuePointer( TLeaf *from,
2270 return TFormLeafInfo::GetLocalValuePointer( from, instance);
2276 void *TFormLeafInfoMethod::GetLocalValuePointer(
char *from,
2279 void *thisobj = from;
2280 if (!thisobj)
return 0;
2282 TMethodCall::EReturnType r = fMethod->ReturnType();
2285 if (r == TMethodCall::kLong) {
2287 fMethod->Execute(thisobj, l);
2288 fResult = (Double_t) l;
2290 gInterpreter->ClearStack();
2293 }
else if (r == TMethodCall::kDouble) {
2295 fMethod->Execute(thisobj, d);
2296 fResult = (Double_t) d;
2298 gInterpreter->ClearStack();
2301 }
else if (r == TMethodCall::kString) {
2302 char *returntext = 0;
2303 fMethod->Execute(thisobj,&returntext);
2304 gInterpreter->ClearStack();
2307 }
else if (r == TMethodCall::kOther) {
2308 char * char_result = 0;
2310 if (fValuePointer) {
2311 gROOT->ProcessLine(Form(fDeleteFormat.Data(),fValuePointer));
2315 fMethod->Execute(thisobj, &char_result);
2317 fValuePointer = (
char*)gInterpreter->Calc(Form(fCopyFormat.Data(),char_result));
2318 char_result = (
char*)fValuePointer;
2320 gInterpreter->ClearStack();
2330 template <
typename T>
2331 T TFormLeafInfoMethod::ReadValueImpl(
char *where, Int_t instance)
2333 void *thisobj = where;
2334 if (!thisobj)
return 0;
2336 TMethodCall::EReturnType r = fMethod->ReturnType();
2339 if (r == TMethodCall::kLong) {
2341 fMethod->Execute(thisobj, l);
2344 }
else if (r == TMethodCall::kDouble) {
2346 fMethod->Execute(thisobj, d);
2349 }
else if (r == TMethodCall::kString) {
2350 char *returntext = 0;
2351 fMethod->Execute(thisobj,&returntext);
2352 result = T((Long_t) returntext);
2355 char * char_result = 0;
2356 fMethod->Execute(thisobj, &char_result);
2357 result = fNext->ReadTypedValue<T>(char_result,instance);
2359 }
else fMethod->Execute(thisobj);
2362 gInterpreter->ClearStack();
2366 INSTANTIATE_READVAL(TFormLeafInfoMethod);
2378 TFormLeafInfoMultiVarDim::TFormLeafInfoMultiVarDim( TClass* classptr,
2380 TStreamerElement* element,
2381 TFormLeafInfo* parent) :
2382 TFormLeafInfo(classptr,offset,element),fNsize(0),fCounter2(0),fSumOfSizes(0),
2383 fDim(0),fVirtDim(-1),fPrimaryIndex(-1),fSecondaryIndex(-1)
2385 if (element && element->InheritsFrom(TStreamerBasicPointer::Class())) {
2386 TStreamerBasicPointer * elem = (TStreamerBasicPointer*)element;
2388 Int_t counterOffset = 0;
2389 TStreamerElement* counter = ((TStreamerInfo*)classptr->GetStreamerInfo())->GetStreamerElement(elem->GetCountName(),counterOffset);
2390 if (!parent)
return;
2391 fCounter2 = parent->DeepCopy();
2392 TFormLeafInfo ** next = &(fCounter2->fNext);
2393 while(*next != 0) next = &( (*next)->fNext);
2394 *next =
new TFormLeafInfo(classptr,counterOffset,counter);
2396 }
else Error(
"Constructor",
"Called without a proper TStreamerElement");
2402 TFormLeafInfoMultiVarDim::TFormLeafInfoMultiVarDim() :
2403 TFormLeafInfo(0,0,0),fNsize(0),fCounter2(0),fSumOfSizes(0),
2404 fDim(0),fVirtDim(-1),fPrimaryIndex(-1),fSecondaryIndex(-1)
2411 TFormLeafInfoMultiVarDim::TFormLeafInfoMultiVarDim(
const TFormLeafInfoMultiVarDim& orig) : TFormLeafInfo(orig)
2413 fNsize = orig.fNsize;
2414 orig.fSizes.Copy(fSizes);
2415 fCounter2 = orig.fCounter2?orig.fCounter2->DeepCopy():0;
2416 fSumOfSizes = orig.fSumOfSizes;
2418 fVirtDim = orig.fVirtDim;
2419 fPrimaryIndex = orig.fPrimaryIndex;
2420 fSecondaryIndex = orig.fSecondaryIndex;
2426 void TFormLeafInfoMultiVarDim::Swap(TFormLeafInfoMultiVarDim &other)
2428 TFormLeafInfo::Swap(other);
2429 std::swap(fNsize,other.fNsize);
2430 std::swap(fSizes,other.fSizes);
2431 std::swap(fSumOfSizes,other.fSumOfSizes);
2432 std::swap(fDim,other.fDim);
2433 std::swap(fVirtDim,other.fVirtDim);
2434 std::swap(fPrimaryIndex,other.fPrimaryIndex);
2435 std::swap(fSecondaryIndex,other.fSecondaryIndex);
2441 TFormLeafInfoMultiVarDim &TFormLeafInfoMultiVarDim::operator=(
const TFormLeafInfoMultiVarDim &other)
2443 TFormLeafInfoMultiVarDim tmp(other);
2451 TFormLeafInfo* TFormLeafInfoMultiVarDim::DeepCopy()
const
2453 return new TFormLeafInfoMultiVarDim(*
this);
2459 TFormLeafInfoMultiVarDim:: ~TFormLeafInfoMultiVarDim()
2472 void TFormLeafInfoMultiVarDim::LoadSizes(TBranch* branch)
2475 TLeaf *leaf = (TLeaf*)branch->GetListOfLeaves()->At(0);
2476 if (fCounter) fNsize = (Int_t)fCounter->GetValue(leaf);
2477 else fNsize = fCounter2->GetCounterValue(leaf);
2478 if (fNsize > fSizes.GetSize()) fSizes.Set(fNsize);
2480 for (Int_t i=0; i<fNsize; i++) {
2481 Int_t size = (Int_t)fCounter2->GetValue(leaf,i);
2482 fSumOfSizes += size;
2483 fSizes.AddAt( size, i );
2487 if (!fCounter2 || !fCounter)
return;
2488 TBranchElement *br =
dynamic_cast<TBranchElement*
>(branch);
2490 fNsize = br->GetBranchCount()->GetNdata();
2491 if (fNsize > fSizes.GetSize()) fSizes.Set(fNsize);
2493 for (Int_t i=0; i<fNsize; i++) {
2494 Int_t size = (Int_t)fCounter2->GetValue((TLeaf*)br->GetBranchCount2()->GetListOfLeaves()->At(0),i);
2495 fSumOfSizes += size;
2496 fSizes.AddAt( size, i );
2503 Int_t TFormLeafInfoMultiVarDim::GetPrimaryIndex()
2505 return fPrimaryIndex;
2511 Int_t TFormLeafInfoMultiVarDim::GetSize(Int_t index)
2513 if (index >= fSizes.GetSize()) {
2516 return fSizes.At(index);
2523 void TFormLeafInfoMultiVarDim::SetPrimaryIndex(Int_t index)
2525 fPrimaryIndex = index;
2531 void TFormLeafInfoMultiVarDim::SetSecondaryIndex(Int_t index)
2533 fSecondaryIndex = index;
2539 void TFormLeafInfoMultiVarDim::SetSize(Int_t index, Int_t val)
2541 fSumOfSizes += (val - fSizes.At(index));
2542 fSizes.AddAt(val,index);
2548 Int_t TFormLeafInfoMultiVarDim::GetSumOfSizes()
2555 Double_t TFormLeafInfoMultiVarDim::GetValue(TLeaf * ,
2559 Error(
"GetValue",
"This should never be called");
2568 Int_t TFormLeafInfoMultiVarDim::GetVarDim()
2577 Int_t TFormLeafInfoMultiVarDim::GetVirtVarDim()
2587 Bool_t TFormLeafInfoMultiVarDim::Update()
2589 Bool_t res = TFormLeafInfo::Update();
2590 if (fCounter2) fCounter2->Update();
2597 void TFormLeafInfoMultiVarDim::UpdateSizes(TArrayI *garr)
2600 if (garr->GetSize()<fNsize) garr->Set(fNsize);
2601 for (Int_t i=0; i<fNsize; i++) {
2602 Int_t local = fSizes.At(i);
2603 Int_t global = garr->At(i);
2604 if (global==0 || local<global) global = local;
2605 garr->AddAt(global,i);
2618 TFormLeafInfo* TFormLeafInfoMultiVarDimDirect::DeepCopy()
const
2620 return new TFormLeafInfoMultiVarDimDirect(*
this);
2626 template <
typename T>
2627 T TFormLeafInfoMultiVarDimDirect::GetValueImpl(TLeaf *leaf, Int_t instance)
2629 return ((TLeafElement*)leaf)->GetTypedValueSubArray<T>(fPrimaryIndex,instance);
2632 INSTANTIATE_GETVAL(TFormLeafInfoMultiVarDimDirect);
2637 Double_t TFormLeafInfoMultiVarDimDirect::ReadValue(
char * , Int_t )
2639 Error(
"ReadValue",
"This should never be called");
2652 TFormLeafInfoMultiVarDimCollection::TFormLeafInfoMultiVarDimCollection(
2653 TClass* motherclassptr,
2655 TClass* elementclassptr,
2656 TFormLeafInfo *parent) :
2657 TFormLeafInfoMultiVarDim(motherclassptr,offset,
2658 new TStreamerElement(
"collection",
"in class",
2660 TStreamerInfo::kAny,
2662 ? elementclassptr->GetName()
2664 ? motherclassptr->GetName()
2670 fCounter = parent->DeepCopy();
2671 fCounter2 = parent->DeepCopy();
2672 TFormLeafInfo ** next = &(fCounter2->fNext);
2673 while(*next != 0) next = &( (*next)->fNext);
2674 *next =
new TFormLeafInfoCollectionSize(elementclassptr);
2680 TFormLeafInfoMultiVarDimCollection::TFormLeafInfoMultiVarDimCollection(
2681 TClass* motherclassptr,
2683 TStreamerElement* element,
2684 TFormLeafInfo *parent) :
2685 TFormLeafInfoMultiVarDim(motherclassptr,offset,element)
2687 R__ASSERT(parent && element);
2688 fCounter = parent->DeepCopy();
2689 fCounter2 = parent->DeepCopy();
2690 TFormLeafInfo ** next = &(fCounter2->fNext);
2691 while(*next != 0) next = &( (*next)->fNext);
2692 *next =
new TFormLeafInfoCollectionSize(motherclassptr,offset,element);
2698 TFormLeafInfo* TFormLeafInfoMultiVarDimCollection::DeepCopy()
const
2700 return new TFormLeafInfoMultiVarDimCollection(*
this);
2705 Double_t TFormLeafInfoMultiVarDimCollection::GetValue(TLeaf * ,
2709 Error(
"GetValue",
"This should never be called");
2716 void TFormLeafInfoMultiVarDimCollection::LoadSizes(TBranch* branch)
2718 R__ASSERT(fCounter2);
2720 TLeaf *leaf = (TLeaf*)branch->GetListOfLeaves()->At(0);
2721 fNsize = (Int_t)fCounter->GetCounterValue(leaf);
2723 if (fNsize > fSizes.GetSize()) fSizes.Set(fNsize);
2725 for (Int_t i=0; i<fNsize; i++) {
2726 Int_t size = (Int_t)fCounter2->GetValue(leaf,i);
2727 fSumOfSizes += size;
2728 fSizes.AddAt( size, i );
2736 template <
typename T>
2737 T TFormLeafInfoMultiVarDimCollection::ReadValueImpl(
char *where, Int_t instance)
2739 if (fSecondaryIndex>=0) {
2740 UInt_t len = fNext->GetArrayLength();
2742 instance = fSecondaryIndex*len;
2744 instance = fSecondaryIndex;
2747 return fNext->ReadTypedValue<T>(where,instance);
2750 INSTANTIATE_READVAL(TFormLeafInfoMultiVarDimCollection);
2762 TFormLeafInfoMultiVarDimClones::TFormLeafInfoMultiVarDimClones(
2763 TClass* motherclassptr,
2765 TClass* elementclassptr,
2766 TFormLeafInfo *parent) :
2767 TFormLeafInfoMultiVarDim(motherclassptr,offset,
2768 new TStreamerElement(
"clones",
"in class",
2770 TStreamerInfo::kAny,
2772 ? elementclassptr->GetName()
2774 ? motherclassptr->GetName()
2780 fCounter = parent->DeepCopy();
2781 fCounter2 = parent->DeepCopy();
2782 TFormLeafInfo ** next = &(fCounter2->fNext);
2783 while(*next != 0) next = &( (*next)->fNext);
2784 *next =
new TFormLeafInfoClones(elementclassptr);
2790 TFormLeafInfoMultiVarDimClones::TFormLeafInfoMultiVarDimClones(
2791 TClass* motherclassptr,
2793 TStreamerElement* element,
2794 TFormLeafInfo *parent) :
2795 TFormLeafInfoMultiVarDim(motherclassptr,offset,element)
2797 R__ASSERT(parent && element);
2798 fCounter = parent->DeepCopy();
2799 fCounter2 = parent->DeepCopy();
2800 TFormLeafInfo ** next = &(fCounter2->fNext);
2801 while(*next != 0) next = &( (*next)->fNext);
2802 *next =
new TFormLeafInfoClones(motherclassptr,offset,element);
2808 TFormLeafInfo* TFormLeafInfoMultiVarDimClones::DeepCopy()
const
2810 return new TFormLeafInfoMultiVarDimClones(*
this);
2815 Double_t TFormLeafInfoMultiVarDimClones::GetValue(TLeaf * ,
2819 Error(
"GetValue",
"This should never be called");
2826 void TFormLeafInfoMultiVarDimClones::LoadSizes(TBranch* branch)
2828 R__ASSERT(fCounter2);
2830 TLeaf *leaf = (TLeaf*)branch->GetListOfLeaves()->At(0);
2831 fNsize = (Int_t)fCounter->GetCounterValue(leaf);
2833 if (fNsize > fSizes.GetSize()) fSizes.Set(fNsize);
2835 for (Int_t i=0; i<fNsize; i++) {
2836 TClonesArray *clones = (TClonesArray*)fCounter2->GetValuePointer(leaf,i);
2838 Int_t size = clones->GetEntries();
2839 fSumOfSizes += size;
2840 fSizes.AddAt( size, i );
2849 template <
typename T>
2850 T TFormLeafInfoMultiVarDimClones::ReadValueImpl(
char *where, Int_t instance)
2852 if (fSecondaryIndex>=0) {
2853 UInt_t len = fNext->GetArrayLength();
2855 instance = fSecondaryIndex*len;
2857 instance = fSecondaryIndex;
2860 return fNext->ReadTypedValue<T>(where,instance);
2863 INSTANTIATE_READVAL(TFormLeafInfoMultiVarDimClones);
2873 TFormLeafInfoCast::TFormLeafInfoCast(TClass* classptr, TClass* casted) :
2874 TFormLeafInfo(classptr),fCasted(casted),fGoodCast(kTRUE)
2876 if (casted) { fCastedName = casted->GetName(); }
2878 fIsTObject = fClass->IsTObject() && fCasted->IsLoaded();
2884 TFormLeafInfoCast::TFormLeafInfoCast(
const TFormLeafInfoCast& orig) :
2887 fCasted = orig.fCasted;
2888 fCastedName = orig.fCastedName;
2889 fGoodCast = orig.fGoodCast;
2890 fIsTObject = orig.fIsTObject;
2896 void TFormLeafInfoCast::Swap(TFormLeafInfoCast &other)
2898 TFormLeafInfo::Swap(other);
2899 std::swap(fCasted,other.fCasted);
2900 std::swap(fCastedName,other.fCastedName);
2901 std::swap(fGoodCast,other.fGoodCast);
2902 std::swap(fIsTObject,other.fIsTObject);
2908 TFormLeafInfoCast &TFormLeafInfoCast::operator=(
const TFormLeafInfoCast &other)
2910 TFormLeafInfoCast tmp(other);
2918 TFormLeafInfo* TFormLeafInfoCast::DeepCopy()
const
2920 return new TFormLeafInfoCast(*
this);
2926 TFormLeafInfoCast::~TFormLeafInfoCast()
2931 Int_t TFormLeafInfoCast::GetNdata()
2935 if (!fGoodCast)
return 0;
2936 if (fNext)
return fNext->GetNdata();
2943 template <
typename T>
2944 T TFormLeafInfoCast::ReadValueImpl(
char *where, Int_t instance)
2946 if (!fNext)
return 0;
2951 if ( fIsTObject && !((TObject*)where)->InheritsFrom(fCasted) ) {
2959 return fNext->ReadTypedValue<T>(where,instance);
2962 INSTANTIATE_READVAL(TFormLeafInfoCast);
2970 Bool_t TFormLeafInfoCast::Update()
2973 TClass * new_class = TClass::GetClass(fCastedName);
2974 if (new_class!=fCasted) {
2975 fCasted = new_class;
2978 return TFormLeafInfo::Update();
2986 TFormLeafInfoTTree::TFormLeafInfoTTree(TTree *tree,
const char *alias, TTree *current) :
2987 TFormLeafInfo( TTree::Class(), 0, 0 ), fTree(tree),fCurrent(current),fAlias(alias)
2991 if (fCurrent==0) fCurrent = fTree->GetFriend(alias);
2994 TFormLeafInfoTTree::TFormLeafInfoTTree(
const TFormLeafInfoTTree& orig) :
2999 fAlias = orig.fAlias;
3000 fCurrent = orig.fCurrent;
3003 TFormLeafInfo* TFormLeafInfoTTree::DeepCopy()
const
3007 return new TFormLeafInfoTTree(*
this);
3014 void* TFormLeafInfoTTree::GetLocalValuePointer(TLeaf *, Int_t instance)
3016 return GetLocalValuePointer((
char*)fCurrent,instance);
3022 template <
typename T>
3023 T TFormLeafInfoTTree::GetValueImpl(TLeaf *, Int_t instance)
3025 return ReadTypedValue<T>((
char*)fCurrent,instance);
3031 template <
typename T>
3032 T TFormLeafInfoTTree::ReadValueImpl(
char *thisobj, Int_t instance)
3034 if (fElement)
return TFormLeafInfo::ReadTypedValue<T>(thisobj,instance);
3035 else if (fNext)
return fNext->ReadTypedValue<T>(thisobj,instance);
3039 INSTANTIATE_GETVAL(TFormLeafInfoTTree);
3040 INSTANTIATE_READVAL(TFormLeafInfoTTree);
3045 Bool_t TFormLeafInfoTTree::Update()
3047 if (fAlias.Length() && fAlias != fTree->GetName()) {
3048 fCurrent = fTree->GetFriend(fAlias.Data());
3050 return fCurrent && TFormLeafInfo::Update();