Scippy

SCIP

Solving Constraint Integer Programs

buffer.h File Reference

Detailed Description

internal methods for memory buffers for temporary objects

Author
Tobias Achterberg

Definition in file buffer.h.

#include "scip/def.h"
#include "scip/type_retcode.h"
#include "scip/type_set.h"
#include "scip/type_buffer.h"

Go to the source code of this file.

Functions

SCIP_RETCODE SCIPbufferCreate (SCIP_BUFFER **buffer)
 
void SCIPbufferFree (SCIP_BUFFER **buffer)
 
SCIP_RETCODE SCIPbufferAllocMem (SCIP_BUFFER *buffer, SCIP_SET *set, void **ptr, int size)
 
SCIP_RETCODE SCIPbufferDuplicateMem (SCIP_BUFFER *buffer, SCIP_SET *set, void **ptr, const void *source, int size)
 
SCIP_RETCODE SCIPbufferReallocMem (SCIP_BUFFER *buffer, SCIP_SET *set, void **ptr, int size)
 
SCIP_RETCODE SCIPbufferAllocMemSave (SCIP_SET *set, void **ptr, int num, size_t elemsize)
 
SCIP_RETCODE SCIPbufferDuplicateMemSave (SCIP_SET *set, void **ptr, const void *source, int num, size_t elemsize)
 
SCIP_RETCODE SCIPbufferReallocMemSave (SCIP_SET *set, void **ptr, int num, size_t elemsize)
 
void SCIPbufferFreeMem (SCIP_BUFFER *buffer, void **ptr, int dummysize)
 
int SCIPbufferGetNUsed (SCIP_BUFFER *buffer)
 
void SCIPbufferPrint (SCIP_BUFFER *buffer)
 

Function Documentation

SCIP_RETCODE SCIPbufferCreate ( SCIP_BUFFER **  buffer)

creates memory buffer storage

Parameters
bufferpointer to memory buffer storage

Definition at line 36 of file buffer.c.

References BMSallocMemory, NULL, SCIP_ALLOC, and SCIP_OKAY.

Referenced by SCIPsetCreate().

void SCIPbufferFree ( SCIP_BUFFER **  buffer)

frees memory buffer storage

frees memory buffer

Parameters
bufferpointer to memory buffer storage

Definition at line 53 of file buffer.c.

References BMSfreeMemory, BMSfreeMemoryArrayNull, and NULL.

Referenced by SCIPsetFree().

SCIP_RETCODE SCIPbufferAllocMem ( SCIP_BUFFER buffer,
SCIP_SET set,
void **  ptr,
int  size 
)

allocates the next unused buffer

Parameters
buffermemory buffer storage
setglobal SCIP settings
ptrpointer to store the allocated memory buffer
sizeminimal required size of the buffer

Definition at line 73 of file buffer.c.

References BMSallocMemorySize, BMSreallocMemoryArray, BMSreallocMemorySize, SCIP_Buffer::data, FALSE, SCIP_Buffer::firstfree, SCIP_Buffer::ndata, NULL, SCIP_ALLOC, SCIP_OKAY, SCIPdebugMessage, SCIPsetCalcMemGrowSize(), SCIP_Buffer::size, TRUE, and SCIP_Buffer::used.

Referenced by SCIPbufferAllocMemSave(), SCIPbufferDuplicateMem(), and SCIPbufferReallocMem().

SCIP_RETCODE SCIPbufferDuplicateMem ( SCIP_BUFFER buffer,
SCIP_SET set,
void **  ptr,
const void *  source,
int  size 
)

allocates the next unused buffer and copies the given memory into the buffer

Parameters
buffermemory buffer storage
setglobal SCIP settings
ptrpointer to store the allocated memory buffer
sourcememory block to copy into the buffer
sizeminimal required size of the buffer

Definition at line 142 of file buffer.c.

References BMScopyMemorySize, NULL, SCIP_CALL, SCIP_OKAY, and SCIPbufferAllocMem().

