Bifrost SDK
Bifrost SDK documentation
BuiltInTypes.h
Go to the documentation of this file.
1//-
2// =============================================================================
3// Copyright 2024 Autodesk, Inc. All rights reserved.
4//
5// Use of this software is subject to the terms of the Autodesk license
6// agreement provided at the time of installation or download, or which
7// otherwise accompanies this software in either electronic or hard copy form.
8// =============================================================================
9//+
10
17
18#ifndef AMINO_BUILTIN_TYPES_H
19#define AMINO_BUILTIN_TYPES_H
20
21#include <type_traits>
22
23namespace Amino {
24
25//==============================================================================
26// TYPE ALIASES
27//==============================================================================
28
47
49using char_t = signed char;
50
52using short_t = signed short;
53
55using int_t = signed int;
56
58using long_t = signed long long;
59
61using uchar_t = unsigned char;
62
64using ushort_t = unsigned short;
65
67using uint_t = unsigned int;
68
70using ulong_t = unsigned long long;
71
73using float_t = float;
74
76using double_t = double;
77
79using bool_t = bool;
80
83
90enum class enum_t : enum_underlying_t {};
91
93
94//==============================================================================
95// STATIC ASSERTIONS
96//==============================================================================
97
98// These assertions are present mainly for the purposes of verifying that the
99// setting of the end-user compiler are appropriate. This validates the
100// assumptions made by the Amino compiler.
101
102static_assert(
103 std::is_same<std::underlying_type_t<enum_t>, enum_underlying_t>::value,
104 "enum_t's underlying type mismatch.");
105
106// clang-format off
107static_assert(sizeof(char_t ) == 1, "char_t should be a 8-bit integer");
108static_assert(sizeof(short_t ) == 2, "short_t should be a 16-bit integer");
109static_assert(sizeof(int_t ) == 4, "int_t should be a 32-bit integer");
110static_assert(sizeof(long_t ) == 8, "long_t should be a 64-bit integer");
111
112static_assert(sizeof(uchar_t ) == 1, "uchar_t should be a 8-bit integer");
113static_assert(sizeof(ushort_t) == 2, "ushort_t should be a 16-bit integer");
114static_assert(sizeof(uint_t ) == 4, "uint_t should be a 32-bit integer");
115static_assert(sizeof(ulong_t ) == 8, "ulong_t should be a 64-bit integer");
116
117static_assert(sizeof(float_t ) == 4, "float_t should be a 32-bit number");
118static_assert(sizeof(double_t) == 8, "double_t should be a 64-bit number");
119
120static_assert(sizeof(bool_t ) == 1, "bool_t should occupy one byte");
121static_assert(sizeof(enum_t ) == 4, "enum_t should be a 32-bit integer");
122// clang-format on
123
124// clang-format off
125static_assert(std::is_integral<char_t >::value, "char_t should be an integer");
126static_assert(std::is_integral<short_t >::value, "short_t should be an integer");
127static_assert(std::is_integral<int_t >::value, "int_t should be an integer");
128static_assert(std::is_integral<long_t >::value, "long_t should be an integer");
129static_assert(std::is_integral<uchar_t >::value, "uchar_t should be an integer");
130static_assert(std::is_integral<ushort_t>::value, "ushort_t should be an integer");
131static_assert(std::is_integral<uint_t >::value, "uint_t should be an integer");
132static_assert(std::is_integral<ulong_t >::value, "ulong_t should be an integer");
133static_assert(std::is_integral<bool_t >::value, "bool_t should be an integer");
134// clang-format on
135
136static_assert(
137 std::is_floating_point<float_t>::value,
138 "float_t should be a floating point number");
139static_assert(
140 std::is_floating_point<double_t>::value,
141 "double_t should be a floating point number");
142static_assert(
143 std::is_integral<enum_underlying_t>::value,
144 "enum_t's underlying type should be an integer");
145
146// clang-format off
147static_assert(std::is_signed<char_t >::value, "char_t should be signed");
148static_assert(std::is_signed<short_t>::value, "short_t should be signed");
149static_assert(std::is_signed<int_t >::value, "int_t should be signed");
150static_assert(std::is_signed<long_t >::value, "long_t should be signed");
151
152static_assert(std::is_unsigned<uchar_t >::value, "uchar_t should be unsigned");
153static_assert(std::is_unsigned<ushort_t>::value, "ushort_t should be unsigned");
154static_assert(std::is_unsigned<uint_t >::value, "uint_t should be unsigned");
155static_assert(std::is_unsigned<ulong_t >::value, "ulong_t should be unsigned");
156
157static_assert(std::is_unsigned<bool_t >::value, "bool_t should be unsigned");
158// clang-format on
159
160static_assert(
161 std::is_signed<enum_underlying_t>::value,
162 "enum_t's underlying type should be signed");
163
164} // namespace Amino
165
166#endif // AMINO_AMINOBUILTINTYPES_H
Definition: HostData.h:33
unsigned short ushort_t
Type alias for Amino's ushort type, an unsigned 16-bit integer.
Definition: BuiltInTypes.h:64
bool bool_t
Type alias for Amino's bool type, a boolean.
Definition: BuiltInTypes.h:79
double double_t
Type alias for Amino's 64-bit float-point number.
Definition: BuiltInTypes.h:76
enum_t
Type alias for a standin for a Amino's enumeration type.
Definition: BuiltInTypes.h:90
signed char char_t
Type alias for Amino's char type, a signed 8-bit integer.
Definition: BuiltInTypes.h:49
float float_t
Type alias for Amino's 32-bit float-point number.
Definition: BuiltInTypes.h:73
unsigned long long ulong_t
Type alias for Amino's ulong type, an unsigned 64-bit integer.
Definition: BuiltInTypes.h:70
unsigned char uchar_t
Type alias for Amino's uchar type, an unsigned 8-bit integer.
Definition: BuiltInTypes.h:61
unsigned int uint_t
Type alias for Amino's uint type, an unsigned 32-bit integer.
Definition: BuiltInTypes.h:67
signed long long long_t
Type alias for Amino's long type, a signed 64-bit integer.
Definition: BuiltInTypes.h:58
signed short short_t
Type alias for Amino's short type, a signed 16-bit integer.
Definition: BuiltInTypes.h:52
int_t enum_underlying_t
Type alias for the underlying type of Amino's enumerations.
Definition: BuiltInTypes.h:82
signed int int_t
Type alias for Amino's int type, a signed 32-bit integer.
Definition: BuiltInTypes.h:55