Qore Programming Language: include/qore/AbstractPrivateData.h (6585) Source File

Qore Programming Language 0.8.11

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AbstractPrivateData.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3 AbstractPrivateData.h
4
5 abstract class for private data in objects
6
7 Qore Programming Language
8
9 Copyright 2003 - 2014 David Nichols
10
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 2.1 of the License, or (at your option) any later version.
15
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #ifndef _QORE_ABSTRACTPRIVATEDATA_H
27
28 #define _QORE_ABSTRACTPRIVATEDATA_H
29
30 #include <qore/QoreReferenceCounter.h>
31
33
36 class AbstractPrivateData : public QoreReferenceCounter {
37 protected:
39 DLLLOCAL virtual ~AbstractPrivateData() {}
40
41 public:
43 DLLLOCAL void ref() {
44 ROreference();
45 }
46
48
51 DLLLOCAL virtual void deref(class ExceptionSink *xsink) {
52 if (ROdereference())
53 delete this;
54 }
55
57 DLLLOCAL virtual void deref() {
58 if (ROdereference())
59 delete this;
60 }
61 };
62
63 #endif // _QORE_ABSTRACTPRIVATEDATA_H
AbstractPrivateData::deref
virtual DLLLOCAL void deref(class ExceptionSink *xsink)
decrements the reference count of the object
Definition: AbstractPrivateData.h:51
QoreReferenceCounter::ROdereference
DLLEXPORT bool ROdereference() const
atomically decrements the reference count
AbstractPrivateData
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:36
QoreReferenceCounter::ROreference
DLLEXPORT void ROreference() const
atomically increments the reference count
AbstractPrivateData::~AbstractPrivateData
virtual DLLLOCAL ~AbstractPrivateData()
as these objects are reference counted, the destructor should be called only when the reference count...
Definition: AbstractPrivateData.h:39
QoreReferenceCounter
provides atomic reference counting to Qore objects
Definition: QoreReferenceCounter.h:34
AbstractPrivateData::deref
virtual DLLLOCAL void deref()
decrements the reference count of the object without the possibility of throwing a Qore-language exce...
Definition: AbstractPrivateData.h:57
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:35
AbstractPrivateData::ref
DLLLOCAL void ref()
increments the reference count of the object
Definition: AbstractPrivateData.h:43