Referenced by SCIPbufferDuplicateMemSave().

SCIP_RETCODE SCIPbufferReallocMem ( SCIP_BUFFER buffer,
SCIP_SET set,
void **  ptr,
int  size 
)

reallocates the buffer to at least the given size

Parameters
buffermemory buffer storage
setglobal SCIP settings
ptrpointer to the allocated memory buffer
sizeminimal required size of the buffer

Definition at line 162 of file buffer.c.

References BMSreallocMemorySize, SCIP_Buffer::data, SCIP_Buffer::firstfree, SCIP_Buffer::ndata, NULL, SCIP_ALLOC, SCIP_OKAY, SCIPbufferAllocMem(), SCIPdebugMessage, SCIPsetCalcMemGrowSize(), SCIP_Buffer::size, and SCIP_Buffer::used.

Referenced by SCIPbufferReallocMemSave().

SCIP_RETCODE SCIPbufferAllocMemSave ( SCIP_SET set,
void **  ptr,
int  num,
size_t  elemsize 
)

allocates the next unused buffer; checks for integer overflow

Parameters
setglobal SCIP settings
ptrpointer to store the allocated memory buffer
numnumber of entries to allocate
elemsizesize of one element in the array

Definition at line 221 of file buffer.c.

References NULL, SCIP_CALL, SCIP_NOMEMORY, SCIP_OKAY, and SCIPbufferAllocMem().

SCIP_RETCODE SCIPbufferDuplicateMemSave ( SCIP_SET set,
void **  ptr,
const void *  source,
int  num,
size_t  elemsize 
)

allocates the next unused buffer and copies the given memory into the buffer; checks for integer overflows

Parameters
setglobal SCIP settings
ptrpointer to store the allocated memory buffer
sourcememory block to copy into the buffer
numnumber of entries to copy
elemsizesize of one element in the array

Definition at line 240 of file buffer.c.

References NULL, SCIP_CALL, SCIP_NOMEMORY, SCIP_OKAY, and SCIPbufferDuplicateMem().

SCIP_RETCODE SCIPbufferReallocMemSave ( SCIP_SET set,
void **  ptr,
int  num,
size_t  elemsize 
)

reallocates the buffer to at least the given size; checks for integer overflows

Parameters
setglobal SCIP settings
ptrpointer to the allocated memory buffer
numnumber of entries to get memory for
elemsizesize of one element in the array

Definition at line 260 of file buffer.c.

References NULL, SCIP_CALL, SCIP_NOMEMORY, SCIP_OKAY, and SCIPbufferReallocMem().

void SCIPbufferFreeMem ( SCIP_BUFFER buffer,
void **  ptr,
int  dummysize 
)

frees a buffer

Parameters
buffermemory buffer storage
ptrpointer to the allocated memory buffer
dummysizeused to get a safer define for SCIPsetFreeBufferSize/Array

Definition at line 280 of file buffer.c.

References BMSfreeMemory, SCIP_Buffer::data, FALSE, SCIP_Buffer::firstfree, SCIP_Buffer::ndata, NULL, SCIPdebugMessage, SCIP_Buffer::size, and SCIP_Buffer::used.

int SCIPbufferGetNUsed ( SCIP_BUFFER buffer)

gets number of used buffers

Parameters
buffermemory buffer storage

Definition at line 320 of file buffer.c.

References SCIP_Buffer::firstfree, and NULL.

Referenced by exitPresolve(), initPresolve(), presolve(), presolveRound(), priceAndCutLoop(), propAndSolve(), SCIPsolveCIP(), and solveNode().

void SCIPbufferPrint ( SCIP_BUFFER buffer)

outputs statistics about currently allocated buffers to the screen

Parameters
buffermemory buffer storage

Definition at line 330 of file buffer.c.

References SCIP_Buffer::data, SCIP_Buffer::ndata, NULL, SCIP_Buffer::size, and SCIP_Buffer::used.

Referenced by SCIPprintMemoryDiagnostic().