Fabcoin Core  0.16.2
P2P Digital Currency
netmessagemaker.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2017 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 FABCOIN_NETMESSAGEMAKER_H
7 #define FABCOIN_NETMESSAGEMAKER_H
8 
9 #include <net.h>
10 #include <serialize.h>
11 
13 {
14 public:
15  CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn){}
16 
17  template <typename... Args>
18  CSerializedNetMsg Make(int nFlags, std::string sCommand, Args&&... args) const
19  {
21  msg.command = std::move(sCommand);
22  CVectorWriter{ SER_NETWORK, nFlags | nVersion, msg.data, 0, std::forward<Args>(args)... };
23  return msg;
24  }
25 
26  template <typename... Args>
27  CSerializedNetMsg Make(std::string sCommand, Args&&... args) const
28  {
29  return Make(0, std::move(sCommand), std::forward<Args>(args)...);
30  }
31 
32 private:
33  const int nVersion;
34 };
35 
36 #endif // FABCOIN_NETMESSAGEMAKER_H
std::vector< unsigned char > data
Definition: net.h:115
const int nVersion
CSerializedNetMsg Make(std::string sCommand, Args &&...args) const
CNetMsgMaker(int nVersionIn)
std::string command
Definition: net.h:116
CSerializedNetMsg Make(int nFlags, std::string sCommand, Args &&...args) const