Merge READWRITEMANY into READWRITE

This commit is contained in:
Pieter Wuille 2018-03-13 16:35:01 -07:00
parent 0630974647
commit 2761bca997
2 changed files with 2 additions and 28 deletions

View File

@ -148,8 +148,7 @@ enum
SER_GETHASH = (1 << 2), SER_GETHASH = (1 << 2),
}; };
#define READWRITE(obj) (::SerReadWrite(s, (obj), ser_action)) #define READWRITE(...) (::SerReadWriteMany(s, ser_action, __VA_ARGS__))
#define READWRITEMANY(...) (::SerReadWriteMany(s, ser_action, __VA_ARGS__))
/** /**
* Implement three methods for serializable objects. These are actually wrappers over * Implement three methods for serializable objects. These are actually wrappers over
@ -825,19 +824,6 @@ struct CSerActionUnserialize
constexpr bool ForRead() const { return true; } constexpr bool ForRead() const { return true; }
}; };
template<typename Stream, typename T>
inline void SerReadWrite(Stream& s, const T& obj, CSerActionSerialize ser_action)
{
::Serialize(s, obj);
}
template<typename Stream, typename T>
inline void SerReadWrite(Stream& s, T& obj, CSerActionUnserialize ser_action)
{
::Unserialize(s, obj);
}
@ -897,12 +883,6 @@ void SerializeMany(Stream& s)
{ {
} }
template<typename Stream, typename Arg>
void SerializeMany(Stream& s, Arg&& arg)
{
::Serialize(s, std::forward<Arg>(arg));
}
template<typename Stream, typename Arg, typename... Args> template<typename Stream, typename Arg, typename... Args>
void SerializeMany(Stream& s, Arg&& arg, Args&&... args) void SerializeMany(Stream& s, Arg&& arg, Args&&... args)
{ {
@ -915,12 +895,6 @@ inline void UnserializeMany(Stream& s)
{ {
} }
template<typename Stream, typename Arg>
inline void UnserializeMany(Stream& s, Arg& arg)
{
::Unserialize(s, arg);
}
template<typename Stream, typename Arg, typename... Args> template<typename Stream, typename Arg, typename... Args>
inline void UnserializeMany(Stream& s, Arg& arg, Args&... args) inline void UnserializeMany(Stream& s, Arg& arg, Args&... args)
{ {

View File

@ -53,7 +53,7 @@ public:
template <typename Stream, typename Operation> template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) { inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITEMANY(intval, boolval, stringval, FLATDATA(charstrval), txval); READWRITE(intval, boolval, stringval, FLATDATA(charstrval), txval);
} }
}; };