MQT Core
The Backbone of the Munich Quantum Toolkit (MQT)
Loading...
Searching...
No Matches
qdmi::Driver Class Referencefinal

The MQT QDMI driver class. More...

#include <Driver.hpp>

Inheritance diagram for qdmi::Driver:
qdmi::Singleton< Driver >

Public Member Functions

void registerDevice (DeviceDefinition definition, bool replace=false)
 Registers a device definition without loading its library.
 
auto registerDeviceIfAbsent (DeviceDefinition definition) -> bool
 Registers a device definition unless its ID is already present.
 
auto registeredDeviceIds () const -> std::vector< std::string >
 Lists the stable IDs of all registered devices.
 
auto open (std::string_view id) -> QDMI_Device
 Opens the registered device with the given stable ID.
 
auto sessionAlloc (QDMI_Session *session) -> int
 Allocates a new session.
 
auto sessionFree (QDMI_Session session) -> void
 Frees a session.
 
- Public Member Functions inherited from qdmi::Singleton< Driver >
 Singleton (Singleton &&)=delete
 
 Singleton (const Singleton &)=delete
 
Singletonoperator= (Singleton &&)=delete
 
Singletonoperator= (const Singleton &)=delete
 
virtual ~Singleton ()=default
 Virtual destructor for the Singleton base class.
 

Static Public Member Functions

static auto get () -> Driver &
 
- Static Public Member Functions inherited from qdmi::Singleton< Driver >
static auto get () -> Driver &
 

Friends

class Singleton
 
class Session
 

Additional Inherited Members

- Protected Member Functions inherited from qdmi::Singleton< Driver >
 Singleton ()=default
 Protected constructor to enforce the singleton pattern.
 

Detailed Description

The MQT QDMI driver class.

This driver discovers configured QDMI device definitions and opens their libraries. Additional definitions can be registered at runtime.

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.

Member Function Documentation

◆ get()

static auto qdmi::Driver::get ( ) -> Driver &
static
Returns
the process-wide Driver instance.

This out-of-line accessor keeps static-library consumers from instantiating separate singleton storage in different translation units.

◆ registerDevice()

void qdmi::Driver::registerDevice ( DeviceDefinition  definition,
bool  replace = false 
)

Registers a device definition without loading its library.

Parameters
definitionThe definition to validate and store.
replaceWhether an existing unopened definition may be replaced.
Exceptions
std::invalid_argumentIf the definition is incomplete or its ID is already registered.
std::runtime_errorIf replacing an already opened definition.

◆ registerDeviceIfAbsent()

auto qdmi::Driver::registerDeviceIfAbsent ( DeviceDefinition  definition) -> bool

Registers a device definition unless its ID is already present.

Parameters
definitionThe definition to validate and store.
Returns
Whether the definition was inserted.
Exceptions
std::invalid_argumentIf the definition is incomplete.

Existing and explicitly disabled IDs are not inserted. The complete definition is validated before checking for either condition.

◆ registeredDeviceIds()

auto qdmi::Driver::registeredDeviceIds ( ) const -> std::vector< std::string >

Lists the stable IDs of all registered devices.

Returns
The enabled device IDs in deterministic registration order.

This query includes runtime registrations and does not load device libraries or expose their definitions.

◆ open()

auto qdmi::Driver::open ( std::string_view  id) -> QDMI_Device

Opens the registered device with the given stable ID.

Returns
The existing device handle when the ID is already open.
Exceptions
std::out_of_rangeIf the ID is unknown.
std::runtime_errorIf loading or session initialization fails.

◆ sessionAlloc()

auto qdmi::Driver::sessionAlloc ( QDMI_Session *  session) -> int

Allocates a new session.

See also
QDMI_session_alloc

◆ sessionFree()

auto qdmi::Driver::sessionFree ( QDMI_Session  session) -> void

Frees a session.

See also
QDMI_session_free

Friends And Related Symbol Documentation

◆ Singleton

friend class Singleton
friend

◆ Session

friend class Session
friend