主要内容

peek

Class: wnet.FIFOQueue
Namespace: wnet

Retrieve a packet from the head of FIFO queue

Since R2026a

Description

packet = peek(queueObj) retrieves the packet from the head of the first-in first-out (FIFO) queue without removing it.

example

Examples

expand all

Create a FIFO queue for 1000 packets.

queueObj = wnet.FIFOQueue(MaxSize=1000);

Create a sample packet and specify the packet size.

packet = [255;255];
packetSize = numel(packet);

Add the packet to the tail of the queue.

isQueued = enqueue(queueObj,packet,packetSize);

Get the number of packets in the queue.

numPackets = queueObj.CurrentSize;

Get the number of packet bytes in the queue.

nBytes = queueObj.CurrentSizeBytes;

Check if the queue is full.

status = isFull(queueObj);

Retrieve the first packet from the head of the queue.

PeekedPacket = peek(queueObj);

Remove the packet from the head of the queue.

dequeuedPacket = dequeue(queueObj);

Input Arguments

expand all

FIFO queue, specified as an object of class wnet.FIFOQueue.

Output Arguments

expand all

Packet retrieved from the head of the queue, returned as any MATLAB data type present at the head of the queue. This packet remains at the head of the queue.

Version History

Introduced in R2026a

See Also

Classes

Functions