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;
This class implements a scoped object for ARCore objects.
Definition ScopedARObject.h:114
T ** ingest()
Allows to ingest an object via an external function.
Definition ScopedARObject.h:234
~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
void(* CreateFunction)(const ArSession *arSession, T **object)
Definition of a function pointer to a function creating the object.
Definition ScopedARObject.h:122
T * object_
The actual object.
Definition ScopedARObject.h:201
ScopedARObject< ArImage, ArImage_release > ScopedARImage
Definition of a scoped object for ArImage.
Definition ScopedARObject.h:54
ScopedARObject< ArSession, ArSession_destroy > ScopedARSession
Definition of a scoped object for ArSession.
Definition ScopedARObject.h:33
ScopedARObject< ArCameraIntrinsics, ArCameraIntrinsics_destroy > ScopedARCameraIntrinsics
Definition of a scoped object for ArCameraIntrinsics.
Definition ScopedARObject.h:82
ScopedARObject< ArCameraConfigList, ArCameraConfigList_destroy > ScopedARCameraConfigList
Definition of a scoped object for ArCameraConfigList.
Definition ScopedARObject.h:68
ScopedARObject< ArCameraConfig, ArCameraConfig_destroy > ScopedARCameraConfig
Definition of a scoped object for ArCameraConfig.
Definition ScopedARObject.h:61
ScopedARObject< ArTrackableList, ArTrackableList_destroy > ScopedARTrackableList
Definition of a scoped object for ArTrackableList.
Definition ScopedARObject.h:96
ScopedARObject< ArPose, ArPose_destroy > ScopedARPose
Definition of a scoped object for ArPose.
Definition ScopedARObject.h:47
ScopedARObject< ArTrackable, ArTrackable_release > ScopedARTrackable
Definition of a scoped object for ArTrackable.
Definition ScopedARObject.h:89
ScopedARObject< ArConfig, ArConfig_destroy > ScopedARConfig
Definition of a scoped object for ArConfig.
Definition ScopedARObject.h:40
ScopedARObject< ArPointCloud, ArPointCloud_release > ScopedARPointCloud
Definition of a scoped object for ArPointCloud.
Definition ScopedARObject.h:103
ScopedARObject< ArCameraConfigFilter, ArCameraConfigFilter_destroy > ScopedARCameraConfigFilter
Definition of a scoped object for ArCameraConfigFilter.
Definition ScopedARObject.h:75
The namespace covering the entire Ocean framework.
Definition Accessor.h:15