LCOV - code coverage report
Current view: top level - src/Def - MIDIAddress.cpp (source / functions) Hit Total Coverage
Test: e224b347cd670555e44f06608ac41bd1ace9d9d8 Lines: 38 38 100.0 %
Date: 2020-09-08 17:44:46 Functions: 7 7 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+=(const 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-=(const 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+(const RelativeMIDIAddress &rhs) const {
      30          48 :     MIDIAddress copy = *this;
      31          48 :     copy += rhs;
      32          48 :     return copy;
      33             : }
      34             : 
      35           1 : MIDIAddress MIDIAddress::operator-(const RelativeMIDIAddress &rhs) const {
      36           1 :     MIDIAddress copy = *this;
      37           1 :     copy -= rhs;
      38           1 :     return copy;
      39             : }
      40             : 
      41          12 : bool MIDIAddress::matchSingle(const MIDIAddress &toMatch,
      42             :                               const MIDIAddress &base) {
      43          12 :     return base == toMatch;
      44             : }
      45             : 
      46          83 : bool MIDIAddress::matchAddressInRange(const MIDIAddress &toMatch,
      47             :                                       const MIDIAddress &base, uint8_t length) {
      48          83 :     bool valid = base.addresses.valid && toMatch.addresses.valid;
      49         166 :     bool addressInRange =
      50          83 :         base.addresses.address <= toMatch.addresses.address &&
      51          83 :         base.addresses.address + length > toMatch.addresses.address;
      52         166 :     bool equalChannelAndCN =
      53          83 :         base.addresses.channel == toMatch.addresses.channel &&
      54          83 :         base.addresses.cableNumber == toMatch.addresses.cableNumber;
      55          83 :     return valid && addressInRange && equalChannelAndCN;
      56          83 : }
      57             : 
      58             : END_CS_NAMESPACE

Generated by: LCOV version 1.14-6-g40580cd