12#include "_cexports/c_img.h"
15#include "exception.hpp"
59 return DataType(8 | CExports::DT_Signed);
99 return DataType(16 | CExports::DT_Signed);
119 return DataType(32 | CExports::DT_Signed);
139 return DataType(64 | CExports::DT_Signed);
149 return DataType(32 | CExports::DT_Float | CExports::DT_Signed);
159 return DataType(64 | CExports::DT_Float | CExports::DT_Signed);
184 "CVB: Unsupported image plane data type!");
185 static_assert((1 << 8) == CExports::DT_Signed,
186 "CVB: DT_Signed does not match!");
187 static_assert((1 << 9) == CExports::DT_Float,
188 "CVB: DT_Float does not match!");
191 CExports::cvbdatatype_t nativeDescriptor =
sizeof(T) * 8
209 template <
template<
class>
class T,
class ACTION,
class... CTORARGS>
210 auto CallWithInstanceOf(ACTION action, CTORARGS... args)
const ->
decltype(action(T<int>{std::forward<CTORARGS>(args)...}))
218 T<std::uint8_t> t{std::forward<CTORARGS>(args)...};
223 T<std::uint16_t> t{std::forward<CTORARGS>(args)...};
228 T<std::uint32_t> t{std::forward<CTORARGS>(args)...};
233 T<std::uint64_t> t{std::forward<CTORARGS>(args)...};
248 T<std::int8_t> t{std::forward<CTORARGS>(args)...};
253 T<std::int16_t> t{std::forward<CTORARGS>(args)...};
258 T<std::int32_t> t{std::forward<CTORARGS>(args)...};
263 T<std::int64_t> t{std::forward<CTORARGS>(args)...};
278 T<float> t{std::forward<CTORARGS>(args)...};
283 T<double> t{std::forward<CTORARGS>(args)...};
309 "CVB: T must be integer or floating point");
324 return dataTypeDescriptor_;
334 return dataTypeDescriptor_ & 0xFF;
356 return (dataTypeDescriptor_ & CExports::DT_Float) != 0;
366 return (dataTypeDescriptor_ & CExports::DT_Signed) != 0 && !
IsFloat();
376 return (dataTypeDescriptor_ & 0xB00) == 0;
386 return (dataTypeDescriptor_ & CExports::DT_Signed) != 0;
396 return (dataTypeDescriptor_ & CExports::DT_Overlay) != 0;
412 return (dataTypeDescriptor_ & CExports::DT_ComplexPacked) != 0;
436 CExports::cvbval_t min = 0;
437 CExports::cvbval_t max = 0;
438 CVB_CALL_CAPI(GetDatatypeMinMaxVal(
static_cast<CExports::cvbdatatype_t
>(dataTypeDescriptor_), min, max));
439 return static_cast<double>(min);
464 CExports::cvbval_t min = 0;
465 CExports::cvbval_t max = 0;
466 CVB_CALL_CAPI(GetDatatypeMinMaxVal(
static_cast<CExports::cvbdatatype_t
>(dataTypeDescriptor_), min, max));
467 return static_cast<double>(max);
520 if (
IsFloat() && dataType.IsFloat())
522 return dataTypeDescriptor_ == dataType.dataTypeDescriptor_;
533 return !(*
this == dataType);
540 explicit DataType(CExports::cvbdatatype_t dataTypeDescriptor) noexcept
541 : dataTypeDescriptor_(dataTypeDescriptor)
546 int dataTypeDescriptor_;
Data type description for an image plane.
Definition: data_type.hpp:28
int BytesPerPixel() const noexcept
Number of bytes occupied by each pixel.
Definition: data_type.hpp:342
static DataType Int64BppSigned() noexcept
Represents 64-bit signed integer pixels.
Definition: data_type.hpp:137
static DataType Int12BppUnsigned() noexcept
Represents 12-bit unsigned integer pixels.
Definition: data_type.hpp:77
double MinVal() const noexcept
Gets the minimum pixel value that fits this data type.
Definition: data_type.hpp:420
static DataType Int16BppUnsigned() noexcept
Represents 16-bit unsigned integer pixels.
Definition: data_type.hpp:87
bool HasOverlayBit() const noexcept
Gets whether bit 0 of the pixels of the plane are being used as an overlay indicator bit.
Definition: data_type.hpp:394
int BitsPerPixel() const noexcept
Number of actually valid bits per pixel.
Definition: data_type.hpp:332
bool IsSigned() const noexcept
Gets whether the pixels of the plane have signed values.
Definition: data_type.hpp:384
int NativeDescriptor() const noexcept
Native data type descriptor.
Definition: data_type.hpp:322
bool IsSignedInteger() const noexcept
Gets whether the pixels of the plane have signed integer values.
Definition: data_type.hpp:364
static DataType Int8BppUnsigned() noexcept
Represents 8-bit unsigned integer pixels (bytes).
Definition: data_type.hpp:47
bool operator!=(const DataType &dataType) const noexcept
Compares to an other data type.
Definition: data_type.hpp:531
bool Matches() const noexcept
Gets whether the type T matches this data type.
Definition: data_type.hpp:306
bool IsUnsignedInteger() const noexcept
Gets whether the pixels of the plane have unsigned integer values.
Definition: data_type.hpp:374
static DataType Int32BppUnsigned() noexcept
Represents 32-bit unsigned integer pixels.
Definition: data_type.hpp:107
PixelDataType NumericType() const noexcept
Returns the basic numeric type of the pixels.
Definition: data_type.hpp:477
static DataType Int32BppSigned() noexcept
Represents 32-bit signed integer pixels.
Definition: data_type.hpp:117
bool operator==(const DataType &dataType) const noexcept
Compares to an other data type.
Definition: data_type.hpp:518
static DataType FromNativeType() noexcept
Construct a data type descriptor from one of the native data type value equivalents.
Definition: data_type.hpp:181
static DataType Int16BppSigned() noexcept
Represents 16-bit signed integer pixels.
Definition: data_type.hpp:97
bool IsFloat() const noexcept
Gets whether the pixels of the plane have floating point values.
Definition: data_type.hpp:353
auto CallWithInstanceOf(ACTION action, CTORARGS... args) const -> decltype(action(T< int >{std::forward< CTORARGS >(args)...}))
Calls action with T instance of native data type this value represents.
Definition: data_type.hpp:210
static DataType Int8BppSigned() noexcept
Represents 8-bit signed integer pixels.
Definition: data_type.hpp:57
static DataType FromNativeDescriptor(int dataTypeDescriptor) noexcept
Construct a data type descriptor from one of the native library's descriptor values.
Definition: data_type.hpp:37
static DataType Float32Bpp() noexcept
Represents single precision (32-bit) floating point pixels.
Definition: data_type.hpp:147
static DataType Int10BppUnsigned() noexcept
Represents 10-bit unsigned integer pixels.
Definition: data_type.hpp:67
static DataType Int64BppUnsigned() noexcept
Represents 64-bit unsigned integer pixels.
Definition: data_type.hpp:127
static DataType Float64Bpp() noexcept
Represents double precision (64-bit) floating point pixels.
Definition: data_type.hpp:157
double MaxVal() const noexcept
Gets the maximum pixel value that fits this data type.
Definition: data_type.hpp:448
double UndefinedVal() const noexcept
Get the undefined value for this data type.
Definition: data_type.hpp:502
bool IsComplexPacked() const noexcept
Indicates whether or not the plane contains a complex packed image format.
Definition: data_type.hpp:410
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24
PixelDataType
Defines the numeric data type of one pixel.
Definition: global.hpp:130