System documentation of the GNU Image-Finding Tool

myNew.h
1 // -*- mode: c++ -*-
2 #ifndef _MYNEW
3 #define _MYNEW
4 /* -*- mode: c++ -*-
5 */
6 /*
7 
8  GIFT, a flexible content based image retrieval system.
9  Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
10 
11  Copyright (C) 2003, 2004 Bayreuth University
12  2005 Bamberg University
13  This program is free software; you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 2 of the License, or
16  (at your option) any later version.
17 
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 
27 */
28 #include <iostream>
29 #include <cstdlib>
30 #include "libMRML/include/CDebuggingMemoryManager.h"
31 
32 //#define __memdebug
33 
34 void* operator new(size_t s){
35  if(gMemManager.isValid()){
36 
37 #ifdef __memdebug
38  cout << "MyAlloc" << s << endl;
39 #endif
40  return gMemManager.getMem(s);
41  }
42 #ifdef __memdebug
43  cout << "NormalAlloc" << flush;
44 #endif
45  return malloc(s);
46 }
47 /* void* operator new[](size_t s){ */
48 /* return new(s); */
49 /* } */
50 
51 void operator delete(void * inToBeDeleted){
52  if(inToBeDeleted){
53  if(gMemManager.freeMem(inToBeDeleted)){
54 #ifdef __memdebug
55  cout << "°my["
56  << inToBeDeleted
57  << "]"
58  << flush;// a character for which one can grep
59 #endif
60  return;
61  }else{
62 #ifdef __memdebug
63  cout << "§pre["
64  << inToBeDeleted
65  << "]"
66  << flush;// a character for which one can grep
67 #endif
68  free(inToBeDeleted);
69  }
70  }else{
71  cout << "!null" << endl;
72  }
73 }
74 
75 void operator delete[](void* inToBeDeleted){
76  delete(inToBeDeleted);
77 }
78 
79 #endif

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