ATLAS Offline Software
Loading...
Searching...
No Matches
ROOT8367Workaround::TBufferFileWorkaround Class Reference
Inheritance diagram for ROOT8367Workaround::TBufferFileWorkaround:
Collaboration diagram for ROOT8367Workaround::TBufferFileWorkaround:

Public Member Functions

void * ReadObjectAnyNV (const TClass *)

Static Public Member Functions

static void *doReadObjectAny NO_SANITIZE_UNDEFINED (TBufferFile *buf, const TClass *cl)

Detailed Description

Definition at line 79 of file TrigTSerializer.cxx.

Member Function Documentation

◆ NO_SANITIZE_UNDEFINED()

void *doReadObjectAny ROOT8367Workaround::TBufferFileWorkaround::NO_SANITIZE_UNDEFINED ( TBufferFile * buf,
const TClass * cl )
inlinestatic

Definition at line 84 of file TrigTSerializer.cxx.

85 {
86 TBufferFileWorkaround* ba = reinterpret_cast<TBufferFileWorkaround*>(buf);
87 return ba->ReadObjectAnyNV(cl);
88 }

◆ ReadObjectAnyNV()

void * ROOT8367Workaround::TBufferFileWorkaround::ReadObjectAnyNV ( const TClass * clCast)

Definition at line 92 of file TrigTSerializer.cxx.

93{
94 R__ASSERT(IsReading());
95
96 // make sure fMap is initialized
97 InitMap();
98
99 // before reading object save start position
100 UInt_t startpos = UInt_t(fBufCur-fBuffer);
101
102 // attempt to load next object as TClass clCast
103 UInt_t tag; // either tag or byte count
104 TClass *clRef = ReadClass(clCast, &tag);
105 TClass *clOnfile = 0;
106 Int_t baseOffset = 0;
107 if (clRef && (clRef!=invalidPtr) && clCast) {
108 //baseOffset will be -1 if clRef does not inherit from clCast.
109 baseOffset = clRef->GetBaseClassOffset(clCast);
110 if (baseOffset == -1) {
111 // The 2 classes are unrelated, maybe there is a converter between the 2.
112
113 if (!clCast->GetSchemaRules() ||
114 !clCast->GetSchemaRules()->HasRuleWithSourceClass(clRef->GetName()))
115 {
116 // There is no converter
117 Error("ReadObject", "got object of wrong class! requested %s but got %s",
118 clCast->GetName(), clRef->GetName());
119
120 CheckByteCount(startpos, tag, (TClass*)0); // avoid mis-leading byte count error message
121 return 0; // We better return at this point
122 }
123 baseOffset = 0; // For now we do not support requesting from a class that is the base of one of the class for which there is transformation to ....
124
125 //Info("ReadObjectAny","Using Converter StreamerInfo from %s to %s",clRef->GetName(),clCast->GetName());
126 clOnfile = clRef;
127 clRef = const_cast<TClass*>(clCast);
128
129 }
130 if (clCast->GetState() > TClass::kEmulated && clRef->GetState() <= TClass::kEmulated) {
131 //we cannot mix a compiled class with an emulated class in the inheritance
132 Error("ReadObject", "trying to read an emulated class (%s) to store in a compiled pointer (%s)",
133 clRef->GetName(),clCast->GetName());
134 CheckByteCount(startpos, tag, (TClass*)0); // avoid mis-leading byte count error message
135 return 0;
136 }
137 }
138
139 // check if object has not already been read
140 // (this can only happen when called via CheckObject())
141 char *obj;
142 if (fVersion > 0) {
143 obj = (char *) (Long_t)fMap->GetValue(startpos+kMapOffset);
144 if (obj == (void*) -1) obj = 0;
145 if (obj) {
146 CheckByteCount(startpos, tag, (TClass*)0);
147 return (obj+baseOffset);
148 }
149 }
150
151 // unknown class, skip to next object and return 0 obj
152 if (clRef == invalidPtr) {
153 if (fBufCur >= fBufMax) return 0;
154 if (fVersion > 0)
155 MapObject((TObject*) -1, startpos+kMapOffset);
156 else
157 MapObject((void*)0, 0, fMapCount);
158 CheckByteCount(startpos, tag, (TClass*)0);
159 return 0;
160 }
161
162 if (!clRef) {
163
164 // got a reference to an already read object
165 if (fVersion > 0) {
166 tag += fDisplacement;
167 tag = CheckObject(tag, clCast);
168 } else {
169 if (tag > (UInt_t)fMap->GetSize()) {
170 Error("ReadObject", "object tag too large, I/O buffer corrupted");
171 return 0;
172 // exception
173 }
174 }
175 obj = (char *) (Long_t)fMap->GetValue(tag);
176 clRef = (TClass*) (Long_t)fClassMap->GetValue(tag);
177
178 if (clRef && (clRef!=invalidPtr) && clCast) {
179 //baseOffset will be -1 if clRef does not inherit from clCast.
180 baseOffset = clRef->GetBaseClassOffset(clCast);
181 if (baseOffset == -1) {
182 Error("ReadObject", "Got object of wrong class (Got %s while expecting %s)",
183 clRef->GetName(),clCast->GetName());
184 // exception
185 baseOffset = 0;
186 }
187 }
188
189 // There used to be a warning printed here when:
190 // obj && isTObject && !((TObject*)obj)->IsA()->InheritsFrom(clReq)
191 // however isTObject was based on clReq (now clCast).
192 // If the test was to fail, then it is as likely that the object is not a TObject
193 // and then we have a potential core dump.
194 // At this point (missing clRef), we do NOT have enough information to really
195 // answer the question: is the object read of the type I requested.
196
197 } else {
198
199 // allocate a new object based on the class found
200 obj = (char*)clRef->New();
201 if (!obj) {
202 Error("ReadObject", "could not create object of class %s",
203 clRef->GetName());
204 // exception
205 return 0;
206 }
207
208 // add to fMap before reading rest of object
209 if (fVersion > 0)
210 MapObject(obj, clRef, startpos+kMapOffset);
211 else
212 MapObject(obj, clRef, fMapCount);
213
214 // let the object read itself
215 clRef->Streamer( obj, *this, clOnfile );
216
217 CheckByteCount(startpos, tag, clRef);
218 }
219
220 return obj+baseOffset;
221}
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition Error.h:16

The documentation for this class was generated from the following file: