22 #include "../config.h"
25 #include "RMonoHandle_FwdDef.h"
26 #include "RMonoTypes.h"
42 virtual void forceDelete() = 0;
49 inline void RMonoObjectHandleDelete(rmono_gchandle gchandle,
RMonoAPIBase* mono);
70 typedef HandleT HandleType;
82 : handle(handle), mono(mono), flags(owned ? FlagOwned : 0)
92 if ((flags & FlagOwned) != 0) {
94 deleter(handle, mono);
99 inline void registerBackend();
100 inline void unregisterBackend();
104 if ((flags & FlagOwned) != 0) {
112 virtual void forceDelete()
114 if ((flags & FlagOwned) != 0) {
115 deleter(handle, mono);
118 handle = invalidHandle;
125 typename std::list<RMonoHandleBackendBase*>::iterator regIt;
148 : d(handle == invalidHandle ? std::shared_ptr<Data>() : std::make_shared<Data>(handle, mono, owned)) {}
177 d = std::move(other.d);
196 HandleType
operator*()
const {
return d ? d->handle : invalidHandle; }
212 return d ? d->takeOwnership() :
false;
231 bool isNull()
const {
return !isValid(); }
236 operator bool()
const {
return isValid(); }
239 std::shared_ptr<Data> d;
273 template <
typename RawPtrT>
282 typedef RawPtrT RawPtr;
332 inline bool operator==(
const Self& other)
const;
345 inline Self pin()
const;
351 inline Self clone()
const;
357 inline RawPtr raw()
const;
374 HandleT invalidHandle
380 std::size_t operator()(
HandleT const& h)
const noexcept
386 std::hash<typename HandleT::HandleType> hh;
RMonoAPIBase * getMonoAPI()
Definition: RMonoHandle_Def.h:201
Self & operator=(const Self &other)
Definition: RMonoHandle_Def.h:164
RMonoObjectHandle()
Definition: RMonoHandle_Def.h:288
RMonoHandle(const Self &other)
Definition: RMonoHandle_Def.h:153
Definition: RMonoAPIBase_Def.h:43
bool operator==(const Self &other) const
Definition: RMonoHandle_Def.h:185
bool isValid() const
Definition: RMonoHandle_Def.h:226
Definition: RMonoHandle_Def.h:277
Self & operator=(Self &&other)
Definition: RMonoHandle_Def.h:324
RMonoHandle(std::nullptr_t)
Definition: RMonoHandle_Def.h:137
Self & operator=(Self &&other)
Definition: RMonoHandle_Def.h:174
RMonoObjectHandle(const Self &other)
Definition: RMonoHandle_Def.h:308
bool operator!=(const Self &other) const
Definition: RMonoHandle_Def.h:190
HandleType operator*() const
Definition: RMonoHandle_Def.h:196
bool isNull() const
Definition: RMonoHandle_Def.h:231
RMonoObjectHandle(rmono_gchandle gchandle, RMonoAPIBase *mono, bool owned=true)
Definition: RMonoHandle_Def.h:303
Self & operator=(const Self &other)
Definition: RMonoHandle_Def.h:319
void reset()
Definition: RMonoHandle_Def.h:219
RMonoHandle(HandleType handle, RMonoAPIBase *mono, bool owned)
Definition: RMonoHandle_Def.h:147
RMonoObjectHandle(Self &&other)
Definition: RMonoHandle_Def.h:313
RMonoHandle(Self &&other)
Definition: RMonoHandle_Def.h:158
bool takeOwnership()
Definition: RMonoHandle_Def.h:210
Definition: RMonoHandle_Def.h:40
RMonoObjectHandle(std::nullptr_t)
Definition: RMonoHandle_Def.h:293
Definition: RMonoHandle_Def.h:246
Definition: RMonoHandle_Def.h:54
RMonoHandle()
Definition: RMonoHandle_Def.h:132
bool operator!=(const Self &other) const
Definition: RMonoHandle_Def.h:339
Definition: RMonoHandle_Def.h:68