diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-02-12 14:53:42 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-02-16 11:34:20 +0000 |
commit | bca41151f08e2b198bd6ac1da1603d6933c9166a (patch) | |
tree | 3d835697679d793ee5bc4434bf760929d50641fa /src/lib/corelib/buildgraph/requestedartifacts.h | |
parent | 21c5ea0f79ad0e89eaa29ab5b91387b8454c4e3e (diff) |
Get rid of redundancies between load() and store() methods
It's silly that we have to mention each serializable data member in
both the load and the store methods.
Instead, whenever possible, forward these methods to a template that calls
the right function in the persistence backend based on its parameter.
Change-Id: I00e2dee8cdf55405f447cee27190bc97df8673e3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'src/lib/corelib/buildgraph/requestedartifacts.h')
-rw-r--r-- | src/lib/corelib/buildgraph/requestedartifacts.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/corelib/buildgraph/requestedartifacts.h b/src/lib/corelib/buildgraph/requestedartifacts.h index b08252997..003688e2c 100644 --- a/src/lib/corelib/buildgraph/requestedartifacts.h +++ b/src/lib/corelib/buildgraph/requestedartifacts.h @@ -66,7 +66,13 @@ public: void doSanityChecks() const; void load(PersistentPool &pool); - void store(PersistentPool &pool) const; + void store(PersistentPool &pool); + + template<PersistentPool::OpType opType> void serializationOp(PersistentPool &pool) + { + pool.serializationOp<opType>(m_requestedArtifactsPerProduct); + } + private: struct RequestedArtifactsPerProduct { @@ -79,8 +85,13 @@ private: void doSanityChecks() const; + template<PersistentPool::OpType opType> void serializationOp(PersistentPool &pool) + { + pool.serializationOp<opType>(allTags, requestedTags); + } + void load(PersistentPool &pool); - void store(PersistentPool &pool) const; + void store(PersistentPool &pool); }; std::unordered_map<QString, RequestedArtifactsPerProduct> m_requestedArtifactsPerProduct; |