TaPAS  0.2
ccl-bittable.h
Go to the documentation of this file.
1 /*
2  * ccl-bittable.h -- Implementation of vectors of bits
3  *
4  * This file is a part of the C Common Library (CCL) project.
5  *
6  * Copyright (C) 2010 CNRS UMR 5800 & Universit√© Bordeaux I (see AUTHORS file).
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the AltaRica Public License that comes with this
10  * package.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15  */
16 
22 #ifndef __CCL_BITTABLE_H__
23 # define __CCL_BITTABLE_H__
24 
25 # include <ccl/ccl-common.h>
26 # include <ccl/ccl-log.h>
27 # include <ccl/ccl-iterator.h>
28 
29 BEGIN_C_DECLS
30 
34 typedef struct ccl_bittable_st ccl_bittable;
35 
42 extern ccl_bittable *
43 ccl_bittable_create (int size);
44 
50 extern void
52 
58 extern int
60 
69 extern int
70 ccl_bittable_has (const ccl_bittable *bt, int index);
71 
83 extern void
84 ccl_bittable_set (ccl_bittable *bt, int index);
85 
97 extern void
98 ccl_bittable_unset (ccl_bittable *bt, int index);
99 
108 extern int
110 
123 extern int
124 ccl_bittable_get_next (ccl_bittable *bt, int prev);
125 
132 extern void
134 
141 extern unsigned int
142 ccl_bittable_hash (const ccl_bittable *bt);
143 
155 extern int
156 ccl_bittable_equals (const ccl_bittable *bt1, const ccl_bittable *bt2);
157 
164 extern ccl_bittable *
165 ccl_bittable_dup (const ccl_bittable *bt);
166 
173 extern int
175 
186 extern ccl_int_iterator *
188 
201 extern ccl_bittable *
202 ccl_bittable_resize (ccl_bittable *bt, int newsize);
203 
211 extern ccl_bittable *
212 ccl_bittable_union (const ccl_bittable *bt1, const ccl_bittable *bt2);
213 
223 extern ccl_bittable *
224 ccl_bittable_nary_union (ccl_bittable **bts, int nb_bts);
225 
233 extern ccl_bittable *
234 ccl_bittable_intersection (const ccl_bittable *bt1, const ccl_bittable *bt2);
235 
243 extern ccl_bittable *
244 ccl_bittable_sub (const ccl_bittable *bt1, const ccl_bittable *bt2);
245 
252 extern ccl_bittable *
254 
273 extern void
274 ccl_bittable_window_union (ccl_bittable *bt_dst, int dst,
275  const ccl_bittable *bt_src, int src, int w);
276 
291 extern int
293  const ccl_bittable *bt_src, int src,
294  int w);
295 
304 extern int
305 ccl_bittable_is_included_in (const ccl_bittable *bt1, const ccl_bittable *bt2);
306 
313 extern void
315 
316 END_C_DECLS
317 
318 #endif /* ! __CCL_BITTABLE_H__ */
int ccl_bittable_get_size(const ccl_bittable *bt)
Returns the number of bits of the table.
unsigned int ccl_bittable_hash(const ccl_bittable *bt)
Computes an hashed value of the content of bt.
ccl_bittable * ccl_bittable_resize(ccl_bittable *bt, int newsize)
Resize the table of bits bt for newsize bits.
void ccl_bittable_delete(ccl_bittable *bt)
Releases resources allocated to bt.
ccl_int_iterator * ccl_bittable_get_ones(ccl_bittable *bt)
Returns an iterator that gives positions of bit equal to 1.
int ccl_bittable_get_next(ccl_bittable *bt, int prev)
Returns the index of the first non-null bit encountered after the position prev.
ccl_bittable * ccl_bittable_dup(const ccl_bittable *bt)
Duplicates the table bt.
A generic iterator interface.
ccl_bittable * ccl_bittable_sub(const ccl_bittable *bt1, const ccl_bittable *bt2)
Computes the bitwise difference of tables bt1 and bt2.
ccl_bittable * ccl_bittable_create(int size)
Creates a new table of bits large enough for size bits.
void ccl_bittable_set(ccl_bittable *bt, int index)
Set the bit at position index.
void ccl_bittable_window_union(ccl_bittable *bt_dst, int dst, const ccl_bittable *bt_src, int src, int w)
Makes a bitwise disjunction between bts_dst and bt_src but on a restricted part of indices...
ccl_bittable * ccl_bittable_union(const ccl_bittable *bt1, const ccl_bittable *bt2)
Computes the bitwise disjunction of tables bt1 and bt2.
int ccl_bittable_equals(const ccl_bittable *bt1, const ccl_bittable *bt2)
Checks if bt1 and bt2 are equal.
void ccl_bittable_log(ccl_log_type log, const ccl_bittable *bt)
Display the content of the table bt to the stream log.
void ccl_bittable_clear(ccl_bittable *bt)
Sets to zero all bits of bt.
ccl_bittable * ccl_bittable_intersection(const ccl_bittable *bt1, const ccl_bittable *bt2)
Computes the bitwise conjunction of tables bt1 and bt2.
void ccl_bittable_unset(ccl_bittable *bt, int index)
Unset the bit at position index.
int ccl_bittable_is_included_in(const ccl_bittable *bt1, const ccl_bittable *bt2)
Checks if the set represented by bt1 is included in bt2.
struct ccl_bittable_st ccl_bittable
Abstract type of a vector of bytes.
Definition: ccl-bittable.h:34
int ccl_bittable_has(const ccl_bittable *bt, int index)
Checks if the bit at position index is set or not.
int ccl_bittable_window_union_with_roll(ccl_bittable *bt_dst, int dst, const ccl_bittable *bt_src, int src, int w)
Does the same work than ccl_bittable_window_union but the window of bt_src is rolled for 1 bit on the...
ccl_bittable * ccl_bittable_nary_union(ccl_bittable **bts, int nb_bts)
Computes the bitwise disjunction of tables bt[0], ..., bt[nb_bts-1].
Some useful and common macros.
int ccl_bittable_get_nb_one(ccl_bittable *bt)
Returns the number of bits set to 1 in bt/.
enum ccl_log_type_enum ccl_log_type
Enum that indicates which kind of message has to be displayed. Each kind of message can be displayed ...
Definition: ccl-log.h:50
int ccl_bittable_get_first(ccl_bittable *bt)
Returns the index of the first non-null bit.
ccl_bittable * ccl_bittable_complement(const ccl_bittable *bt)
Negate the bits of bt.
Message displayer.