OnixS C++ CME MDP Premium Market Data Handler 5.11.1
Users' manual and API documentation
Loading...
Searching...
No Matches
NetPacket Class Reference

#include <OnixS/CME/MDH/Packet.h>

Public Member Functions

 NetPacket () noexcept=default
 NetPacket (const void *data, PacketSize size)
 NetPacket (const NetPacket &other) noexcept=default
 ~NetPacket ()=default
const NetFeed & source () const noexcept
void source (const NetFeed &source) noexcept
const Messaging::Timestamp & receiveTime () const noexcept
void receiveTime (const Messaging::Timestamp &receiveTime) noexcept
void reset () noexcept
NetPacket & operator= (const NetPacket &other) noexcept=default
Public Member Functions inherited from Packet
 Packet () noexcept=default
 Packet (const void *data, PacketSize size)
 Packet (const void *data, PacketSize size, const NoVerify &noVerify) noexcept
 Packet (const Packet &other) noexcept=default
 ~Packet ()=default
 operator bool () const noexcept
const void * data () const noexcept
const Header * header () const noexcept
PacketSize size () const noexcept
SequenceNumber seqNumber () const noexcept
Messaging::Timestamp sendingTime () const noexcept
BinaryMessages messages () const noexcept
void reset () noexcept
void reset (const void *data, PacketSize size)
void reset (const void *data, PacketSize size, const NoVerify &noVerify) noexcept
Packet & operator= (const Packet &other) noexcept=default

Additional Inherited Members

Public Types inherited from Packet
using Header = PacketHeader

Detailed Description

The referenced packet buffer and source feed are not owned and must remain valid while accessed through this object.

Definition at line 420 of file Packet.h.

Constructor & Destructor Documentation

◆ NetPacket() [1/3]

NetPacket ( )
defaultnoexcept

Constructs a null network packet without a source.

◆ NetPacket() [2/3]

NetPacket ( const void * data,
PacketSize size )
inline

Constructs a packet view over a buffer and validates its minimum size.

Parameters
dataAddress of the packet buffer.
sizeBuffer size in bytes.
Exceptions
std::runtime_errorIf size is smaller than the packet header.
Note
The buffer must remain valid and unchanged while the packet view is used. The source remains unset.

Definition at line 431 of file Packet.h.

◆ NetPacket() [3/3]

NetPacket ( const NetPacket & other)
defaultnoexcept

Copies the packet view and its network metadata without copying referenced objects.

Parameters
otherNetwork packet to copy.

◆ ~NetPacket()

~NetPacket ( )
default

Destroys the view without releasing the referenced buffer or source feed.

Member Function Documentation

◆ operator=()

NetPacket & operator= ( const NetPacket & other)
defaultnoexcept

Copies another packet view and its network metadata.

Parameters
otherNetwork packet to copy.
Returns
Reference to this network packet.

◆ receiveTime() [1/2]

const Messaging::Timestamp & receiveTime ( ) const
inlinenoexcept

Returns the packet reception time.

Returns
Reception timestamp, or its default value if no timestamp has been assigned.

Definition at line 468 of file Packet.h.

◆ receiveTime() [2/2]

void receiveTime ( const Messaging::Timestamp & receiveTime)
inlinenoexcept

Sets the packet reception time.

Parameters
receiveTimeReception timestamp to store.

Definition at line 476 of file Packet.h.

◆ reset()

void reset ( )
inlinenoexcept

Clears the packet view, source feed, and reception timestamp.

Definition at line 482 of file Packet.h.

◆ source() [1/2]

const NetFeed & source ( ) const
inlinenoexcept

Returns the network feed from which the packet was received.

Returns
Reference to the non-owned source feed.
Note
A source must have been assigned before this function is called.

Definition at line 449 of file Packet.h.

◆ source() [2/2]

void source ( const NetFeed & source)
inlinenoexcept

Associates the packet with its network feed.

Parameters
sourceSource feed, which must outlive accesses through this packet.

Definition at line 459 of file Packet.h.