System documentation of the GNU Image-Finding Tool

Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

myNew.h

00001 // -*- mode: c++ -*-
00002 #ifndef _MYNEW
00003 #define _MYNEW
00004 /* -*- mode: c++ -*- 
00005 */
00006 /* 
00007 
00008     GIFT, a flexible content based image retrieval system.
00009     Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
00010 
00011      Copyright (C) 2003, 2004 Bayreuth University
00012       2005 Bamberg University
00013     This program is free software; you can redistribute it and/or modify
00014     it under the terms of the GNU General Public License as published by
00015     the Free Software Foundation; either version 2 of the License, or
00016     (at your option) any later version.
00017 
00018     This program is distributed in the hope that it will be useful,
00019     but WITHOUT ANY WARRANTY; without even the implied warranty of
00020     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021     GNU General Public License for more details.
00022 
00023     You should have received a copy of the GNU General Public License
00024     along with this program; if not, write to the Free Software
00025     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 
00027 */
00028 #include <iostream>
00029 #include <cstdlib>
00030 #include "libMRML/include/CDebuggingMemoryManager.h"
00031 
00032 //#define __memdebug
00033 
00034 void* operator new(size_t s){
00035   if(gMemManager.isValid()){
00036 
00037 #ifdef __memdebug
00038     cout << "MyAlloc" << s << endl;
00039 #endif
00040     return gMemManager.getMem(s);
00041   }
00042 #ifdef __memdebug
00043   cout << "NormalAlloc" << flush;
00044 #endif
00045   return malloc(s);
00046 }
00047 /* void* operator new[](size_t s){ */
00048 /*   return new(s); */
00049 /* } */
00050 
00051 void operator delete(void * inToBeDeleted){
00052   if(inToBeDeleted){
00053     if(gMemManager.freeMem(inToBeDeleted)){
00054 #ifdef __memdebug
00055       cout << "°my[" 
00056            << inToBeDeleted 
00057            << "]" 
00058            << flush;// a character for which one can grep
00059 #endif
00060       return;
00061     }else{
00062 #ifdef __memdebug
00063       cout << "§pre[" 
00064            << inToBeDeleted 
00065            << "]" 
00066            << flush;// a character for which one can grep
00067 #endif
00068       free(inToBeDeleted);
00069     }
00070   }else{
00071     cout << "!null" << endl;
00072   }
00073 }
00074 
00075 void operator delete[](void* inToBeDeleted){ 
00076   delete(inToBeDeleted); 
00077 } 
00078 
00079 #endif

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