Qore Programming Language: include/qore/QoreTypeSafeReferenceHelper.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
QoreTypeSafeReferenceHelper.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3 QoreTypeSafeReferenceHelper.h
4
5 Qore Programming Language
6
7 Copyright 2003 - 2013 David Nichols
8
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
13
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef _QORE_QORETYPESAFEREFERENCEHELPER_H
25
26 #define _QORE_QORETYPESAFEREFERENCEHELPER_H
27
29
49 class QoreTypeSafeReferenceHelper {
50 private:
52 DLLLOCAL QoreTypeSafeReferenceHelper(const QoreTypeSafeReferenceHelper&);
53
55 DLLLOCAL QoreTypeSafeReferenceHelper& operator=(const QoreTypeSafeReferenceHelper&);
56
58 DLLLOCAL void *operator new(size_t);
59
61 struct qore_type_safe_ref_helper_priv_t *priv;
62
63 public:
65
68 DLLEXPORT QoreTypeSafeReferenceHelper(const ReferenceNode *ref, ExceptionSink *xsink);
69
71
77 DLLEXPORT QoreTypeSafeReferenceHelper(const ReferenceNode *ref, AutoVLock &vl, ExceptionSink *xsink);
78
80 DLLEXPORT ~QoreTypeSafeReferenceHelper();
81
83
85 DLLEXPORT operator bool() const;
86
88
90 DLLEXPORT qore_type_t getType() const;
91
93
95 DLLEXPORT const char* getTypeName() const;
96
98
114 DLLEXPORT AbstractQoreNode *getUnique(ExceptionSink *xsink);
115
117
129 DLLEXPORT int assign(AbstractQoreNode *val);
130
132
147 DLLEXPORT int assign(AbstractQoreNode *val, ExceptionSink *xsink);
148
150
153 DLLEXPORT int assignBigInt(int64 v);
154
156
159 DLLEXPORT int assignFloat(double v);
160
162
164 DLLEXPORT const AbstractQoreNode *getValue() const;
165
167 DLLEXPORT void swap(QoreTypeSafeReferenceHelper &other);
168 };
169
170 #ifndef _QORE_LIB_INTERN
171 typedef QoreTypeSafeReferenceHelper ReferenceHelper;
172 #endif
173
174 #endif
AutoVLock
AutoVLock is a container for safely managing global variable and object lock handovers, required for functions accessing global variables and object data where locking is necessary.
Definition: AutoVLock.h:72
QoreTypeSafeReferenceHelper::swap
DLLEXPORT void swap(QoreTypeSafeReferenceHelper &other)
swaps the values of two references
AbstractQoreNode
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:47
QoreTypeSafeReferenceHelper::getType
DLLEXPORT qore_type_t getType() const
returns the type of the reference's value
QoreTypeSafeReferenceHelper::assign
DLLEXPORT int assign(AbstractQoreNode *val)
assigns a value to the reference, assumes the reference is valid
qore_type_t
signed short qore_type_t
used to identify unique Qore data and parse types (descendents of AbstractQoreNode) ...
Definition: common.h:59
QoreTypeSafeReferenceHelper::getUnique
DLLEXPORT AbstractQoreNode * getUnique(ExceptionSink *xsink)
returns a pointer to the value with a unique reference count (so it can be updated in place)...
QoreTypeSafeReferenceHelper::~QoreTypeSafeReferenceHelper
DLLEXPORT ~QoreTypeSafeReferenceHelper()
destroys the object
ReferenceNode
parse type: reference to a lvalue expression
Definition: ReferenceNode.h:37
QoreTypeSafeReferenceHelper::assignBigInt
DLLEXPORT int assignBigInt(int64 v)
assigns an integer value to the reference
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:35
QoreTypeSafeReferenceHelper
helper class to manage variable references passed to functions and class methods, stack only...
Definition: QoreTypeSafeReferenceHelper.h:49
QoreTypeSafeReferenceHelper::assignFloat
DLLEXPORT int assignFloat(double v)
assigns an integer value to the reference
QoreTypeSafeReferenceHelper::getTypeName
DLLEXPORT const char * getTypeName() const
returns the type name of the reference's value
QoreTypeSafeReferenceHelper::getValue
DLLEXPORT const AbstractQoreNode * getValue() const
returns a constant pointer to the reference's value