summaryrefslogtreecommitdiff
path: root/src/lib/buildgraph/productbuilddata.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2013-08-02 09:37:45 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2013-08-02 10:57:40 +0200
commitb47da5be0461aeaf54b16025430bf604938dd6fb (patch)
tree42ebce6104dee23183ae7628b4f4567adf374ea7 /src/lib/buildgraph/productbuilddata.cpp
parent7893c2b986c8f767e2cc747e98efcc6b48aec05f (diff)
downloadqbs-b47da5be0461aeaf54b16025430bf604938dd6fb.tar.gz
unmystify the serialization of artifacts
Move the serialization responsibility to Artifact itself. Do not store parents. They are merely backpointers that can be restored after loading. Change-Id: I82b07f6ac07bd74b638985d86635894330743558 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/lib/buildgraph/productbuilddata.cpp')
-rw-r--r--src/lib/buildgraph/productbuilddata.cpp58
1 files changed, 2 insertions, 56 deletions
diff --git a/src/lib/buildgraph/productbuilddata.cpp b/src/lib/buildgraph/productbuilddata.cpp
index 50f53c3d7..a8d0841a8 100644
--- a/src/lib/buildgraph/productbuilddata.cpp
+++ b/src/lib/buildgraph/productbuilddata.cpp
@@ -46,67 +46,13 @@ ProductBuildData::~ProductBuildData()
void ProductBuildData::load(PersistentPool &pool)
{
- // artifacts
- int i;
- pool.stream() >> i;
- artifacts.clear();
- for (; --i >= 0;) {
- Artifact *artifact = pool.idLoad<Artifact>();
- artifacts.insert(artifact);
- }
-
- // edges
- for (i = artifacts.count(); --i >= 0;) {
- Artifact *artifact = pool.idLoad<Artifact>();
- int k;
- pool.stream() >> k;
- artifact->parents.clear();
- artifact->parents.reserve(k);
- for (; --k >= 0;)
- artifact->parents.insert(pool.idLoad<Artifact>());
-
- pool.stream() >> k;
- artifact->children.clear();
- artifact->children.reserve(k);
- for (; --k >= 0;)
- artifact->children.insert(pool.idLoad<Artifact>());
-
- pool.stream() >> k;
- artifact->fileDependencies.clear();
- artifact->fileDependencies.reserve(k);
- for (; --k >= 0;)
- artifact->fileDependencies.insert(pool.idLoad<FileDependency>());
- }
-
- // other data
+ pool.loadContainer(artifacts);
pool.loadContainer(targetArtifacts);
}
void ProductBuildData::store(PersistentPool &pool) const
{
- pool.stream() << artifacts.count();
-
- //artifacts
- for (ArtifactList::const_iterator i = artifacts.constBegin(); i != artifacts.constEnd(); ++i)
- pool.store(*i);
-
- // edges
- for (ArtifactList::const_iterator i = artifacts.constBegin(); i != artifacts.constEnd(); ++i) {
- Artifact * artifact = *i;
- pool.store(artifact);
-
- pool.stream() << artifact->parents.count();
- foreach (Artifact * n, artifact->parents)
- pool.store(n);
- pool.stream() << artifact->children.count();
- foreach (Artifact * n, artifact->children)
- pool.store(n);
- pool.stream() << artifact->fileDependencies.count();
- foreach (FileDependency *dependency, artifact->fileDependencies)
- pool.store(dependency);
- }
-
- // other data
+ pool.storeContainer(artifacts);
pool.storeContainer(targetArtifacts);
}