34#include <NDEVR/LibAssert.h>
155 template<
class t_enum_type>
158 static_assert(std::is_enum_v<t_enum_type>);
160 constexpr eint04(t_enum_type e)
164 constexpr operator uint04()
const {
return static_cast<uint04>(
static_cast<std::underlying_type_t<t_enum_type>
>(v)); }
165 constexpr operator t_enum_type()
const {
return v; }
167 template<
class t_enum_type>
170 static_assert(std::is_enum_v<t_enum_type>);
172 constexpr eint01(t_enum_type e)
176 constexpr operator uint01()
const {
return static_cast<uint01>(
static_cast<std::underlying_type_t<t_enum_type>
>(v)); }
177 constexpr operator t_enum_type()
const {
return v; }
259 template<
class t_type>
262 static const t_type Invalid;
263 static const t_type Min;
264 static const t_type Max;
267 template<>
constexpr const bool Constant<bool>::Invalid =
false;
268 template<>
constexpr const bool Constant<bool>::Max =
true;
269 template<>
constexpr const bool Constant<bool>::Min =
false;
271 template<>
constexpr const sint01 Constant<sint01>::Invalid = -128;
272 template<>
constexpr const sint01 Constant<sint01>::Max = 127;
273 template<>
constexpr const sint01 Constant<sint01>::Min = -127;
275 template<>
constexpr const uint01 Constant<uint01>::Invalid = 255;
276 template<>
constexpr const uint01 Constant<uint01>::Max = 254;
277 template<>
constexpr const uint01 Constant<uint01>::Min = 0;
279 template<>
constexpr const sint02 Constant<sint02>::Invalid = -32768;
280 template<>
constexpr const sint02 Constant<sint02>::Max = 32767;
281 template<>
constexpr const sint02 Constant<sint02>::Min = -32767;
283 template<>
constexpr const uint02 Constant<uint02>::Invalid = 65535;
284 template<>
constexpr const uint02 Constant<uint02>::Max = 65534;
285 template<>
constexpr const uint02 Constant<uint02>::Min = 0;
287 template<>
constexpr const sint04 Constant<sint04>::Invalid = 0x80000000;
288 template<>
constexpr const sint04 Constant<sint04>::Max = 2147483647;
289 template<>
constexpr const sint04 Constant<sint04>::Min = -2147483647;
291 template<>
constexpr const uint04 Constant<uint04>::Invalid = 4294967295UL;
292 template<>
constexpr const uint04 Constant<uint04>::Max = 4294967294UL;
293 template<>
constexpr const uint04 Constant<uint04>::Min = 0;
295 template<>
constexpr const sint08 Constant<sint08>::Invalid = 0x8000000000000000;
296 template<>
constexpr const sint08 Constant<sint08>::Max = 9223372036854775807LL;
297 template<>
constexpr const sint08 Constant<sint08>::Min = -9223372036854775807LL;
299 template<>
constexpr const uint08 Constant<uint08>::Invalid = 18446744073709551615ULL;
300 template<>
constexpr const uint08 Constant<uint08>::Max = 18446744073709551614ULL;
301 template<>
constexpr const uint08 Constant<uint08>::Min = 0;
303 template<>
constexpr const fltp04 Constant<fltp04>::Invalid = std::numeric_limits<fltp04>::quiet_NaN();
304 template<>
constexpr const fltp04 Constant<fltp04>::Max = std::numeric_limits<fltp04>::infinity();
305 template<>
constexpr const fltp04 Constant<fltp04>::Min = -std::numeric_limits<fltp04>::infinity();
307 template<>
constexpr const fltp08 Constant<fltp08>::Invalid = std::numeric_limits<fltp08>::quiet_NaN();
308 template<>
constexpr const fltp08 Constant<fltp08>::Max = std::numeric_limits<fltp08>::infinity();
309 template<>
constexpr const fltp08 Constant<fltp08>::Min = -std::numeric_limits<fltp08>::infinity();
326 template<
class t_to,
class t_from>
327 constexpr t_to
cast(t_from value)
329 return static_cast<t_to
>(value);
350 lib_assert(value >= 0,
"Bad value");
351 return static_cast<uint04>(value);
371 lib_assert(value >= 0,
"Bad value");
372 return static_cast<uint04>(value);
392 lib_assert(value >= 0,
"Bad value");
393 return static_cast<uint04>(value);
413 lib_assert(value >= 0,
"Bad value");
414 return static_cast<uint04>(value);
430 template<
class t_to,
class t_from>
431 constexpr t_to&
rcast(t_from& value)
433 static_assert(
sizeof(t_to) <=
sizeof(t_from),
"Bad rcast conversion");
434 return *((t_to*)(&value));
436 template<
class t_to,
class t_from>
437 constexpr const t_to&
rcast(
const t_from& value)
439 static_assert(
sizeof(t_to) <=
sizeof(t_from),
"Bad rcast conversion");
440 return *((
const t_to*)(&value));
442 #define UNUSED(expr) do { (void)(expr); } while (0)
445 static_assert(
sizeof(bool) == 1,
"Bad bool size");
446 static_assert(
sizeof(char) == 1,
"Bad char size");
448 static_assert(
sizeof(float) == 4,
"Bad float size");
449 static_assert(
sizeof(double) == 8,
"Bad double size");
451 static_assert(
sizeof(
fltp04) == 4,
"Bad fltp04 size");
452 static_assert(
sizeof(
fltp08) == 8,
"Bad fltp08 size");
454 static_assert(
sizeof(
uint01) == 1,
"Bad int size");
455 static_assert(
sizeof(
uint02) == 2,
"Bad int size");
456 static_assert(
sizeof(
uint04) == 4,
"Bad int size");
457 static_assert(
sizeof(
uint08) == 8,
"Bad int size");
459 static_assert(
sizeof(
sint01) == 1,
"Bad int size");
460 static_assert(
sizeof(
sint02) == 2,
"Bad int size");
461 static_assert(
sizeof(
sint04) == 4,
"Bad int size");
462 static_assert(
sizeof(
sint08) == 8,
"Bad int size");
465#include "BaseFunctions.hpp"
Dummy class to ensure creation of an include file around core root values.
The primary namespace for the NDEVR SDK.
DimensionValues
Values that represent dimension values.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
uint16_t uint02
-Defines an alias representing a 2 byte, unsigned integer -Can represent exact integer values 0 throu...
uint64_t uint08
-Defines an alias representing an 8 byte, unsigned integer
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
int16_t sint02
-Defines an alias representing a 2 byte, signed integer.
int32_t sint04
-Defines an alias representing a 4 byte, signed integer.
InterpolationValues
Values that represent interpolation functions.
constexpr t_to & rcast(t_from &value)
Casts the given value.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
IntersectionTypes
Used for classifying shape intersections.
GeodeticValues
Values that represent dimension values for geodic dimensions.
int8_t sint01
-Defines an alias representing a 1 byte, signed integer.
wchar_t wchar
Allias for wchar_t, a value that represents a character of two bytes in size.
LocationValues
Values that represent location values.
int64_t sint08
-Defines an alias representing an 8 byte, signed integer -Can represent exact integer values -9223372...
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...