data: save nodes and edges to Storage in order of parsing

This commit is contained in:
Eberhard Graether
2016-03-11 13:01:59 +01:00
parent f85d5a6024
commit a8aaf6950f
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -46,7 +46,7 @@ Id IntermediateStorage::addNode(int type, const NameHierarchy& nameHierarchy, bo
// refine stored information
if (defined)
{
std::unordered_map<Id, std::shared_ptr<StorageNode>>::const_iterator it2 = m_nodeIdsToData.find(it->second);
std::map<Id, std::shared_ptr<StorageNode>>::const_iterator it2 = m_nodeIdsToData.find(it->second);
std::shared_ptr<StorageNode> storageNode = it2->second;
if (!storageNode->defined && storageNode->type < type)
{
@@ -184,7 +184,7 @@ void IntermediateStorage::transferToStorage(SqliteStorage& storage)
}
}
for (std::unordered_map<Id, std::shared_ptr<StorageNode>>::const_iterator it = m_nodeIdsToData.begin(); it != m_nodeIdsToData.end(); it++)
for (std::map<Id, std::shared_ptr<StorageNode>>::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<Id, std::shared_ptr<StorageEdge>>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++)
for (std::map<Id, std::shared_ptr<StorageEdge>>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++)
{
std::unordered_map<Id, Id>::const_iterator it2;
it2 = clientIdToStorageId.find(it->second->sourceNodeId);
@@ -324,7 +324,7 @@ void IntermediateStorage::forEachFile(std::function<void(const Id /*id*/, const
void IntermediateStorage::forEachNode(std::function<void(const Id /*id*/, const StorageNode& /*data*/)> callback) const
{
for (std::unordered_map<Id, std::shared_ptr<StorageNode>>::const_iterator it = m_nodeIdsToData.begin(); it != m_nodeIdsToData.end(); it++)
for (std::map<Id, std::shared_ptr<StorageNode>>::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<void(const Id /*id*/, const
void IntermediateStorage::forEachEdge(std::function<void(const Id /*id*/, const StorageEdge& /*data*/)> callback) const
{
for (std::unordered_map<Id, std::shared_ptr<StorageEdge>>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++)
for (std::map<Id, std::shared_ptr<StorageEdge>>::const_iterator it = m_edgeIdsToData.begin(); it != m_edgeIdsToData.end(); it++)
{
callback(it->first, *(it->second.get()));
}
+2 -2
View File
@@ -45,10 +45,10 @@ private:
std::unordered_map<Id, std::shared_ptr<StorageFile>> m_fileIdsToData;
std::unordered_map<std::string, Id> m_nodeNamesToIds; // this is used to prevent duplicates (unique)
std::unordered_map<Id, std::shared_ptr<StorageNode>> m_nodeIdsToData;
std::map<Id, std::shared_ptr<StorageNode>> m_nodeIdsToData;
std::unordered_map<std::string, Id> m_edgeNamesToIds; // this is used to prevent duplicates (unique)
std::unordered_map<Id, std::shared_ptr<StorageEdge>> m_edgeIdsToData;
std::map<Id, std::shared_ptr<StorageEdge>> m_edgeIdsToData;
std::vector<StorageSourceLocation> m_sourceLocations;
std::vector<StorageComponentAccess> m_componentAccesses;