Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::CastFromBitToNumeric Struct Reference

Public Member Functions

template<>
bool Operation (string_t input, bool &result, CastParameters &parameters)
template<>
bool Operation (string_t input, hugeint_t &result, CastParameters &parameters)
template<>
bool Operation (string_t input, uhugeint_t &result, CastParameters &parameters)
template<>
bool Operation (string_t input, bool &result, CastParameters &parameters)
template<>
bool Operation (string_t input, hugeint_t &result, CastParameters &parameters)
template<>
bool Operation (string_t input, uhugeint_t &result, CastParameters &parameters)

Static Public Member Functions

template<class SRC = string_t, class DST>
static bool Operation (SRC input, DST &result, CastParameters &parameters)

Member Function Documentation

◆ Operation() [1/4]

template<class SRC = string_t, class DST>
bool duckdb::CastFromBitToNumeric::Operation ( SRC input,
DST & result,
CastParameters & parameters )
inlinestatic
32160 {
32161 D_ASSERT(input.GetSize() > 1);
32162
32163 // TODO: Allow conversion if the significant bytes of the bitstring can be cast to the target type
32164 // Currently only allows bitstring -> numeric if the full bitstring fits inside the numeric type
32165 if (input.GetSize() - 1 > sizeof(DST)) {
32166 throw ConversionException(parameters.query_location, "Bitstring doesn't fit inside of %s",
32167 GetTypeId<DST>());
32168 }
32169 Bit::BitToNumeric(input, result);
32170 return (true);
32171 }
static void BitToNumeric(bitstring_t bit, T &output_num)
bit is expected to fit inside of output num (bit size <= sizeof(T) + 1)
Definition duckdb.cpp:31142
PhysicalType GetTypeId()
Returns the PhysicalType for the given type.
Definition duckdb.hpp:10381

◆ Operation() [2/4]

template<>
bool duckdb::CastFromBitToNumeric::Operation ( string_t input,
bool & result,
CastParameters & parameters )
90112 {
90113 D_ASSERT(input.GetSize() > 1);
90114
90115 uint8_t value;
90116 bool success = CastFromBitToNumeric::Operation(input, value, parameters);
90117 result = (value > 0);
90118 return (success);
90119}
::uint8_t uint8_t

◆ Operation() [3/4]

template<>
bool duckdb::CastFromBitToNumeric::Operation ( string_t input,
hugeint_t & result,
CastParameters & parameters )
90122 {
90123 D_ASSERT(input.GetSize() > 1);
90124
90125 if (input.GetSize() - 1 > sizeof(hugeint_t)) {
90126 throw ConversionException(parameters.query_location, "Bitstring doesn't fit inside of %s",
90128 }
90129 Bit::BitToNumeric(input, result);
90130 return (true);
90131}

◆ Operation() [4/4]

template<>
bool duckdb::CastFromBitToNumeric::Operation ( string_t input,
uhugeint_t & result,
CastParameters & parameters )
90134 {
90135 D_ASSERT(input.GetSize() > 1);
90136
90137 if (input.GetSize() - 1 > sizeof(uhugeint_t)) {
90138 throw ConversionException(parameters.query_location, "Bitstring doesn't fit inside of %s",
90140 }
90141 Bit::BitToNumeric(input, result);
90142 return (true);
90143}

The documentation for this struct was generated from the following file: