1 /******************************************************************************
2 * Copyright © 2014-2018 The SuperNET Developers. *
4 * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
5 * the top-level directory of this distribution for the individual copyright *
6 * holder information and the developer policies on copyright and licensing. *
8 * Unless otherwise agreed in a custom licensing agreement, no part of the *
9 * SuperNET software, including this file may be copied, modified, propagated *
10 * or distributed except according to the terms contained in the LICENSE file *
12 * Removal or modification of this copyright notice is prohibited. *
14 ******************************************************************************/
24 * Serialisation boilerplate
28 std::vector<uint8_t> SerializeF(const T f)
30 CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
32 return std::vector<unsigned char>(ss.begin(), ss.end());
36 bool DeserializeF(const std::vector<unsigned char> vIn, T f)
38 CDataStream ss(vIn, SER_NETWORK, PROTOCOL_VERSION);
41 if (ss.eof()) return true;
46 #define E_MARSHAL(body) SerializeF([&] (CDataStream &ss) {body;})
47 #define E_UNMARSHAL(params, body) DeserializeF(params, [&] (CDataStream &ss) {body;})
49 #endif /* CC_UTILS_H */