CLucene - a full-featured, c++ search engine
API Documentation
00001 /*------------------------------------------------------------------------------ 00002 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team 00003 * 00004 * Distributable under the terms of either the Apache License (Version 2.0) or 00005 * the GNU Lesser General Public License, as specified in the COPYING file. 00006 ------------------------------------------------------------------------------*/ 00007 #ifndef _lucene_debug_lucenebase_ 00008 #define _lucene_debug_lucenebase_ 00009 00010 #ifdef _LUCENE_PRAGMA_ONCE 00011 # pragma once 00012 #endif 00013 00014 CL_NS_DEF(debug) 00015 00016 //Lucenebase is the superclass of all clucene objects. It provides 00017 //memory debugging tracking and/or reference counting 00018 class LuceneBase{ 00019 public: 00020 #ifdef LUCENE_ENABLE_MEMLEAKTRACKING 00021 static void* operator new (size_t size); 00022 static void operator delete (void *p); 00023 int32_t __cl_initnum; 00024 00025 static void* operator new (size_t size, char const * file, int32_t line); 00026 static void operator delete (void *p, char const * file, int32_t line); 00027 00028 static void* __cl_voidpadd(void* data, const char* file, int line, size_t size); 00029 static void __cl_voidpremove(const void* data, const char* file, int line); 00030 static void __cl_unregister(const void* obj); 00031 00032 static int32_t __cl_GetUnclosedObjectsCount(); 00033 static const char* __cl_GetUnclosedObject(int32_t item); 00034 static char* __cl_GetUnclosedObjects(); 00035 static void __cl_PrintUnclosedObjects(); 00036 00042 static void __cl_ClearMemory(); 00043 00044 #endif //LUCENE_ENABLE_MEMLEAKTRACKING 00045 00046 int __cl_refcount; 00047 LuceneBase(){ 00048 __cl_refcount=1; 00049 } 00050 inline int __cl_getref(){ 00051 return __cl_refcount; 00052 } 00053 inline int __cl_addref(){ 00054 __cl_refcount++; 00055 return __cl_refcount; 00056 } 00057 inline int __cl_decref(){ 00058 __cl_refcount--; 00059 return __cl_refcount; 00060 } 00061 virtual ~LuceneBase(){}; 00062 }; 00063 00064 class LuceneVoidBase{ 00065 public: 00066 #ifdef _DEBUG 00067 //a compile time check to make sure that _CLDELETE and _CLDECDELETE is being 00068 //used correctly. 00069 int dummy__see_mem_h_for_details; 00070 #endif 00071 virtual ~LuceneVoidBase(){}; 00072 }; 00073 00074 CL_NS_END 00075 #endif //_lucene_debug_lucenebase_