26 TFormLeafInfoReference::TFormLeafInfoReference(TClass* cl, TStreamerElement* e,
int off)
27 : TFormLeafInfo(cl,off,e), fProxy(0), fBranch(0)
29 TVirtualRefProxy* p = cl->GetReferenceProxy();
31 ::Error(
"TFormLeafInfoReference",
"No reference proxy for class %s availible",cl->GetName());
40 TFormLeafInfoReference::TFormLeafInfoReference(
const TFormLeafInfoReference& org)
41 : TFormLeafInfo(org), fProxy(0), fBranch(org.fBranch)
43 TVirtualRefProxy* p = org.fProxy;
45 ::Error(
"TFormLeafInfoReference",
"No reference proxy for class %s availible",fClass->GetName());
54 TFormLeafInfoReference::~TFormLeafInfoReference()
56 if ( fProxy ) fProxy->Release();
62 void TFormLeafInfoReference::Swap(TFormLeafInfoReference &other)
64 TFormLeafInfo::Swap(other);
65 std::swap(fProxy,other.fProxy);
66 std::swap(fBranch,other.fBranch);
72 TFormLeafInfoReference &TFormLeafInfoReference::operator=(
const TFormLeafInfoReference &other)
74 TFormLeafInfoReference tmp(other);
82 TFormLeafInfo* TFormLeafInfoReference::DeepCopy()
const
84 return new TFormLeafInfoReference(*
this);
90 TClass* TFormLeafInfoReference::GetClass()
const
92 return fNext ? fNext->GetClass() : 0;
98 Bool_t TFormLeafInfoReference::HasCounter()
const
100 Bool_t result = fProxy ? fProxy->HasCounter() :
false;
101 if (fNext) result |= fNext->HasCounter();
102 return fCounter!=0 || result;
107 Int_t TFormLeafInfoReference::ReadCounterValue(
char *where)
110 if ( where && HasCounter() ) {
111 where = (
char*)fProxy->GetPreparedReference(where);
113 return fProxy->GetCounterValue(
this, where);
116 gInterpreter->ClearStack();
124 Int_t TFormLeafInfoReference::GetCounterValue(TLeaf* leaf) {
125 if ( HasCounter() ) {
128 if (leaf->InheritsFrom(TLeafObject::Class()) ) {
129 thisobj = (
char*)((TLeafObject*)leaf)->GetObject();
131 thisobj = GetObjectAddress((TLeafElement*)leaf, instance);
133 return ReadCounterValue(thisobj);
141 TClass* TFormLeafInfoReference::GetValueClass(TLeaf* leaf)
143 return this->GetValueClass(this->GetLocalValuePointer(leaf,0));
149 TClass* TFormLeafInfoReference::GetValueClass(
void* obj)
151 return fProxy ? fProxy->GetValueClass(obj) : 0;
157 Bool_t TFormLeafInfoReference::Update()
159 Bool_t res = this->TFormLeafInfo::Update();
160 if ( fProxy ) fProxy->Update();
167 template <
typename T>
168 T TFormLeafInfoReference::GetValueImpl(TLeaf *leaf, Int_t instance)
170 fBranch = leaf->GetBranch();
171 return TFormLeafInfo::GetValueImpl<T>(leaf, instance);
174 template Double_t TFormLeafInfoReference::GetValueImpl<Double_t>(TLeaf*, Int_t);
175 template Long64_t TFormLeafInfoReference::GetValueImpl<Long64_t>(TLeaf*, Int_t);
176 template LongDouble_t TFormLeafInfoReference::GetValueImpl<LongDouble_t>(TLeaf*, Int_t);
182 void *TFormLeafInfoReference::GetLocalValuePointer( TLeaf *from, Int_t instance)
184 fBranch = from->GetBranch();
185 return TFormLeafInfo::GetLocalValuePointer(from, instance);
191 void *TFormLeafInfoReference::GetLocalValuePointer(
char *where, Int_t instance)
194 where = (
char*)fProxy->GetPreparedReference(where);
196 void* result = fProxy->GetObject(
this, where, instance);
197 gInterpreter->ClearStack();
201 gInterpreter->ClearStack();
208 template <
typename T>
209 T TFormLeafInfoReference::ReadValueImpl(
char *where, Int_t instance)
213 where = (
char*)fProxy->GetPreparedReference(where);
215 void* res = fProxy->GetObject(
this, where, instance);
217 result = (fNext) ? fNext->ReadTypedValue<T>((
char*)res,instance) : *(Double_t*)res;
221 gInterpreter->ClearStack();
226 template Double_t TFormLeafInfoReference::ReadValueImpl<Double_t>(
char*, Int_t);
227 template Long64_t TFormLeafInfoReference::ReadValueImpl<Long64_t>(
char*, Int_t);
228 template LongDouble_t TFormLeafInfoReference::ReadValueImpl<LongDouble_t>(
char*, Int_t);