56 class Chunk :
public HeapAllocated {
65 bool alloc(
size_t s,
void*&
p);
133 T*
alloc(
long unsigned int n);
168 void free(T*
b,
long unsigned int n);
179 void free(T*
b,
long int n);
190 void free(T*
b,
unsigned int n);
214 T*
realloc(T*
b,
long unsigned int n,
long unsigned int m);
227 T*
realloc(T*
b,
long int n,
long int m);
240 T*
realloc(T*
b,
unsigned int n,
unsigned int m);
265 void rfree(
void*
p,
size_t s);
279 template<
class T,
typename A1>
286 template<
class T,
typename A1,
typename A2>
287 T&
construct(A1
const& a1, A2
const& a2);
293 template<
class T,
typename A1,
typename A2,
typename A3>
294 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3);
300 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
301 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4);
307 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
308 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4, A5
const& a5);
314 static void*
operator new(
size_t s)
throw() { (void) s;
return NULL; }
316 static void operator delete(
void*
p) { (void)
p; };
320 const Region& operator =(
const Region&) {
return *
this; }
330 Region::Chunk::alloc(
size_t s,
void*&
p) {
340 Region::Chunk::reset(
void) {
347 : chunk(pool().chunk()), hi(0) {}
357 if (chunk->alloc(s,p))
360 return heap_alloc(s);
381 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*n));
382 for (
long unsigned int i=n;
i--; )
383 (
void)
new (p+
i) T();
390 return alloc<T>(
static_cast<long unsigned int>(
n));
395 return alloc<T>(
static_cast<long unsigned int>(
n));
401 return alloc<T>(
static_cast<long unsigned int>(
n));
407 for (
long unsigned int i=n;
i--; )
409 rfree(b,n*
sizeof(T));
415 free<T>(
b,
static_cast<long unsigned int>(
n));
420 free<T>(
b,
static_cast<long unsigned int>(
n));
426 free<T>(
b,
static_cast<long unsigned int>(
n));
433 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*m));
434 for (
long unsigned int i=n;
i--; )
435 (
void)
new (p+
i) T(b[
i]);
436 for (
long unsigned int i=n; i<m; i++)
437 (
void)
new (p+
i) T();
448 assert((n >= 0) && (m >= 0));
449 return realloc<T>(
b,
static_cast<long unsigned int>(
n),
450 static_cast<long unsigned int>(m));
455 return realloc<T>(
b,
static_cast<long unsigned int>(
n),
456 static_cast<long unsigned int>(m));
461 assert((n >= 0) && (m >= 0));
462 return realloc<T>(
b,
static_cast<long unsigned int>(
n),
463 static_cast<long unsigned int>(m));
475 template<
class T,
typename A1>
478 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
482 template<
class T,
typename A1,
typename A2>
485 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
489 template<
class T,
typename A1,
typename A2,
typename A3>
492 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
493 new (&
t) T(a1,a2,a3);
496 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
499 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
500 new (&
t) T(a1,a2,a3,a4);
503 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
506 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
507 new (&
t) T(a1,a2,a3,a4,a5);
void rfree(void *p, size_t s)
Free memory previously allocated.
void free(void)
Free allocate memory.
T & construct(void)
Constructs a single object of type T from region using the default constructor.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
void align(size_t &s)
Align size s to the required alignment.
Region(void)
Initialize region.
~Region(void)
Return memory.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
unsigned int size(I &i)
Size of all ranges of range iterator i.
const size_t region_area_size
Size of region area.
union Gecode::@585::NNF::@62 u
Union depending on nodetype t.
#define GECODE_KERNEL_EXPORT
T ptr_cast(void *p)
Cast p into pointer of type T.
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
void * ralloc(size_t s)
Allocate memory from region.
T * realloc(T *b, long unsigned int n, long unsigned int m)
Reallocate block of n objects starting at b to m objects of type T from the region.