Quantum Resource Manager and Compiler Infrastructure (QRM&CI) 0.1.0
ConstantsMapping.h File Reference
Include dependency graph for ConstantsMapping.h:
This graph shows which files directly or indirectly include this file:

Functions

Error mqss::qrmci::toQrmciError (Error::Kind kind, const mqss::submitter::Error &error)
 Wrap a submitter failure as a QRM&CI failure of a kind the caller names.
mqss::CircuitFormat mqss::qrmci::mapProtoCircuitFormat (int format) noexcept
 Translate a raw circuit-format value received over the wire into a mqss::CircuitFormat.
mqss::BackendType mqss::qrmci::mapProtoBackendType (int type) noexcept
 Translate a raw backend-type value received over the wire into a mqss::BackendType, the same way mapProtoCircuitFormat() handles circuit formats: an enumerator this build does not know becomes BACKEND_TYPE_UNSPECIFIED rather than an out-of-range value.
mqss::BackendStatus mqss::qrmci::mapProtoBackendStatus (int status) noexcept
 Translate a raw backend-status value received over the wire into a mqss::BackendStatus, the same way mapProtoCircuitFormat() handles circuit formats: an enumerator this build does not know becomes BACKEND_STATUS_UNSPECIFIED – and therefore not online – rather than an out-of-range value.
std::expected< mqss::mqssci::OptLevel, Error > mqss::qrmci::getCompilerOptimizationLevel (int level)
 Translate a task's requested optimisation level into the matching mqss-ci compiler optimisation level.
bool mqss::qrmci::isOnlineBackendStatus (mqss::BackendStatus status) noexcept
 Check whether a backend status means the backend is able to accept tasks.
std::string mqss::qrmci::circuitFormatLabel (mqss::CircuitFormat format)
 Name a circuit format for a log line.
std::string mqss::qrmci::backendStatusLabel (mqss::BackendStatus status)
 Name a backend status for a log line.

Detailed Description

Pure translations between the submitter, mqss protocol and mqss-ci enumerations: status, optimisation level, and wire-format decoding.

The tables themselves are private to src/ConstantsMapping.cpp; these functions are the whole interface. Task/compiler/backend circuit-format admission policy lives in CircuitFormatPolicy.h instead – that is policy, not translation.

No QDMI type appears here. QDMI translation belongs to MQSS-Submitter, behind its Client/Device/Job interface, which is what keeps QDMI out of every QRM&CI public header.

Definition in file ConstantsMapping.h.

Function Documentation

◆ backendStatusLabel()

std::string mqss::qrmci::backendStatusLabel ( mqss::BackendStatus status)
nodiscard

Name a backend status for a log line.

Parameters
statusThe backend status to describe.
Returns
The protocol's stable enumerator name (e.g. BACKEND_STATUS_IDLE), or UNKNOWN(<number>) if status is not a known enumerator.

◆ circuitFormatLabel()

std::string mqss::qrmci::circuitFormatLabel ( mqss::CircuitFormat format)
nodiscard

Name a circuit format for a log line.

Parameters
formatThe circuit format to describe.
Returns
The protocol's stable enumerator name (e.g. CIRCUIT_FORMAT_QASM2), or UNKNOWN(<number>) if format is not a known enumerator – the same case mapProtoCircuitFormat() normalizes away before this ever sees it, kept here only so a raw value logged before normalization still reads clearly.

◆ getCompilerOptimizationLevel()

std::expected< mqss::mqssci::OptLevel, Error > mqss::qrmci::getCompilerOptimizationLevel ( int level)
nodiscard

Translate a task's requested optimisation level into the matching mqss-ci compiler optimisation level.

0 and 1 both select O1 – proto3's implicit zero for an omitted field must not be mistaken for a request to maximize optimisation.

Parameters
levelThe optimisation level requested on the QuantumTask.
Returns
The matching mqss::mqssci::OptLevel, or a CompilationFailed error naming level if it is outside 0-3.

◆ isOnlineBackendStatus()

bool mqss::qrmci::isOnlineBackendStatus ( mqss::BackendStatus status)
nodiscardnoexcept

Check whether a backend status means the backend is able to accept tasks.

Parameters
statusThe backend status to check.
Returns
True for the statuses that count as online (idle and busy).

◆ mapProtoBackendStatus()

mqss::BackendStatus mqss::qrmci::mapProtoBackendStatus ( int status)
nodiscardnoexcept

Translate a raw backend-status value received over the wire into a mqss::BackendStatus, the same way mapProtoCircuitFormat() handles circuit formats: an enumerator this build does not know becomes BACKEND_STATUS_UNSPECIFIED – and therefore not online – rather than an out-of-range value.

Parameters
statusThe raw backend-status value as carried in the message.
Returns
The matching mqss::BackendStatus, or mqss::BackendStatus::BACKEND_STATUS_UNSPECIFIED if status is not a known enumerator.

◆ mapProtoBackendType()

mqss::BackendType mqss::qrmci::mapProtoBackendType ( int type)
nodiscardnoexcept

Translate a raw backend-type value received over the wire into a mqss::BackendType, the same way mapProtoCircuitFormat() handles circuit formats: an enumerator this build does not know becomes BACKEND_TYPE_UNSPECIFIED rather than an out-of-range value.

Parameters
typeThe raw backend-type value as carried in the message.
Returns
The matching mqss::BackendType, or mqss::BackendType::BACKEND_TYPE_UNSPECIFIED if type is not a known enumerator.

◆ mapProtoCircuitFormat()

mqss::CircuitFormat mqss::qrmci::mapProtoCircuitFormat ( int format)
nodiscardnoexcept

Translate a raw circuit-format value received over the wire into a mqss::CircuitFormat.

protobuf preserves unknown enum values as their raw integer, so a peer built against a newer protocol can hand us an enumerator this build does not know; this is the only supported way to turn such a value into a mqss::CircuitFormat.

Parameters
formatThe raw circuit-format value as carried in the message.
Returns
The matching mqss::CircuitFormat, or mqss::CircuitFormat::CIRCUIT_FORMAT_UNSPECIFIED if format is not a known enumerator.

◆ toQrmciError()

Error mqss::qrmci::toQrmciError ( Error::Kind kind,
const mqss::submitter::Error & error )
nodiscard

Wrap a submitter failure as a QRM&CI failure of a kind the caller names.

The submitter's ErrorCode is deliberately generic – it cannot distinguish a refused submission from a device fault – so the caller, which knows what it was trying to do, supplies the Kind. This function only formats the detail: the error code's own name followed by the submitter's message.

Parameters
kindThe QRM&CI error kind this failure should carry.
errorThe submitter error to wrap.
Returns
A QRM&CI error of kind kind, detailing error.