LCOV - code coverage report
Current view: top level - src/Def - MIDIAddress.cpp (source / functions) Hit Total Coverage
Test: 169c36a3797bc662d84b5726f34a3f37d3c58247 Lines: 35 35 100.0 %
Date: 2024-11-09 15:32:27 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #include "MIDIAddress.hpp"
       2             : 
       3             : BEGIN_CS_NAMESPACE
       4             : 
       5          32 : RelativeMIDIAddress &RelativeMIDIAddress::operator+=(RelativeMIDIAddress that) {
       6          32 :     this->addresses.valid &= that.addresses.valid;
       7          32 :     this->addresses.address += that.addresses.address;
       8          32 :     this->addresses.channel += that.addresses.channel;
       9          32 :     this->addresses.cableNumber += that.addresses.cableNumber;
      10          32 :     return *this;
      11             : }
      12             : 
      13          68 : MIDIAddress &MIDIAddress::operator+=(RelativeMIDIAddress rhs) {
      14          68 :     this->addresses.valid &= rhs.addresses.valid;
      15          68 :     this->addresses.address += rhs.addresses.address;
      16          68 :     this->addresses.channel += rhs.addresses.channel;
      17          68 :     this->addresses.cableNumber += rhs.addresses.cableNumber;
      18          68 :     return *this;
      19             : }
      20             : 
      21           4 : MIDIAddress &MIDIAddress::operator-=(RelativeMIDIAddress rhs) {
      22           4 :     this->addresses.valid &= rhs.addresses.valid;
      23           4 :     this->addresses.address -= rhs.addresses.address;
      24           4 :     this->addresses.channel -= rhs.addresses.channel;
      25           4 :     this->addresses.cableNumber -= rhs.addresses.cableNumber;
      26           4 :     return *this;
      27             : }
      28             : 
      29          48 : MIDIAddress MIDIAddress::operator+(RelativeMIDIAddress rhs) const {
      30          48 :     MIDIAddress copy = *this;
      31          48 :     copy += rhs;
      32          48 :     return copy;
      33             : }
      34             : 
      35           1 : MIDIAddress MIDIAddress::operator-(RelativeMIDIAddress rhs) const {
      36           1 :     MIDIAddress copy = *this;
      37           1 :     copy -= rhs;
      38           1 :     return copy;
      39             : }
      40             : 
      41          96 : bool MIDIAddress::matchAddressInRange(MIDIAddress toMatch, MIDIAddress base,
      42             :                                       uint8_t length) {
      43          96 :     bool valid = base.addresses.valid && toMatch.addresses.valid;
      44          96 :     bool addressInRange =
      45         191 :         base.addresses.address <= toMatch.addresses.address &&
      46          95 :         base.addresses.address + length > toMatch.addresses.address;
      47          96 :     bool equalChannelAndCN =
      48         192 :         base.addresses.channel == toMatch.addresses.channel &&
      49          96 :         base.addresses.cableNumber == toMatch.addresses.cableNumber;
      50          96 :     return valid && addressInRange && equalChannelAndCN;
      51             : }
      52             : 
      53             : END_CS_NAMESPACE

Generated by: LCOV version 1.15