| 10 | #include <serialize.h> |
| 11 | |
| 12 | class CNetMsgMaker |
| 13 | { |
| 14 | public: |
| 15 | explicit CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn){} |
| 16 | |
| 17 | template <typename... Args> |
| 18 | CSerializedNetMsg Make(int nFlags, std::string msg_type, Args&&... args) const |
| 19 | { |
| 20 | CSerializedNetMsg msg; |
| 21 | msg.m_type = std::move(msg_type); |
| 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 msg_type, Args&&... args) const |
| 28 | { |
| 29 | return Make(0, std::move(msg_type), std::forward<Args>(args)...); |
| 30 | } |
| 31 | |
| 32 | private: |
| 33 | const int nVersion; |
| 34 | }; |
| 35 | |
| 36 | #endif // BITCOIN_NETMESSAGEMAKER_H |
no outgoing calls
no test coverage detected