|
mavtables
0.2.1
MAVLink router and firewall.
|
#include <QueuedPacket.hpp>

Public Member Functions | |
| QueuedPacket (const QueuedPacket &other)=default | |
| QueuedPacket (QueuedPacket &&other)=default | |
| QueuedPacket (std::shared_ptr< const Packet > packet, int priority, unsigned long long ticket_number) | |
| std::shared_ptr< const Packet > | packet () const |
| QueuedPacket & | operator= (const QueuedPacket &other)=default |
| QueuedPacket & | operator= (QueuedPacket &&other)=default |
Friends | |
| bool | operator== (const QueuedPacket &lhs, const QueuedPacket &rhs) |
| bool | operator!= (const QueuedPacket &lhs, const QueuedPacket &rhs) |
| bool | operator< (const QueuedPacket &lhs, const QueuedPacket &rhs) |
| bool | operator> (const QueuedPacket &lhs, const QueuedPacket &rhs) |
| bool | operator<= (const QueuedPacket &lhs, const QueuedPacket &rhs) |
| bool | operator>= (const QueuedPacket &lhs, const QueuedPacket &rhs) |
| std::ostream & | operator<< (std::ostream &os, const QueuedPacket &queued_packet) |
A packet in the queue to be sent out.
Forms a node in the PacketQueue class.
This is the data structure used in the priority queues used by the Connection class. It stores a MAVLink packet as well as a priority and ticket number used to maintain packet order in the priority queue when packets have the same priority.
Definition at line 39 of file QueuedPacket.hpp.
|
default |
Copy constructor.
| other | QueuedPacket to copy from. |
|
default |
Move constructor.
| other | QueuedPacket to move from. |
| QueuedPacket::QueuedPacket | ( | std::shared_ptr< const Packet > | packet, |
| int | priority, | ||
| unsigned long long | ticket_number | ||
| ) |
Construct a queued packet.
| packet | The packet to store in the queue. |
| priority | The priority to send the packet with, higher numbers result in a higher priority. |
| ticket_number | A number that should always be incremented for each queued packet created per packet queue, even if this increment causes an unsigned integer wraparound. |
| std::invalid_argument | if the given packet pointer is nullptr. |
Definition at line 36 of file QueuedPacket.cpp.
|
default |
Assignment operator.
| other | QueuedPacket to copy from. |
|
default |
Assignment operator (by move semantics).
| other | QueuedPacket to move from. |
| std::shared_ptr< const Packet > QueuedPacket::packet | ( | ) | const |
Return the contained packet.
Definition at line 53 of file QueuedPacket.cpp.
|
friend |
Inequality comparison.
| lhs | The left hand side queued packet. |
| rhs | The right hand side queued packet. |
| true | if lhs and rhs do not have the same priority and ticket number. |
| false | if lhs and rhs have the same priority and ticket number. |
Definition at line 90 of file QueuedPacket.cpp.
|
friend |
Less than comparison.
The priority is considered first, followed by the ticket number in reverse order (lower ticket number is greater).
std::numeric_limits<unsigned long long>::max()/2 of each other are considered in the same range. In this way 0 is greater than std::numeric_limits<unsigned long long>::max(). Because of this it is important that anything relying on ordering must not contain a range of ticket numbers equal to or grater than std::numeric_limits<unsigned long long>::max()/2.| lhs | The left hand side queued packet. |
| rhs | The right hand side queued packet. |
| true | if lhs is less than rhs. |
| false | if lhs is not less than rhs. |
Definition at line 116 of file QueuedPacket.cpp.
|
friend |
Print the packet to the given output stream.
Some examples are:
HEARTBEAT (#1) from 16.8 (v1.0) with priority -3PING (#4) from 128.4 to 16.8 (v2.0) with priority 0DATA_TRANSMISSION_HANDSHAKE (#130) from 16.8 (v2.0) with priority 3ENCAPSULATED_DATA (#131) from 128.4 (v2.0) with priority 1| os | The output stream to print to. |
| queued_packet | The queued packet to print. |
Definition at line 192 of file QueuedPacket.cpp.
|
friend |
Less than or equal comparison.
| lhs | The left hand side queued packet. |
| rhs | The right hand side queued packet. |
| true | if lhs is less than or eqaul to rhs. |
| false | if lhs is greater than rhs. |
Definition at line 159 of file QueuedPacket.cpp.
|
friend |
Equality comparison.
| lhs | The left hand side queued packet. |
| rhs | The right hand side queued packet. |
| true | if lhs and rhs have the same priority and ticket number. |
| false | if lhs and rhs do not have the same priority and ticket number. |
Definition at line 71 of file QueuedPacket.cpp.
|
friend |
Greater than comparison.
The priority is considered first, followed by the ticket number in reverse order (lower ticket number is greater).
std::numeric_limits<unsigned long long>::max()/2 of each other are considered in the same range. In this way 0 is greater than std::numeric_limits<unsigned long long>::max(). Because of this it is important that anything relying on ordering must not contain a range of ticket numbers equal to or grater than std::numeric_limits<unsigned long long>::max()/2.| lhs | The left hand side queued packet. |
| rhs | The right hand side queued packet. |
| true | if lhs is less than rhs. |
| false | if lhs is not less than rhs. |
Definition at line 143 of file QueuedPacket.cpp.
|
friend |
Greater than or equal comparison.
| lhs | The left hand side queued packet. |
| rhs | The right hand side queued packet. |
| true | if lhs is greater than or equal to rhs. |
| false | if lhs is less than rhs. |
Definition at line 173 of file QueuedPacket.cpp.
1.8.14