System documentation of the GNU Image-Finding Tool

CDebuggingMemoryManager.h
1 // -*- mode: c++ -*-
2 #ifndef _CDEBUGMEMORYMANAGER
3 #define _CDEBUGMEMORYMANAGER
4 #include "libMRML/include/uses-declarations.h"
5 #include <iostream>
6 // -*- mode: c++ -*-
7 /*
8 
9  GIFT, a flexible content based image retrieval system.
10  Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
11 
12  Copyright (C) 2003, 2004 Bayreuth University
13  2005 Bamberg University
14  This program is free software; you can redistribute it and/or modify
15  it under the terms of the GNU General Public License as published by
16  the Free Software Foundation; either version 2 of the License, or
17  (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful,
20  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  GNU General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with this program; if not, write to the Free Software
26  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 
28 */
29 #include "libMRML/include/CMutex.h"
30 typedef long CDebuggingMemoryManagerSize;
31 
32 // we will allocate a chunk of 10 megs
33 #define MEMSIZE 20000000
34 
41 struct lTChunk{
42 public:
45 
48 
51 
54 
59  CDebuggingMemoryManagerSize mSize;
60 
67  long mMagic;
68 };
69 
76 protected:
77 
80  void FreeChunk(lTChunk* inChunk);
81 
86 
89 
91  const long cMagic;
93  const long cUnMagic;
94 
96  long cVM;
99 public:
100 
104  CDebuggingMemoryManager(const CDebuggingMemoryManagerSize inSize);
105 
107  void* getMem(CDebuggingMemoryManagerSize inSize);
108 
110  bool freeMem(void*);
111 
113  bool isValid()const;
114 
116  friend ostream& operator <<(ostream& outStream,
117  const CDebuggingMemoryManager& inMem);
118 };
119 
121 ostream& operator<<(ostream& o, const CDebuggingMemoryManager& inMem);
122 
124 extern CDebuggingMemoryManager gMemManager;
125 
126 #endif

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen