Generated on Sat Jul 29 2017 12:41:24 for Gecode by doxygen 1.8.13

Heap memory management class More...

#include <heap.hpp>

Public Member Functions

 Heap (void)
 Default constructor (ensuring that only a single instance is created) More...
 

Typed allocation routines

template<class T >
T * alloc (long unsigned int n)
 Allocate block of n objects of type T from heap. More...
 
template<class T >
T * alloc (long int n)
 Allocate block of n objects of type T from heap. More...
 
template<class T >
T * alloc (unsigned int n)
 Allocate block of n objects of type T from heap. More...
 
template<class T >
T * alloc (int n)
 Allocate block of n objects of type T from heap. More...
 
template<class T >
void free (T *b, long unsigned int n)
 Delete n objects starting at b. More...
 
template<class T >
void free (T *b, long int n)
 Delete n objects starting at b. More...
 
template<class T >
void free (T *b, unsigned int n)
 Delete n objects starting at b. More...
 
template<class T >
void free (T *b, int n)
 Delete n objects starting at b. More...
 
template<class T >
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 heap. More...
 
template<class T >
T * realloc (T *b, long int n, long int m)
 Reallocate block of n objects starting at b to m objects of type T from heap. More...
 
template<class T >
T * realloc (T *b, unsigned int n, unsigned int m)
 Reallocate block of n objects starting at b to m objects of type T from heap. More...
 
template<class T >
T * realloc (T *b, int n, int m)
 Reallocate block of n objects starting at b to m objects of type T from heap. More...
 
template<class T >
T ** realloc (T **b, long unsigned int n, long unsigned int m)
 Reallocate block of n pointers starting at b to m objects of type T* from heap. More...
 
template<class T >
T ** realloc (T **b, long int n, long int m)
 Reallocate block of n pointers starting at b to m objects of type T* from heap. More...
 
template<class T >
T ** realloc (T **b, unsigned int n, unsigned int m)
 Reallocate block of n pointers starting at b to m objects of type T* from heap. More...
 
template<class T >
T ** realloc (T **b, int n, int m)
 Reallocate block of n pointers starting at b to m objects of type T* from heap. More...
 
template<class T >
static T * copy (T *d, const T *s, long unsigned int n)
 Copy n objects starting at s to d. More...
 
template<class T >
static T * copy (T *d, const T *s, long int n)
 Copy n objects starting at s to d. More...
 
template<class T >
static T * copy (T *d, const T *s, unsigned int n)
 Copy n objects starting at s to d. More...
 
template<class T >
static T * copy (T *d, const T *s, int n)
 Copy n objects starting at s to d. More...
 
template<class T >
static T ** copy (T **d, const T **s, long unsigned int n)
 Copy n pointers starting at s to d. More...
 
template<class T >
static T ** copy (T **d, const T **s, long int n)
 Copy n pointers starting at s to d. More...
 
template<class T >
static T ** copy (T **d, const T **s, unsigned int n)
 Copy n pointers starting at s to d. More...
 
template<class T >
static T ** copy (T **d, const T **s, int n)
 Copy n pointers starting at s to d. More...
 

Raw allocation routines

void * ralloc (size_t s)
 Allocate s bytes from heap. More...
 
void rfree (void *p)
 Free memory block starting at p. More...
 
void rfree (void *p, size_t s)
 Free memory block starting at p with size s. More...
 
void * rrealloc (void *p, size_t s)
 Change memory block starting at p to size s. More...
 

Detailed Description

Heap memory management class

All routines throw an exception of MemoryExhausted, if a request cannot be fulfilled.

Definition at line 66 of file heap.hpp.

Constructor & Destructor Documentation

◆ Heap()

Gecode::Heap::Heap ( void  )

Default constructor (ensuring that only a single instance is created)

Definition at line 42 of file heap.cpp.

Member Function Documentation

◆ alloc() [1/4]

template<class T >
T * Gecode::Heap::alloc ( long unsigned int  n)
inline

Allocate block of n objects of type T from heap.

Note that this function implements C++ semantics: the default constructor of T is run for all n objects.

Definition at line 435 of file heap.hpp.

◆ alloc() [2/4]

template<class T >
T * Gecode::Heap::alloc ( long int  n)
inline

