LCOV - code coverage report
Current view: top level - src/Module/Stateful/Controller - Controller.cpp (source / functions) Hit Total Coverage
Test: streampu_clean.info Lines: 16 32 50.0 %
Date: 2025-01-11 12:25:42 Functions: 2 7 28.6 %

          Line data    Source code
       1             : #include <string>
       2             : 
       3             : #include "Module/Stateful/Controller/Controller.hpp"
       4             : 
       5             : using namespace spu;
       6             : using namespace spu::module;
       7             : 
       8          10 : Controller::Controller(const size_t init_path)
       9             :   : Stateful()
      10          10 :   , init_path(init_path)
      11          10 :   , path(init_path)
      12             : {
      13          10 :     const std::string name = "Controller";
      14          10 :     this->set_short_name(name);
      15          10 :     this->set_single_wave(true);
      16             : 
      17          10 :     auto& p1 = this->create_task("control");
      18          10 :     const auto p1s_out = this->create_socket_out(p1, "out", 1, typeid(int8_t));
      19          10 :     this->create_codelet(p1,
      20         572 :                          [p1s_out](Module& m, runtime::Task& t, const size_t frame_id) -> int
      21             :                          {
      22         572 :                              auto& ctr = static_cast<Controller&>(m);
      23         572 :                              ctr._control(t[p1s_out].get_dataptr<int8_t>(), frame_id);
      24         579 :                              return runtime::status_t::SUCCESS;
      25             :                          });
      26             : 
      27          10 :     auto& p2 = this->create_task("reset");
      28          10 :     this->create_codelet(p2,
      29           0 :                          [](Module& m, runtime::Task& t, const size_t frame_id) -> int
      30             :                          {
      31           0 :                              auto& ctr = static_cast<Controller&>(m);
      32           0 :                              ctr.reset();
      33           0 :                              return runtime::status_t::SUCCESS;
      34             :                          });
      35          10 : }
      36             : 
      37             : void
      38           0 : Controller::set_path(const size_t path)
      39             : {
      40           0 :     this->path = path;
      41           0 : }
      42             : 
      43             : size_t
      44           0 : Controller::get_path() const
      45             : {
      46           0 :     return this->path;
      47             : }
      48             : 
      49             : void
      50           0 : Controller::reset()
      51             : {
      52           0 :     this->path = this->init_path;
      53           0 : }
      54             : 
      55             : void
      56           0 : Controller::control(int8_t* out, const int frame_id, const bool managed_memory)
      57             : {
      58           0 :     (*this)[ctr::sck::control::out].bind(out);
      59           0 :     (*this)[ctr::tsk::control].exec(frame_id, managed_memory);
      60           0 : }

Generated by: LCOV version 1.14