base/utils/queue.bro

Queue

A FIFO queue.

Namespace:Queue
Source File:/scripts/base/utils/queue.bro

Summary

Types

Queue::Queue: record The internal data structure for the queue.
Queue::Settings: record Settings for initializing the queue.

Redefinitions

Queue::Queue: record  

Functions

Queue::get: function Get a value from the end of a queue.
Queue::get_vector: function Get the contents of the queue as a vector.
Queue::init: function Initialize a queue record structure.
Queue::len: function Get the number of items in a queue.
Queue::merge: function Merge two queues together.
Queue::peek: function Peek at the value at the end of the queue without removing it.
Queue::put: function Put a value onto the beginning of a queue.

Detailed Interface

Types

Queue::Queue
Type:

record

initialized: bool &default = F &optional

vals: table [count] of any &optional

settings: Queue::Settings &optional

top: count &default = 0 &optional

bottom: count &default = 0 &optional

size: count &default = 0 &optional

The internal data structure for the queue.

Queue::Settings
Type:

record

max_len: count &optional

If a maximum length is set for the queue it will maintain itself at that maximum length automatically.

Settings for initializing the queue.

Functions

Queue::get
Type:function (q: Queue::Queue) : any

Get a value from the end of a queue.

Q:The queue to get the value from.
Returns:The value gotten from the queue.
Queue::get_vector
Type:function (q: Queue::Queue, ret: vector of any) : void

Get the contents of the queue as a vector.

Q:The queue.
Ret:A vector containing the current contents of the queue as the type of ret.
Queue::init
Type:function (s: Queue::Settings &default = [] &optional) : Queue::Queue

Initialize a queue record structure.

S:A record which configures the queue.
Returns:An opaque queue record.
Queue::len
Type:function (q: Queue::Queue) : count

Get the number of items in a queue.

Q:The queue.
Returns:The length of the queue.
Queue::merge
Type:function (q1: Queue::Queue, q2: Queue::Queue) : Queue::Queue

Merge two queues together. If any settings are applied to the queues, the settings from q1 are used for the new merged queue.

Q1:The first queue. Settings are taken from here.
Q2:The second queue.
Returns:A new queue from merging the other two together.
Queue::peek
Type:function (q: Queue::Queue) : any

Peek at the value at the end of the queue without removing it.

Q:The queue to get the value from.
Returns:The value at the end of the queue.
Queue::put
Type:function (q: Queue::Queue, val: any) : void

Put a value onto the beginning of a queue.

Q:The queue to put the value into.
Val:The value to insert into the queue.

Previous Page

base/utils/numbers.bro

Copyright 2016, The Bro Project. Last updated on January 10, 2019. Created using Sphinx 1.7.5.