C

<platform/messagequeue.h> - Queue abstraction

Provides abstraction for platform-specific queues. More...

Header: #include <platform/messagequeue.h>

Types

enum class MessageQueueStatus { Success, MessageDiscarded, MessageOverwritten, EmptyQueue, Timeout, …, OtherError }

Functions

void deleteQueue(Qul::Platform::MessageQueueInterface *queue)
std::size_t maximumQueueMessageSize()
Qul::Platform::MessageQueueInterface *requestQueue(std::size_t queueCapacity, std::size_t messageSize)

Detailed Description

This header contains all queue interface abstractions that are used by EventQueues processed by the Qt Quick Ultralite Core library.

Classes

Qul::Platform::MessageQueue

A convenience class used to interface with the queue implementation

Qul::Platform::MessageQueueInterface

Interface class providing platform-specific queues to Qt Quick Ultralite

Type Documentation

[since Qt Quick Ultralite (Platform) 1.9] enum class MessageQueueStatus

Status code returned by the MessageQueueInterface functions.

ConstantValueDescription
MessageQueueStatus::Success0Function was executed successfully.
MessageQueueStatus::MessageDiscarded1Message was discarded. This must be returned only when MessageQueueInterface::enqueueOrDiscard() and MessageQueueInterface::enqueueOrDiscardFromInterrupt() functions discard the given message.
MessageQueueStatus::MessageOverwritten2A message in a queue was overwritten with the given message. This must be returned only by the MessageQueueInterface::enqueueOrOverwrite() and MessageQueueInterface::enqueueOrOverwriteFromInterrupt() functions.
MessageQueueStatus::EmptyQueue3MessageQueueInterface::receive() or MessageQueueInterface::receiveFromInterrupt() could not get a message from the queue because it is empty.
MessageQueueStatus::Timeout4Could not get a message from the queue within timeout ms.
MessageQueueStatus::DiscardNotSupported5The queue implementation does not support discarding.
MessageQueueStatus::OverwriteNotSupported6The queue implementation does not support overwriting.
MessageQueueStatus::OtherError7None of the status codes fit the status of the function. EventQueue treats it as an error.

This enum was introduced or modified in Qt Quick Ultralite (Platform) 1.9.

Function Documentation

[since Qt Quick Ultralite (Platform) 1.9] void deleteQueue(Qul::Platform::MessageQueueInterface *queue)

Deletes the queue.

This function is used by MessageQueue to delete a queue when it is not needed anymore.

Here is an example implementation of this function:

void deleteQueue(MessageQueueInterface *queue)
{
    MyMessageQueue *mq = static_cast<MyMessageQueue *>(queue);
    mq->~MyMessageQueue();
    qul_free(mq);
}

This function was introduced in Qt Quick Ultralite (Platform) 1.9.

See also requestQueue(), maximumQueueMessageSize(), Qul::Platform::MessageQueue, and Qul::Platform::MessageQueueInterface.

[since Qt Quick Ultralite (Platform) 1.9] std::size_t maximumQueueMessageSize()

Returns the maximum size of a message that a queue can hold. If the queue's maximum message size is not known or is arbitrary, SIZE_MAX must be returned.

This function was introduced in Qt Quick Ultralite (Platform) 1.9.

See also requestQueue(), Qul::Platform::MessageQueue, and Qul::Platform::MessageQueueInterface.

[since Qt Quick Ultralite (Platform) 1.9] Qul::Platform::MessageQueueInterface *requestQueue(std::size_t queueCapacity, std::size_t messageSize)

Returns an instance of the MessageQueueInterface implementation with queueCapacity capacity. The queue must accept messages that satisfies the messageSize requirement. If the implementation can't satisfy the queueCapacity or messageSize, the function must return a null pointer.

This function is used by MessageQueue to get an appropriate queue for its use.

Here is an example implementation of this function:

MessageQueueInterface *requestQueue(size_t queueCapacity, size_t messageSize)
{
    void *queue = qul_malloc(sizeof(MyMessageQueue));

    if (queue == NULL) {
        return NULL;
    }

    MessageQueueInterface *interface = new (queue) MyMessageQueue(queueCapacity, messageSize);
    return interface;
}

This function was introduced in Qt Quick Ultralite (Platform) 1.9.

See also deleteQueue(), maximumQueueMessageSize(), Qul::Platform::MessageQueue, and Qul::Platform::MessageQueueInterface.

Available under certain Qt licenses.
Find out more.