danicoin/tests/CoreTests/CryptoNoteBoostSerialization.h
2015-07-30 16:22:07 +01:00

136 lines
4.2 KiB
C++
Executable file

// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers
//
// This file is part of Bytecoin.
//
// Bytecoin is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Bytecoin is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with Bytecoin. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <boost/serialization/vector.hpp>
#include <boost/serialization/utility.hpp>
#include <boost/serialization/variant.hpp>
#include <boost/serialization/set.hpp>
#include <boost/serialization/map.hpp>
#include <boost/foreach.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include "CryptoNoteCore/CryptoNoteBasic.h"
#include "UnorderedContainersBoostSerialization.h"
#include "crypto/crypto.h"
//namespace CryptoNote {
namespace boost
{
namespace serialization
{
//---------------------------------------------------
template <class Archive>
inline void serialize(Archive &a, Crypto::PublicKey &x, const boost::serialization::version_type ver)
{
a & reinterpret_cast<char (&)[sizeof(Crypto::PublicKey)]>(x);
}
template <class Archive>
inline void serialize(Archive &a, Crypto::SecretKey &x, const boost::serialization::version_type ver)
{
a & reinterpret_cast<char (&)[sizeof(Crypto::SecretKey)]>(x);
}
template <class Archive>
inline void serialize(Archive &a, Crypto::KeyDerivation &x, const boost::serialization::version_type ver)
{
a & reinterpret_cast<char (&)[sizeof(Crypto::KeyDerivation)]>(x);
}
template <class Archive>
inline void serialize(Archive &a, Crypto::KeyImage &x, const boost::serialization::version_type ver)
{
a & reinterpret_cast<char (&)[sizeof(Crypto::KeyImage)]>(x);
}
template <class Archive>
inline void serialize(Archive &a, Crypto::Signature &x, const boost::serialization::version_type ver)
{
a & reinterpret_cast<char (&)[sizeof(Crypto::Signature)]>(x);
}
template <class Archive>
inline void serialize(Archive &a, Crypto::Hash &x, const boost::serialization::version_type ver)
{
a & reinterpret_cast<char (&)[sizeof(Crypto::Hash)]>(x);
}
template <class Archive> void serialize(Archive& archive, CryptoNote::MultisignatureInput &output, unsigned int version) {
archive & output.amount;
archive & output.signatureCount;
archive & output.outputIndex;
}
template <class Archive> void serialize(Archive& archive, CryptoNote::MultisignatureOutput &output, unsigned int version) {
archive & output.keys;
archive & output.requiredSignatureCount;
}
template <class Archive>
inline void serialize(Archive &a, CryptoNote::KeyOutput &x, const boost::serialization::version_type ver)
{
a & x.key;
}
template <class Archive>
inline void serialize(Archive &a, CryptoNote::BaseInput &x, const boost::serialization::version_type ver)
{
a & x.blockIndex;
}
template <class Archive>
inline void serialize(Archive &a, CryptoNote::KeyInput &x, const boost::serialization::version_type ver)
{
a & x.amount;
a & x.outputIndexes;
a & x.keyImage;
}
template <class Archive>
inline void serialize(Archive &a, CryptoNote::TransactionOutput &x, const boost::serialization::version_type ver)
{
a & x.amount;
a & x.target;
}
template <class Archive>
inline void serialize(Archive &a, CryptoNote::Transaction &x, const boost::serialization::version_type ver)
{
a & x.version;
a & x.unlockTime;
a & x.inputs;
a & x.outputs;
a & x.extra;
a & x.signatures;
}
template <class Archive>
inline void serialize(Archive &a, CryptoNote::Block &b, const boost::serialization::version_type ver)
{
a & b.majorVersion;
a & b.minorVersion;
a & b.timestamp;
a & b.previousBlockHash;
a & b.nonce;
//------------------
a & b.baseTransaction;
a & b.transactionHashes;
}
}
}
//}