libqasm
library for handling cQASM files
|
Namespace for the primitive types used in trees generated by tree-gen.
Classes | |
class | Matrix |
Two-dimensional matrix of some kind of type. More... | |
Typedefs | |
using | Str = std::string |
String primitive used within the AST and semantic trees. More... | |
using | Bool = bool |
Boolean primitive used within the semantic trees. More... | |
using | Int = std::int64_t |
Integer primitive used within the AST and semantic trees. More... | |
using | Real = double |
Real number primitive used within the AST and semantic trees. More... | |
using | Complex = std::complex< double > |
Complex number primitive used within the semantic trees. More... | |
using | RMatrix = Matrix< Real > |
Matrix of real numbers. More... | |
using | CMatrix = Matrix< Complex > |
Matrix of complex numbers. More... | |
using | Version = version::Version |
Version number primitive used within the AST and semantic trees. More... | |
Enumerations | |
enum | Axis { Axis::X, Axis::Y, Axis::Z } |
Axis primitive used within the semantic trees. More... | |
Functions | |
template<> | |
void | serialize (const error_model::ErrorModelRef &obj, ::tree::cbor::MapWriter &map) |
template<> | |
error_model::ErrorModelRef | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
void | serialize (const instruction::InstructionRef &obj, ::tree::cbor::MapWriter &map) |
template<> | |
instruction::InstructionRef | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
Str | initialize< Str > () |
template<> | |
void | serialize (const Str &obj, ::tree::cbor::MapWriter &map) |
template<> | |
Str | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
Bool | initialize< Bool > () |
template<> | |
void | serialize (const Bool &obj, ::tree::cbor::MapWriter &map) |
template<> | |
Bool | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
Axis | initialize< Axis > () |
template<> | |
void | serialize (const Axis &obj, ::tree::cbor::MapWriter &map) |
template<> | |
Axis | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
Int | initialize< Int > () |
template<> | |
void | serialize (const Int &obj, ::tree::cbor::MapWriter &map) |
template<> | |
Int | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
Real | initialize< Real > () |
template<> | |
void | serialize (const Real &obj, ::tree::cbor::MapWriter &map) |
template<> | |
Real | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
void | serialize (const Complex &obj, ::tree::cbor::MapWriter &map) |
template<> | |
Complex | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
void | serialize (const RMatrix &obj, ::tree::cbor::MapWriter &map) |
template<> | |
RMatrix | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
void | serialize (const CMatrix &obj, ::tree::cbor::MapWriter &map) |
template<> | |
CMatrix | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<> | |
void | serialize (const Version &obj, ::tree::cbor::MapWriter &map) |
template<> | |
Version | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
std::ostream & | operator<< (std::ostream &os, const Axis &axis) |
Stream << overload for axis nodes. More... | |
template<class T > | |
T | initialize () |
Generates a default value for the given primitive type. More... | |
template<typename T > | |
void | serialize (const T &obj, ::tree::cbor::MapWriter &map) |
Serializes the given primitive object to CBOR. More... | |
template<typename T > | |
T | deserialize (const ::tree::cbor::MapReader &map) |
Deserializes the given primitive object from CBOR. More... | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &os, const Matrix< T > &mat) |
Stream << overload for matrix nodes. More... | |
using cqasm::v1::primitives::Str = typedef std::string |
String primitive used within the AST and semantic trees.
Definition at line 48 of file cqasm-v1-primitives.hpp.
using cqasm::v1::primitives::Bool = typedef bool |
Boolean primitive used within the semantic trees.
Defaults to false.
Definition at line 59 of file cqasm-v1-primitives.hpp.
using cqasm::v1::primitives::Int = typedef std::int64_t |
Integer primitive used within the AST and semantic trees.
Definition at line 81 of file cqasm-v1-primitives.hpp.
using cqasm::v1::primitives::Real = typedef double |
Real number primitive used within the AST and semantic trees.
Definition at line 92 of file cqasm-v1-primitives.hpp.
using cqasm::v1::primitives::Complex = typedef std::complex<double> |
Complex number primitive used within the semantic trees.
Definition at line 103 of file cqasm-v1-primitives.hpp.
using cqasm::v1::primitives::RMatrix = typedef Matrix<Real> |
Matrix of real numbers.
Definition at line 222 of file cqasm-v1-primitives.hpp.
using cqasm::v1::primitives::CMatrix = typedef Matrix<Complex> |
Matrix of complex numbers.
Definition at line 231 of file cqasm-v1-primitives.hpp.
using cqasm::v1::primitives::Version = typedef version::Version |
Version number primitive used within the AST and semantic trees.
Definition at line 240 of file cqasm-v1-primitives.hpp.
|
strong |
Axis primitive used within the semantic trees.
Defaults to X.
Enumerator | |
---|---|
X | |
Y | |
Z |
Definition at line 70 of file cqasm-v1-primitives.hpp.
void cqasm::v1::primitives::serialize | ( | const error_model::ErrorModelRef & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 58 of file cqasm-v1-error-model.cpp.
error_model::ErrorModelRef cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 71 of file cqasm-v1-error-model.cpp.
void cqasm::v1::primitives::serialize | ( | const instruction::InstructionRef & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 78 of file cqasm-v1-instruction.cpp.
instruction::InstructionRef cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 95 of file cqasm-v1-instruction.cpp.
Str cqasm::v1::primitives::initialize< Str > | ( | ) |
Definition at line 12 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const Str & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 15 of file cqasm-v1-primitives.cpp.
Str cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 20 of file cqasm-v1-primitives.cpp.
Bool cqasm::v1::primitives::initialize< Bool > | ( | ) |
Definition at line 25 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const Bool & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 28 of file cqasm-v1-primitives.cpp.
Bool cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 33 of file cqasm-v1-primitives.cpp.
Axis cqasm::v1::primitives::initialize< Axis > | ( | ) |
Definition at line 38 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const Axis & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 41 of file cqasm-v1-primitives.cpp.
Axis cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 50 of file cqasm-v1-primitives.cpp.
Int cqasm::v1::primitives::initialize< Int > | ( | ) |
Definition at line 60 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const Int & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 63 of file cqasm-v1-primitives.cpp.
Int cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 68 of file cqasm-v1-primitives.cpp.
Real cqasm::v1::primitives::initialize< Real > | ( | ) |
Definition at line 73 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const Real & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 76 of file cqasm-v1-primitives.cpp.
Real cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 81 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const Complex & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 86 of file cqasm-v1-primitives.cpp.
Complex cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 92 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const RMatrix & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 97 of file cqasm-v1-primitives.cpp.
RMatrix cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 107 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const CMatrix & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 119 of file cqasm-v1-primitives.cpp.
CMatrix cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 130 of file cqasm-v1-primitives.cpp.
void cqasm::v1::primitives::serialize | ( | const Version & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Definition at line 142 of file cqasm-v1-primitives.cpp.
Version cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 151 of file cqasm-v1-primitives.cpp.
std::ostream & cqasm::v1::primitives::operator<< | ( | std::ostream & | os, |
const Axis & | axis | ||
) |
Stream << overload for axis nodes.
Definition at line 164 of file cqasm-v1-primitives.cpp.
T cqasm::v1::primitives::initialize | ( | ) |
Generates a default value for the given primitive type.
This is specialized for the primitives mapping to builtin types (int, bool, etc, for which the "constructor" doesn't initialize the value at all) such that they actually initialize with a sane default. Used in the default constructors of the generated tree nodes to ensure that there's no garbage in the nodes.
Definition at line 31 of file cqasm-v1-primitives.hpp.
void cqasm::v1::primitives::serialize | ( | const T & | obj, |
::tree::cbor::MapWriter & | map | ||
) |
Serializes the given primitive object to CBOR.
T cqasm::v1::primitives::deserialize | ( | const ::tree::cbor::MapReader & | map | ) |
Deserializes the given primitive object from CBOR.
Definition at line 71 of file cqasm-v1-error-model.cpp.
std::ostream& cqasm::v1::primitives::operator<< | ( | std::ostream & | os, |
const Matrix< T > & | mat | ||
) |
Stream << overload for matrix nodes.
Definition at line 255 of file cqasm-v1-primitives.hpp.