MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / nullifyPointer

Method nullifyPointer

src/utilities/idf/WorkspaceObject.cpp:996–1014  ·  view source on GitHub ↗

Pre-condition: field index is a pointer, and its targetHandle is either null or valid in m_workspace. Post-condition: field index is a pointer with a null targetHandle.

Source from the content-addressed store, hash-verified

994 // m_workspace.
995 // Post-condition: field index is a pointer with a null targetHandle.
996 void WorkspaceObject_Impl::nullifyPointer(unsigned index) {
997 OS_ASSERT(!m_handle.isNull());
998 // reverse pointer
999 OptionalWorkspaceObject oTarget = getTarget(index);
1000 if (oTarget) {
1001 WorkspaceObject target = *oTarget;
1002 target.getImpl<WorkspaceObject_Impl>()->nullifyReversePointer(m_handle, index);
1003 // remove forwarded reference if no other source sets the same
1004 m_workspace->removeForwardedReferences(handle(), index, target);
1005 }
1006
1007 // forward pointer
1008 auto fpIt = getIteratorAtFieldIndex<SourceData>(m_sourceData->pointers, index);
1009 OS_ASSERT(fpIt != m_sourceData->pointers.end());
1010 m_sourceData->pointers.erase(fpIt);
1011 std::pair<SourceData::pointer_set::iterator, bool> insertResult;
1012 insertResult = m_sourceData->pointers.insert(ForwardPointer(index, Handle()));
1013 OS_ASSERT(insertResult.second);
1014 }
1015
1016 // Pre-condition: Object sourceHandle points to this object from field index.
1017 // Post-condition: That information is removed from this object's m_targetData (in preparation for

Callers

nothing calls this directly

Calls 7

ForwardPointerFunction · 0.85
isNullMethod · 0.80
nullifyReversePointerMethod · 0.80
endMethod · 0.45
eraseMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected