1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #ifndef BITCOIN_NETMESSAGEMAKER_H
7 #define BITCOIN_NETMESSAGEMAKER_H
10 #include <serialize.h>
15 explicit CNetMsgMaker(int nVersionIn
) : nVersion(nVersionIn
){}
17 template <typename
... Args
>
18 CSerializedNetMsg
Make(int nFlags
, std::string sCommand
, Args
&&... args
) const
20 CSerializedNetMsg msg
;
21 msg
.command
= std::move(sCommand
);
22 CVectorWriter
{ SER_NETWORK
, nFlags
| nVersion
, msg
.data
, 0, std::forward
<Args
>(args
)... };
26 template <typename
... Args
>
27 CSerializedNetMsg
Make(std::string sCommand
, Args
&&... args
) const
29 return Make(0, std::move(sCommand
), std::forward
<Args
>(args
)...);
36 #endif // BITCOIN_NETMESSAGEMAKER_H