Skip to content

Commit 6a38a0f

Browse files
🎨 pre-commit fixes
1 parent 655610b commit 6a38a0f

File tree

14 files changed

+511
-323
lines changed

14 files changed

+511
-323
lines changed

include/mqt-core/qdmi/sc/Device.hpp

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,34 @@ class Device final {
4848

4949
public:
5050
/**
51-
* @brief Move-constructs a Device, transferring ownership of internal resources.
52-
*
53-
* Leaves the moved-from instance in a valid but unspecified state.
54-
*/
51+
* @brief Move-constructs a Device, transferring ownership of internal
52+
* resources.
53+
*
54+
* Leaves the moved-from instance in a valid but unspecified state.
55+
*/
5556
Device(Device&&) = default;
5657
/**
57-
* @brief Move-assigns the Device instance from another Device.
58-
*
59-
* @param other rvalue reference to the source Device to move from.
60-
* @return Device& Reference to this Device after move assignment.
61-
*/
62-
Device& operator=(Device&&) = default;
58+
* @brief Move-assigns the Device instance from another Device.
59+
*
60+
* @param other rvalue reference to the source Device to move from.
61+
* @return Device& Reference to this Device after move assignment.
62+
*/
63+
Device& operator=(Device&&) = default;
6364
/**
64-
* @brief Deleted copy constructor to prevent copying of the singleton Device.
65-
*
66-
* Deleting this constructor enforces the singleton pattern by disallowing copy construction.
67-
*/
65+
* @brief Deleted copy constructor to prevent copying of the singleton Device.
66+
*
67+
* Deleting this constructor enforces the singleton pattern by disallowing
68+
* copy construction.
69+
*/
6870
Device(const Device&) = delete;
6971
/**
70-
* @brief Deleted copy assignment operator to prevent copying of the Device singleton.
71-
*
72-
* The Device class is non-copyable; assigning from another Device is disallowed to
73-
* preserve the singleton semantics and unique device state.
74-
*/
75-
Device& operator=(const Device&) = delete;
72+
* @brief Deleted copy assignment operator to prevent copying of the Device
73+
* singleton.
74+
*
75+
* The Device class is non-copyable; assigning from another Device is
76+
* disallowed to preserve the singleton semantics and unique device state.
77+
*/
78+
Device& operator=(const Device&) = delete;
7679

7780
/**
7881
* @brief Accesses the singleton Device instance.
@@ -187,10 +190,11 @@ struct MQT_SC_QDMI_Device_Job_impl_d {
187190

188191
public:
189192
/**
190-
* @brief Initializes a device job implementation bound to the given session.
191-
*
192-
* @param session Pointer to the owning MQT_SC_QDMI_Device_Session_impl_d. The session must remain valid for the job's lifetime.
193-
*/
193+
* @brief Initializes a device job implementation bound to the given session.
194+
*
195+
* @param session Pointer to the owning MQT_SC_QDMI_Device_Session_impl_d. The
196+
* session must remain valid for the job's lifetime.
197+
*/
194198
explicit MQT_SC_QDMI_Device_Job_impl_d(
195199
MQT_SC_QDMI_Device_Session_impl_d* session)
196200
: session_(session) {}
@@ -260,10 +264,10 @@ struct MQT_SC_QDMI_Site_impl_d {
260264
uint64_t id_ = 0; ///< Unique identifier of the site
261265

262266
/**
263-
* @brief Initializes a site implementation with the given unique identifier.
264-
*
265-
* @param id Unique identifier for the site.
266-
*/
267+
* @brief Initializes a site implementation with the given unique identifier.
268+
*
269+
* @param id Unique identifier for the site.
270+
*/
267271
MQT_SC_QDMI_Site_impl_d(uint64_t id) : id_(id) {}
268272

269273
public:
@@ -299,4 +303,4 @@ struct MQT_SC_QDMI_Operation_impl_d {
299303
size_t numParams, const double* params,
300304
QDMI_Operation_Property prop, size_t size, void* value,
301305
size_t* sizeRet) const -> int;
302-
};
306+
};

src/na/device/Device.cpp

Lines changed: 61 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@
9191

