Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Related Pages

ByteVectors


Detailed Description

Implementation of a vector of bits.

A bitvector is a special case of a vector which is more memory efficient than a generic vector and more time efficient than a bitstring.

Data Structures

Defines

Functions


Function Documentation

int bvAddElement ByteVector  v,
char  element
 

adds a new element to the end of the ByteVector.

automatically increases the capacity of the ByteVector if necessary

Parameters:
v the vector to which the new element has to be added.
element the element that has to be added to the end of the bitvector v
Returns:
index of the vector
Definition at line 150 of file bitvector-old.c.

References check_magic, and resize().

char bvAndElement ByteVector  v,
char  element,
int  index
 

computes AND to the element at the given index.

if necessary the vector automatically increases its capacity.

Parameters:
v the vector in which the element has to be set at the apecified index.
element the element that has to be set in the bitvector.
index the index at which the element to be set is present.
Returns:
The new value at the index.
Definition at line 310 of file bitvector-old.c.

References check_magic, and resize().

int bvCapacity ByteVector  v  ) 
 

finds the current capacity of bitvector.

Parameters:
v the bitvector whose capacity has to be retrieved.
Returns:
the capacity of the bitvector v.
Definition at line 436 of file bitvector-old.c.

References check_magic.

Referenced by bvClone().

ByteVector bvClone ByteVector  v  ) 
 

creates an exact copy of the specified bitvector.

Parameters:
v the bitvector for which cloning has to be performed.
Returns:
a complete independent CLONE of the bit vector v.
Definition at line 475 of file bitvector-old.c.

References bvCapacity(), bvCopy(), bvNew(), and check_magic.

ByteVector bvCopy ByteVector  dst,
ByteVector  src
 

copies entries of one bitvector to another.

copying is done from bitVector src to the bitvector dst. dst vector automatically increases its capacity.

Parameters:
src source index or the index from which copying has to be initiated.
dst destination index or the index until which the copying has to be done.
Returns:
the new dst vector with the elements copied into it.
Definition at line 496 of file bitvector-old.c.

Referenced by bvClone().

void bvDelete ByteVector  v  ) 
 

deletes a bitvector and frees the associated memory.

note that nothing user-defined is stored in a bitvector. therefore, the user does not need to free anything himself.

Parameters:
v the bitvector that has to be deleted.
Definition at line 133 of file bitvector-old.c.

References check_magic.

char bvElement ByteVector  v,
int  index
 

sets the element at the specific index to a new element.

if necessary the bitVector automatically increases its capacity.

Parameters:
v the bitvector in which the specified element has to be set to a new element.
index the index of the element that has to be set.
Returns:
the old element or False at the specified index.
Definition at line 170 of file bitvector-old.c.

References check_magic.

char bvInsertElement ByteVector  v,
char  element,
int  index
 

inserts a new element at the given index.

if necessary the bitvector automatically increases its capacity. inefficient method,not recommended.

Parameters:
v the bitvector into which the new element has to be inserted.
element the new element that has to be inserted into the bitvector v.
index the index at which the new element has to be inserted in the bitvector v.
Returns:
the old element at the index.
Definition at line 227 of file bitvector-old.c.

References check_magic, and resize().

Boolean bvIsEmpty ByteVector  v  ) 
 

finds if the bit vector is empty or not.

Parameters:
v the bitvector for which emptiness is checked.
Returns:
TRUE if bitvector is empty and FALSE otherwise.
Definition at line 462 of file bitvector-old.c.

References check_magic.

ByteVector bvNew int  capacity  ) 
 

creates a new empty bitvector with an initial capacity.

Specifying a correct or nearly correct capacity slightly improves the efficiency. The bitvector roughly needs capacity bytes.

Parameters:
capacity the capacity of the new vector to be created.
Returns:
a new and empty bit vector of the specified capacity.
Definition at line 107 of file bitvector-old.c.

Referenced by bvClone().

char bvNotElement ByteVector  v,
int  index
 

computes NOT to the element at the given index.

if necessary the vector automatically increases its capacity.

Parameters:
v the vector in which the element has to be set at the apecified index.
index the index at which the element to be set is present.
Returns:
The new value at the index.
Definition at line 363 of file bitvector-old.c.

References check_magic, and resize().

char bvOrElement ByteVector  v,
char  element,
int  index
 

computes OR to the element at the given index.

if necessary the vector automatically increases its capacity.

Parameters:
v the vector in which the element has to be set at the apecified index.
element the element that has to be set in the bitvector.
index the index at which the element to be set is present.
Returns:
The new value at the index.
Definition at line 337 of file bitvector-old.c.

References check_magic, and resize().

char bvRemoveElement ByteVector  v,
int  index
 

removes element at the specified index.

size decreases and all later elements move one position to the front. inefficient method, not recommended.

Parameters:
v the bitvector from which the element has to be removed.
index the index at which the element to be removed is present.
Returns:
old element at the specifed index.
Definition at line 190 of file bitvector-old.c.

References check_magic.

void bvSetAllElements ByteVector  v,
char  element
 

sets all the elements to a new value.

the size increases to the current capacity of the bit vector.

Parameters:
v the bitvector in which all the elements have to be set.
element the elements at the specified indices.
Returns:
the bitvector after setting all the elements.
Definition at line 424 of file bitvector-old.c.

char bvSetElement ByteVector  v,
char  element,
int  index
 

sets element at the given index.

if necessary the vector automatically increases its capacity.

Parameters:
v the vector in which the element has to be set at the apecified index.
element the element that has to be set in the bitvector.
index the index at which the element to be set is present.
Returns:
The old element at the index.
Definition at line 277 of file bitvector-old.c.

References check_magic, and resize().

void bvSetElements ByteVector  v,
char  element,
int  from,
int  to
 

sets all the elements between index from and to (excluding to) to a new value.

if necesaary the bit vector automatically increases in capacity.

Parameters:
v the bitvector in which the elements have to be set.
element the value of the bits at the corresponding indices.
from the source index from which all the elements in the bitvector have to be set.
to the destination index until which all the elements in the bitvector have to be set.
Returns:
the bitvector v after setting all the elements at the specified indices.
Definition at line 392 of file bitvector-old.c.

References check_magic, and resize().

int bvSize ByteVector  v  ) 
 

finds the number of entries(size) in the bitvector.

Parameters:
v the bitvector whose size has to be retrieved.
Returns:
the size of the bitvector v.
Definition at line 449 of file bitvector-old.c.

References check_magic.

void resize ByteVector  v  )  [static]
 

doubles capacity of ByteVector.

Parameters:
v the bitvector that has to be resized.
Returns:
the bitvector after increasing its capacity.
Definition at line 89 of file bitvector-old.c.

References check_magic.

Referenced by bitClear(), bitSet(), bvAddElement(), bvAndElement(), bvInsertElement(), bvNotElement(), bvOrElement(), bvSetElement(), and bvSetElements().


BLAH 0.95 (20 Oct 2004)