MemoryManager.cpp
Go to the documentation of this file.
00001 /* ========================================================================
00002  * PROJECT: ARToolKitPlus
00003  * ========================================================================
00004  * This work is based on the original ARToolKit developed by
00005  *   Hirokazu Kato
00006  *   Mark Billinghurst
00007  *   HITLab, University of Washington, Seattle
00008  * http://www.hitl.washington.edu/artoolkit/
00009  *
00010  * Copyright of the derived and new portions of this work
00011  *     (C) 2006 Graz University of Technology
00012  *
00013  * This framework 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 framework 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 framework; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026  *
00027  * For further information please contact 
00028  *   Dieter Schmalstieg
00029  *   <schmalstieg@icg.tu-graz.ac.at>
00030  *   Graz University of Technology, 
00031  *   Institut for Computer Graphics and Vision,
00032  *   Inffeldgasse 16a, 8010 Graz, Austria.
00033  * ========================================================================
00034  ** @author   Daniel Wagner
00035  *
00036  * $Id: MemoryManager.cpp 164 2006-05-02 11:29:10Z daniel $
00037  * @file
00038  * ======================================================================== */
00039 
00040 
00041 #include <ARToolKitPlus/MemoryManager.h>
00042 #include <malloc.h>
00043 
00044 
00045 namespace ARToolKitPlus
00046 {
00047 
00048 
00049 #ifndef _ARTKP_NO_MEMORYMANAGER_
00050 
00051 MemoryManager* memManager = NULL;
00052 
00053 
00054 ARTOOLKITPLUS_API void
00055 setMemoryManager(MemoryManager* nManager)
00056 {
00057         memManager = nManager;
00058 }
00059 
00060 
00061 ARTOOLKITPLUS_API MemoryManager*
00062 getMemoryManager()
00063 {
00064         return memManager;
00065 }
00066 
00067 
00068 #endif //_ARTKP_NO_MEMORYMANAGER_
00069 
00070 
00071 void
00072 artkp_Free(void* rawMemory)
00073 {
00074         if(!rawMemory)
00075                 return;
00076 
00077 #ifndef _ARTKP_NO_MEMORYMANAGER_
00078         if(memManager)
00079                 memManager->releaseMemory(rawMemory);
00080         else
00081 #endif //_ARTKP_NO_MEMORYMANAGER_
00082                 ::free(rawMemory);
00083 
00084         rawMemory = NULL;
00085 }
00086 
00087 
00088 }  // namespace ARToolKitPlus
00089 
00090 


tuw_artoolkitplus
Author(s): Markus Bader
autogenerated on Sun May 29 2016 02:50:12