void CObjectOStream::WritePointer(TConstObjectPtr objectPtr, TTypeInfo declaredTypeInfo) { _TRACE("WritePointer("<<NStr::PtrToString(objectPtr)<<", " <<declaredTypeInfo->GetName()<<")"); if ( objectPtr == 0 ) { _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<": null"); WriteNullPointer(); return; } TTypeInfo realTypeInfo = declaredTypeInfo->GetRealTypeInfo(objectPtr); if ( m_Objects ) { const CWriteObjectInfo* info = m_Objects->RegisterObject(objectPtr, realTypeInfo); if ( info ) { // old object WriteObjectReference(info->GetIndex()); return; } } if ( declaredTypeInfo == realTypeInfo ) { _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<": new"); WriteThis(objectPtr, realTypeInfo); } else { _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<< ": new "<<realTypeInfo->GetName()); WriteOther(objectPtr, realTypeInfo); } }
TTypeInfo CPointerTypeInfo::GetRealDataTypeInfo(TConstObjectPtr object) const { TTypeInfo dataTypeInfo = GetPointedType(); if ( object ) dataTypeInfo = dataTypeInfo->GetRealTypeInfo(object); return dataTypeInfo; }