Public Member Functions | List of all members
universal_midi_packets::View Class Reference

Points to a single Universal MIDI Packet. More...

Public Member Functions

 View () noexcept=default
 Create an invalid view. More...
 
 View (const uint32_t *data) noexcept
 Create a view of the packet starting at address d. More...
 
const uint32_t * data () const noexcept
 Get a pointer to the first word in the Universal MIDI Packet currently pointed-to by this view. More...
 
uint32_t size () const noexcept
 Get the number of 32-words (between 1 and 4 inclusive) in the Universal MIDI Packet currently pointed-to by this view. More...
 
const uint32_t & operator[] (size_t index) const noexcept
 Get a specific word from this packet. More...
 
const uint32_t * begin () const noexcept
 Get an iterator pointing to the first word in the packet. More...
 
const uint32_t * cbegin () const noexcept
 
const uint32_t * end () const noexcept
 Get an iterator pointing one-past the last word in the packet. More...
 
const uint32_t * cend () const noexcept
 
bool operator== (const View &other) const noexcept
 Return true if this view is pointing to the same address as another view. More...
 
bool operator!= (const View &other) const noexcept
 Return false if this view is pointing to the same address as another view. More...
 

Detailed Description

Points to a single Universal MIDI Packet.

The packet must be well-formed for member functions to work correctly.

Specifically, the constructor argument must be the beginning of a region of uint32_t that contains at least getNumWordsForMessageType(*ddata) items, where data is the constructor argument.

NOTE: Instances of this class do not own the memory that they point to! If you need to store a packet pointed-to by a View for later use, copy the view contents to a Packets collection, or use the Utils::PacketX types.

Constructor & Destructor Documentation

◆ View() [1/2]

universal_midi_packets::View::View ( )
defaultnoexcept

Create an invalid view.

◆ View() [2/2]

universal_midi_packets::View::View ( const uint32_t *  data)
explicitnoexcept

Create a view of the packet starting at address d.

Member Function Documentation

◆ data()

const uint32_t* universal_midi_packets::View::data ( ) const
noexcept

Get a pointer to the first word in the Universal MIDI Packet currently pointed-to by this view.

Referenced by universal_midi_packets::Iterator::operator++().

◆ size()

uint32_t universal_midi_packets::View::size ( ) const
noexcept

Get the number of 32-words (between 1 and 4 inclusive) in the Universal MIDI Packet currently pointed-to by this view.

Referenced by cend(), end(), and universal_midi_packets::Iterator::operator++().

◆ operator[]()

const uint32_t& universal_midi_packets::View::operator[] ( size_t  index) const
noexcept

Get a specific word from this packet.

Passing an index that is greater than or equal to the result of size will cause undefined behaviour.

◆ begin()

const uint32_t* universal_midi_packets::View::begin ( ) const
noexcept

Get an iterator pointing to the first word in the packet.

◆ cbegin()

const uint32_t* universal_midi_packets::View::cbegin ( ) const
noexcept

◆ end()

const uint32_t* universal_midi_packets::View::end ( ) const
noexcept

Get an iterator pointing one-past the last word in the packet.

References size().

◆ cend()

const uint32_t* universal_midi_packets::View::cend ( ) const
noexcept

References size().

Referenced by universal_midi_packets::Packets::add().

◆ operator==()

bool universal_midi_packets::View::operator== ( const View other) const
noexcept

Return true if this view is pointing to the same address as another view.

Referenced by operator!=().

◆ operator!=()

bool universal_midi_packets::View::operator!= ( const View other) const
noexcept

Return false if this view is pointing to the same address as another view.

References operator==().


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