Allocate block of n objects of type T from heap.

Note that this function implements C++ semantics: the default constructor of T is run for all n objects.

Definition at line 443 of file heap.hpp.

◆ alloc() [3/4]

template<class T >
T * Gecode::Heap::alloc ( unsigned int  n)
inline

Allocate block of n objects of type T from heap.

Note that this function implements C++ semantics: the default constructor of T is run for all n objects.

Definition at line 449 of file heap.hpp.

◆ alloc() [4/4]

template<class T >
T * Gecode::Heap::alloc ( int  n)
inline

Allocate block of n objects of type T from heap.

Note that this function implements C++ semantics: the default constructor of T is run for all n objects.

Definition at line 454 of file heap.hpp.

◆ free() [1/4]

template<class T >
void Gecode::Heap::free ( T *  b,
long unsigned int  n 
)
inline

Delete n objects starting at b.

Note that this function implements C++ semantics: the destructor of T is run for all n objects.

Definition at line 461 of file heap.hpp.

◆ free() [2/4]

template<class T >
void Gecode::Heap::free ( T *  b,
long int  n 
)
inline

Delete n objects starting at b.

Note that this function implements C++ semantics: the destructor of T is run for all n objects.

Definition at line 468 of file heap.hpp.

◆ free() [3/4]

template<class T >
void Gecode::Heap::free ( T *  b,
unsigned int  n 
)
inline

Delete n objects starting at b.

Note that this function implements C++ semantics: the destructor of T is run for all n objects.

Definition at line 474 of file heap.hpp.

◆ free() [4/4]

template<class T >
void Gecode::Heap::free ( T *  b,
int  n 
)
inline

Delete n objects starting at b.

Note that this function implements C++ semantics: the destructor of T is run for all n objects.

Definition at line 479 of file heap.hpp.

◆ realloc() [1/8]

template<class T >
T * Gecode::Heap::realloc ( T *  b,
long unsigned int  n,
long unsigned int  m 
)
inline

Reallocate block of n objects starting at b to m objects of type T from heap.

Note that this function implements C++ semantics: the copy constructor of T is run for all $\min(n,m)$ objects, the default constructor of T is run for all remaining $\max(n,m)-\min(n,m)$ objects, and the destrucor of T is run for all n objects in b.

Returns the address of the new block.

Definition at line 486 of file heap.hpp.

◆ realloc() [2/8]

template<class T >
T * Gecode::Heap::realloc ( T *  b,
long int  n,
long int  m 
)
inline

Reallocate block of n objects starting at b to m objects of type T from heap.

Note that this function implements C++ semantics: the copy constructor of T is run for all $\min(n,m)$ objects, the default constructor of T is run for all remaining $\max(n,m)-\min(n,m)$ objects, and the destrucor of T is run for all n objects in b.

Returns the address of the new block.

Definition at line 499 of file heap.hpp.

◆ realloc() [3/8]

template<class T >
T * Gecode::Heap::realloc ( T *  b,
unsigned int  n,
unsigned int  m 
)
inline

Reallocate block of n objects starting at b to m objects of type T from heap.

Note that this function implements C++ semantics: the copy constructor of T is run for all $\min(n,m)$ objects, the default constructor of T is run for all remaining $\max(n,m)-\min(n,m)$ objects, and the destrucor of T is run for all n objects in b.

Returns the address of the new block.

Definition at line 506 of file heap.hpp.

◆ realloc() [4/8]

template<class T >
T * Gecode::Heap::realloc ( T *  b,
int  n,
int  m 
)
inline

Reallocate block of n objects starting at b to m objects of type T from heap.

Note that this function implements C++ semantics: the copy constructor of T is run for all $\min(n,m)$ objects, the default constructor of T is run for all remaining $\max(n,m)-\min(n,m)$ objects, and the destrucor of T is run for all n objects in b.

Returns the address of the new block.

Definition at line 512 of file heap.hpp.

◆ realloc() [5/8]

template<class T >
T ** Gecode::Heap::realloc ( T **  b,
long unsigned int  n,
long unsigned int  m 
)
inline

Reallocate block of n pointers starting at b to m objects of type T* from heap.

Returns the address of the new block.

This is a specialization for performance.

