From 52955068b70fdd4166ffe443e716b0b2f6fe9f6d Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Wed, 8 Oct 2014 14:28:03 -0400 Subject: [PATCH] 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. --- src/serialize.h | 77 ------------------------------------------------ src/walletdb.cpp | 8 ++--- 2 files changed, 4 insertions(+), 81 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 8220fecb9..55b689139 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -20,8 +20,6 @@ #include #include -#include - class CAutoFile; class CDataStream; class CScript; @@ -452,16 +450,6 @@ template unsigned int GetSerializeSize(const std::pair void Serialize(Stream& os, const std::pair& item, int nType, int nVersion); template void Unserialize(Stream& is, std::pair& item, int nType, int nVersion); -// 3 tuple -template unsigned int GetSerializeSize(const boost::tuple& item, int nType, int nVersion); -template void Serialize(Stream& os, const boost::tuple& item, int nType, int nVersion); -template void Unserialize(Stream& is, boost::tuple& item, int nType, int nVersion); - -// 4 tuple -template unsigned int GetSerializeSize(const boost::tuple& item, int nType, int nVersion); -template void Serialize(Stream& os, const boost::tuple& item, int nType, int nVersion); -template void Unserialize(Stream& is, boost::tuple& item, int nType, int nVersion); - // map template unsigned int GetSerializeSize(const std::map& m, int nType, int nVersion); template void Serialize(Stream& os, const std::map& m, int nType, int nVersion); @@ -669,71 +657,6 @@ void Unserialize(Stream& is, std::pair& item, int nType, int nVersion) -// -// 3 tuple -// -template -unsigned int GetSerializeSize(const boost::tuple& 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 -void Serialize(Stream& os, const boost::tuple& 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 -void Unserialize(Stream& is, boost::tuple& 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 -unsigned int GetSerializeSize(const boost::tuple& 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 -void Serialize(Stream& os, const boost::tuple& 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 -void Unserialize(Stream& is, boost::tuple& 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 // diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 783f766f6..ffddd8106 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