ATLAS Offline Software
Public Member Functions | Static Public Member Functions | List of all members
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 73 of file TrigTSerializer.cxx.

Member Function Documentation

◆ NO_SANITIZE_UNDEFINED()

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

Definition at line 78 of file TrigTSerializer.cxx.

79  {
80  TBufferFileWorkaround* ba = reinterpret_cast<TBufferFileWorkaround*>(buf);
81  return ba->ReadObjectAnyNV(cl);
82  }

◆ ReadObjectAnyNV()

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

Definition at line 86 of file TrigTSerializer.cxx.

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

The documentation for this class was generated from the following file:
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
ROOT8367Workaround::kMapOffset
const Int_t kMapOffset
Definition: TrigTSerializer.cxx:68
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
python.PyAthena.obj
obj
Definition: PyAthena.py:132
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26