src/bitmap.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bitmap.h"

Functions

void assert (int testresult, char *message)
unsigned char * bitmapGetContents (bitmap bm)
unsigned int bitmapGetMaxSize (bitmap bm)
unsigned int bitmapGetLength (bitmap bm)
bitmap bitmapInit (unsigned int max_size)
unsigned char bitmapGetBit (bitmap bm, unsigned int index)
void bitmapSetBit (bitmap *bm, unsigned int index, unsigned char bit)
void bitmapAppendLeastSignificantBit (bitmap *bm, unsigned char bit)

Detailed Description

Define um TAD representando um mapa de bits.

Author:
Joao Paulo Andrade Almeida (jpalmeida@inf.ufes.br)

Function Documentation

void assert ( int  testresult,
char *  message 
)

Funcao auxiliar que imprime uma mensagem de falha e aborta o programa caso testresult seja falso.

Parameters:
testresult Valor booleano representando o resultado do teste que deveria ser verdadeiro.
message A mensagem para ser impressa se resultado do teste for falso.

void bitmapAppendLeastSignificantBit ( bitmap bm,
unsigned char  bit 
)

Adiciona um bit no final do mapa de bits.

Parameters:
bm O mapa de bits.
bit O novo valor do bit.
Precondition:
bitmapGetLength(bm) < bitmapGetMaxSize(bm)
Postcondition:
(bitmapGetBit(bm,bitmapGetLength(bm) @ pre)==bit) and (bitmapGetLength(bm) == bitmapGetLength(bm) @ pre+1)

unsigned char bitmapGetBit ( bitmap  bm,
unsigned int  index 
)

Retorna o valor do bit na posicao index.

Parameters:
bm O mapa de bits.
index A posicao do bit.
Precondition:
index<bitmapGetLength(bm)
Returns:
O valor do bit.

unsigned char* bitmapGetContents ( bitmap  bm  ) 

Retorna o conteudo do mapa de bits.

Parameters:
bm O mapa de bits.

unsigned int bitmapGetLength ( bitmap  bm  ) 

Retorna o tamanho atual do mapa de bits.

Parameters:
bm O mapa de bits.
Returns:
O tamanho atual do mapa de bits.

unsigned int bitmapGetMaxSize ( bitmap  bm  ) 

Retorna o tamanho maximo do mapa de bits.

Parameters:
bm O mapa de bits.
Returns:
O tamanho maximo do mapa de bits.

bitmap bitmapInit ( unsigned int  max_size  ) 

Constroi um novo mapa de bits, definindo um tamanho maximo.

Parameters:
max_size O tamanho maximo para o mapa de bits.
Returns:
O mapa de bits inicializado.

void bitmapSetBit ( bitmap bm,
unsigned int  index,
unsigned char  bit 
)

Modifica o valor do bit na posicao index.

Parameters:
bm O mapa de bits.
index A posicao do bit.
bit O novo valor do bit.
Postcondition:
bitmapGetBit(bm,index)==bit


Generated on Sun Jun 1 10:19:09 2008 for bitmap by  doxygen 1.5.3