LCOV - code coverage report
Current view: top level - src - netmessagemaker.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 11 13 84.6 %
Date: 2020-06-05 16:23:38 Functions: 7 46 15.2 %
Legend: Lines: hit, modifiedhit, not modified not hit, modifiednot hit, not modified

          Line data    Source code
#       1             : // Copyright (c) 2009-2010 Satoshi Nakamoto
#       2             : // Copyright (c) 2009-2018 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 <net.h>
#      10             : #include <serialize.h>
#      11             : 
#      12             : class CNetMsgMaker
#      13             : {
#      14             : public:
#      15          52 :     explicit CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn){}
#      16             : 
#      17             :     template <typename... Args>
#      18             :     CSerializedNetMsg Make(int nFlags, std::string sCommand, Args&&... args) const
#      19          38 :     {
#      20          38 :         CSerializedNetMsg msg;
#      21          38 :         if (sCommand == NetMsgType::ADDRv2) {
#      22           0 :             nFlags |= ADDRv2_FORMAT;
#      23           0 :         }
#      24          38 :         msg.command = std::move(sCommand);
#      25          38 :         CVectorWriter{ SER_NETWORK, nFlags | nVersion, msg.data, 0, std::forward<Args>(args)... };
#      26          38 :         return msg;
#      27          38 :     }
#      28             : 
#      29             :     template <typename... Args>
#      30             :     CSerializedNetMsg Make(std::string sCommand, Args&&... args) const
#      31          38 :     {
#      32          38 :         return Make(0, std::move(sCommand), std::forward<Args>(args)...);
#      33          38 :     }
#      34             : 
#      35             : private:
#      36             :     const int nVersion;
#      37             : };
#      38             : 
#      39             : #endif // BITCOIN_NETMESSAGEMAKER_H

Generated by: LCOV version 1.14