Changeset View
Changeset View
Standalone View
Standalone View
src/netmessagemaker.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_NETMESSAGEMAKER_H | #ifndef BITCOIN_NETMESSAGEMAKER_H | ||||
#define BITCOIN_NETMESSAGEMAKER_H | #define BITCOIN_NETMESSAGEMAKER_H | ||||
#include "net.h" | #include "net.h" | ||||
#include "serialize.h" | #include "serialize.h" | ||||
class CNetMsgMaker { | class CNetMsgMaker { | ||||
public: | public: | ||||
CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn) {} | explicit CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn) {} | ||||
template <typename... Args> | template <typename... Args> | ||||
CSerializedNetMsg Make(int nFlags, std::string sCommand, | CSerializedNetMsg Make(int nFlags, std::string sCommand, | ||||
Args &&... args) const { | Args &&... args) const { | ||||
CSerializedNetMsg msg; | CSerializedNetMsg msg; | ||||
msg.command = std::move(sCommand); | msg.command = std::move(sCommand); | ||||
CVectorWriter{SER_NETWORK, nFlags | nVersion, msg.data, 0, | CVectorWriter{SER_NETWORK, nFlags | nVersion, msg.data, 0, | ||||
std::forward<Args>(args)...}; | std::forward<Args>(args)...}; | ||||
Show All 13 Lines |