Control Surface  1.2.0
MIDI Control Surface library for Arduino
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
Cable Class Reference

A type-safe class for MIDI USB Cable numbers. More...

#include <Def/Cable.hpp>

+ Collaboration diagram for Cable:

Public Member Functions

constexpr Cable (uint8_t zeroBasedCable)
 Create a MIDI Cable object. More...
 
constexpr uint8_t getRaw () const
 Get the cable as an integer. More...
 
constexpr bool operator== (const Cable &rhs) const
 Check if two cables are the same. More...
 
Cableoperator+= (uint8_t rhs)
 Add an offset. More...
 
Cable operator+ (uint8_t rhs) const
 Add an offset to a cable. More...
 
Cableoperator-= (uint8_t rhs)
 Subtract an offset. More...
 
Cable operator- (uint8_t rhs) const
 Subtract an offset from a cable. More...
 

Static Public Member Functions

static constexpr Cable createCable (uint8_t oneBasedCable)
 Create a cable. More...
 

Private Attributes

uint8_t zeroBasedCable: 4
 

Detailed Description

A type-safe class for MIDI USB Cable numbers.

Definition at line 13 of file Cable.hpp.

Constructor & Destructor Documentation

◆ Cable()

constexpr Cable ( uint8_t  zeroBasedCable)
inlineexplicitconstexpr

Create a MIDI Cable object.

Parameters
zeroBasedCableThe zero-based cable (0 is the first cable).

Definition at line 21 of file Cable.hpp.

Member Function Documentation

◆ getRaw()

constexpr uint8_t getRaw ( ) const
inlineconstexpr

Get the cable as an integer.

Returns
The zero-based cable (0 is the first cable).

Definition at line 29 of file Cable.hpp.

◆ createCable()

static constexpr Cable createCable ( uint8_t  oneBasedCable)
inlinestaticconstexpr

Create a cable.

Parameters
oneBasedCableThe cable number (1 is the first cable).

Definition at line 37 of file Cable.hpp.

◆ operator==()

constexpr bool operator== ( const Cable rhs) const
inlineconstexpr

Check if two cables are the same.

Parameters
rhsThe other cable to compare this cable to.

Definition at line 47 of file Cable.hpp.

◆ operator+=()

Cable& operator+= ( uint8_t  rhs)
inline

Add an offset.

Parameters
rhsThe offset to add to this cable.

Definition at line 57 of file Cable.hpp.

◆ operator+()

Cable operator+ ( uint8_t  rhs) const
inline

Add an offset to a cable.

Parameters
rhsThe offset to add to the cable.

Definition at line 68 of file Cable.hpp.

◆ operator-=()

Cable& operator-= ( uint8_t  rhs)
inline

Subtract an offset.

Parameters
rhsThe offset to subtract from this cable.

Definition at line 80 of file Cable.hpp.

◆ operator-()

Cable operator- ( uint8_t  rhs) const
inline

Subtract an offset from a cable.

Parameters
rhsThe offset to subtract from the cable.

Definition at line 91 of file Cable.hpp.

Member Data Documentation

◆ zeroBasedCable

uint8_t zeroBasedCable
private

Definition at line 98 of file Cable.hpp.


The documentation for this class was generated from the following file: