Gnash 0.8.9
|
00001 // 00002 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 00003 // 2011 Free Software Foundation, Inc 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 // Smart (ref-counting) pointer classes. Uses "intrusive" approach: 00020 // the types pointed to must have add_ref() and drop_ref() methods. 00021 // Typically this is done by inheriting from a ref_counted class, 00022 // although the nice thing about templates is that no particular 00023 // ref-counted class is mandated. 00024 00025 00026 #ifndef SMART_PTR_H 00027 #define SMART_PTR_H 00028 00029 #include "ref_counted.h" 00030 00031 // TODO: drop all users of this macro, we _are_ using GC now 00032 #define GNASH_USE_GC 1 00033 00034 namespace gnash { 00035 class GcResource; 00036 } 00037 00038 00039 namespace gnash { 00040 00041 inline void 00042 intrusive_ptr_add_ref(const ref_counted* o) 00043 { 00044 o->add_ref(); 00045 } 00046 00047 inline void 00048 intrusive_ptr_release(const ref_counted* o) 00049 { 00050 o->drop_ref(); 00051 } 00052 00053 } // namespace boost||gnash 00054 00055 00056 #endif // SMART_PTR_H 00057 00058 00059 // Local Variables: 00060 // mode: C++ 00061 // c-basic-offset: 8 00062 // tab-width: 8 00063 // indent-tabs-mode: t 00064 // End: