lemon-project-template-glpk

annotate deps/glpk/src/glpdmp.h @ 11:4fc6ad2fb8a6

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