1
/* This program is free software; you can redistribute it and/or
2
modify it under the terms of the GNU General Public License as
3
published by the Free Software Foundation; either version 2 of the
4
License, or (at your option) any later version.
6
This program is distributed in the hope that it will be useful, but
7
WITHOUT ANY WARRANTY; without even the implied warranty of
8
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9
General Public License for more details.
11
You should have received a copy of the GNU General Public License
12
along with this program; if not, write to the Free Software
13
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17
#include "range_tree.hh"
19
/* Give RangeTreeUInt a real type rather than the opaque struct type
20
defined for external use. */
21
#define RANGE_TREE_C_API_INTERNAL
22
typedef RangeTree<unsigned> RangeTreeUInt;
24
#include "range_tree_c_api.h"
26
RangeTreeUInt *range_tree_uint_alloc(unsigned min, unsigned max)
28
return new RangeTreeUInt(min, max);
31
RangeTreeUInt *range_tree_uint_copy(RangeTreeUInt *src)
33
return new RangeTreeUInt(*src);
36
void range_tree_uint_free(RangeTreeUInt *rt)
41
void range_tree_uint_take(RangeTreeUInt *rt, unsigned v)
46
unsigned range_tree_uint_take_any(RangeTreeUInt *rt)
48
return rt->take_any();
51
void range_tree_uint_release(RangeTreeUInt *rt, unsigned v)
56
int range_tree_uint_has(const RangeTreeUInt *rt, unsigned v)
61
int range_tree_uint_has_range(const RangeTreeUInt *rt,
65
return rt->has_range(vmin, vmax);
68
int range_tree_uint_empty(const RangeTreeUInt *rt)
73
unsigned range_tree_uint_size(const RangeTreeUInt *rt)
78
void range_tree_uint_print(const RangeTreeUInt *rt)
83
unsigned int range_tree_uint_allocation_lower_bound(const RangeTreeUInt *rt)
85
return rt->allocation_lower_bound();