5#include "../data_type.hpp"
6#include "../global.hpp"
7#include "../iarray.hpp"
15 inline HandleGuard<Plane>::HandleGuard(
void *handle) noexcept
16 : HandleGuard<Plane>(handle, [](
void *handle) { CVB_CALL_CAPI(
ReleaseObject(handle)); })
24 class Plane :
public IArray
32 using GuardType = HandleGuard<Plane>;
34 Plane(HandleGuard<Plane> &&guard, PrivateTag) noexcept
40 Plane(
const Plane &other) =
delete;
41 Plane &operator=(
const Plane &other) =
delete;
42 Plane(Plane &&other) =
delete;
43 Plane &operator=(Plane &&other) =
delete;
44 virtual ~Plane() =
default;
98 void *
Handle() const noexcept
override
100 return handle_.Handle();
98 void *
Handle() const noexcept
override {
…}
111 int Rank() const noexcept
override
113 CExports::cvbdim_t rank = 0;
114 CVB_CALL_CAPI(CVCPlaneGetRank(
Handle(), rank));
115 return static_cast<int>(rank);
111 int Rank() const noexcept
override {
…}
125 CExports::CVCPlaneRole role = CExports::CVCPR_Undefined;
126 CVB_CALL_CAPI(CVCPlaneGetRole(
Handle(), role));
138 CExports::cvbdatatype_t dataType = 0;
139 CVB_CALL_CAPI(CVCPlaneGetDataType(
Handle(), dataType));
152 return CVB_CALL_CAPI(CVCPlaneGetIncrement(
Handle(),
static_cast<CExports::cvbdim_t
>(dimension), value));
164 return static_cast<int>(NativeCall<CExports::cvbint64_t>([&](CExports::cvbint64_t &value) {
165 return CVB_CALL_CAPI(CVCPlaneGetLength(
Handle(),
static_cast<CExports::cvbdim_t
>(dimension), value));
177 NativeCall<void *>([&](
void *&value) {
return CVB_CALL_CAPI(CVCPlaneGetBasePtr(
Handle(), value)); }));
182 T NativeCall(
std::function<CExports::cvbres_t(T &value)> fn)
const
185 auto result = fn(value);
187 Utilities::SystemInfo::ThrowLastError(result);
191 HandleGuard<Plane> handle_;
192 ReleaseObjectGuard shared_;
24 class Plane :
public IArray {
…};
198 using PlaneT = Plane;
199 using TypeList = DispatchableTypeList<std::uint8_t, std::int8_t, std::uint16_t, std::int16_t, std::uint32_t,
200 std::int32_t, std::uint64_t, std::int64_t, float,
double>;
202 static constexpr bool HasVpat =
false;
204 static int GetWidth(
const Plane &plane)
206 return plane.Length(0);
210 static int GetHeight(
const Plane &plane)
212 return plane.Length(1);
215 static DataType GetDataType(
const Plane &plane)
217 return plane.DataType();
220 static int GetRank(
const Plane &plane)
225 static std::uint8_t *GetBasePtr(
const Plane &plane)
227 return plane.BasePtr();
230 static std::ptrdiff_t GetXInc(
const Plane &plane)
232 return plane.Increment(0);
236 static std::ptrdiff_t GetYInc(
const Plane &plane)
238 return plane.Increment(1);
static DataType FromNativeDescriptor(int dataTypeDescriptor) noexcept
Construct a data type descriptor from one of the native library's descriptor values.
Definition data_type.hpp:31
Image plane information container.
Definition decl_image_plane.hpp:29
Plane information container.
Definition decl_plane.hpp:25
int Length(int dimension) const
Gets the number of elements in the given dimension.
Definition decl_plane.hpp:162
static PlanePtr FromHandle(HandleGuard< Plane > &&guard)
Creates a plane from a classic API handle.
Definition decl_plane.hpp:76
static PlanePtr FromImagePlane(const ImagePlane &imagePlane, PlaneRole role=PlaneRole::Undefined)
Creates a plane from an image plane.
Definition decl_plane.hpp:67
int Rank() const noexcept override
Gets the number of dimensions of this plane.
Definition decl_plane.hpp:111
PlaneRole Role() const noexcept
Get the meaning of this plane.
Definition decl_plane.hpp:123
void * Handle() const noexcept override
Classic API image handle.
Definition decl_plane.hpp:98
std::intptr_t Increment(int dimension) const
Gets the offset in bytes to move to the next element in the given dimension.
Definition decl_plane.hpp:149
class DataType DataType() const noexcept override
Gets the data type of the plane.
Definition decl_plane.hpp:136
std::uint8_t * BasePtr() const
Get the pointer to the first element of this plane.
Definition decl_plane.hpp:174
cvbbool_t ReleaseObject(OBJ &Object)
@ DataType
Definition spectral.hpp:148
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
PlaneRole
A plane role describes the components of the plane. They can coarsely be separated in two sets.
Definition global.hpp:411
@ Undefined
Unknown/undefined value.
Definition global.hpp:413
std::shared_ptr< Plane > PlanePtr
Convenience shared pointer for Plane.
Definition global.hpp:78
Definition global.hpp:1080