COIN-OR::LEMON - Graph Library

source: glpk-cmake/src/glpdmp.h @ 2:4c8956a7bdf4

Last change on this file since 2:4c8956a7bdf4 was 1:c445c931472f, checked in by Alpar Juttner <alpar@…>, 14 years ago

Import glpk-4.45

  • Generated files and doc/notes are removed
File size: 2.6 KB
Line 
1/* glpdmp.h (dynamic memory pool) */
2
3/***********************************************************************
4*  This code is part of GLPK (GNU Linear Programming Kit).
5*
6*  Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
7*  2009, 2010 Andrew Makhorin, Department for Applied Informatics,
8*  Moscow Aviation Institute, Moscow, Russia. All rights reserved.
9*  E-mail: <mao@gnu.org>.
10*
11*  GLPK is free software: you can redistribute it and/or modify it
12*  under the terms of the GNU General Public License as published by
13*  the Free Software Foundation, either version 3 of the License, or
14*  (at your option) any later version.
15*
16*  GLPK is distributed in the hope that it will be useful, but WITHOUT
17*  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18*  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19*  License for more details.
20*
21*  You should have received a copy of the GNU General Public License
22*  along with GLPK. If not, see <http://www.gnu.org/licenses/>.
23***********************************************************************/
24
25#ifndef GLPDMP_H
26#define GLPDMP_H
27
28#include "glpenv.h"
29
30typedef struct DMP DMP;
31
32#define DMP_BLK_SIZE 8000
33/* size of memory blocks, in bytes, allocated for memory pools */
34
35struct DMP
36{     /* dynamic memory pool */
37#if 0
38      int size;
39      /* size of atoms, in bytes, 1 <= size <= 256; if size = 0, atoms
40         may have different sizes */
41#endif
42      void *avail[32];
43      /* avail[k], 0 <= k <= 31, is a pointer to the first available
44         (free) cell of (k+1)*8 bytes long; in the beginning of each
45         free cell there is a pointer to another free cell of the same
46         length */
47      void *block;
48      /* pointer to the most recently allocated memory block; in the
49         beginning of each allocated memory block there is a pointer to
50         the previously allocated memory block */
51      int used;
52      /* number of bytes used in the most recently allocated memory
53         block */
54      glp_long count;
55      /* number of atoms which are currently in use */
56};
57
58#define dmp_create_pool _glp_dmp_create_pool
59DMP *dmp_create_pool(void);
60/* create dynamic memory pool */
61
62#define dmp_get_atom _glp_dmp_get_atom
63void *dmp_get_atom(DMP *pool, int size);
64/* get free atom from dynamic memory pool */
65
66#define dmp_free_atom _glp_dmp_free_atom
67void dmp_free_atom(DMP *pool, void *atom, int size);
68/* return atom to dynamic memory pool */
69
70#define dmp_in_use _glp_dmp_in_use
71glp_long dmp_in_use(DMP *pool);
72/* determine how many atoms are still in use */
73
74#define dmp_delete_pool _glp_dmp_delete_pool
75void dmp_delete_pool(DMP *pool);
76/* delete dynamic memory pool */
77
78#endif
79
80/* eof */
Note: See TracBrowser for help on using the repository browser.