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::ByteReader Class Reference

Public Member Functions

void SetStream (const uint8_t *buffer)
size_t Index () const
template<class T>
T ReadValue ()
template<class T, uint8_t SIZE>
T ReadValue ()
template<class T>
T ReadValue (uint8_t bytes, uint8_t trailing_zero)
template<>
uint32_t ReadValue (uint8_t bytes, uint8_t trailing_zero)

Private Attributes

const uint8_t * buffer
uint32_t index

Constructor & Destructor Documentation

◆ ByteReader()

duckdb::ByteReader::ByteReader ( )
inline
392178 : buffer(nullptr), index(0) {
392179 }

Member Function Documentation

◆ SetStream()

void duckdb::ByteReader::SetStream ( const uint8_t * buffer)
inline
392182 {
392183 this->buffer = buffer;
392184 index = 0;
392185 }

◆ Index()

size_t duckdb::ByteReader::Index ( ) const
inline
392187 {
392188 return index;
392189 }

◆ ReadValue() [1/4]

template<class T>
T duckdb::ByteReader::ReadValue ( )
inline
392192 {
392193 auto result = Load<T>(buffer + index);
392194 index += sizeof(T);
392195 return result;
392196 }

◆ ReadValue() [2/4]

template<class T, uint8_t SIZE>
T duckdb::ByteReader::ReadValue ( )
inline
392199 {
392200 return ReadValue<T>(SIZE);
392201 }

◆ ReadValue() [3/4]

template<class T>
T duckdb::ByteReader::ReadValue ( uint8_t bytes,
uint8_t trailing_zero )
inline
392204 {
392205 T result = 0;
392206 switch (bytes) {
392207 // LCOV_EXCL_START
392208 case 1:
392209 result = Load<uint8_t>(buffer + index);
392210 index++;
392211 return result;
392212 case 2:
392213 result = Load<uint16_t>(buffer + index);
392214 index += 2;
392215 return result;
392216 case 3:
392217 memcpy(&result, (void *)(buffer + index), 3);
392218 index += 3;
392219 return result;
392220 case 4:
392221 result = Load<uint32_t>(buffer + index);
392222 index += 4;
392223 return result;
392224 case 5:
392225 memcpy(&result, (void *)(buffer + index), 5);
392226 index += 5;
392227 return result;
392228 case 6:
392229 memcpy(&result, (void *)(buffer + index), 6);
392230 index += 6;
392231 return result;
392232 case 7:
392233 memcpy(&result, (void *)(buffer + index), 7);
392234 index += 7;
392235 return result;
392236 // LCOV_EXCL_STOP
392237 default:
392238 if (trailing_zero < 8) {
392239 result = Load<T>(buffer + index);
392240 index += sizeof(T);
392241 return result;
392242 }
392243 return result;
392244 }
392245 }

◆ ReadValue() [4/4]

template<>
uint32_t duckdb::ByteReader::ReadValue ( uint8_t bytes,
uint8_t trailing_zero )
inline
392253 {
392254 uint32_t result = 0;
392255 switch (bytes) {
392256 case 0:
392257 // LCOV_EXCL_START
392258 if (trailing_zero < 8) {
392259 result = Load<uint32_t>(buffer + index);
392260 index += sizeof(uint32_t);
392261 return result;
392262 }
392263 return result;
392264 case 1:
392265 result = Load<uint8_t>(buffer + index);
392266 index++;
392267 return result;
392268 case 2:
392269 result = Load<uint16_t>(buffer + index);
392270 index += 2;
392271 return result;
392272 case 3:
392273 memcpy(&result, (void *)(buffer + index), 3);
392274 index += 3;
392275 return result;
392276 case 4:
392277 result = Load<uint32_t>(buffer + index);
392278 index += 4;
392279 return result;
392280 // LCOV_EXCL_STOP
392281 default:
392282 throw InternalException("Write of %llu bytes attempted into address pointing to 4 byte value", bytes);
392283 }
392284}
::uint32_t uint32_t

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