9292
namespace qdmi::na {
9393
/**
94-
* @brief Constructs the device and initializes its metadata and supported entities.
94+
* @brief Constructs the device and initializes its metadata and supported
95+
* entities.
9596
*
96-
* Initializes the device name, number of qubits, minimum atom distance, length and
97-
* duration units/scale factors, and populates the site and operation lists.
97+
* Initializes the device name, number of qubits, minimum atom distance, length
98+
* and duration units/scale factors, and populates the site and operation lists.
9899
*/
99100
Device::Device() {
100101
// NOLINTBEGIN(cppcoreguidelines-prefer-member-initializer)
@@ -187,13 +188,7 @@ auto Device::queryProperty(const QDMI_Device_Property prop, const size_t size,
187188
operations_, prop, size, value, sizeRet)
188189
return QDMI_ERROR_NOTSUPPORTED;
189190
}
190-
} /**
191-
* @brief Initialize the device session by transitioning it from ALLOCATED to INITIALIZED.
192-
*
193-
* Sets the session's internal state to INITIALIZED when it is currently ALLOCATED.
194-
*
195-
* @return int `QDMI_SUCCESS` on successful initialization, `QDMI_ERROR_BADSTATE` if the session was not in the ALLOCATED state.
196-
*/
191+
} // namespace qdmi::na
197192

