Container for managing MQTT messages with efficient lookup and ordering.
More...
#include <MessageContainer.h>
|
| const MessageContainer::MsgIter | push (MessageContainerData &&msg) noexcept |
| | Adds a new message to the end of the container.
|
| void | erase (const std::uint16_t packetId) noexcept |
| | Removes a message from the container by its packet ID.
|
| bool | contains (const std::int16_t packetId) const noexcept |
| | Checks if a message with the given packet ID exists in the container.
|
| const MessageContainer::MsgIter * | get (const std::uint16_t packetId) noexcept |
| | Retrieves an iterator to the message with the specified packet ID.
|
| MsgIter | begin () noexcept |
| | Returns an iterator to the beginning of the message list.
|
| MsgIter | end () noexcept |
| | Returns an iterator to the end of the message list.
|
| ConstMsgIter | begin () const noexcept |
| | Returns a const iterator to the beginning of the message list.
|
| ConstMsgIter | end () const noexcept |
| | Returns a const iterator to the end of the message list.
|
| ConstMsgIter | cbegin () const noexcept |
| | Returns a const iterator to the beginning of the message list.
|
| ConstMsgIter | cend () const noexcept |
| | Returns a const iterator to the end of the message list.
|
| void | moveToEnd (const std::uint16_t packetId) noexcept |
| | Moves the message with the specified packet ID to the end of the list.
|
| void | clear () noexcept |
| | Removes all messages from the container.
|
| std::size_t | size () const noexcept |
| | Returns the number of messages in the container.
|
Container for managing MQTT messages with efficient lookup and ordering.
This class provides a dual data structure approach using both a list for maintaining message order and an unordered_map for O(1) packet ID lookups. It is designed to efficiently manage MQTT messages during session state handling.
◆ begin() [1/2]
| ConstMsgIter kmMqtt::mqtt::MessageContainer::begin |
( |
| ) |
const |
|
inlinenoexcept |
Returns a const iterator to the beginning of the message list.
- Returns
- Const iterator to the first message.
◆ begin() [2/2]
| MsgIter kmMqtt::mqtt::MessageContainer::begin |
( |
| ) |
|
|
inlinenoexcept |
Returns an iterator to the beginning of the message list.
- Returns
- Iterator to the first message.
◆ cbegin()
| ConstMsgIter kmMqtt::mqtt::MessageContainer::cbegin |
( |
| ) |
const |
|
inlinenoexcept |
Returns a const iterator to the beginning of the message list.
- Returns
- Const iterator to the first message.
◆ cend()
| ConstMsgIter kmMqtt::mqtt::MessageContainer::cend |
( |
| ) |
const |
|
inlinenoexcept |
Returns a const iterator to the end of the message list.
- Returns
- Const iterator to one past the last message.
◆ clear()
| void kmMqtt::mqtt::MessageContainer::clear |
( |
| ) |
|
|
noexcept |
Removes all messages from the container.
This operation is noexcept and clears both the list and the map.
◆ contains()
| bool kmMqtt::mqtt::MessageContainer::contains |
( |
const std::int16_t | packetId | ) |
const |
|
noexcept |
Checks if a message with the given packet ID exists in the container.
- Parameters
-
| packetId | The unique identifier of the packet to check. |
- Returns
- true if the packet ID exists in the container, false otherwise.
◆ end() [1/2]
| ConstMsgIter kmMqtt::mqtt::MessageContainer::end |
( |
| ) |
const |
|
inlinenoexcept |
Returns a const iterator to the end of the message list.
- Returns
- Const iterator to one past the last message.
◆ end() [2/2]
| MsgIter kmMqtt::mqtt::MessageContainer::end |
( |
| ) |
|
|
inlinenoexcept |
Returns an iterator to the end of the message list.
- Returns
- Iterator to one past the last message.
◆ erase()
| void kmMqtt::mqtt::MessageContainer::erase |
( |
const std::uint16_t | packetId | ) |
|
|
noexcept |
Removes a message from the container by its packet ID.
- Parameters
-
| packetId | The unique identifier of the packet to remove. |
◆ get()
| const MessageContainer::MsgIter * kmMqtt::mqtt::MessageContainer::get |
( |
const std::uint16_t | packetId | ) |
|
|
noexcept |
Retrieves an iterator to the message with the specified packet ID.
- Parameters
-
| packetId | The unique identifier of the packet to retrieve. |
- Returns
- Pointer to the iterator if found, nullptr otherwise.
◆ moveToEnd()
| void kmMqtt::mqtt::MessageContainer::moveToEnd |
( |
const std::uint16_t | packetId | ) |
|
|
noexcept |
Moves the message with the specified packet ID to the end of the list.
- Parameters
-
| packetId | The unique identifier of the packet to move. This operation maintains the packet ID mapping and is useful for implementing message retry or prioritization logic. If the packet ID is not found, this operation has no effect. This operation is noexcept. |
◆ push()
Adds a new message to the end of the container.
- Parameters
-
| msg | The message data to be added (moved into the container). |
- Returns
- Iterator pointing to the newly added message in the list.
◆ size()
| std::size_t kmMqtt::mqtt::MessageContainer::size |
( |
| ) |
const |
|
inlinenoexcept |
Returns the number of messages in the container.
- Returns
- The number of messages currently stored.
The documentation for this class was generated from the following file: