Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
RefCountingObjectPtr.h
Go to the documentation of this file.
1
2// RefCountingObject system for AngelScript
3// Copyright (c) 2022 Petr Ohlidal
4// https://github.com/only-a-ptr/RefCountingObject-AngelScript
5// See license (MIT) at the bottom of this file.
6
7// Adopted from "scripthandle" AngelScript addon, distributed with AngelScript SDK.
8
9#pragma once
10
11#include <angelscript.h>
12#include <stdio.h> // snprintf
13
14#if !defined(RefCoutingObjectPtr_DEBUGTRACE)
15# define RefCoutingObjectPtr_DEBUGTRACE(_Expr)
16#endif
17
18#if !defined(RefCountingObjectPtr_ASSERT)
19# include <cassert>
20# define RefCountingObjectPtr_ASSERT(_Expr_) assert(_Expr_)
21#endif
22
23template<class T>
25{
26public:
27 // Constructors
32
33 // Assignments
35 // Intentionally omitting raw-pointer assignment, for simplicity - see raw pointer constructor.
36
37 // Compare smart ptr
38 bool operator==(const RefCountingObjectPtr<T> &o) const { return m_ref == o.m_ref; }
39 bool operator!=(const RefCountingObjectPtr<T> &o) const { return m_ref != o.m_ref; }
40
41 // Compare pointer
42 bool operator==(const T* o) const { return m_ref == o; }
43 bool operator!=(const T* o) const { return m_ref != o; }
44
45 // Compare nullptr
46 bool operator==(const std::nullptr_t) const { return m_ref == nullptr; }
47 bool operator!=(const std::nullptr_t) const { return m_ref != nullptr; }
48
49 // Get the reference
50 T *GetRef() { return m_ref; } // To be invoked from C++ only!!
51 T *GetRef() const { return m_ref; } // To be invoked from C++ only!!
52 T* operator->() { return m_ref; }
53 T* operator->() const { return m_ref; }
54
55 // Identity conversion (classic `if (foo) {}` pointer check... and also `std::map<>` identity comparsion)
56 operator long long() const { return reinterpret_cast<long long>(m_ref); }
57
58 // GC callback
59 void EnumReferences(AS_NAMESPACE_QUALIFIER asIScriptEngine *engine);
60 void ReleaseReferences(AS_NAMESPACE_QUALIFIER asIScriptEngine *engine);
61
62 static void RegisterRefCountingObjectPtr(AS_NAMESPACE_QUALIFIER asIScriptEngine* engine, const char* handle_name, const char* obj_name);
63
65 static void RegisterRefCountingObjectPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptEngine* engine, const char* handle_name, const char* obj_name);
66
67protected:
68
69 void Set(T* ref);
72
73 // Wrapper functions, to be invoked by AngelScript only!
76 static void ConstructRef(RefCountingObjectPtr<T>* self, void** objhandle);
79 static RefCountingObjectPtr & OpAssign(RefCountingObjectPtr<T>* self, void** objhandle);
80 static bool OpEquals(RefCountingObjectPtr<T>* self, void** objhandle);
81 static T* DereferenceHandle(void** objhandle);
82
83 // Generic calling convention wrappers, to be invoked by AngelScript only!
84 static void ConstructDefaultGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
85 static void ConstructCopyGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
86 static void ConstructRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
87 static void DestructGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
88 static void EnumReferencesGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
89 static void ReleaseReferencesGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
90 static void OpImplCastGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
91 static void OpHndlAssignPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
92 static void OpHndlAssignRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
93 static void OpEqualsPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
94 static void OpEqualsRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen);
95
97};
98
99template<class T>
100void RefCountingObjectPtr<T>::RegisterRefCountingObjectPtr(AS_NAMESPACE_QUALIFIER asIScriptEngine* engine, const char* handle_name, const char* obj_name)
101{
102 int r;
103 const size_t DECLBUF_MAX = 300;
104 char decl_buf[DECLBUF_MAX];
105
106#if defined(AS_USE_NAMESPACE)
107 using namespace AngelScript;
108#endif
109
110 // With C++11 it is possible to use asGetTypeTraits to automatically determine the flags that represent the C++ class
111 r = engine->RegisterObjectType(handle_name, sizeof(RefCountingObjectPtr), asOBJ_VALUE | asOBJ_ASHANDLE | asOBJ_GC | asGetTypeTraits<RefCountingObjectPtr>()); RefCountingObjectPtr_ASSERT( r >= 0 );
112
113 // construct/destruct
114 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(RefCountingObjectPtr::ConstructDefault), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
115 snprintf(decl_buf, DECLBUF_MAX, "void f(%s @&in)", obj_name);
116 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_CONSTRUCT, decl_buf, asFUNCTION(RefCountingObjectPtr::ConstructRef), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
117 snprintf(decl_buf, DECLBUF_MAX, "void f(const %s &in)", handle_name);
118 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_CONSTRUCT, decl_buf, asFUNCTION(RefCountingObjectPtr::ConstructCopy), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
119 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_DESTRUCT, "void f()", asFUNCTION(RefCountingObjectPtr::Destruct), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
120
121 // GC
122 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_ENUMREFS, "void f(int&in)", asMETHOD(RefCountingObjectPtr,EnumReferences), asCALL_THISCALL); RefCountingObjectPtr_ASSERT(r >= 0);
123 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_RELEASEREFS, "void f(int&in)", asMETHOD(RefCountingObjectPtr, ReleaseReferences), asCALL_THISCALL); RefCountingObjectPtr_ASSERT(r >= 0);
124
125 // Cast
126 snprintf(decl_buf, DECLBUF_MAX, "%s @ opImplCast()", obj_name);
127 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpImplCast), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
128
129 // GetRef
130 snprintf(decl_buf, DECLBUF_MAX, "%s @ getHandle()", obj_name);
131 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpImplCast), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
132
133 // Assign
134 snprintf(decl_buf, DECLBUF_MAX, "%s &opHndlAssign(const %s &in)", handle_name, handle_name);
135 r = engine->RegisterObjectMethod(handle_name, decl_buf, asMETHOD(RefCountingObjectPtr, operator=), asCALL_THISCALL); RefCountingObjectPtr_ASSERT( r >= 0 );
136 snprintf(decl_buf, DECLBUF_MAX, "%s &opHndlAssign(const %s @&in)", handle_name, obj_name);
137 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpAssign), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
138
139 // Equals
140 snprintf(decl_buf, DECLBUF_MAX, "bool opEquals(const %s &in) const", handle_name);
141 r = engine->RegisterObjectMethod(handle_name, decl_buf, asMETHODPR(RefCountingObjectPtr, operator==, (const RefCountingObjectPtr &) const, bool), asCALL_THISCALL); RefCountingObjectPtr_ASSERT( r >= 0 );
142 snprintf(decl_buf, DECLBUF_MAX, "bool opEquals(const %s @&in) const", obj_name);
143 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpEquals), asCALL_CDECL_OBJFIRST); RefCountingObjectPtr_ASSERT( r >= 0 );
144}
145
146template<class T>
147void RefCountingObjectPtr<T>::RegisterRefCountingObjectPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptEngine* engine, const char* handle_name, const char* obj_name)
148{
149 // NOTE: Must register exactly the same declarations as `RegisterRefCountingObjectPtr()`!
150 int r;
151 const size_t DECLBUF_MAX = 300;
152 char decl_buf[DECLBUF_MAX];
153
154#if defined(AS_USE_NAMESPACE)
155 using namespace AngelScript;
156#endif
157
158 r = engine->RegisterObjectType(handle_name, sizeof(RefCountingObjectPtr), asOBJ_VALUE | asOBJ_ASHANDLE | asOBJ_GC | asGetTypeTraits<RefCountingObjectPtr>()); RefCountingObjectPtr_ASSERT( r >= 0 );
159
160 // construct/destruct
161 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(RefCountingObjectPtr::ConstructDefaultGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
162 snprintf(decl_buf, DECLBUF_MAX, "void f(%s @&in)", obj_name);
163 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_CONSTRUCT, decl_buf, asFUNCTION(RefCountingObjectPtr::ConstructRefGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
164 snprintf(decl_buf, DECLBUF_MAX, "void f(const %s &in)", handle_name);
165 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_CONSTRUCT, decl_buf, asFUNCTION(RefCountingObjectPtr::ConstructCopyGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
166 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_DESTRUCT, "void f()", asFUNCTION(RefCountingObjectPtr::DestructGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
167
168 // GC
169 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_ENUMREFS, "void f(int&in)", asFUNCTION(RefCountingObjectPtr::EnumReferencesGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT(r >= 0);
170 r = engine->RegisterObjectBehaviour(handle_name, asBEHAVE_RELEASEREFS, "void f(int&in)", asFUNCTION(RefCountingObjectPtr::ReleaseReferencesGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT(r >= 0);
171
172 // Cast
173 snprintf(decl_buf, DECLBUF_MAX, "%s @ opImplCast()", obj_name);
174 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpImplCastGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
175
176 // GetRef
177 snprintf(decl_buf, DECLBUF_MAX, "%s @ getHandle()", obj_name);
178 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpImplCastGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
179
180 // Assign
181 snprintf(decl_buf, DECLBUF_MAX, "%s &opHndlAssign(const %s &in)", handle_name, handle_name);
182 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpHndlAssignPtrGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
183 snprintf(decl_buf, DECLBUF_MAX, "%s &opHndlAssign(const %s @&in)", handle_name, obj_name);
184 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpHndlAssignRefGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
185
186 // Equals
187 snprintf(decl_buf, DECLBUF_MAX, "bool opEquals(const %s &in) const", handle_name);
188 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpEqualsPtrGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
189 snprintf(decl_buf, DECLBUF_MAX, "bool opEquals(const %s @&in) const", obj_name);
190 r = engine->RegisterObjectMethod(handle_name, decl_buf, asFUNCTION(RefCountingObjectPtr::OpEqualsRefGeneric), asCALL_GENERIC); RefCountingObjectPtr_ASSERT( r >= 0 );
191}
192
193
194// ---------------------------- Internals ------------------------------
195
196template<class T>
198{
199 // Dereference the handle to get the object itself (see AngelScript SDK, addon 'generic handle', function `Assign()` or `Equals()`).
200 return static_cast<T*>(*objhandle);
201}
202
203template<class T>
205{
206 T* ref = DereferenceHandle(objhandle);
207 new(self)RefCountingObjectPtr(ref);
208
209 // Increase refcount manually because constructor is designed for C++ use only.
210 if (ref)
211 ref->AddRef();
212}
213
214template<class T>
216{
217 T* ref = self->GetRef();
218 if (ref)
219 ref->AddRef();
220 return ref;
221}
222
223template<class T>
225{
226 T* ref = DereferenceHandle(objhandle);
227 self->Set(ref);
228 return *self;
229}
230
231template<class T>
233{
234 T* ref = DereferenceHandle(objhandle);
235 return self->GetRef() == ref;
236}
237
238template<class T>
240 : m_ref(nullptr)
241{
243 this->Set(ref);
244}
245
246template<class T>
248 : m_ref(nullptr)
249{
251}
252
253template<class T>
255{
257 m_ref = other.m_ref;
258 AddRefHandle();
259}
260
261template<class T>
263{
265 ReleaseHandle();
266}
267
268template<class T>
270{
272
273 if( m_ref )
274 {
275 m_ref->Release();
276 m_ref = nullptr;
277 }
278}
279
280template<class T>
282{
284
285 if( m_ref )
286 {
287 m_ref->AddRef();
288 }
289}
290
291template<class T>
293{
295 Set(other.m_ref);
296 return *this;
297}
298
299template<class T>
301{
302 if( m_ref == ref )
303 return;
304
305 ReleaseHandle();
306 m_ref = ref;
307 AddRefHandle();
308}
309
310template<class T>
311inline void RefCountingObjectPtr<T>::EnumReferences(AS_NAMESPACE_QUALIFIER asIScriptEngine *inEngine)
312{
313 // If we're holding a reference, we'll notify the garbage collector of it
314 if (m_ref)
315 inEngine->GCEnumCallback(m_ref);
316}
317
318template<class T>
319inline void RefCountingObjectPtr<T>::ReleaseReferences(AS_NAMESPACE_QUALIFIER asIScriptEngine * /*inEngine*/)
320{
321 // Simply clear the content to release the references
322 Set(nullptr);
323}
324
325// ---------------------------- Generic calling convention wrappers ------------------------------
326// NOTE: `GetArgAddress()` returns the address held by a reference argument, i.e.
327// for `const PtrType &in` it's the `RefCountingObjectPtr*` and for `ObjType @&in` it's the `void**` handle.
328
329template<class T>
330inline void RefCountingObjectPtr<T>::ConstructDefaultGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
331{
332 ConstructDefault(static_cast<RefCountingObjectPtr<T>*>(gen->GetObject()));
333}
334
335template<class T>
336inline void RefCountingObjectPtr<T>::ConstructCopyGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
337{
338 ConstructCopy(static_cast<RefCountingObjectPtr<T>*>(gen->GetObject()),
339 *static_cast<RefCountingObjectPtr<T>*>(gen->GetArgAddress(0)));
340}
341
342template<class T>
343inline void RefCountingObjectPtr<T>::ConstructRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
344{
345 ConstructRef(static_cast<RefCountingObjectPtr<T>*>(gen->GetObject()),
346 static_cast<void**>(gen->GetArgAddress(0)));
347}
348
349template<class T>
350inline void RefCountingObjectPtr<T>::DestructGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
351{
352 Destruct(static_cast<RefCountingObjectPtr<T>*>(gen->GetObject()));
353}
354
355template<class T>
356inline void RefCountingObjectPtr<T>::EnumReferencesGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
357{
358 // The `int&in` parameter of GC behaviours actually carries the engine pointer.
359 static_cast<RefCountingObjectPtr<T>*>(gen->GetObject())->EnumReferences(
360 static_cast<AS_NAMESPACE_QUALIFIER asIScriptEngine*>(gen->GetArgAddress(0)));
361}
362
363template<class T>
364inline void RefCountingObjectPtr<T>::ReleaseReferencesGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
365{
366 // The `int&in` parameter of GC behaviours actually carries the engine pointer.
367 static_cast<RefCountingObjectPtr<T>*>(gen->GetObject())->ReleaseReferences(
368 static_cast<AS_NAMESPACE_QUALIFIER asIScriptEngine*>(gen->GetArgAddress(0)));
369}
370
371template<class T>
372inline void RefCountingObjectPtr<T>::OpImplCastGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
373{
374 // `OpImplCast()` already increased the refcount, so store the handle directly
375 // (`SetReturnObject()` would increase it again).
376 *static_cast<T**>(gen->GetAddressOfReturnLocation()) = OpImplCast(static_cast<RefCountingObjectPtr<T>*>(gen->GetObject()));
377}
378
379template<class T>
380inline void RefCountingObjectPtr<T>::OpHndlAssignPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
381{
382 RefCountingObjectPtr<T>* self = static_cast<RefCountingObjectPtr<T>*>(gen->GetObject());
383 *self = *static_cast<RefCountingObjectPtr<T>*>(gen->GetArgAddress(0));
384 gen->SetReturnAddress(self);
385}
386
387template<class T>
388inline void RefCountingObjectPtr<T>::OpHndlAssignRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
389{
390 RefCountingObjectPtr<T>& ret = OpAssign(static_cast<RefCountingObjectPtr<T>*>(gen->GetObject()),
391 static_cast<void**>(gen->GetArgAddress(0)));
392 gen->SetReturnAddress(&ret);
393}
394
395template<class T>
396inline void RefCountingObjectPtr<T>::OpEqualsPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
397{
398 RefCountingObjectPtr<T>* self = static_cast<RefCountingObjectPtr<T>*>(gen->GetObject());
399 gen->SetReturnByte(*self == *static_cast<RefCountingObjectPtr<T>*>(gen->GetArgAddress(0)));
400}
401
402template<class T>
403inline void RefCountingObjectPtr<T>::OpEqualsRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric* gen)
404{
405 gen->SetReturnByte(OpEquals(static_cast<RefCountingObjectPtr<T>*>(gen->GetObject()),
406 static_cast<void**>(gen->GetArgAddress(0))));
407}
408
409/*
410MIT License
411
412Copyright (c) 2022 Petr OhlĂ­dal
413
414Permission is hereby granted, free of charge, to any person obtaining a copy
415of this software and associated documentation files (the "Software"), to deal
416in the Software without restriction, including without limitation the rights
417to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
418copies of the Software, and to permit persons to whom the Software is
419furnished to do so, subject to the following conditions:
420
421The above copyright notice and this permission notice shall be included in all
422copies or substantial portions of the Software.
423
424THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
425IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
426FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
427AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
428LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
429OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
430SOFTWARE.
431*/
#define RefCoutingObjectPtr_DEBUGTRACE(_Expr)
#define RefCountingObjectPtr_ASSERT(_Expr_)
static void RegisterRefCountingObjectPtr(AS_NAMESPACE_QUALIFIER asIScriptEngine *engine, const char *handle_name, const char *obj_name)
static void ReleaseReferencesGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
void ReleaseReferences(AS_NAMESPACE_QUALIFIER asIScriptEngine *engine)
bool operator==(const std::nullptr_t) const
static void EnumReferencesGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
static bool OpEquals(RefCountingObjectPtr< T > *self, void **objhandle)
static void ConstructCopy(RefCountingObjectPtr< T > *self, const RefCountingObjectPtr &o)
static RefCountingObjectPtr & OpAssign(RefCountingObjectPtr< T > *self, void **objhandle)
static void OpEqualsPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
static void Destruct(RefCountingObjectPtr< T > *self)
static void OpImplCastGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
static void DestructGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
static void OpHndlAssignRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
bool operator==(const RefCountingObjectPtr< T > &o) const
bool operator!=(const T *o) const
static T * DereferenceHandle(void **objhandle)
static void RegisterRefCountingObjectPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptEngine *engine, const char *handle_name, const char *obj_name)
Same as RegisterRefCountingObjectPtr() but uses the generic calling convention (for platforms with AS...
static void ConstructRef(RefCountingObjectPtr< T > *self, void **objhandle)
void EnumReferences(AS_NAMESPACE_QUALIFIER asIScriptEngine *engine)
bool operator==(const T *o) const
static void OpHndlAssignPtrGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
static void ConstructDefault(RefCountingObjectPtr< T > *self)
bool operator!=(const RefCountingObjectPtr< T > &o) const
RefCountingObjectPtr & operator=(const RefCountingObjectPtr< T > &other)
static void ConstructCopyGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
RefCountingObjectPtr(const RefCountingObjectPtr< T > &other)
bool operator!=(const std::nullptr_t) const
static void ConstructDefaultGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
static void ConstructRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)
static T * OpImplCast(RefCountingObjectPtr< T > *self)
static void OpEqualsRefGeneric(AS_NAMESPACE_QUALIFIER asIScriptGeneric *gen)