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

Method restorePointers

src/utilities/idf/WorkspaceObject.cpp:1041–1072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1039 }
1040
1041 void WorkspaceObject_Impl::restorePointers() {
1042 OS_ASSERT(!m_handle.isNull());
1043 if (m_sourceData) {
1044 for (const ForwardPointer& ptr : m_sourceData->pointers) {
1045 if (!ptr.targetHandle.isNull()) {
1046 OptionalWorkspaceObject target = m_workspace->getObject(ptr.targetHandle);
1047 if (target) {
1048 WorkspaceObjectVector sources = target->getSources(iddObject().type());
1049 HandleVector h = getHandles<WorkspaceObject>(sources);
1050 if (std::find(h.begin(), h.end(), m_handle) == h.end()) {
1051 target->getImpl<WorkspaceObject_Impl>()->setReversePointer(m_handle, ptr.fieldIndex);
1052 }
1053 }
1054 }
1055 }
1056 }
1057 if (m_targetData) {
1058 for (const ReversePointer& ptr : m_targetData->reversePointers) {
1059 OptionalWorkspaceObject source = m_workspace->getObject(ptr.sourceHandle);
1060 if (source) {
1061 OptionalWorkspaceObject oTarget = source->getTarget(ptr.fieldIndex);
1062 OptionalHandle h;
1063 if (oTarget) {
1064 h = oTarget->handle();
1065 }
1066 if ((!h) || (*h != m_handle)) {
1067 source->getImpl<WorkspaceObject_Impl>()->setPointer(ptr.fieldIndex, m_handle, false);
1068 }
1069 }
1070 }
1071 }
1072 }
1073
1074 // PRIVATE
1075

Callers 1

restoreObjectMethod · 0.80

Calls 10

isNullMethod · 0.80
getSourcesMethod · 0.80
beginMethod · 0.80
setReversePointerMethod · 0.80
getObjectMethod · 0.45
typeMethod · 0.45
endMethod · 0.45
getTargetMethod · 0.45
handleMethod · 0.45
setPointerMethod · 0.45

Tested by

no test coverage detected