Namespace qdmi

namespace qdmi

Enums

enum class SessionStatus : uint8_t

The status of a session.

This enum defines the possible states of a session in the QDMI library. A session can be either allocated or initialized.

Values:

enumerator ALLOCATED

The session has been allocated but not initialized.

enumerator INITIALIZED

The session has been initialized and is ready for use.

Functions

inline void unreachable()

Function used to mark unreachable code.

Uses compiler-specific extensions if possible. Even if no extension is used, undefined behavior is still raised by an empty function body and the noreturn attribute.

constexpr auto toString(const QDMI_STATUS result) -> const char*

Returns the string representation of the given status code result.

auto throwIfError(int result, const std::string &msg) -> void

Throws an exception if the result indicates an error.

Parameters:
  • result – The result of a QDMI operation

  • msg – The error message to include in the exception

Throws:
  • std::bad_alloc – if the result is QDMI_ERROR_OUTOFMEM

  • std::out_of_range – if the result is QDMI_ERROR_OUTOFRANGE

  • std::invalid_argument – if the result is QDMI_ERROR_INVALIDARGUMENT

  • std::runtime_error – for all other error results

constexpr auto toString(const QDMI_Session_Parameter param) -> const char*

Returns the string representation of the given session parameter param.

constexpr auto toString(const QDMI_Session_Property prop) -> const char*

Returns the string representation of the given session property prop.

constexpr auto toString(const QDMI_Device_Session_Parameter param) -> const char*

Returns the string representation of the given device session parameter param.

constexpr auto toString(const QDMI_Site_Property prop) -> const char*

Returns the string representation of the given site property prop.

constexpr auto toString(const QDMI_Operation_Property prop) -> const char*

Returns the string representation of the given operation property prop.

constexpr auto toString(const QDMI_Device_Property prop) -> const char*

Returns the string representation of the given device property prop.

struct DeviceLibrary
#include <Driver.hpp>

Definition of the device library.

The device library contains function pointers to the QDMI device interface functions.

Subclassed by qdmi::DynamicDeviceLibrary

Public Members

decltype(QDMI_device_initialize) *device_initialize = {}

Function pointer to QDMI_device_initialize.

decltype(QDMI_device_finalize) *device_finalize = {}

Function pointer to QDMI_device_finalize.

decltype(QDMI_device_session_alloc) *device_session_alloc = {}

Function pointer to QDMI_device_session_alloc.

decltype(QDMI_device_session_init) *device_session_init = {}

Function pointer to QDMI_device_session_init.

decltype(QDMI_device_session_free) *device_session_free = {}

Function pointer to QDMI_device_session_free.

decltype(QDMI_device_session_set_parameter) *device_session_set_parameter = {}

Function pointer to QDMI_device_session_set_parameter.

decltype(QDMI_device_session_create_device_job) *device_session_create_device_job = {}

Function pointer to QDMI_device_session_create_device_job.

decltype(QDMI_device_job_free) *device_job_free = {}

Function pointer to QDMI_device_job_free.

decltype(QDMI_device_job_set_parameter) *device_job_set_parameter = {}

Function pointer to QDMI_device_job_set_parameter.

decltype(QDMI_device_job_query_property) *device_job_query_property = {}

Function pointer to QDMI_device_job_query_property.

decltype(QDMI_device_job_submit) *device_job_submit = {}

Function pointer to QDMI_device_job_submit.

decltype(QDMI_device_job_cancel) *device_job_cancel = {}

Function pointer to QDMI_device_job_cancel.

decltype(QDMI_device_job_check) *device_job_check = {}

Function pointer to QDMI_device_job_check.

decltype(QDMI_device_job_wait) *device_job_wait = {}

Function pointer to QDMI_device_job_wait.

decltype(QDMI_device_job_get_results) *device_job_get_results = {}

Function pointer to QDMI_device_job_get_results.

decltype(QDMI_device_session_query_device_property) *device_session_query_device_property = {}

Function pointer to QDMI_device_session_query_device_property.

decltype(QDMI_device_session_query_site_property) *device_session_query_site_property = {}

Function pointer to QDMI_device_session_query_site_property.

decltype(QDMI_device_session_query_operation_property) *device_session_query_operation_property = {}

Function pointer to QDMI_device_session_query_operation_property.

struct DeviceSessionConfig
#include <Driver.hpp>

Configuration for device session parameters.

This struct holds optional parameters that can be set on a device session before initialization. All parameters are optional.

Public Members

std::optional<std::string> baseUrl

Base URL for API endpoint.

std::optional<std::string> token

Authentication token.

std::optional<std::string> authFile

Path to file containing authentication information.

std::optional<std::string> authUrl

URL to authentication server.

std::optional<std::string> username

