Typedefs
gfsmBitVector.h File Reference

Bit vector utilities using GArray. More...

#include <gfsmIO.h>
#include <gfsmBitVector.hi>
Include dependency graph for gfsmBitVector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef GArray gfsmBitVector
 bit vector type: really just a wrapper for GArray

Functions

Utilities
static guint gfsm_bitvector_bits2bytes_ (guint nbits)
static guint gfsm_bitvector_bytes2bits_ (guint nbytes)
Constructors etc.
static gfsmBitVectorgfsm_bitvector_new (void)
static gfsmBitVectorgfsm_bitvector_sized_new (guint nbits)
static void gfsm_bitvector_resize (gfsmBitVector *bv, guint nbits)
static guint gfsm_bitvector_size (gfsmBitVector *bv)
static void gfsm_bitvector_clear (gfsmBitVector *bv)
static gfsmBitVectorgfsm_bitvector_zero (gfsmBitVector *bv)
static gfsmBitVectorgfsm_bitvector_one (gfsmBitVector *bv)
static void gfsm_bitvector_free (gfsmBitVector *bv)
Accessors
static gboolean gfsm_bitvector_get (gfsmBitVector *bv, guint i)
static void gfsm_bitvector_set (gfsmBitVector *bv, guint i, gboolean v)
I/O
gboolean gfsm_bitvector_write_bin_handle (gfsmBitVector *bv, gfsmIOHandle *ioh, gfsmError **errp)
gboolean gfsm_bitvector_read_bin_handle (gfsmBitVector *bv, gfsmIOHandle *ioh, gfsmError **errp)

Detailed Description

Typedef Documentation

typedef GArray gfsmBitVector

Function Documentation

static guint gfsm_bitvector_bits2bytes_ ( guint  nbits)
inlinestatic

Low-level utility to convert bit-indices to byte-indices (starting from 0)

static guint gfsm_bitvector_bytes2bits_ ( guint  nbytes)
inlinestatic

Low-level utility to convert byte-sizes to bit-sizes

static gfsmBitVector* gfsm_bitvector_new ( void  )
inlinestatic

Create a new bit vector of length 0

static gfsmBitVector* gfsm_bitvector_sized_new ( guint  nbits)
inlinestatic

Create a new bit vector of length 0 with reserved space for at least nbits bits

static void gfsm_bitvector_resize ( gfsmBitVector bv,
guint  nbits 
)
inlinestatic

Resize a bit vector bv to at least nbits bits (rounded to next byte boundary)

static guint gfsm_bitvector_size ( gfsmBitVector bv)
inlinestatic

Get current size (in bits) of a bit vector bv

static void gfsm_bitvector_clear ( gfsmBitVector bv)
inlinestatic

Clear a bit vector

static gfsmBitVector* gfsm_bitvector_zero ( gfsmBitVector bv)
inlinestatic

Set all bits to zero.

Returns
altered bv
static gfsmBitVector* gfsm_bitvector_one ( gfsmBitVector bv)
inlinestatic

Set all bits to one.

Returns
altered bv
static void gfsm_bitvector_free ( gfsmBitVector bv)
inlinestatic

Destroy a bit vector

static gboolean gfsm_bitvector_get ( gfsmBitVector bv,
guint  i 
)
inlinestatic

Get the value (0 or 1) of the bit at index i in vector bv.

static void gfsm_bitvector_set ( gfsmBitVector bv,
guint  i,
gboolean  v 
)
inlinestatic

Set the value (0 or 1) of the bit at index i to boolean value v in vector bv. Formerly implemented as a macro which evaluates its arguments multiple times.

gboolean gfsm_bitvector_write_bin_handle ( gfsmBitVector bv,
gfsmIOHandle ioh,
gfsmError **  errp 
)

Write the contents of a gfsmBitVector to a (binary) gfsmIOHandle.

Parameters
bvbit-vector to write
iohhandle to which data is to be written
errpif an error occurs, *errp will hold an error message
Returns
true on success
gboolean gfsm_bitvector_read_bin_handle ( gfsmBitVector bv,
gfsmIOHandle ioh,
gfsmError **  errp 
)

Read the contents of a gfsmBitVector from a (binary) gfsmIOHandle.

Parameters
bvbit-vector into which data is to be read
iohhandle from which data is to be read
errpif an error occurs, *errp will hold an error message
Returns
true on success