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

Static Public Member Functions

static DataFileType CheckMagicBytes (QueryContext context, FileSystem &fs, const string &path)

Member Function Documentation

◆ CheckMagicBytes()

DataFileType duckdb::MagicBytes::CheckMagicBytes ( QueryContext context,
FileSystem & fs,
const string & path )
static
414237 {
414238 if (path.empty() || path == IN_MEMORY_PATH) {
414239 return DataFileType::DUCKDB_FILE;
414240 }
414241 auto handle = fs.OpenFile(path, FileFlags::FILE_FLAGS_READ | FileFlags::FILE_FLAGS_NULL_IF_NOT_EXISTS);
414242 if (!handle) {
414243 return DataFileType::FILE_DOES_NOT_EXIST;
414244 }
414245
414246 constexpr const idx_t MAGIC_BYTES_READ_SIZE = 16;
414247 char buffer[MAGIC_BYTES_READ_SIZE] = {};
414248
414249 handle->Read(context, buffer, MAGIC_BYTES_READ_SIZE);
414250 if (memcmp(buffer, "SQLite format 3\0", 16) == 0) {
414251 return DataFileType::SQLITE_FILE;
414252 }
414253 if (memcmp(buffer, "PAR1", 4) == 0) {
414254 return DataFileType::PARQUET_FILE;
414255 }
414256 if (memcmp(buffer + MainHeader::MAGIC_BYTE_OFFSET, MainHeader::MAGIC_BYTES, MainHeader::MAGIC_BYTE_SIZE) == 0) {
414257 return DataFileType::DUCKDB_FILE;
414258 }
414259 return DataFileType::UNKNOWN_FILE;
414260}
static constexpr FileOpenFlags FILE_FLAGS_NULL_IF_NOT_EXISTS
Return NULL if the file does not exist instead of throwing an error.
Definition duckdb.hpp:7865
static constexpr FileOpenFlags FILE_FLAGS_READ
Open file with read access.
Definition duckdb.hpp:7850
static const char MAGIC_BYTES[]
The magic bytes in front of the file should be "DUCK".
Definition duckdb.hpp:9751
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

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