LCOV - code coverage report
Current view: top level - src/Banks - BankConfig.hpp (source / functions) Hit Total Coverage
Test: e224b347cd670555e44f06608ac41bd1ace9d9d8 Lines: 9 9 100.0 %
Date: 2020-09-08 17:44:46 Functions: 10 10 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* ✔ */
       2             : 
       3             : #pragma once
       4             : 
       5             : #include <Def/Def.hpp>
       6             : 
       7             : BEGIN_CS_NAMESPACE
       8             : 
       9             : /**
      10             :  * @brief   An enumeration of the different bank types.
      11             :  */
      12             : enum BankType {
      13             :     /**
      14             :      * @brief   Change the offset of the address (i.e. Controller number or
      15             :      *          Note number) of the element.
      16             :      */
      17             :     CHANGE_ADDRESS = 0,
      18             :     /**
      19             :      * @brief   Change the offset of the channel number of the element.
      20             :      */
      21             :     CHANGE_CHANNEL = 1,
      22             :     /**
      23             :      * @brief   Change the offset of the cable number of the element.
      24             :      */
      25             :     CHANGE_CABLENB = 2,
      26             : };
      27             : 
      28             : template <setting_t N>
      29             : class Bank;
      30             : class OutputBank;
      31             : 
      32             : template <BankType DefaultBankType>
      33             : struct OutputBankConfig;
      34             : 
      35             : /** 
      36             :  * @brief   A struct for selecting the bank of BankableMIDIInput%s and the
      37             :  *          bank type.
      38             :  */
      39             : template <setting_t N>
      40             : class BaseBankConfig {
      41             :   protected:
      42          15 :     BaseBankConfig(Bank<N> &bank, BankType type) : bank(bank), type(type) {}
      43             : 
      44             :   public:
      45             :     Bank<N> &bank;
      46             :     const BankType type;
      47             : };
      48             : 
      49             : /// @copydoc BaseBankConfig
      50             : template <setting_t N, BankType DefaultBankType = BankType::CHANGE_ADDRESS>
      51             : struct BankConfig : BaseBankConfig<N> {
      52          15 :     BankConfig(Bank<N> &bank, BankType type = DefaultBankType)
      53          15 :         : BaseBankConfig<N>(bank, type) {}
      54             : };
      55             : 
      56             : /** 
      57             :  * @brief   A struct for selecting the bank of BankableMIDIOutput%s and the
      58             :  *          bank type.
      59             :  */
      60             : class BaseOutputBankConfig {
      61             :   protected:
      62          26 :     BaseOutputBankConfig(OutputBank &bank, BankType type)
      63          26 :         : bank(bank), type(type) {}
      64             : 
      65             :   public:
      66             :     template <setting_t N>
      67           2 :     BaseOutputBankConfig(BaseBankConfig<N> config)
      68           2 :         : bank(config.bank), type(config.type) {}
      69             : 
      70             :     OutputBank &bank;
      71             :     const BankType type;
      72             : };
      73             : 
      74             : /// @copydoc BaseOutputBankConfig
      75             : template <BankType DefaultBankType = BankType::CHANGE_ADDRESS>
      76             : struct OutputBankConfig : BaseOutputBankConfig {
      77          26 :     OutputBankConfig(OutputBank &bank, BankType type = DefaultBankType)
      78          26 :         : BaseOutputBankConfig(bank, type) {}
      79             : };
      80             : 
      81             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-6-g40580cd