From a8aaf6950f45c84e55e110a6c3f0cff1be21c857 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Fri, 11 Mar 2016 13:01:59 +0100 Subject: [PATCH] data: save nodes and edges to Storage in order of parsing --- src/lib/data/IntermediateStorage.cpp | 10 +++++----- src/lib/data/IntermediateStorage.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/data/IntermediateStorage.cpp b/src/lib/data/IntermediateStorage.cpp index f2889e2b..b2a45a8d 100644 --- a/src/lib/data/IntermediateStorage.cpp +++ b/src/lib/data/IntermediateStorage.cpp @@ -46,7 +46,7 @@ Id IntermediateStorage::addNode(int type, const NameHierarchy& nameHierarchy, bo // refine stored information if (defined) { - std::unordered_map>::const_iterator it2 = m_nodeIdsToData.find(it->second); + std::map>::const_iterator it2 = m_nodeIdsToData.find(it->second); std::shared_ptr storageNode = it2->second; if (!storageNode->defined && storageNode->type < type) { @@ -184,7 +184,7 @@ void IntermediateStorage::transferToStorage(SqliteStorage& storage) } } - for (std::unordered_map>::const_iterator it = m_nodeIdsToData.begin(); it != m_nodeIdsToData.end(); it++) + for (std::map>::const_iterator it = m_nodeIdsToData.begin(); it != m_nodeIdsToData.end(); it++) { StorageNode clientNode = *(it->second.get()); StorageNode storageNode = storage.getNodeBySerializedName(clientNode.serializedName); @@ -207,7 +207,7 @@ void IntermediateStorage::transferToStorage(SqliteStorage& storage) clientIdToStorageId[it->first] = storageNodeId; } - for (std::unordered_map>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++) + for (std::map>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++) { std::unordered_map::const_iterator it2; it2 = clientIdToStorageId.find(it->second->sourceNodeId); @@ -324,7 +324,7 @@ void IntermediateStorage::forEachFile(std::function callback) const { - for (std::unordered_map>::const_iterator it = m_nodeIdsToData.begin(); it != m_nodeIdsToData.end(); it++) + for (std::map>::const_iterator it = m_nodeIdsToData.begin(); it != m_nodeIdsToData.end(); it++) { callback(it->first, *(it->second.get())); } @@ -332,7 +332,7 @@ void IntermediateStorage::forEachNode(std::function callback) const { - for (std::unordered_map>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++) + for (std::map>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++) { callback(it->first, *(it->second.get())); } diff --git a/src/lib/data/IntermediateStorage.h b/src/lib/data/IntermediateStorage.h index 6a8c556d..cb0efdd7 100644 --- a/src/lib/data/IntermediateStorage.h +++ b/src/lib/data/IntermediateStorage.h @@ -45,10 +45,10 @@ private: std::unordered_map> m_fileIdsToData; std::unordered_map m_nodeNamesToIds; // this is used to prevent duplicates (unique) - std::unordered_map> m_nodeIdsToData; + std::map> m_nodeIdsToData; std::unordered_map m_edgeNamesToIds; // this is used to prevent duplicates (unique) - std::unordered_map> m_edgeIdsToData; + std::map> m_edgeIdsToData; std::vector m_sourceLocations; std::vector m_componentAccesses;