LCOV - code coverage report
Current view: top level - src - netmessagemaker.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 9 9 100.0 %
Date: 2025-02-23 09:33:43 Functions: 59 73 80.8 %

          Line data    Source code
       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 PIVX_NETMESSAGEMAKER_H
       7             : #define PIVX_NETMESSAGEMAKER_H
       8             : 
       9             : #include "serialize.h"
      10             : 
      11             : class CNetMsgMaker
      12             : {
      13             : public:
      14     2913400 :     explicit CNetMsgMaker(int nVersionIn) : nVersion(nVersionIn){}
      15             : 
      16             :     template <typename... Args>
      17      329466 :     CSerializedNetMsg Make(int nFlags, std::string sCommand, Args&&... args)
      18             :     {
      19      329466 :         CSerializedNetMsg msg;
      20      329466 :         msg.command = std::move(sCommand);
      21      329466 :         msg.data.reserve(4 * 1024);
      22      329466 :         CVectorWriter{ SER_NETWORK, nFlags | nVersion, msg.data, 0, std::forward<Args>(args)... };
      23      329466 :         return msg;
      24             :     }
      25             : 
      26             :     template <typename... Args>
      27      329464 :     CSerializedNetMsg Make(std::string sCommand, Args&&... args)
      28             :     {
      29      988392 :         return Make(0, std::move(sCommand), std::forward<Args>(args)...);
      30             :     }
      31             : 
      32             : private:
      33             :     const int nVersion;
      34             : };
      35             : 
      36             : #endif // PIVX_NETMESSAGEMAKER_H

Generated by: LCOV version 1.14