Bitcoin ABC 0.32.6
P2P Digital Currency
netmessagemaker.h
Go to the documentation of this file.
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.
5
6#ifndef BITCOIN_NETMESSAGEMAKER_H
7#define BITCOIN_NETMESSAGEMAKER_H
8
9#include <serialize.h>
10
12class CVectorWriter;
13
14namespace NetMsg {
15template <typename... Args>
16CSerializedNetMsg Make(std::string msg_type, Args &&...args) {
18 msg.m_type = std::move(msg_type);
19 VectorWriter{msg.data, 0, std::forward<Args>(args)...};
20 return msg;
21}
22} // namespace NetMsg
23
24#endif // BITCOIN_NETMESSAGEMAKER_H
Minimal stream for overwriting and/or appending to an existing byte vector.
Definition: streams.h:31
CSerializedNetMsg Make(std::string msg_type, Args &&...args)
std::vector< uint8_t > data
Definition: net.h:134
std::string m_type
Definition: net.h:135