00001 /* -*- mode: c++; indent-tabs-mode: nil -*- */ 00002 /* 00003 QoreTypeSafeReferenceHelper.h 00004 00005 Qore Programming Language 00006 00007 Copyright 2003 - 2010 David Nichols 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #ifndef _QORE_QORETYPESAFEREFERENCEHELPER_H 00025 00026 #define _QORE_QORETYPESAFEREFERENCEHELPER_H 00027 00029 00050 class QoreTypeSafeReferenceHelper { 00051 private: 00053 DLLLOCAL QoreTypeSafeReferenceHelper(const QoreTypeSafeReferenceHelper&); 00054 00056 DLLLOCAL QoreTypeSafeReferenceHelper& operator=(const QoreTypeSafeReferenceHelper&); 00057 00059 DLLLOCAL void *operator new(size_t); 00060 00062 struct qore_type_safe_ref_helper_priv_t *priv; 00063 00064 public: 00066 00070 DLLEXPORT QoreTypeSafeReferenceHelper(const ReferenceNode *ref, AutoVLock &vl, ExceptionSink *xsink); 00071 00073 DLLEXPORT ~QoreTypeSafeReferenceHelper(); 00074 00076 00078 DLLEXPORT operator bool() const; 00079 00081 00083 DLLEXPORT qore_type_t getType() const; 00084 00086 00103 DLLEXPORT AbstractQoreNode *getUnique(ExceptionSink *xsink); 00104 00106 00120 DLLEXPORT int assign(AbstractQoreNode *val, ExceptionSink *xsink); 00121 00123 00125 DLLEXPORT const AbstractQoreNode *getValue() const; 00126 00128 DLLEXPORT void swap(QoreTypeSafeReferenceHelper &other); 00129 }; 00130 00131 #ifndef _QORE_LIB_INTERN 00132 typedef QoreTypeSafeReferenceHelper ReferenceHelper; 00133 #endif 00134 00135 #endif