Definition at line 561 of file heap.hpp.

◆ realloc() [6/8]

template<class T >
T ** Gecode::Heap::realloc ( T **  b,
long int  n,
long int  m 
)
inline

Reallocate block of n pointers starting at b to m objects of type T* from heap.

Returns the address of the new block.

This is a specialization for performance.

Definition at line 566 of file heap.hpp.

◆ realloc() [7/8]

template<class T >
T ** Gecode::Heap::realloc ( T **  b,
unsigned int  n,
unsigned int  m 
)
inline

Reallocate block of n pointers starting at b to m objects of type T* from heap.

Returns the address of the new block.

This is a specialization for performance.

Definition at line 573 of file heap.hpp.

◆ realloc() [8/8]

template<class T >
T ** Gecode::Heap::realloc ( T **  b,
int  n,
int  m 
)
inline

Reallocate block of n pointers starting at b to m objects of type T* from heap.

Returns the address of the new block.

This is a specialization for performance.

Definition at line 579 of file heap.hpp.

◆ copy() [1/8]

template<class T >
T * Gecode::Heap::copy ( T *  d,
const T *  s,
long unsigned int  n 
)
inlinestatic

Copy n objects starting at s to d.

Note that this function implements C++ semantics: the assignment operator of T is run for all n objects.

Returns d.

Definition at line 587 of file heap.hpp.

◆ copy() [2/8]

template<class T >
T * Gecode::Heap::copy ( T *  d,
const T *  s,
long int  n 
)
inlinestatic

Copy n objects starting at s to d.

Note that this function implements C++ semantics: the assignment operator of T is run for all n objects.

Returns d.

Definition at line 594 of file heap.hpp.

◆ copy() [3/8]

template<class T >
T * Gecode::Heap::copy ( T *  d,
const T *  s,
unsigned int  n 
)
inlinestatic

Copy n objects starting at s to d.

Note that this function implements C++ semantics: the assignment operator of T is run for all n objects.

Returns d.

Definition at line 600 of file heap.hpp.

◆ copy() [4/8]

template<class T >
T * Gecode::Heap::copy ( T *  d,
const T *  s,
int  n 
)
inlinestatic

Copy n objects starting at s to d.

Note that this function implements C++ semantics: the assignment operator of T is run for all n objects.

Returns d.

Definition at line 605 of file heap.hpp.

◆ copy() [5/8]

template<class T >
T ** Gecode::Heap::copy ( T **  d,
const T **  s,
long unsigned int  n 
)
inlinestatic

Copy n pointers starting at s to d.

Returns d.

This is a specialization for performance.

Definition at line 650 of file heap.hpp.

◆ copy() [6/8]

template<class T >
T ** Gecode::Heap::copy ( T **  d,
const T **  s,
long int  n 
)
inlinestatic

Copy n pointers starting at s to d.

Returns d.

This is a specialization for performance.

Definition at line 655 of file heap.hpp.

◆ copy() [7/8]

template<class T >
T ** Gecode::Heap::copy ( T **  d,
const T **  s,
unsigned int  n 
)
inlinestatic

Copy n pointers starting at s to d.

Returns d.

This is a specialization for performance.

Definition at line 661 of file heap.hpp.

◆ copy() [8/8]

template<class T >
T ** Gecode::Heap::copy ( T **  d,
const T **  s,
int  n 
)
inlinestatic

Copy n pointers starting at s to d.

Returns d.

This is a specialization for performance.

Definition at line 666 of file heap.hpp.

◆ ralloc()

void * Gecode::Heap::ralloc ( size_t  s)
inline

Allocate s bytes from heap.

Definition at line 361 of file heap.hpp.

◆ rfree() [1/2]

void Gecode::Heap::rfree ( void *  p)
inline

Free memory block starting at p.

Definition at line 375 of file heap.hpp.

◆ rfree() [2/2]

void Gecode::Heap::rfree ( void *  p,
size_t  s 
)
inline

Free memory block starting at p with size s.

Definition at line 385 of file heap.hpp.

◆ rrealloc()

void * Gecode::Heap::rrealloc ( void *  p,
size_t  s 
)
inline

Change memory block starting at p to size s.

Definition at line 395 of file heap.hpp.


The documentation for this class was generated from the following files: