Accumulates message chunks that have been sent by another device in response to a transaction initiated by a local device. More...
Public Member Functions | |
InitiatorPropertyExchangeCache () | |
~InitiatorPropertyExchangeCache () | |
InitiatorPropertyExchangeCache (InitiatorPropertyExchangeCache &&) noexcept | |
InitiatorPropertyExchangeCache & | operator= (InitiatorPropertyExchangeCache &&) noexcept |
std::optional< Token64 > | primeCache (uint8_t maxSimultaneousRequests, std::function< void(const PropertyExchangeResult &)> onDone) |
Picks an unused request ID, and prepares the cache for that ID to accumulate message chunks. | |
bool | terminate (Token64) |
Terminates/cancels an ongoing transaction. | |
std::optional< Token64 > | getTokenForRequestId (RequestID) const |
If there's a transaction ongoing with the given request id, returns the token uniquely identifying that transaction, otherwise returns nullopt. | |
std::optional< RequestID > | getRequestIdForToken (Token64) const |
If the token refers to an ongoing transaction, returns the request id of that transaction. | |
void | addChunk (RequestID, const Message::DynamicSizePropertyExchange &chunk) |
Adds a message chunk for the provided transaction id. | |
void | notify (RequestID, Span< const std::byte > header) |
Updates the transaction state based on the contents of the provided notification. | |
std::vector< Token64 > | getOngoingTransactions () const |
Returns all ongoing transactions. | |
Accumulates message chunks that have been sent by another device in response to a transaction initiated by a local device.
midi_ci::InitiatorPropertyExchangeCache::InitiatorPropertyExchangeCache | ( | ) |
Referenced by InitiatorPropertyExchangeCache(), and operator=().
midi_ci::InitiatorPropertyExchangeCache::~InitiatorPropertyExchangeCache | ( | ) |
|
noexcept |
References InitiatorPropertyExchangeCache().
|
noexcept |
References InitiatorPropertyExchangeCache(), and JUCE_DECLARE_NON_COPYABLE.
std::optional< Token64 > midi_ci::InitiatorPropertyExchangeCache::primeCache | ( | uint8_t | maxSimultaneousRequests, |
std::function< void(const PropertyExchangeResult &)> | onDone ) |
Picks an unused request ID, and prepares the cache for that ID to accumulate message chunks.
Incoming chunks added with addChunk are generated by another device acting as a responder.
References primeCache().
Referenced by primeCache().
bool midi_ci::InitiatorPropertyExchangeCache::terminate | ( | Token64 | ) |
Terminates/cancels an ongoing transaction.
Returns true if the termination had an effect (i.e. the transaction was still ongoing), or false otherwise (the transaction already ended or never started).
References terminate().
Referenced by terminate().
std::optional< Token64 > midi_ci::InitiatorPropertyExchangeCache::getTokenForRequestId | ( | RequestID | ) | const |
If there's a transaction ongoing with the given request id, returns the token uniquely identifying that transaction, otherwise returns nullopt.
References getTokenForRequestId().
Referenced by getTokenForRequestId().
std::optional< RequestID > midi_ci::InitiatorPropertyExchangeCache::getRequestIdForToken | ( | Token64 | ) | const |
If the token refers to an ongoing transaction, returns the request id of that transaction.
Otherwise, returns an invalid request id.
References getRequestIdForToken().
Referenced by getRequestIdForToken().
void midi_ci::InitiatorPropertyExchangeCache::addChunk | ( | RequestID | , |
const Message::DynamicSizePropertyExchange & | chunk ) |
Adds a message chunk for the provided transaction id.
References addChunk().
Referenced by addChunk().
std::vector< Token64 > midi_ci::InitiatorPropertyExchangeCache::getOngoingTransactions | ( | ) | const |
Returns all ongoing transactions.
References getOngoingTransactions().
Referenced by getOngoingTransactions().