libqasm
library for handling cQASM files
Public Member Functions | Public Attributes | List of all members
cqasm::v1::error_model::ErrorModel Class Reference

Representation of an error model. More...

Public Member Functions

 ErrorModel (const std::string &name, const std::string &param_types="")
 Creates a new error model. More...
 
bool operator== (const ErrorModel &rhs) const
 Equality operator. More...
 
bool operator!= (const ErrorModel &rhs) const
 Inequality operator. More...
 

Public Attributes

std::string name
 The name of the error model. More...
 
types::Types param_types
 The vector of parameter types that this error model expects. More...
 

Detailed Description

Representation of an error model.

A number of these can be registered into libqasm by the program or library using it through register_error_model(), to inform libqasm about which error models are supported. libqasm needs to know its name and which parameters it expects in order to be able to resolve the error model information specified in the cQASM file. The resolved error model (if any is specified in the file) can then be read from the parse result.

Note that it is legal to have multiple error models with the same name, as long as they can be distinguished through their parameter types (i.e. the available error models can be overloaded).

You can add any data you like to these through the Annotatable interface for your own bookkeeping, so you don't have to maintain an additional map from this error model structure to your own internal structure if you're okay with using this one.

Definition at line 41 of file cqasm-v1-error-model.hpp.

#include <cqasm-v1-error-model.hpp>

Inheritance diagram for cqasm::v1::error_model::ErrorModel:
Inheritance graph
[legend]
Collaboration diagram for cqasm::v1::error_model::ErrorModel:
Collaboration graph
[legend]

Constructor & Destructor Documentation

◆ ErrorModel()

cqasm::v1::error_model::ErrorModel::ErrorModel ( const std::string &  name,
const std::string &  param_types = "" 
)

Creates a new error model.

param_types is a shorthand type specification string as parsed by cqasm::types::from_spec(). If you need more control, you can also manipulate param_types directly.

Definition at line 18 of file cqasm-v1-error-model.cpp.

Member Function Documentation

◆ operator==()

bool cqasm::v1::error_model::ErrorModel::operator== ( const ErrorModel rhs) const

Equality operator.

Definition at line 29 of file cqasm-v1-error-model.cpp.

◆ operator!=()

bool cqasm::v1::error_model::ErrorModel::operator!= ( const ErrorModel rhs) const
inline

Inequality operator.

Definition at line 69 of file cqasm-v1-error-model.hpp.

Member Data Documentation

◆ name

std::string cqasm::v1::error_model::ErrorModel::name

The name of the error model.

Names are matched case insensitively.

Definition at line 47 of file cqasm-v1-error-model.hpp.

◆ param_types

types::Types cqasm::v1::error_model::ErrorModel::param_types

The vector of parameter types that this error model expects.

Definition at line 52 of file cqasm-v1-error-model.hpp.


The documentation for this class was generated from the following files: