CVB++ 15.0
Loading...
Searching...
No Matches
detail_point_cloud.hpp
1#pragma once
2
3#include "../_decl/decl_point_cloud.hpp"
4
5#include "../dense_point_cloud.hpp"
6#include "../sparse_point_cloud.hpp"
7
8#include "detail_composite.hpp"
9
10namespace Cvb
11{
12
13 CVB_BEGIN_INLINE_NS
14
15 inline PointCloudPtr PointCloud::FromHandle(HandleGuard<PointCloud> &&guard)
16 {
17 if (!guard.Handle())
18 throw std::runtime_error("handle must not be null");
19
20 if (IsDense(guard.Handle()))
21 return std::make_shared<DensePointCloud>(std::move(guard), PrivateTag{});
22 else
23 return std::make_shared<SparsePointCloud>(std::move(guard), PrivateTag{});
24 }
25
26 template <class T>
28 {
29 static_assert(std::is_base_of<PointCloud, T>::value, "CVB: T must be derived from PointCloud");
30 CVB_CALL_CAPI(ShareObject(object->Handle()));
31 return FromHandle<T>(HandleGuard<PointCloud>(object->Handle()));
32 }
33
34 inline PointCloudPtr PointCloud::FromMemory(void *buffer, size_t size, PointCloudFlags flags,
36 {
37 return Internal::DoResCallShareOut<PointCloud>([&](void *&handle) {
38 return CVB_CALL_CAPI(CVC3DMemoryToPointCloud(buffer, size, static_cast<CExports::cvbval_t>(flags),
39 static_cast<CExports::CVC3DPointCloudFileFormat>(format), handle));
40 });
41 }
42
43 CVB_END_INLINE_NS
44
45} // namespace Cvb
static PointCloudPtr FromHandle(HandleGuard< PointCloud > &&guard)
Creates a point cloud from a classic API handle.
Definition detail_point_cloud.hpp:15
static std::shared_ptr< T > FromComposite(CompositePtr object)
Creates a point cloud from a composite.
Definition detail_point_cloud.hpp:27
static PointCloudPtr FromMemory(void *buffer, size_t size, PointCloudFlags flags, Cvb::PointCloudFileFormat format)
Creates a point cloud reading memory from buffer.
Definition detail_point_cloud.hpp:34
cvbbool_t ShareObject(OBJ Object)
T make_shared(T... args)
T move(T... args)
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
PointCloudFileFormat
Supported point cloud point formats.
Definition core_3d.hpp:141
PointCloudFlags
Flags for creating point clouds.
Definition core_3d.hpp:90
std::shared_ptr< PointCloud > PointCloudPtr
Convenience shared pointer for PointCloud.
Definition core_3d.hpp:40
std::shared_ptr< Composite > CompositePtr
Convenience shared pointer for Composite.
Definition global.hpp:102