queue-class: A Queue Class

queue-classR Documentation

A Queue Class

Description

A queue implementation using a filehash database

Usage

createQ(filename)

initQ(filename)

pop(db, ...)

push(db, val, ...)

isEmpty(db, ...)

top(db, ...)

## S4 method for signature 'queue'
show(object)

## S4 method for signature 'queue'
push(db, val, ...)

## S4 method for signature 'queue'
isEmpty(db)

## S4 method for signature 'queue'
top(db, ...)

## S4 method for signature 'queue'
pop(db, ...)

Arguments

filename

name of queue file

db

a queue object

...

arguments passed to other methods

val

an R object to be added to the tail queue

object

a queue object

Details

Objects can be created by calls of the form new("queue", ...) or by calling createQ. Existing queues can be initialized with initQ.

Value

createQ and initQ return a queue object

Methods (by generic)

  • show(queue): Print a queue object

  • push(queue): adds an element to the tail ("bottom") of the queue

  • isEmpty(queue): returns TRUE/FALSE depending on whether there are elements in the queue.

  • top(queue): returns the value of the "top" (i.e. head) of the queue; an error is signaled if the queue is empty

  • pop(queue): returns the value of the "top" (i.e. head) of the queue and subsequently removes that element from the queue; an error is signaled if the queue is empty

Functions

  • createQ(): Create a file-based queue object

  • initQ(): Intialize an existing queue object

  • pop(): Return (and remove) the top element of a queue

  • push(): Push an R object on to the tail of a queue

  • isEmpty(): Check if a queue is empty or not

  • top(): Return the top of the queue

Slots

queue

Object of class "filehashDB1"

name

Object of class "character": the name of the queue (default is the file name in which the queue data are stored)


filehash documentation built on June 26, 2024, 1:06 a.m.