diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2014-10-08 14:28:03 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2014-10-15 15:13:19 -0400 |
commit | 52955068b70fdd4166ffe443e716b0b2f6fe9f6d (patch) | |
tree | 83451c056f24669164f1e212531e567928d1e599 /src | |
parent | 1d9b86d584542fbc34bf49726badaba2ca764228 (diff) |
boost: drop dependency on tuple in serialization
There's only one user of this form of serialization, so it can be easily
dropped. It could be re-added if desired when we switch to c++11.
Diffstat (limited to 'src')
-rw-r--r-- | src/serialize.h | 77 | ||||
-rw-r--r-- | src/walletdb.cpp | 8 |
2 files changed, 4 insertions, 81 deletions
diff --git a/src/serialize.h b/src/serialize.h index 8220fecb9c..55b6891394 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -20,8 +20,6 @@ #include <utility> #include <vector> -#include <boost/tuple/tuple.hpp> - class CAutoFile; class CDataStream; class CScript; @@ -452,16 +450,6 @@ template<typename K, typename T> unsigned int GetSerializeSize(const std::pair<K template<typename Stream, typename K, typename T> void Serialize(Stream& os, const std::pair<K, T>& item, int nType, int nVersion); template<typename Stream, typename K, typename T> void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion); -// 3 tuple -template<typename T0, typename T1, typename T2> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion); -template<typename Stream, typename T0, typename T1, typename T2> void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion); -template<typename Stream, typename T0, typename T1, typename T2> void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion); - -// 4 tuple -template<typename T0, typename T1, typename T2, typename T3> unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion); -template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion); -template<typename Stream, typename T0, typename T1, typename T2, typename T3> void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion); - // map template<typename K, typename T, typename Pred, typename A> unsigned int GetSerializeSize(const std::map<K, T, Pred, A>& m, int nType, int nVersion); template<typename Stream, typename K, typename T, typename Pred, typename A> void Serialize(Stream& os, const std::map<K, T, Pred, A>& m, int nType, int nVersion); @@ -670,71 +658,6 @@ void Unserialize(Stream& is, std::pair<K, T>& item, int nType, int nVersion) // -// 3 tuple -// -template<typename T0, typename T1, typename T2> -unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2>& item, int nType, int nVersion) -{ - unsigned int nSize = 0; - nSize += GetSerializeSize(boost::get<0>(item), nType, nVersion); - nSize += GetSerializeSize(boost::get<1>(item), nType, nVersion); - nSize += GetSerializeSize(boost::get<2>(item), nType, nVersion); - return nSize; -} - -template<typename Stream, typename T0, typename T1, typename T2> -void Serialize(Stream& os, const boost::tuple<T0, T1, T2>& item, int nType, int nVersion) -{ - Serialize(os, boost::get<0>(item), nType, nVersion); - Serialize(os, boost::get<1>(item), nType, nVersion); - Serialize(os, boost::get<2>(item), nType, nVersion); -} - -template<typename Stream, typename T0, typename T1, typename T2> -void Unserialize(Stream& is, boost::tuple<T0, T1, T2>& item, int nType, int nVersion) -{ - Unserialize(is, boost::get<0>(item), nType, nVersion); - Unserialize(is, boost::get<1>(item), nType, nVersion); - Unserialize(is, boost::get<2>(item), nType, nVersion); -} - - - -// -// 4 tuple -// -template<typename T0, typename T1, typename T2, typename T3> -unsigned int GetSerializeSize(const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion) -{ - unsigned int nSize = 0; - nSize += GetSerializeSize(boost::get<0>(item), nType, nVersion); - nSize += GetSerializeSize(boost::get<1>(item), nType, nVersion); - nSize += GetSerializeSize(boost::get<2>(item), nType, nVersion); - nSize += GetSerializeSize(boost::get<3>(item), nType, nVersion); - return nSize; -} - -template<typename Stream, typename T0, typename T1, typename T2, typename T3> -void Serialize(Stream& os, const boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion) -{ - Serialize(os, boost::get<0>(item), nType, nVersion); - Serialize(os, boost::get<1>(item), nType, nVersion); - Serialize(os, boost::get<2>(item), nType, nVersion); - Serialize(os, boost::get<3>(item), nType, nVersion); -} - -template<typename Stream, typename T0, typename T1, typename T2, typename T3> -void Unserialize(Stream& is, boost::tuple<T0, T1, T2, T3>& item, int nType, int nVersion) -{ - Unserialize(is, boost::get<0>(item), nType, nVersion); - Unserialize(is, boost::get<1>(item), nType, nVersion); - Unserialize(is, boost::get<2>(item), nType, nVersion); - Unserialize(is, boost::get<3>(item), nType, nVersion); -} - - - -// // map // template<typename K, typename T, typename Pred, typename A> diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 783f766f6f..ffddd8106b 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -185,7 +185,7 @@ bool CWalletDB::WriteAccount(const string& strAccount, const CAccount& account) bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccountingEntry& acentry) { - return Write(boost::make_tuple(string("acentry"), acentry.strAccount, nAccEntryNum), acentry); + return Write(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry); } bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry) @@ -218,7 +218,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); if (fFlags == DB_SET_RANGE) - ssKey << boost::make_tuple(string("acentry"), (fAllAccounts? string("") : strAccount), uint64_t(0)); + ssKey << std::make_pair(std::string("acentry"), std::make_pair((fAllAccounts ? string("") : strAccount), uint64_t(0))); CDataStream ssValue(SER_DISK, CLIENT_VERSION); int ret = ReadAtCursor(pcursor, ssKey, ssValue, fFlags); fFlags = DB_NEXT; @@ -977,11 +977,11 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename) bool CWalletDB::WriteDestData(const std::string &address, const std::string &key, const std::string &value) { nWalletDBUpdated++; - return Write(boost::make_tuple(std::string("destdata"), address, key), value); + return Write(std::make_pair(std::string("destdata"), std::make_pair(address, key)), value); } bool CWalletDB::EraseDestData(const std::string &address, const std::string &key) { nWalletDBUpdated++; - return Erase(boost::make_tuple(string("destdata"), address, key)); + return Erase(std::make_pair(std::string("destdata"), std::make_pair(address, key))); } |