hi thank you i have solved the problem really it was so simple just add (struct) before BLOOM that was really too simple thank you for your cooperating.but i just want to ask you other question how can i make this BLOOM 4 bit counter it is 8 bit counter as it is shown in the first file i had posted where is the source code for it is bloom_filter.ccp is as follow:
#include<limits.h>
#include<stdarg.h>
#include<math.h>
#include<string.h>
#include"bloom_filter.h"
#include"clru.h"
#include"uthash.h"
#include"stdafx.h"
#include"CDPSpace.h"
#include"Resource.h"
#include"sd.h"
#include"./lib/md5.h"
CBloom_Filter::CBloom_Filter(){
BLOOM *bloom=CBloom_Filter::bloom_create((size_t)ceil(0.5*1*1.44), 1,MD5String);
}
CBloom_Filter::~CBloom_Filter(){
}
BLOOM *CBloom_Filter::bloom_create(size_t size, size_t nfuncs, ...)
{
BLOOM *bloom;
va_list l;
int n;
if(!(bloom = (BLOOM *)malloc( sizeof(BLOOM)))) return NULL;
if(!(bloom->a=(unsigned char *)calloc((size*COUNTER_BITS+CHAR_BIT-1)/(CHAR_BIT), sizeof(char)))) {
free(bloom);
return NULL;
}
if(!(bloom->funcs=(hashfunc_t*)malloc(nfuncs*sizeof(hashfunc_t)))) {
free(bloom->a);
free(bloom);
return NULL;
}
va_start(l, nfuncs);
for(n=0; n<nfuncs; ++n) {
bloom->funcs[n]=va_arg(l, hashfunc_t);
}
va_end(l);
if (!(bloom->PDATAINDEX[0]=(DATA_INDEX*)malloc((MAX_DATA_INDEX_NUM)*sizeof(DATA_INDEX)))){
free(bloom->PDATAINDEX);
free(bloom->a);
free(bloom);
return NULL ;
}
bloom->nfuncs=nfuncs;
bloom->asize=size;
const char *s=(const char*)bloom->a;
memset(bloom->a,0,(size*COUNTER_BITS+CHAR_BIT-1)/(CHAR_BIT));
return bloom;
}
int CBloom_Filter:: bloom_destroy(BLOOM *bloom)
{
free((void*)bloom->asize);
free(bloom->a);
free(bloom->PDATAINDEX);
free((void*)bloom->nfuncs);
free(bloom->funcs);
free(bloom);
return 0;
}
int CBloom_Filter:: bloom_increament(BLOOM *bloom, const char *s)
{
size_t n;
for(n=0; n<bloom->nfuncs; ++n) {
if (bloom->a[((*(bloom->funcs[n]))(s))%(bloom->asize)]<225)
bloom->a[((*(bloom->funcs[n]))(s))%(bloom->asize)]++;
}
return 0;
}
int CBloom_Filter:: bloom_decrement(BLOOM *bloom,const char *s)
{
size_t n;
for(n=0;n<bloom->nfuncs;++n){
if (bloom->a[((*(bloom->funcs[n]))(s))%(bloom->asize)]>0)
bloom->a[((*(bloom->funcs[n]))(s))%(bloom->asize)]--;
}
return 0;
}
int CBloom_Filter:: bloom_check(BLOOM *bloom, const char *s)
{
size_t n;
for(n=0; n<bloom->nfuncs; ++n) {
if(bloom->a[((*(bloom->funcs[n]))(s))%(bloom->asize)]>=1)
return true;
else
return false;
}
}