MALOC  0.1
vmem.h
1 /*
2  * ***************************************************************************
3  * MALOC = < Minimal Abstraction Layer for Object-oriented C >
4  * Copyright (C) 1994--2000 Michael Holst
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation; either version 2 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * rcsid="$Id: vmem.h,v 1.9 2002/10/01 21:29:45 mholst Exp $"
21  * ***************************************************************************
22  */
23 
24 /*
25  * ***************************************************************************
26  * File: vmem.h < vmem.c >
27  *
28  * Purpose: Class Vmem: A safer, object-oriented, malloc/free object.
29  *
30  * Author: Michael Holst
31  * ***************************************************************************
32  */
33 
34 #ifndef _VMEM_H_
35 #define _VMEM_H_
36 
37 #include <maloc/maloc_base.h>
38 
39 /*
40  * ***************************************************************************
41  * Class Vmem: Parameters and datatypes
42  * ***************************************************************************
43  */
44 
45 /*
46  * ***************************************************************************
47  * Class Vmem: Definition
48  * ***************************************************************************
49  */
50 
51 typedef struct Vmem {
52 
53  char name[80]; /* name of class we are managing malloc areas for */
54 
55  int mallocBytes; /* total size of all current malloc areas of class */
56  int freeBytes; /* total size of all freed malloc areas of class */
57  int highWater; /* high-water malloc bytemark for this class */
58  int mallocAreas; /* total number of individual malloc areas */
59 
60 } Vmem;
61 
62 /*
63  * ***************************************************************************
64  * Class Vmem: Inlineable methods (vmem.c)
65  * ***************************************************************************
66  */
67 
68 #if !defined(VINLINE_MALOC)
69 #else /* if defined(VINLINE_MALOC) */
70 #endif /* if !defined(VINLINE_MALOC) */
71 
72 /*
73  * ***************************************************************************
74  * Class Vmem: Non-Inlineable methods (vmem.c)
75  * ***************************************************************************
76  */
77 
78 int Vmem_bytesTotal(void);
79 int Vmem_mallocBytesTotal(void);
80 int Vmem_freeBytesTotal(void);
81 int Vmem_highWaterTotal(void);
82 int Vmem_mallocAreasTotal(void);
83 void Vmem_printTotal(void);
84 
85 Vmem* Vmem_ctor(char *name);
86 void Vmem_dtor(Vmem **thee);
87 
88 void *Vmem_malloc(Vmem *thee, int num, int size);
89 void Vmem_free(Vmem *thee, int num, int size, void **ram);
90 void *Vmem_realloc(Vmem *thee, int num, int size, void **ram,
91  int newNum);
92 
93 int Vmem_bytes(Vmem *thee);
94 int Vmem_mallocBytes(Vmem *thee);
95 int Vmem_freeBytes(Vmem *thee);
96 int Vmem_highWater(Vmem *thee);
97 int Vmem_mallocAreas(Vmem *thee);
98 void Vmem_print(Vmem *thee);
99 
100 #endif /* _VMEM_H_ */
101 
Vmem
Definition: vmem.h:51