198193
auto MQT_NA_QDMI_Device_Session_impl_d::init() -> int {
199194
if (status_ != Status::ALLOCATED) {
@@ -237,10 +232,16 @@ auto MQT_NA_QDMI_Device_Session_impl_d::freeDeviceJob(
237232
* @brief Query a device-level property for this session.
238233
*
239234
* @param prop The device property to query.
240-
* @param size Size of the caller-provided buffer pointed to by `value`, in bytes.
241-
* @param value Pointer to a buffer to receive the property's value; may be null to query required size.
242-
* @param sizeRet Pointer to receive the number of bytes written or required; may be null if not needed.
243-
* @return int QDMI status code: `QDMI_SUCCESS` on success, `QDMI_ERROR_BADSTATE` if the session is not initialized, `QDMI_ERROR_NOTSUPPORTED` if the property is not supported, or other QDMI error codes on failure.
235+
* @param size Size of the caller-provided buffer pointed to by `value`, in
236+
* bytes.
237+
* @param value Pointer to a buffer to receive the property's value; may be null
238+
* to query required size.
239+
* @param sizeRet Pointer to receive the number of bytes written or required;
240+
* may be null if not needed.
241+
* @return int QDMI status code: `QDMI_SUCCESS` on success,
242+
* `QDMI_ERROR_BADSTATE` if the session is not initialized,
243+
* `QDMI_ERROR_NOTSUPPORTED` if the property is not supported, or other QDMI
244+
* error codes on failure.
244245
*/
245246
auto MQT_NA_QDMI_Device_Session_impl_d::queryDeviceProperty(
246247
const QDMI_Device_Property prop, const size_t size, void* value,
@@ -258,11 +259,14 @@ auto MQT_NA_QDMI_Device_Session_impl_d::queryDeviceProperty(
258259
* @param site Site handle to query; must not be `nullptr`.
259260
* @param prop Property to query.
260261
* @param size Size of the buffer pointed to by `value`, in bytes.
261-
* @param value Output buffer for the property value; may be `nullptr` to obtain required size.
262-
* @param sizeRet Receives the number of bytes written or required; may be `nullptr` if not needed.
262+
* @param value Output buffer for the property value; may be `nullptr` to obtain
263+
* required size.
264+
* @param sizeRet Receives the number of bytes written or required; may be
265+
* `nullptr` if not needed.
263266
* @return int `QDMI_ERROR_INVALIDARGUMENT` if `site` is `nullptr`.
264267
* `QDMI_ERROR_BADSTATE` if the session is not initialized.
265-
* Otherwise, returns the status code produced while retrieving the site's property.
268+
* Otherwise, returns the status code produced while retrieving the site's
269+
* property.
266270
*/
267271
auto MQT_NA_QDMI_Device_Session_impl_d::querySiteProperty(
268272
MQT_NA_QDMI_Site site, const QDMI_Site_Property prop, const size_t size,
@@ -598,26 +602,31 @@ auto MQT_NA_QDMI_Operation_impl_d::queryProperty(
598602
}
599603
if (fidelity_) {
600604
/**
601-
* @brief Query an operation property for the specified sites and parameters.
602-
*
603-
* Validates the provided site pointers and parameter pointers, checks that the
604-
* supplied sites are compatible with this operation (including ordering for
605-
* two-qubit operations), and writes the requested property into the provided
606-
* buffer if supported.
607-
*
608-
* @param numSites Number of sites in `sites`.
609-
* @param sites Pointer to an array of site handles to query against.
610-
* @param numParams Number of numeric parameters in `params`.
611-
* @param params Pointer to an array of parameter values (may be nullptr if none).
612-
* @param prop The operation property to query.
613-
* @param size Size of the `value` buffer in bytes.
614-
* @param value Buffer to receive the property value (may be nullptr to query required size).
615-
* @param sizeRet If non-null, receives the number of bytes written or required.
616-
* @return int `QDMI_ERROR_SUCCESS` if the property was written to `value`;
617-
* `QDMI_ERROR_NOTSUPPORTED` if the property or the supplied site/parameter
618-
* combination is not supported; `QDMI_ERROR_BADARG` for invalid input arguments.
619-
*/
620-
ADD_SINGLE_VALUE_PROPERTY(QDMI_OPERATION_PROPERTY_FIDELITY, double,
605+
* @brief Query an operation property for the specified sites and
606+
* parameters.
607+
*
608+
* Validates the provided site pointers and parameter pointers, checks that
609+
* the supplied sites are compatible with this operation (including ordering
610+
* for two-qubit operations), and writes the requested property into the
611+
* provided buffer if supported.
612+
*
613+
* @param numSites Number of sites in `sites`.
614+
* @param sites Pointer to an array of site handles to query against.
615+
* @param numParams Number of numeric parameters in `params`.
616+
* @param params Pointer to an array of parameter values (may be nullptr if
617+
* none).
618+
* @param prop The operation property to query.
619+
* @param size Size of the `value` buffer in bytes.
620+
* @param value Buffer to receive the property value (may be nullptr to
621+
* query required size).
622+
* @param sizeRet If non-null, receives the number of bytes written or
623+
* required.
624+
* @return int `QDMI_ERROR_SUCCESS` if the property was written to `value`;
625+
* `QDMI_ERROR_NOTSUPPORTED` if the property or the supplied site/parameter
626+
* combination is not supported; `QDMI_ERROR_BADARG` for invalid input
627+
* arguments.
628+
*/
629+
ADD_SINGLE_VALUE_PROPERTY(QDMI_OPERATION_PROPERTY_FIDELITY, double,
621630
*fidelity_, prop, size, value, sizeRet)
622631
}
623632
if (numQubits_) {
@@ -634,7 +643,8 @@ ADD_SINGLE_VALUE_PROPERTY(QDMI_OPERATION_PROPERTY_FIDELITY, double,
634643
}
635644

636645
/**
637-
* @brief Initializes the NA QDMI device subsystem by ensuring the Device singleton exists.
646+
* @brief Initializes the NA QDMI device subsystem by ensuring the Device
647+
* singleton exists.
638648
*
639649
* @return QDMI_SUCCESS on success.
640650
*/
@@ -644,9 +654,11 @@ int MQT_NA_QDMI_device_initialize() {
644654
}
645655

646656
/**
647-
* @brief Finalizes the NA QDMI device subsystem and releases any global resources.
657+
* @brief Finalizes the NA QDMI device subsystem and releases any global
658+
* resources.
648659
*
649-
* Performs any final cleanup required by the device subsystem prior to library unload.
660+
* Performs any final cleanup required by the device subsystem prior to library
661+
* unload.
650662
*
651663
* @return int `QDMI_SUCCESS` on success.
652664
*/
@@ -655,8 +667,10 @@ int MQT_NA_QDMI_device_finalize() { return QDMI_SUCCESS; }
655667
/**
656668
* @brief Allocates a new device session and returns its handle.
657669
*
658-
* @param session Pointer to storage that receives the new MQT_NA_QDMI_Device_Session handle; must not be null.
659-
* @return int Status code indicating success or failure. On success the out-parameter `session` is set to the allocated session handle.
670+
* @param session Pointer to storage that receives the new
671+
* MQT_NA_QDMI_Device_Session handle; must not be null.
672+
* @return int Status code indicating success or failure. On success the
673+
* out-parameter `session` is set to the allocated session handle.
660674
*/
661675
int MQT_NA_QDMI_device_session_alloc(MQT_NA_QDMI_Device_Session* session) {
662676
return qdmi::na::Device::get().sessionAlloc(session);
@@ -666,7 +680,8 @@ int MQT_NA_QDMI_device_session_alloc(MQT_NA_QDMI_Device_Session* session) {
666680
* @brief Initializes a device session.
667681
*
668682
* @param session Pointer to an allocated device session handle.
669-
* @return int QDMI_SUCCESS on success; QDMI_ERROR_INVALIDARGUMENT if `session` is null; otherwise the status code returned by the session initialization.
683+
* @return int QDMI_SUCCESS on success; QDMI_ERROR_INVALIDARGUMENT if `session`
684+
* is null; otherwise the status code returned by the session initialization.
670685
*/
671686
int MQT_NA_QDMI_device_session_init(MQT_NA_QDMI_Device_Session session) {
672687
if (session == nullptr) {
@@ -694,7 +709,8 @@ void MQT_NA_QDMI_device_session_free(MQT_NA_QDMI_Device_Session session) {
694709
* @param param Identifier of the session parameter to set.
695710
* @param size Size in bytes of the data pointed to by `value`.
696711
* @param value Pointer to the parameter data.
697-
* @return int QDMI status code: `QDMI_ERROR_INVALIDARGUMENT` if `session` is null; otherwise the status returned by the session implementation.
712+
* @return int QDMI status code: `QDMI_ERROR_INVALIDARGUMENT` if `session` is
713+
* null; otherwise the status returned by the session implementation.
698714
*/
699715
int MQT_NA_QDMI_device_session_set_parameter(
700716
MQT_NA_QDMI_Device_Session session, QDMI_Device_Session_Parameter param,
@@ -839,4 +855,4 @@ int MQT_NA_QDMI_device_session_query_operation_property(
839855
}
840856
return session->queryOperationProperty(operation, numSites, sites, numParams,
841857
params, prop, size, value, sizeRet);
842-
}
858+
}

src/qdmi/Driver.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,19 @@ DEFINE_STATIC_LIBRARY(MQT_SC)
8181

8282
#ifndef _WIN32
8383
/**
84-
* @brief Load a device shared library, bind required QDMI symbols using the given prefix, and initialize the device.
84+
* @brief Load a device shared library, bind required QDMI symbols using the
85+
* given prefix, and initialize the device.
8586
*
86-
* Opens the shared library specified by libName, resolves the set of required QDMI symbols named using
87-
* the pattern "<prefix>_QDMI_<symbol>", and calls the library's initialize function.
87+
* Opens the shared library specified by libName, resolves the set of required
88+
* QDMI symbols named using the pattern "<prefix>_QDMI_<symbol>", and calls the
89+
* library's initialize function.
8890
*
8991
* @param libName Path or filename of the shared library to load.
90-
* @param prefix Symbol name prefix used to construct exported QDMI symbol names (e.g., prefix_QDMI_device_initialize).
92+
* @param prefix Symbol name prefix used to construct exported QDMI symbol names
93+
* (e.g., prefix_QDMI_device_initialize).
9194
*
92-
* @throws std::runtime_error If the library cannot be opened, if the library is already loaded,
93-
* or if any required symbol cannot be resolved.
95+
* @throws std::runtime_error If the library cannot be opened, if the library is
96+
* already loaded, or if any required symbol cannot be resolved.
9497
*/
9598
DynamicDeviceLibrary::DynamicDeviceLibrary(const std::string& libName,
9699
const std::string& prefix)
@@ -363,7 +366,8 @@ Driver::Driver() {
363366
/**
364367
* @brief Releases all resources owned by the Driver.
365368
*
366-
* Destroys and removes all managed session and device objects so the Driver releases its held resources.
369+
* Destroys and removes all managed session and device objects so the Driver
370+
* releases its held resources.
367371
*/
368372
Driver::~Driver() {
369373
sessions_.clear();
@@ -531,4 +535,4 @@ int QDMI_device_query_operation_property(
531535
}
532536
return device->queryOperationProperty(operation, numSites, sites, numParams,
533537
params, prop, size, value, sizeRet);
534-
}
538+
}

0 commit comments

Comments
 (0)