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

#include <Def/Cable.hpp>

Detailed Description

A type-safe class for MIDI USB Cable numbers.

Examples
MIDI-Input-Fine-Grained-All-Callbacks.ino, and MIDI-Input-Fine-Grained.ino.

Definition at line 13 of file 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 uint8_t getOneBased () const
 Get the cable as an integer. More...
 
constexpr bool operator== (const Cable &rhs) const
 Check if two cables are the same. More...
 
constexpr bool operator!= (const Cable &rhs) const
 Check if two cables are the different. 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
 

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.

◆ getOneBased()

constexpr uint8_t getOneBased ( ) const
inlineconstexpr

Get the cable as an integer.

Returns
The one-based cable (1 is the first cable).
Examples
MIDI-Input-Callback.ino, MIDI-Input.ino, Mackie-Control-Universal-Reverse-Engineering.ino, and SysEx-Send-Receive.ino.

Definition at line 36 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 44 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 54 of file Cable.hpp.

◆ operator!=()

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

Check if two cables are the different.

Parameters
rhsThe other cable to compare this cable to.

Definition at line 64 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 74 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 85 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 97 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 108 of file Cable.hpp.

Member Data Documentation

◆ zeroBasedCable

uint8_t zeroBasedCable
private

Definition at line 115 of file Cable.hpp.


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