PHISH WWW Site - PHISH Documentation - Bait.py Commands

phish_queue() function

phish_dequeue() function

phish_nqueue() function

C syntax:

int phish_queue() 
int phish_dequeue(int n) 
int phish_nqueue() 

C examples:

nq = phish_queue();
nvalues = phish_dequeue(0);
nq = phish_nqueue(); 

Python syntax:

def queue() 
def dequeue(n) 
def nqueue() 

Python examples:

import phish
nq = phish.queue()
nvalues = phish.dequeue(0)
nq = phish.nqueue() 

Description:

These are PHISH library functions which can be called from a minnow application. In PHISH lingo, a "minnow" is a stand-alone application which makes calls to the PHISH library.

These functions are used to store and retrieve datums in an internal queue maintained by the PHISH library. This can be useful if a minnow receives a datum but wishes to process it later.


The phish_queue() function stores the most recently received datum in the internal queue. It returns the number of datums in the queue, which includes the one just stored.

The phish_queue() function does not conflict with phish_unpack or phish_datum functions. They can be called before or after a phish_queue() call.


The phish_dequeue() function retrieves a stored datum from the internal queue and copies it into the receive buffer, as if it had just been received. The datum is deleted from the queue, though it can be requeued via a subsequent call to phish_queue.

After a call to phish_dequeue, the datum can be unpacked or its attributes queried via the phish_unpack or phish_datum functions, as if it just been received.

The input parameter "n" for phish_dequeue is the index of the datum to retrieve. N can be any value from 0 to Nqueue-1 inclusive, where Nqueue is the number of datums in the queue. Thus you can easily retrieve the oldest or newest datum in the queue.


The phish_nqueue() function returns the number of datums currently held in the internal queue.


Restrictions: none

Related commands:

phish_recv, phish_datum