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

          Line data    Source code
       1             : /*!
       2             :  * \file
       3             :  * \brief Class module::Switcher.
       4             :  */
       5             : #ifndef SWITCHER_HPP_
       6             : #define SWITCHER_HPP_
       7             : 
       8             : #include <cstddef>
       9             : #include <cstdint>
      10             : #include <memory>
      11             : #include <typeindex>
      12             : #include <vector>
      13             : 
      14             : #include "Module/Module.hpp"
      15             : #include "Runtime/Sequence/Sequence.hpp"
      16             : #include "Runtime/Socket/Socket.hpp"
      17             : #include "Runtime/Task/Task.hpp"
      18             : #include "Tools/Interface/Interface_reset.hpp"
      19             : 
      20             : namespace spu
      21             : {
      22             : namespace module
      23             : {
      24             : namespace swi
      25             : {
      26             : enum class tsk : size_t
      27             : {
      28             :     commute,
      29             :     select,
      30             :     SIZE
      31             : };
      32             : }
      33             : 
      34             : class Switcher
      35             :   : public Module
      36             :   , public tools::Interface_reset
      37             : {
      38             :     friend runtime::Sequence; // Sequence is friend to enable the no copy mode (0 copy)
      39             : 
      40             :   public:
      41             :     inline runtime::Task& operator[](const swi::tsk t);
      42             :     inline const runtime::Task& operator[](const swi::tsk t) const;
      43             :     inline runtime::Socket& operator[](const std::string& tsk_sck);
      44             : 
      45             :   protected:
      46             :     const size_t n_data_sockets;
      47             :     const size_t n_elmts_commute;
      48             :     const size_t n_elmts_select;
      49             :     const size_t n_bytes_commute;
      50             :     const size_t n_bytes_select;
      51             :     const std::type_index datatype_commute;
      52             :     const std::type_index datatype_select;
      53             :     size_t path;
      54             : 
      55             :     bool no_copy_commute;
      56             :     bool no_copy_select;
      57             : 
      58             :   public:
      59             :     inline Switcher(const size_t n_data_sockets,
      60             :                     const size_t n_elmts_commute,
      61             :                     const std::type_index datatype_commute,
      62             :                     const size_t n_elmts_select,
      63             :                     const std::type_index datatype_select);
      64             : 
      65             :     inline Switcher(const size_t n_data_sockets, const size_t n_elmts, const std::type_index datatype);
      66           0 :     virtual ~Switcher() = default;
      67             :     virtual Switcher* clone() const;
      68             : 
      69             :     inline size_t get_n_data_sockets() const;
      70             :     inline size_t get_n_elmts_commute() const;
      71             :     inline size_t get_n_elmts_select() const;
      72             :     inline size_t get_n_bytes_commute() const;
      73             :     inline size_t get_n_bytes_select() const;
      74             :     inline std::type_index get_datatype_commute() const;
      75             :     inline std::type_index get_datatype_select() const;
      76             :     inline size_t get_path() const;
      77             : 
      78             :     inline bool is_no_copy_commute() const;
      79             :     inline bool is_no_copy_select() const;
      80             : 
      81             :     virtual void reset();
      82             : 
      83             :   protected:
      84             :     inline void set_path(const size_t path);
      85             :     inline void set_no_copy_commute(const bool no_copy_commute);
      86             :     inline void set_no_copy_select(const bool no_copy_select);
      87             : };
      88             : }
      89             : }
      90             : 
      91             : #ifndef DOXYGEN_SHOULD_SKIP_THIS
      92             : #include "Module/Switcher/Switcher.hxx"
      93             : #endif
      94             : 
      95             : #endif /* SWITCHER_HPP_ */

Generated by: LCOV version 1.14