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 81 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 86 of file TrigTSerializer.cxx.

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

◆ ReadObjectAnyNV()

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

Definition at line 94 of file TrigTSerializer.cxx.

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