Username for authentication.

std::optional<std::string> password

Password for authentication.

std::optional<std::string> custom1

Custom configuration parameter 1.

std::optional<std::string> custom2

Custom configuration parameter 2.

std::optional<std::string> custom3

Custom configuration parameter 3.

std::optional<std::string> custom4

Custom configuration parameter 4.

std::optional<std::string> custom5

Custom configuration parameter 5.

class Driver : public qdmi::Singleton<Driver>
#include <Driver.hpp>

The MQT QDMI driver class.

This driver loads all statically known and linked QDMI device libraries. Additional devices can be added dynamically.

Note

This class is a singleton that manages the QDMI libraries and sessions. It is responsible for loading the libraries, allocating sessions, and providing access to the devices.

Public Functions

auto addDynamicDeviceLibrary(const std::string &libName, const std::string &prefix, const DeviceSessionConfig &config = {}) -> QDMI_Device

Loads a dynamic device library and adds it to the driver.

Parameters:
  • libName – The path to the dynamic library to load.

  • prefix – The prefix used for the device interface functions in the library.

  • config – Configuration for device session parameters.

Throws:
  • std::runtime_error – If the device cannot be initialized.

  • std::bad_alloc – If memory allocation fails during the process.

Returns:

A pointer to the newly created device.

auto sessionAlloc(QDMI_Session *session) -> int

Allocates a new session.

See also

QDMI_session_alloc

auto sessionFree(QDMI_Session session) -> void

Frees a session.

See also

QDMI_session_free

class DynamicDeviceLibrary : public qdmi::DeviceLibrary
#include <Driver.hpp>

Definition of the dynamic device library.

This class is used to load the QDMI device interface functions from a dynamic library at runtime. It inherits from DeviceLibrary and overrides the constructor and destructor to open and close the library.

Public Functions

DynamicDeviceLibrary(const std::string &libName, const std::string &prefix)

Constructs a DynamicDeviceLibrary object.

This constructor loads the QDMI device interface functions from the dynamic library specified by libName and prefix.

Parameters:
  • libName – is the name of the dynamic library to load.

  • prefix – is the prefix used for the function names in the library.

~DynamicDeviceLibrary() override

Destructor for the DynamicDeviceLibrary.

This destructor calls the QDMI_device_finalize function if it is not null and closes the dynamic library.

template<class Concrete>
class Singleton

Public Functions

virtual ~Singleton() = default

Virtual destructor for the Singleton base class.

Public Static Functions

static inline auto get() -> Concrete&
Returns:

the singleton instance of the derived class.

namespace dd
class Device : public qdmi::Singleton<Device>

Public Functions

auto sessionAlloc(MQT_DDSIM_QDMI_Device_Session *session) -> QDMI_STATUS

Allocates a new device session.

See also

MQT_DDSIM_QDMI_device_session_alloc

auto sessionFree(MQT_DDSIM_QDMI_Device_Session session) -> void

Frees a device session.

See also

MQT_DDSIM_QDMI_device_session_free

auto queryProperty(QDMI_Device_Property prop, size_t size, void *value, size_t *sizeRet) const -> QDMI_STATUS

Query a device property.

See also

MQT_DDSIM_QDMI_device_session_query_device_property

auto generateUniqueID() -> int

Generates a unique ID.

auto setStatus(QDMI_Device_Status status) -> void

Sets the device status.

auto increaseRunningJobs() -> void

Bumps the number of running jobs and updates the status.

auto decreaseRunningJobs() -> void

Decreases the number of running jobs and updates the status.

namespace na
class Device : public qdmi::Singleton<Device>

Public Functions

auto sessionAlloc(MQT_NA_QDMI_Device_Session *session) -> int

Allocates a new device session.

See also

MQT_NA_QDMI_device_session_alloc

auto sessionFree(MQT_NA_QDMI_Device_Session session) -> void

Frees a device session.

See also

MQT_NA_QDMI_device_session_free

auto queryProperty(QDMI_Device_Property prop, size_t size, void *value, size_t *sizeRet) -> int

Query a device property.

See also

MQT_NA_QDMI_device_session_query_device_property

namespace sc
class Device : public qdmi::Singleton<Device>

Public Functions

auto sessionAlloc(MQT_SC_QDMI_Device_Session *session) -> int

Allocates a new device session.

See also

MQT_SC_QDMI_device_session_alloc

auto sessionFree(MQT_SC_QDMI_Device_Session session) -> void

Frees a device session.

See also

MQT_SC_QDMI_device_session_free

auto queryProperty(QDMI_Device_Property prop, size_t size, void *value, size_t *sizeRet) const -> int

Query a device property.

See also

MQT_SC_QDMI_device_session_query_device_property