| 105 | } |
| 106 | |
| 107 | void WorkspaceObject_Impl::initializeOnClone(const HandleMap& oldNewHandleMap) { |
| 108 | OS_ASSERT(m_workspace); |
| 109 | if (m_sourceData) { |
| 110 | SourceData::pointer_set mappedPointers; |
| 111 | for (const ForwardPointer& fp : m_sourceData->pointers) { |
| 112 | Handle th = openstudio::applyHandleMap(fp.targetHandle, oldNewHandleMap); |
| 113 | if (th.isNull() && !fp.targetHandle.isNull() && !oldNewHandleMap.empty()) { |
| 114 | // if cloned object is also in this workspace, and fp.targetHandle not in |
| 115 | // the map, may be in the workspace |
| 116 | OptionalWorkspaceObject target = workspace().getObject(fp.targetHandle); |
| 117 | if (target) { |
| 118 | // need to set reverse pointer |
| 119 | target->getImpl<WorkspaceObject_Impl>()->setReversePointer(handle(), fp.fieldIndex); |
| 120 | th = fp.targetHandle; |
| 121 | } |
| 122 | } |
| 123 | mappedPointers.insert(ForwardPointer(fp.fieldIndex, th)); |
| 124 | if (!th.isNull()) { |
| 125 | m_workspace->forwardReferences(m_handle, fp.fieldIndex, th); |
| 126 | } |
| 127 | } |
| 128 | m_sourceData->pointers = mappedPointers; |
| 129 | } |
| 130 | if (m_targetData) { |
| 131 | TargetData::pointer_set mappedPointers; |
| 132 | for (const ReversePointer& rp : m_targetData->reversePointers) { |
| 133 | Handle sh = openstudio::applyHandleMap(rp.sourceHandle, oldNewHandleMap); |
| 134 | if (!sh.isNull()) { |
| 135 | mappedPointers.insert(ReversePointer(sh, rp.fieldIndex)); |
| 136 | } |
| 137 | } |
| 138 | m_targetData->reversePointers = mappedPointers; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | // GETTERS |
| 143 |
no test coverage detected