60 class Chunk :
public HeapAllocated {
69 bool alloc(
size_t s,
void*&
p);
137 T*
alloc(
long unsigned int n);
172 void free(T*
b,
long unsigned int n);
183 void free(T*
b,
long int n);
194 void free(T*
b,
unsigned int n);
218 T*
realloc(T*
b,
long unsigned int n,
long unsigned int m);
231 T*
realloc(T*
b,
long int n,
long int m);
244 T*
realloc(T*
b,
unsigned int n,
unsigned int m);
269 void rfree(
void*
p,
size_t s);
283 template<
class T,
typename A1>
290 template<
class T,
typename A1,
typename A2>
291 T&
construct(A1
const& a1, A2
const& a2);
297 template<
class T,
typename A1,
typename A2,
typename A3>
298 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3);
304 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
305 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4);
311 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
312 T&
construct(A1
const& a1, A2
const& a2, A3
const& a3, A4
const& a4, A5
const& a5);
318 static void*
operator new(
size_t s)
throw() { (void) s;
return NULL; }
320 static void operator delete(
void*
p) { (void)
p; };
324 const Region& operator =(
const Region&) {
return *
this; }
334 Region::Chunk::alloc(
size_t s,
void*&
p) {
344 Region::Chunk::reset(
void) {
351 : chunk(pool().chunk()), hi(0) {}
361 if (chunk->alloc(s,p))
364 return heap_alloc(s);
385 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*n));
386 for (
long unsigned int i=n;
i--; )
387 (
void)
new (p+
i) T();
394 return alloc<T>(
static_cast<long unsigned int>(
n));
399 return alloc<T>(
static_cast<long unsigned int>(
n));
405 return alloc<T>(
static_cast<long unsigned int>(
n));
411 for (
long unsigned int i=n;
i--; )
413 rfree(b,n*
sizeof(T));
419 free<T>(
b,
static_cast<long unsigned int>(
n));
424 free<T>(
b,
static_cast<long unsigned int>(
n));
430 free<T>(
b,
static_cast<long unsigned int>(
n));
437 T* p =
static_cast<T*
>(
ralloc(
sizeof(T)*m));
438 for (
long unsigned int i=n;
i--; )
439 (
void)
new (p+
i) T(b[
i]);
440 for (
long unsigned int i=n; i<m; i++)
441 (
void)
new (p+
i) T();
452 assert((n >= 0) && (m >= 0));
453 return realloc<T>(
b,
static_cast<long unsigned int>(
n),
454 static_cast<long unsigned int>(m));
459 return realloc<T>(
b,
static_cast<long unsigned int>(
n),
460 static_cast<long unsigned int>(m));
465 assert((n >= 0) && (m >= 0));
466 return realloc<T>(
b,
static_cast<long unsigned int>(
n),
467 static_cast<long unsigned int>(m));
479 template<
class T,
typename A1>
482 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
486 template<
class T,
typename A1,
typename A2>
489 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
493 template<
class T,
typename A1,
typename A2,
typename A3>
496 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
497 new (&
t) T(a1,a2,a3);
500 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4>
503 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
504 new (&
t) T(a1,a2,a3,a4);
507 template<
class T,
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
510 T&
t = *
static_cast<T*
>(
ralloc(
sizeof(T)));
511 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.