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::ExtensionAccess Struct Reference

Contains the callbacks that are passed to CAPI extensions to allow initialization. More...

Static Public Member Functions

static duckdb_extension_access CreateAccessStruct ()
 Create the struct of function pointers to pass to the extension for initialization.
static void SetError (duckdb_extension_info info, const char *error)
 Called by the extension to indicate failure to initialize the extension.
static duckdb_database * GetDatabase (duckdb_extension_info info)
 Called by the extension get a pointer to the database that is loading it.
static const void * GetAPI (duckdb_extension_info info, const char *version)
 Called by the extension get a pointer the correctly versioned extension C API struct.

Detailed Description

Contains the callbacks that are passed to CAPI extensions to allow initialization.

Member Function Documentation

◆ CreateAccessStruct()

duckdb_extension_access duckdb::ExtensionAccess::CreateAccessStruct ( )
inlinestatic

Create the struct of function pointers to pass to the extension for initialization.

279884 {
279885 return {SetError, GetDatabase, GetAPI};
279886 }
static const void * GetAPI(duckdb_extension_info info, const char *version)
Called by the extension get a pointer the correctly versioned extension C API struct.
Definition duckdb.cpp:279921
static duckdb_database * GetDatabase(duckdb_extension_info info)
Called by the extension get a pointer to the database that is loading it.
Definition duckdb.cpp:279900
static void SetError(duckdb_extension_info info, const char *error)
Called by the extension to indicate failure to initialize the extension.
Definition duckdb.cpp:279889
Here is the call graph for this function:

◆ SetError()

void duckdb::ExtensionAccess::SetError ( duckdb_extension_info info,
const char * error )
inlinestatic

Called by the extension to indicate failure to initialize the extension.

279889 {
279890 auto &load_state = DuckDBExtensionLoadState::Get(info);
279891
279892 load_state.has_error = true;
279893 load_state.error_data =
279894 error ? ErrorData(error)
279895 : ErrorData(ExceptionType::UNKNOWN_TYPE, "Extension has indicated an error occurred during "
279896 "initialization, but did not set an error message.");
279897 }
static DuckDBExtensionLoadState & Get(duckdb_extension_info info)
Create a DuckDBExtensionLoadState reference from a C API opaque pointer.
Definition duckdb.cpp:279850
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetDatabase()

duckdb_database * duckdb::ExtensionAccess::GetDatabase ( duckdb_extension_info info)
inlinestatic

Called by the extension get a pointer to the database that is loading it.

279900 {
279901 auto &load_state = DuckDBExtensionLoadState::Get(info);
279902
279903 try {
279904 // Create the duckdb_database
279905 load_state.database_data = make_uniq<DatabaseWrapper>();
279906 load_state.database_data->database = make_shared_ptr<DuckDB>(load_state.db);
279907 return reinterpret_cast<duckdb_database *>(load_state.database_data.get());
279908 } catch (std::exception &ex) {
279909 load_state.has_error = true;
279910 load_state.error_data = ErrorData(ex);
279911 return nullptr;
279912 } catch (...) {
279913 load_state.has_error = true;
279914 load_state.error_data =
279915 ErrorData(ExceptionType::UNKNOWN_TYPE, "Unknown error in GetDatabase when trying to load extension!");
279916 return nullptr;
279917 }
279918 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAPI()

const void * duckdb::ExtensionAccess::GetAPI ( duckdb_extension_info info,
const char * version )
inlinestatic

Called by the extension get a pointer the correctly versioned extension C API struct.

279921 {
279922 string version_string = version;
279923 auto &load_state = DuckDBExtensionLoadState::Get(info);
279924
279925 if (load_state.init_result.abi_type == ExtensionABIType::C_STRUCT) {
279926 idx_t major, minor, patch;
279927 auto parsed = VersioningUtils::ParseSemver(version_string, major, minor, patch);
279928
279929 if (!parsed || !VersioningUtils::IsSupportedCAPIVersion(major, minor, patch)) {
279930 load_state.has_error = true;
279931 load_state.error_data = ErrorData(
279932 ExceptionType::UNKNOWN_TYPE,
279933 "Unsupported C CAPI version detected during extension initialization: " + string(version));
279934 return nullptr;
279935 }
279936 } else if (load_state.init_result.abi_type == ExtensionABIType::C_STRUCT_UNSTABLE) {
279937 // NOTE: we currently don't check anything here: the version of extensions of ABI type C_STRUCT_UNSTABLE is
279938 // ignored because C_STRUCT_UNSTABLE extensions are tied 1:1 to duckdb verions meaning they will always
279939 // receive the whole function pointer struct
279940 } else {
279941 load_state.has_error = true;
279942 load_state.error_data =
279943 ErrorData(ExceptionType::UNKNOWN_TYPE,
279944 StringUtil::Format("Unknown ABI Type of value '%d' found when loading extension '%s'",
279945 static_cast<uint8_t>(load_state.init_result.abi_type),
279946 load_state.init_result.filename));
279947 return nullptr;
279948 }
279949
279950 load_state.api_struct = load_state.db.GetExtensionAPIV1();
279951 return &load_state.api_struct;
279952 }
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
::uint8_t uint8_t
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237
@ C_STRUCT
Uses C ABI using the duckdb_ext_api_v1 struct, version needs to be equal or higher.
Definition duckdb.hpp:43807
@ C_STRUCT_UNSTABLE
Uses C ABI using the duckdb_ext_api_v1 struct including "unstable" functions, version needs to match ...
Definition duckdb.hpp:43809
static bool ParseSemver(string &semver, idx_t &major_out, idx_t &minor_out, idx_t &patch_out)
Note: only supports format v{major}.{minor}.{patch}.
Definition duckdb.cpp:280905
static bool IsSupportedCAPIVersion(string &capi_version_string)
Note: only supports format v{major}.{minor}.{patch}.
Definition duckdb.cpp:280880
Here is the call graph for this function:
Here is the caller graph for this function:

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