00001 /** @file rutz/shared_ptr.cc A thread-safe shared pointer class */ 00002 00003 /////////////////////////////////////////////////////////////////////// 00004 // 00005 // Copyright (c) 2006-2007 University of Southern California 00006 // Rob Peters <rjpeters at usc dot edu> 00007 // 00008 // created: Wed Aug 16 14:39:14 2006 00009 // commit: $Id: shared_ptr.cc 8250 2007-04-12 07:34:07Z rjpeters $ 00010 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/shared_ptr.cc $ 00011 // 00012 // -------------------------------------------------------------------- 00013 // 00014 // This file is part of GroovX. 00015 // [http://www.klab.caltech.edu/rjpeters/groovx/] 00016 // 00017 // GroovX is free software; you can redistribute it and/or modify it 00018 // under the terms of the GNU General Public License as published by 00019 // the Free Software Foundation; either version 2 of the License, or 00020 // (at your option) any later version. 00021 // 00022 // GroovX is distributed in the hope that it will be useful, but 00023 // WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00025 // General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with GroovX; if not, write to the Free Software Foundation, 00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00030 // 00031 /////////////////////////////////////////////////////////////////////// 00032 00033 #ifndef GROOVX_RUTZ_SHARED_PTR_CC_UTC20070412044845_DEFINED 00034 #define GROOVX_RUTZ_SHARED_PTR_CC_UTC20070412044845_DEFINED 00035 00036 #include "rutz/shared_ptr.h" 00037 00038 namespace 00039 { 00040 rutz::shared_ptr_aux::ptr_check_function* g_function = 0; 00041 } 00042 00043 rutz::shared_ptr_aux::ptr_check_function* 00044 rutz::shared_ptr_aux::set_check_function(rutz::shared_ptr_aux::ptr_check_function* func) 00045 { 00046 ptr_check_function* old = g_function; 00047 g_function = func; 00048 return old; 00049 } 00050 00051 void rutz::shared_ptr_aux::check_ptr(const void* p) 00052 { 00053 if (g_function != 0) 00054 (*g_function)(p); 00055 } 00056 00057 // ###################################################################### 00058 /* So things look consistent in everyone's emacs... */ 00059 /* Local Variables: */ 00060 /* indent-tabs-mode: nil */ 00061 /* End: */ 00062 00063 static const char __attribute__((used)) vcid_groovx_rutz_shared_ptr_cc_utc20070412044845[] = "$Id: shared_ptr.cc 8250 2007-04-12 07:34:07Z rjpeters $ $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/rutz/shared_ptr.cc $"; 00064 #endif // !GROOVX_RUTZ_SHARED_PTR_CC_UTC20070412044845DEFINED