Loading...
Searching...
No Matches
juce_UMPackets.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
#ifndef DOXYGEN
namespace juce::universal_midi_packets
{
class Packets
{
public:
void add (const View& v) { storage.insert (storage.end(), v.cbegin(), v.cend()); }
void add (const PacketX1& p) { addImpl (p); }
void add (const PacketX2& p) { addImpl (p); }
void add (const PacketX3& p) { addImpl (p); }
void add (const PacketX4& p) { addImpl (p); }
void reserve (size_t numWords) { storage.reserve (numWords); }
void clear() { storage.clear(); }
Iterator cbegin() const noexcept { return Iterator (data(), size()); }
Iterator begin() const noexcept { return cbegin(); }
Iterator cend() const noexcept { return Iterator (data() + size(), 0); }
Iterator end() const noexcept { return cend(); }
const uint32_t* data() const noexcept { return storage.data(); }
size_t size() const noexcept { return storage.size(); }
private:
template <size_t numWords>
void addImpl (const Packet<numWords>& p)
{
jassert (Utils::getNumWordsForMessageType (p[0]) == numWords);
add (View (p.data()));
}
std::vector<uint32_t> storage;
};
} // namespace juce::universal_midi_packets
#endif
juce::universal_midi_packets::Iterator
Definition juce_UMPIterator.h:38
juce::universal_midi_packets::Packet
Definition juce_UMPacket.h:35
juce::universal_midi_packets::Packets
Definition juce_UMPackets.h:40
juce::universal_midi_packets::Packets::data
const uint32_t * data() const noexcept
Definition juce_UMPackets.h:71
juce::universal_midi_packets::Packets::add
void add(const View &v)
Definition juce_UMPackets.h:49
juce::universal_midi_packets::Packets::size
size_t size() const noexcept
Definition juce_UMPackets.h:78
juce::universal_midi_packets::Packets::reserve
void reserve(size_t numWords)
Definition juce_UMPackets.h:57
juce::universal_midi_packets::Packets::cbegin
Iterator cbegin() const noexcept
Definition juce_UMPackets.h:63
juce::universal_midi_packets::Packets::clear
void clear()
Definition juce_UMPackets.h:60
juce::universal_midi_packets::Packets::cend
Iterator cend() const noexcept
Definition juce_UMPackets.h:67
juce::universal_midi_packets::View
Definition juce_UMPView.h:44
juce::universal_midi_packets::Utils::getNumWordsForMessageType
static uint32_t getNumWordsForMessageType(uint32_t)
Definition juce_UMPUtils.cpp:26