LCOV - code coverage report
Current view: top level - src/Module/Stateful/Probe/Value - Probe_value.cpp (source / functions) Hit Total Coverage
Test: streampu_clean.info Lines: 15 23 65.2 %
Date: 2025-01-11 12:25:42 Functions: 9 30 30.0 %

          Line data    Source code
       1             : #include <ios>
       2             : #include <sstream>
       3             : 
       4             : #include "Module/Stateful/Probe/Value/Probe_value.hpp"
       5             : #include "Tools/Exception/exception.hpp"
       6             : 
       7             : using namespace spu;
       8             : using namespace spu::module;
       9             : 
      10             : template<typename T>
      11          56 : Probe_value<T>::Probe_value(const int size, const std::string& col_name, tools::Reporter_probe* reporter)
      12          56 :   : Probe<T>(size, col_name)
      13             : {
      14          56 :     const std::string name = "Probe_value<" + col_name + ">";
      15          56 :     this->set_name(name);
      16             : 
      17          56 :     if (size <= 0)
      18             :     {
      19           0 :         std::stringstream message;
      20           0 :         message << "'size' has to be greater than 0 ('size' = " << size << ").";
      21           0 :         throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());
      22           0 :     }
      23             : 
      24          56 :     if (reporter != nullptr) this->register_reporter(reporter);
      25          56 : }
      26             : 
      27             : template<typename T>
      28             : void
      29          56 : Probe_value<T>::register_reporter(tools::Reporter_probe* reporter)
      30             : {
      31          56 :     if (this->reporter != nullptr)
      32             :     {
      33           0 :         std::stringstream message;
      34             :         message << "It is not possible to register this probe to a new 'tools::Reporter_probe' because it is already "
      35           0 :                 << "registered to an other 'tools::Reporter_probe'.";
      36           0 :         throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());
      37           0 :     }
      38          56 :     this->reporter = reporter;
      39          56 :     this->proxy_register_probe(this->get_socket_size(), typeid(T), "", 100, std::ios_base::scientific, 3);
      40          56 : }
      41             : 
      42             : template<typename T>
      43             : void
      44         532 : Probe_value<T>::_probe(const T* in, const size_t frame_id)
      45             : {
      46         532 :     this->proxy_probe((void*)in, frame_id);
      47         532 : }
      48             : 
      49             : // ==================================================================================== explicit template instantiation
      50             : template class spu::module::Probe_value<int8_t>;
      51             : template class spu::module::Probe_value<uint8_t>;
      52             : template class spu::module::Probe_value<int16_t>;
      53             : template class spu::module::Probe_value<uint16_t>;
      54             : template class spu::module::Probe_value<int32_t>;
      55             : template class spu::module::Probe_value<uint32_t>;
      56             : template class spu::module::Probe_value<int64_t>;
      57             : template class spu::module::Probe_value<uint64_t>;
      58             : template class spu::module::Probe_value<float>;
      59             : template class spu::module::Probe_value<double>;
      60             : // ==================================================================================== explicit template instantiation

Generated by: LCOV version 1.14