LCOV - code coverage report
Current view: top level - include/Module/Probe - Probe.hpp (source / functions) Hit Total Coverage
Test: streampu_clean.info Lines: 0 2 0.0 %
Date: 2024-06-12 12:04:18 Functions: 0 22 0.0 %

          Line data    Source code
       1             : /*!
       2             :  * \file
       3             :  * \brief Class module::Probe.
       4             :  */
       5             : #ifndef PROBE_HPP_
       6             : #define PROBE_HPP_
       7             : 
       8             : #include <cstddef>
       9             : #include <cstdint>
      10             : #include <memory>
      11             : #include <string>
      12             : #include <typeindex>
      13             : #include <vector>
      14             : 
      15             : #include "Module/Module.hpp"
      16             : #include "Runtime/Socket/Socket.hpp"
      17             : #include "Runtime/Task/Task.hpp"
      18             : #include "Tools/Interface/Interface_reset.hpp"
      19             : #include "Tools/Reporter/Probe/Reporter_probe.hpp"
      20             : 
      21             : namespace spu
      22             : {
      23             : namespace module
      24             : {
      25             : namespace prb
      26             : {
      27             : enum class tsk : uint8_t
      28             : {
      29             :     probe,
      30             :     SIZE
      31             : };
      32             : 
      33             : namespace sck
      34             : {
      35             : enum class probe : uint8_t
      36             : {
      37             :     in,
      38             :     status
      39             : };
      40             : enum class probe_noin : uint8_t
      41             : {
      42             :     status
      43             : };
      44             : }
      45             : }
      46             : 
      47             : class AProbe
      48             :   : public Module
      49             :   , public tools::Interface_reset
      50             : {
      51             :   protected:
      52             :     tools::Reporter_probe* reporter;
      53             : 
      54             :   public:
      55             :     AProbe();
      56           0 :     virtual ~AProbe() = default;
      57             :     virtual void reset() = 0;
      58             : 
      59             :     virtual void set_col_unit(const std::string& unit) = 0;
      60             :     virtual void set_col_buff_size(const size_t buffer_size) = 0;
      61             :     virtual void set_col_fmtflags(const std::ios_base::fmtflags ff) = 0;
      62             :     virtual void set_col_prec(const size_t precision) = 0;
      63             :     virtual void set_col_size(const size_t col_size) = 0;
      64             : 
      65             :     virtual void register_reporter(tools::Reporter_probe* reporter) = 0;
      66             : 
      67             :     virtual const std::string& get_col_name() const = 0;
      68             : 
      69             :     inline runtime::Task& operator[](const prb::tsk t);
      70             :     inline runtime::Socket& operator[](const prb::sck::probe s);
      71             :     inline runtime::Socket& operator[](const prb::sck::probe_noin s);
      72             :     inline runtime::Socket& operator[](const std::string& tsk_sck);
      73             : 
      74             :   protected:
      75             :     void check_reporter();
      76             :     void proxy_register_probe(const size_t data_size,
      77             :                               const std::type_index data_type,
      78             :                               const std::string& unit,
      79             :                               const size_t buffer_size,
      80             :                               const std::ios_base::fmtflags ff,
      81             :                               const size_t precision);
      82             :     void proxy_probe(const void* data, const size_t frame_id);
      83             : };
      84             : 
      85             : template<typename T = uint8_t>
      86             : class Probe : public AProbe
      87             : {
      88             :   public:
      89             :     inline runtime::Task& operator[](const prb::tsk t);
      90             :     inline runtime::Socket& operator[](const prb::sck::probe s);
      91             :     inline runtime::Socket& operator[](const prb::sck::probe_noin s);
      92             :     inline runtime::Socket& operator[](const std::string& tsk_sck);
      93             : 
      94             :   protected:
      95             :     const size_t socket_size;
      96             :     const std::string col_name;
      97             :     Probe(const size_t socket_size, const std::string& col_name);
      98             : 
      99             :   public:
     100           0 :     virtual ~Probe() = default;
     101             : 
     102             :     template<class AT = std::allocator<T>>
     103             :     void probe(const std::vector<T, AT>& in, const int frame_id = -1, const bool managed_memory = true);
     104             : 
     105             :     void probe(const T* in, const int frame_id = -1, const bool managed_memory = true);
     106             : 
     107             :     void probe(const int frame_id = -1, const bool managed_memory = true);
     108             : 
     109             :     virtual void reset();
     110             : 
     111             :     virtual void set_n_frames(const size_t n_frames);
     112             : 
     113             :     virtual void set_col_unit(const std::string& unit);
     114             :     virtual void set_col_buff_size(const size_t buffer_size);
     115             :     virtual void set_col_fmtflags(const std::ios_base::fmtflags ff);
     116             :     virtual void set_col_prec(const size_t precision);
     117             :     virtual void set_col_size(const size_t col_size);
     118             : 
     119             :     const std::string& get_col_name() const;
     120             :     const size_t get_socket_size() const;
     121             : 
     122             :   protected:
     123             :     virtual void _probe(const T* in, const size_t frame_id);
     124             : };
     125             : }
     126             : }
     127             : 
     128             : #ifndef DOXYGEN_SHOULD_SKIP_THIS
     129             : #include "Module/Probe/Probe.hxx"
     130             : #endif
     131             : 
     132             : #endif /* PROBE_HPP_ */

Generated by: LCOV version 1.14