8#ifndef META_OCEAN_DEVICES_ARCORE_AC_SCOPED_AR_OBJECT_H
9#define META_OCEAN_DEVICES_ARCORE_AC_SCOPED_AR_OBJECT_H
13#include <arcore_c_api.h>
25template <
typename T,
void (*tDestroyFunction)(T*)>
112template <
typename T,
void (*tDestroyFunction)(T*)>
171 inline operator T*()
const;
177 explicit inline operator bool()
const;
204template <
typename T,
void (*tDestroyFunction)(T*)>
208 static_assert(tDestroyFunction !=
nullptr,
"Invalid destroy function!");
211template <
typename T,
void (*tDestroyFunction)(T*)>
214 ocean_assert(arSession !=
nullptr);
215 ocean_assert(createFunction !=
nullptr);
217 createFunction(arSession, &object_);
218 ocean_assert(object_ !=
nullptr);
221template <
typename T,
void (*tDestroyFunction)(T*)>
224 *
this = std::move(arScopedObject);
227template <
typename T,
void (*tDestroyFunction)(T*)>
233template <
typename T,
void (*tDestroyFunction)(T*)>
241template <
typename T,
void (*tDestroyFunction)(T*)>
244 if (object_ !=
nullptr)
246 tDestroyFunction(object_);
251template <
typename T,
void (*tDestroyFunction)(T*)>
257template <
typename T,
void (*tDestroyFunction)(T*)>
260 return object_ !=
nullptr;
263template <
typename T,
void (*tDestroyFunction)(T*)>
266 if (
this != &arScopedObject)
270 object_ = arScopedObject.object_;
271 arScopedObject.object_ =
nullptr;
T ** ingest()
Allows ingesting an object via an external function.
Definition ScopedARObject.h:234
void(*)(const ArSession *arSession, T **object) CreateFunction
Definition of a function pointer to a function creating the object.
Definition ScopedARObject.h:122
~ScopedARObject()
Destructs the object and destroys it.
Definition ScopedARObject.h:228
ScopedARObject< T, tDestroyFunction > & operator=(ScopedARObject< T, tDestroyFunction > &&arScopedObject)
Move operator.
Definition ScopedARObject.h:264
ScopedARObject(T *object)
Creates a new scoped ARCore object.
Definition ScopedARObject.h:205
ScopedARObject(const ArSession *arSession, const CreateFunction &createFunction)
Creates a new scoped ARCore object.
Definition ScopedARObject.h:212
ScopedARObject(const ScopedARObject< T, tDestroyFunction > &)=delete
Disabled copy constructor.
ScopedARObject()=default
Default constructor creating an invalid object.
void release()
Explicitly releases the scoped object.
Definition ScopedARObject.h:242
ScopedARObject< T, tDestroyFunction > & operator=(const ScopedARObject< T, tDestroyFunction > &)=delete
Disabled assign operator.
ScopedARObject(ScopedARObject< T, tDestroyFunction > &&arScopedObject)
Move constructor.
Definition ScopedARObject.h:222
T * object_
The actual object.
Definition ScopedARObject.h:201
The namespace covering the entire Ocean framework.
Definition Accessor.h:15