PHISH WWW Site - PHISH Documentation - Commands

count minnow






Count is a PHISH minnow that can be used in a PHISH program. In PHISH lingo, a "minnow" is a stand-alone application which makes calls to the PHISH library to exchange data with other PHISH minnows.

The count minnow counts occurrences of strings it receives. When it shuts down it sends unique words and their associated counts.


The count minnow uses one input port 0 to receive datums and one output port 0 to send datums.


When it starts, the count minnow calls the phish_loop function. Each time a datum is received on input port 0, its first field must be a string. Unique strings are stored in an internal table, using the string as a "key". This is done via an STL "map" in the C++ version of count, and via a "dictionary" in the Python version of count. The value associated with each key is a count of the number of times the string has been received.

The count minnow shuts down when its input port is closed by receiving a sufficient number of "done" messages. This triggers the count minnow to send a series of datums to its ouput port 0, one for each unique word it has received. Each datum contains two fields. The first field is the count, the second is the string.


The count minnow must receive single field datums of type PHISH_STRING. It sends two-field datums of type (PHISH_INT32, PHISH_STRING).

Restrictions: none

Related minnows: