GTS Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# First In First Out heaps

## Name

First In First Out heaps --

## Synopsis

    #include <gts.h>

    struct      GtsFifo;

    GtsFifo*    gts_fifo_new                    (void);
    void        gts_fifo_push                   (GtsFifo *fifo,
                                                 gpointer data);
    gpointer    gts_fifo_pop                    (GtsFifo *fifo);
    gpointer    gts_fifo_top                    (GtsFifo *fifo);
    guint       gts_fifo_size                   (GtsFifo *fifo);
    void        gts_fifo_foreach                (GtsFifo *fifo,
                                                 GtsFunc func,
                                                 gpointer data);
    gboolean    gts_fifo_is_empty               (GtsFifo *fifo);
    void        gts_fifo_reverse                (GtsFifo *fifo);
    void        gts_fifo_write                  (GtsFifo *fifo,
                                                 FILE *fp);
    void        gts_fifo_destroy                (GtsFifo *fifo);

## Description

## Details

### struct GtsFifo

    struct GtsFifo;

### gts_fifo_new ()

    GtsFifo*    gts_fifo_new                    (void);

Returns : | a new GtsFifo.

### gts_fifo_push ()

    void        gts_fifo_push                   (GtsFifo *fifo,
                                                 gpointer data);

Push `data` into `fifo`.

`fifo` : | a GtsFifo.
`data` : | data to add to `fifo`.

### gts_fifo_pop ()

    gpointer    gts_fifo_pop                    (GtsFifo *fifo);

Removes the first element from `fifo`.

`fifo` : | a GtsFifo.
Returns : | the first element in `fifo` or `NULL` if `fifo` is empty.

### gts_fifo_top ()

    gpointer    gts_fifo_top                    (GtsFifo *fifo);

`fifo` : | a GtsFifo.
Returns : | the first element in `fifo` or `NULL` if `fifo` is empty.

### gts_fifo_size ()

    guint       gts_fifo_size                   (GtsFifo *fifo);

`fifo` : | a GtsFifo.
Returns : | the number of elements in `fifo`.

### gts_fifo_foreach ()

    void        gts_fifo_foreach                (GtsFifo *fifo,
                                                 GtsFunc func,
                                                 gpointer data);

Calls `func` in order for each item in `fifo`, passing `data`.

`fifo` : | a GtsFifo.
`func` : | a GtsFunc.
`data` : | user data to be passed to `func`.

### gts_fifo_is_empty ()

    gboolean    gts_fifo_is_empty               (GtsFifo *fifo);

`fifo` : | a GtsFifo.
Returns : | `TRUE` if `fifo` is empty, `FALSE` otherwise.

### gts_fifo_reverse ()

    void        gts_fifo_reverse                (GtsFifo *fifo);

Reverses the order of elements in `fifo`.

`fifo` : | a GtsFifo.

### gts_fifo_write ()

    void        gts_fifo_write                  (GtsFifo *fifo,
                                                 FILE *fp);

Writes the content of `fifo` in `fp`.

`fifo` : | a GtsFifo.
`fp` : | a file pointer.

### gts_fifo_destroy ()

    void        gts_fifo_destroy                (GtsFifo *fifo);

Frees all the memory allocated for `fifo`.

`fifo` : | a GtsFifo.

<<< Previous Page | Home | Up | Next Page >>>
Extended binary heaps | Vectors and matrices