LCOV - code coverage report
Current view: top level - include/Module/Stateful/Sink/User - Sink_user_binary.hpp (source / functions) Hit Total Coverage
Test: streampu_clean.info Lines: 1 1 100.0 %
Date: 2025-01-11 12:25:42 Functions: 2 20 10.0 %

          Line data    Source code
       1             : /*!
       2             :  * \file
       3             :  * \brief Class module::Sink_user_binary.
       4             :  */
       5             : #ifndef SINK_USER_BINARY_HPP
       6             : #define SINK_USER_BINARY_HPP
       7             : 
       8             : #include <cstddef>
       9             : #include <fstream>
      10             : #include <string>
      11             : #include <vector>
      12             : 
      13             : #include "Module/Stateful/Sink/Sink.hpp"
      14             : 
      15             : namespace spu
      16             : {
      17             : namespace module
      18             : {
      19             : /*!
      20             :  * \class Sink_user_binary
      21             :  *
      22             :  * \brief Send data to a binary file.
      23             :  *
      24             :  * \tparam B: type of the data to send or receive.
      25             :  *
      26             :  */
      27             : template<typename B = int>
      28             : class Sink_user_binary : public Sink<B>
      29             : {
      30             :   private:
      31             :     const std::string filename;
      32             :     std::ofstream sink_file;
      33             :     std::vector<char> chunk;
      34             :     std::vector<B> reconstructed_buffer;
      35             :     size_t n_left; // number of bits left by last call
      36             : 
      37             :   public:
      38             :     Sink_user_binary(const int max_data_size, const std::string& filename);
      39          36 :     ~Sink_user_binary() = default;
      40             : 
      41             :     virtual void reset();
      42             : 
      43             :   protected:
      44             :     virtual void _send_count(const B* in_data, const uint32_t* in_count, const size_t frame_id);
      45             : };
      46             : 
      47             : }
      48             : }
      49             : 
      50             : #endif /* SINK_USER_BINARY_HPP */

Generated by: LCOV version 1.14