class PriorityQueue

Defined at line 26 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/priority_queue.h

A class for maintaining a queue of frames ordered by frame priority.

The queue also supports popping only certain allowed priority levels as identified by a bitmask.

The queue does not implement any locking, the user will have to ensure that calls to push and pop

are mutually exclusive.

Public Methods

bool push (Frame && frame, std::unique_ptr<Frame> * dropped)

Push a frame onto the queue. The frame's Priority() will be used to determine the priority in

the queue. Returns true on success, if a lower priority frame was evicted as a result of this

push the evicted frame will be placed in |dropped|. This allows the caller to return the

evicted frame to storage or netdevice as needed. If this parameter is used it should be an

uninitialized std::unique_ptr and afterwards the caller should check to see if it's still empty

or not to determine if eviction happened. Returns false if the frame is not placed on the

queue. When this happens |frame| is moved into |dropped| (if provided) since a moved from

object should not be used. Similarly to the eviction case this allows the caller to safely

return the frame to storage or complete it.

Defined at line 10 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/priority_queue.cc

void PriorityQueue (size_t max_queue_depth)

Defined at line 28 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/priority_queue.h

void pop (size_t count, uint8_t allowed_priorities, FrameContainer * frames)

Pop |count| number of frames from the queue. |allowed_priorities| specify a bit field

indicating which priorities are allowed to be popped from. Each bit index corresponds to a

priority value. The number of frames popped may be less than |count| if there are not enough

frames available. Note that frames are appended at the end of |frames|, the container will NOT

be cleared first. This allows the caller to call pop multiple times with the same container

with various priorities and create a customized ordering, but it also requires that the caller

ensures the container is empty before each call if they expect only the popped frames to be

present.

Defined at line 56 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/priority_queue.cc

size_t size (uint8_t allowed_priorities)

Return the total number of frames in the queue that match the allowed priorities given. This is

represented as a bit field where each bit index corresponds to a priority value.

Defined at line 63 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/priority_queue.h

size_t size ()

Return the total number of frames for all priorities.

Defined at line 75 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/priority_queue.h

bool empty ()

Defined at line 77 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/priority_queue.h

size_t capacity ()

Defined at line 79 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/include/wlan/drivers/components/priority_queue.h

void pop_if (std::function<bool (const Frame &)> && predicate, FrameContainer * frames)

Pop any number of frames that match |predicate|. Frames will be evaluated, popped and appended

in priority order. |predicate| will be called for each frame and if |predicate| returns true

then the frame will be poppped. This is a slow operation and should not be used in a regular

data path, only for rare cases where specific frames need to be popped or removed. Note that

frames are appended at the end of |frames|, the container will NOT be cleared first. This

allows the caller to call pop_if multiple times with the same container with various conditions

and create a customized ordering, but it also requires that the caller ensures the container is

empty before each call if they expect only the popped frames to be present.

Defined at line 88 of file ../../src/connectivity/wlan/drivers/lib/components/cpp/priority_queue.cc