vmem.h

00001 /*
00002  * ***************************************************************************
00003  * MALOC = < Minimal Abstraction Layer for Object-oriented C >
00004  * Copyright (C) 1994--2000  Michael Holst
00005  * 
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU General Public License as published by the
00008  * Free Software Foundation; either version 2 of the License, or (at your
00009  * option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00014  * See the GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License along
00017  * with this program; if not, write to the Free Software Foundation, Inc.,
00018  * 675 Mass Ave, Cambridge, MA 02139, USA.
00019  * 
00020  * rcsid="$Id: vmem.h,v 1.9 2002/10/01 21:29:45 mholst Exp $"
00021  * ***************************************************************************
00022  */
00023 
00024 /*
00025  * ***************************************************************************
00026  * File:     vmem.h    < vmem.c >
00027  *
00028  * Purpose:  Class Vmem: A safer, object-oriented, malloc/free object.
00029  *
00030  * Author:   Michael Holst
00031  * ***************************************************************************
00032  */
00033 
00034 #ifndef _VMEM_H_
00035 #define _VMEM_H_
00036 
00037 #include <maloc/maloc_base.h>
00038 
00039 /*
00040  * ***************************************************************************
00041  * Class Vmem: Parameters and datatypes
00042  * ***************************************************************************
00043  */
00044 
00045 /*
00046  * ***************************************************************************
00047  * Class Vmem: Definition
00048  * ***************************************************************************
00049  */
00050 
00051 typedef struct Vmem {
00052 
00053     char name[80];      /* name of class we are managing malloc areas for   */
00054 
00055     int mallocBytes;    /* total size of all current malloc areas of class  */
00056     int freeBytes;      /* total size of all freed malloc areas of class    */
00057     int highWater;      /* high-water malloc bytemark for this class        */
00058     int mallocAreas;    /* total number of individual malloc areas          */
00059 
00060 } Vmem;
00061 
00062 /*
00063  * ***************************************************************************
00064  * Class Vmem: Inlineable methods (vmem.c)
00065  * ***************************************************************************
00066  */
00067 
00068 #if !defined(VINLINE_MALOC)
00069 #else /* if defined(VINLINE_MALOC) */
00070 #endif /* if !defined(VINLINE_MALOC) */
00071 
00072 /*
00073  * ***************************************************************************
00074  * Class Vmem: Non-Inlineable methods (vmem.c)
00075  * ***************************************************************************
00076  */
00077 
00078 int Vmem_bytesTotal(void);
00079 int Vmem_mallocBytesTotal(void);
00080 int Vmem_freeBytesTotal(void);
00081 int Vmem_highWaterTotal(void);
00082 int Vmem_mallocAreasTotal(void);
00083 void Vmem_printTotal(void);
00084 
00085 Vmem* Vmem_ctor(char *name);
00086 void Vmem_dtor(Vmem **thee);
00087 
00088 void *Vmem_malloc(Vmem *thee, int num, int size);
00089 void Vmem_free(Vmem *thee, int num, int size, void **ram);
00090 void *Vmem_realloc(Vmem *thee, int num, int size, void **ram,
00091     int newNum);
00092 
00093 int Vmem_bytes(Vmem *thee);
00094 int Vmem_mallocBytes(Vmem *thee);
00095 int Vmem_freeBytes(Vmem *thee);
00096 int Vmem_highWater(Vmem *thee);
00097 int Vmem_mallocAreas(Vmem *thee);
00098 void Vmem_print(Vmem *thee);
00099 
00100 #endif /* _VMEM_H_ */
00101 
00102 

Generated on Fri Aug 21 15:55:32 2009 for MALOC by  doxygen 1.4.7