All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
AbstractPrivateData.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
AbstractPrivateData.h
abstract class for private data in objects
Qore Programming Language
Copyright 2003 - 2014 David Nichols
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _QORE_ABSTRACTPRIVATEDATA_H
#define _QORE_ABSTRACTPRIVATEDATA_H
#include <qore/QoreReferenceCounter.h>
class AbstractPrivateData : public QoreReferenceCounter {
protected:
DLLLOCAL virtual ~AbstractPrivateData() {}
public:
DLLLOCAL void ref() {
ROreference();
}
DLLLOCAL virtual void deref(class ExceptionSink *xsink) {
if (ROdereference())
delete this;
}
DLLLOCAL virtual void deref() {
if (ROdereference())
delete this;
}
};
#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 &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:35
AbstractPrivateData::ref
DLLLOCAL void ref()
increments the reference count of the object
Definition: AbstractPrivateData.h:43