40 template<
class T,
class AccU8>
42 constexpr u64 szT =
sizeof(T);
59 template<
class T,
class AccU8>
61 constexpr u64 szT =
sizeof(T);
79 template<
class T,
class TAcc>
93 template<
class T,
class TAcc>
180 "Can not get reference to null pointer", loc);
190 "Can not get reference to null pointer", loc);
214 "the value cannot be extracted, as the optional is empty", loc);
216 return std::exchange(
o, std::nullopt).value();
230 "the value cannot be extracted, as the unique_ptr is empty", loc);
232 std::unique_ptr<T> tmp = std::exchange(
o, {});
233 return T(std::move(*tmp));
245 template<
int n,
class T>
247 if (
in.size() != n) {
249 "you've input values with the wrong size, input size = {}, wanted = {}",
254 std::array<T, n> tmp;
256 for (
u32 i = 0;
i < n;
i++) {
std::uint8_t u8
8 bit unsigned integer
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
This header file contains utility functions related to exception handling in the code.
namespace for basic c++ utilities
void store_u8(AccU8 &acc, u64 idx_write, T a)
Store a value of type T in a byte buffer.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
auto extract_value(std::optional< T > &o, SourceLocation loc=SourceLocation()) -> T
Extracts the content out of an optional.
std::array< T, n > convert_to_array(std::vector< T > &in)
Convert a vector to an array of size n.
T load_conv(TAcc *acc)
pointer cast load from a pointer
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...
auto extract_pointer(std::unique_ptr< T > &o, SourceLocation loc=SourceLocation()) -> T
extract content out of unique_ptr
T load_u8(AccU8 &acc, u64 ptr_load)
load a value of type T from a byte buffer
void store_conv(TAcc *acc, T a)
pointer cast store the value
provide information about the source location