|
Qore Programming Language
0.8.3
|
00001 /* -*- mode: c++; indent-tabs-mode: nil -*- */ 00002 /* 00003 AbstractPrivateData.h 00004 00005 abstract class for private data in objects 00006 00007 Qore Programming Language 00008 00009 Copyright 2003 - 2011 David Nichols 00010 00011 This library is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU Lesser General Public 00013 License as published by the Free Software Foundation; either 00014 version 2.1 of the License, or (at your option) any later version. 00015 00016 This library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Lesser General Public License for more details. 00020 00021 You should have received a copy of the GNU Lesser General Public 00022 License along with this library; if not, write to the Free Software 00023 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00024 */ 00025 00026 #ifndef _QORE_ABSTRACTPRIVATEDATA_H 00027 00028 #define _QORE_ABSTRACTPRIVATEDATA_H 00029 00030 #include <qore/QoreReferenceCounter.h> 00031 00033 00036 class AbstractPrivateData : public QoreReferenceCounter { 00037 protected: 00039 DLLLOCAL virtual ~AbstractPrivateData() {} 00040 00041 public: 00043 DLLLOCAL void ref() { 00044 ROreference(); 00045 } 00046 00048 00051 DLLLOCAL virtual void deref(class ExceptionSink *xsink) { 00052 if (ROdereference()) 00053 delete this; 00054 } 00055 00057 DLLLOCAL virtual void deref() { 00058 if (ROdereference()) 00059 delete this; 00060 } 00061 }; 00062 00063 #endif // _QORE_ABSTRACTPRIVATEDATA_H