libqasm
library for handling cQASM files
|
Namespace for the classes representing the values (including dynamically evaluated expressions or references to registers) available within cQASM.
Namespace for the various classes representing constants, references, and dynamic expressions in cQASM.
Classes | |
class | BitRefs |
Represents a measurement bit, or a number of measurement bits for conditional gates with multiple conditions. More... | |
class | Constant |
Represents a constant value. More... | |
class | ConstAxis |
Represents an axis value (x, y, or z). More... | |
class | ConstBool |
Represents a value of type bool. More... | |
class | ConstComplex |
Represents a value of type complex. More... | |
class | ConstComplexMatrix |
Represents a value of type complex_matrix. More... | |
class | ConstInt |
Represents a value of type int. More... | |
class | ConstJson |
Represents a value of type json. More... | |
class | ConstReal |
Represents a value of type real. More... | |
class | ConstRealMatrix |
Represents a value of type real_matrix. More... | |
class | ConstString |
Represents a value of type string. More... | |
class | Dumper |
Visitor class that debug-dumps a tree to a stream. More... | |
class | Function |
This can be returned by user-defined functions as a placeholder value for something that needs to be evaluated at runtime rather than during constant propagation. More... | |
class | Node |
Main class for all nodes. More... | |
class | QubitRefs |
Represents a qubit, or a set of qubits for single-gate-multiple-qubit notation. More... | |
class | RecursiveVisitor |
Visitor base class defaulting to DFS pre-order traversal. More... | |
class | Reference |
Represents a reference to some storage location. More... | |
class | VariableRef |
Represents a variable reference. More... | |
class | Visitor |
Base class for the visitor pattern for the tree. More... | |
class | VisitorBase |
Internal class for implementing the visitor pattern. More... | |
Typedefs | |
using | TypeEnum = types::NodeType |
using | ValueEnum = values::NodeType |
using | Value = tree::One< Node > |
A cQASM value, either known at compile-time or an expression for something only known at runtime. More... | |
using | Values = tree::Any< Node > |
Zero or more cQASM values. More... | |
using | Base = cqasm::tree::Base |
template<class T > | |
using | Maybe = cqasm::tree::Maybe< T > |
template<class T > | |
using | One = cqasm::tree::One< T > |
template<class T > | |
using | Any = cqasm::tree::Any< T > |
template<class T > | |
using | Many = cqasm::tree::Many< T > |
template<class T > | |
using | OptLink = cqasm::tree::OptLink< T > |
template<class T > | |
using | Link = cqasm::tree::Link< T > |
Enumerations | |
enum | NodeType { NodeType::BitRefs, NodeType::ConstAxis, NodeType::ConstBool, NodeType::ConstComplex, NodeType::ConstComplexMatrix, NodeType::ConstInt, NodeType::ConstJson, NodeType::ConstReal, NodeType::ConstRealMatrix, NodeType::ConstString, NodeType::Function, NodeType::QubitRefs, NodeType::VariableRef } |
Enumeration of all node types. More... | |
Functions | |
Value | promote (const Value &value, const types::Type &type) |
Type-checks and (if necessary) promotes the given value to the given type. More... | |
types::Type | type_of (const Value &value) |
Returns the type of the given value. More... | |
types::Types | types_of (const Values &values) |
Returns the types of the given values. More... | |
void | check_const (const Value &value) |
Throws an AnalysisError if the given value is not a constant, i.e. More... | |
void | check_const (const Values &values) |
Throws an AnalysisError if any of the given values are not a constant, i.e. More... | |
std::ostream & | operator<< (std::ostream &os, const Value &value) |
Stream << overload for a single value. More... | |
std::ostream & | operator<< (std::ostream &os, const Values &values) |
Stream << overload for zero or more values. More... | |
std::ostream & | operator<< (std::ostream &os, const Node &object) |
Stream << overload for tree nodes (writes debug dump). More... | |
using cqasm::v1::values::TypeEnum = typedef types::NodeType |
Definition at line 15 of file cqasm-v1-values.cpp.
using cqasm::v1::values::ValueEnum = typedef values::NodeType |
Definition at line 16 of file cqasm-v1-values.cpp.
using cqasm::v1::values::Value = typedef tree::One<Node> |
A cQASM value, either known at compile-time or an expression for something only known at runtime.
Definition at line 26 of file cqasm-v1-values.hpp.
using cqasm::v1::values::Values = typedef tree::Any<Node> |
Zero or more cQASM values.
Definition at line 31 of file cqasm-v1-values.hpp.
using cqasm::v1::values::Base = typedef cqasm::tree::Base |
Definition at line 85 of file cqasm-v1-values-gen.hpp.
using cqasm::v1::values::Maybe = typedef cqasm::tree::Maybe<T> |
Definition at line 86 of file cqasm-v1-values-gen.hpp.
using cqasm::v1::values::One = typedef cqasm::tree::One<T> |
Definition at line 87 of file cqasm-v1-values-gen.hpp.
using cqasm::v1::values::Any = typedef cqasm::tree::Any<T> |
Definition at line 88 of file cqasm-v1-values-gen.hpp.
using cqasm::v1::values::Many = typedef cqasm::tree::Many<T> |
Definition at line 89 of file cqasm-v1-values-gen.hpp.
using cqasm::v1::values::OptLink = typedef cqasm::tree::OptLink<T> |
Definition at line 90 of file cqasm-v1-values-gen.hpp.
using cqasm::v1::values::Link = typedef cqasm::tree::Link<T> |
Definition at line 91 of file cqasm-v1-values-gen.hpp.
|
strong |
Enumeration of all node types.
Enumerator | |
---|---|
BitRefs | |
ConstAxis | |
ConstBool | |
ConstComplex | |
ConstComplexMatrix | |
ConstInt | |
ConstJson | |
ConstReal | |
ConstRealMatrix | |
ConstString | |
Function | |
QubitRefs | |
VariableRef |
Definition at line 119 of file cqasm-v1-values-gen.hpp.
Value cqasm::v1::values::promote | ( | const Value & | value, |
const types::Type & | type | ||
) |
Type-checks and (if necessary) promotes the given value to the given type.
Also checks assignability of the value if the type says the value must be assignable. Returns null if the check/promotion fails, otherwise returns the constructed value by way of a smart pointer. If the type was an exact match, this may return the given value without modification or a clone thereof.
Definition at line 25 of file cqasm-v1-values.cpp.
types::Type cqasm::v1::values::type_of | ( | const Value & | value | ) |
Returns the type of the given value.
Definition at line 108 of file cqasm-v1-values.cpp.
types::Types cqasm::v1::values::types_of | ( | const Values & | values | ) |
Returns the types of the given values.
Definition at line 149 of file cqasm-v1-values.cpp.
void cqasm::v1::values::check_const | ( | const Value & | value | ) |
Throws an AnalysisError if the given value is not a constant, i.e.
if it doesn't have a known value at this time.
Definition at line 161 of file cqasm-v1-values.cpp.
void cqasm::v1::values::check_const | ( | const Values & | values | ) |
Throws an AnalysisError if any of the given values are not a constant, i.e.
if it doesn't have a known value at this time.
Definition at line 171 of file cqasm-v1-values.cpp.
std::ostream & cqasm::v1::values::operator<< | ( | std::ostream & | os, |
const Value & | value | ||
) |
Stream << overload for a single value.
Definition at line 180 of file cqasm-v1-values.cpp.
std::ostream & cqasm::v1::values::operator<< | ( | std::ostream & | os, |
const Values & | values | ||
) |
Stream << overload for zero or more values.
Definition at line 192 of file cqasm-v1-values.cpp.
std::ostream & cqasm::v1::values::operator<< | ( | std::ostream & | os, |
const Node & | object | ||
) |
Stream << overload for tree nodes (writes debug dump).
Definition at line 2818 of file cqasm-v1-values-gen.cpp.