1 /*
2  * Copyright (c) 2005, 2006, 2007 Tama Communications Corporation
3  *
4  * This file is part of GNU GLOBAL.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef _IDSET_H_
20 #define _IDSET_H_
21 
22 /**
23  * Any id is not equal to END_OF_ID.
24  */
25 #define END_OF_ID ((unsigned int)(-1))
26 
27 typedef struct {
28 	unsigned int size;
29 	unsigned int min;
30 	unsigned int max;
31 	unsigned int lastid;		/**< used by idset_first() and idset_next() */
32 	unsigned long *set;
33 } IDSET;
34 
35 IDSET *idset_open(unsigned int);
36 int idset_empty(IDSET *);
37 void idset_add(IDSET *, unsigned int);
38 int idset_contains(IDSET *, unsigned int);
39 unsigned int idset_first(IDSET *);
40 unsigned int idset_next(IDSET *);
41 unsigned int idset_count(IDSET *);
42 void idset_close(IDSET *);
43 
44 #endif /* ! _IDSET_H_ */
45