libqasm
library for handling cQASM files
|
Main class for all nodes. More...
Public Member Functions | |
virtual NodeType | type () const =0 |
Returns the NodeType of this node. More... | |
virtual One< Node > | copy () const =0 |
Returns a shallow copy of this node. More... | |
virtual One< Node > | clone () const =0 |
Returns a deep copy of this node. More... | |
virtual bool | equals (const Node &rhs) const =0 |
Value-based equality operator. More... | |
virtual bool | operator== (const Node &rhs) const =0 |
Pointer-based equality operator. More... | |
bool | operator!= (const Node &rhs) const |
Pointer-based inequality operator. More... | |
template<typename T > | |
T | visit (Visitor< T > &visitor) |
Visit this object. More... | |
void | dump (std::ostream &out=std::cout, int indent=0) |
Writes a debug dump of this node to the given stream. More... | |
void | dump_seq (std::ostream &out=std::cout, int indent=0) |
Alternate debug dump that represents links and node uniqueness via sequence number tags. More... | |
virtual Axis * | as_axis () |
Interprets this node to a node of type Axis. More... | |
virtual const Axis * | as_axis () const |
Interprets this node to a node of type Axis. More... | |
virtual Bool * | as_bool () |
Interprets this node to a node of type Bool. More... | |
virtual const Bool * | as_bool () const |
Interprets this node to a node of type Bool. More... | |
virtual Complex * | as_complex () |
Interprets this node to a node of type Complex. More... | |
virtual const Complex * | as_complex () const |
Interprets this node to a node of type Complex. More... | |
virtual ComplexMatrix * | as_complex_matrix () |
Interprets this node to a node of type ComplexMatrix. More... | |
virtual const ComplexMatrix * | as_complex_matrix () const |
Interprets this node to a node of type ComplexMatrix. More... | |
virtual Int * | as_int () |
Interprets this node to a node of type Int. More... | |
virtual const Int * | as_int () const |
Interprets this node to a node of type Int. More... | |
virtual Json * | as_json () |
Interprets this node to a node of type Json. More... | |
virtual const Json * | as_json () const |
Interprets this node to a node of type Json. More... | |
virtual Qubit * | as_qubit () |
Interprets this node to a node of type Qubit. More... | |
virtual const Qubit * | as_qubit () const |
Interprets this node to a node of type Qubit. More... | |
virtual Real * | as_real () |
Interprets this node to a node of type Real. More... | |
virtual const Real * | as_real () const |
Interprets this node to a node of type Real. More... | |
virtual RealMatrix * | as_real_matrix () |
Interprets this node to a node of type RealMatrix. More... | |
virtual const RealMatrix * | as_real_matrix () const |
Interprets this node to a node of type RealMatrix. More... | |
virtual String * | as_string () |
Interprets this node to a node of type String. More... | |
virtual const String * | as_string () const |
Interprets this node to a node of type String. More... | |
virtual TypeBase * | as_type_base () |
Interprets this node to a node of type TypeBase. More... | |
virtual const TypeBase * | as_type_base () const |
Interprets this node to a node of type TypeBase. More... | |
virtual void | serialize (::tree::cbor::MapWriter &map, const ::tree::base::PointerMap &ids) const =0 |
Serializes this node to the given map. More... | |
Static Public Member Functions | |
static std::shared_ptr< Node > | deserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids) |
Deserializes the given node. More... | |
Protected Member Functions | |
virtual void | visit_internal (VisitorBase &visitor, void *retval=nullptr)=0 |
Internal helper method for visiter pattern. More... | |
Main class for all nodes.
Definition at line 107 of file cqasm-v1-types-gen.hpp.
#include <cqasm-v1-types-gen.hpp>
|
pure virtual |
Returns the NodeType
of this node.
Implemented in cqasm::v1::types::String, cqasm::v1::types::RealMatrix, cqasm::v1::types::Real, cqasm::v1::types::Qubit, cqasm::v1::types::Json, cqasm::v1::types::Int, cqasm::v1::types::ComplexMatrix, cqasm::v1::types::Complex, cqasm::v1::types::Bool, and cqasm::v1::types::Axis.
Returns a shallow copy of this node.
Implemented in cqasm::v1::types::String, cqasm::v1::types::RealMatrix, cqasm::v1::types::Real, cqasm::v1::types::Qubit, cqasm::v1::types::Json, cqasm::v1::types::Int, cqasm::v1::types::ComplexMatrix, cqasm::v1::types::Complex, cqasm::v1::types::Bool, and cqasm::v1::types::Axis.
Returns a deep copy of this node.
Implemented in cqasm::v1::types::String, cqasm::v1::types::RealMatrix, cqasm::v1::types::Real, cqasm::v1::types::Qubit, cqasm::v1::types::Json, cqasm::v1::types::Int, cqasm::v1::types::ComplexMatrix, cqasm::v1::types::Complex, cqasm::v1::types::Bool, and cqasm::v1::types::Axis.
|
pure virtual |
Value-based equality operator.
Ignores annotations!
Implemented in cqasm::v1::types::String, cqasm::v1::types::RealMatrix, cqasm::v1::types::Real, cqasm::v1::types::Qubit, cqasm::v1::types::Json, cqasm::v1::types::Int, cqasm::v1::types::ComplexMatrix, cqasm::v1::types::Complex, cqasm::v1::types::Bool, and cqasm::v1::types::Axis.
|
pure virtual |
Pointer-based equality operator.
Implemented in cqasm::v1::types::String, cqasm::v1::types::RealMatrix, cqasm::v1::types::Real, cqasm::v1::types::Qubit, cqasm::v1::types::Json, cqasm::v1::types::Int, cqasm::v1::types::ComplexMatrix, cqasm::v1::types::Complex, cqasm::v1::types::Bool, and cqasm::v1::types::Axis.
|
inline |
Pointer-based inequality operator.
Definition at line 138 of file cqasm-v1-types-gen.hpp.
|
protectedpure virtual |
Internal helper method for visiter pattern.
Implemented in cqasm::v1::types::String, cqasm::v1::types::RealMatrix, cqasm::v1::types::Real, cqasm::v1::types::Qubit, cqasm::v1::types::Json, cqasm::v1::types::Int, cqasm::v1::types::ComplexMatrix, cqasm::v1::types::Complex, cqasm::v1::types::Bool, and cqasm::v1::types::Axis.
T cqasm::v1::types::Node::visit | ( | Visitor< T > & | visitor | ) |
Visit this object.
Definition at line 1834 of file cqasm-v1-types-gen.hpp.
void cqasm::v1::types::Node::dump | ( | std::ostream & | out = std::cout , |
int | indent = 0 |
||
) |
Writes a debug dump of this node to the given stream.
Definition at line 16 of file cqasm-v1-types-gen.cpp.
void cqasm::v1::types::Node::dump_seq | ( | std::ostream & | out = std::cout , |
int | indent = 0 |
||
) |
Alternate debug dump that represents links and node uniqueness via sequence number tags.
Definition at line 25 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Axis.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Axis.
Definition at line 38 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Axis.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Axis.
Definition at line 46 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Bool.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Bool.
Definition at line 54 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Bool.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Bool.
Definition at line 62 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Complex.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Complex.
Definition at line 70 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Complex.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Complex.
Definition at line 78 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type ComplexMatrix.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::ComplexMatrix.
Definition at line 86 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type ComplexMatrix.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::ComplexMatrix.
Definition at line 94 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Int.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Int.
Definition at line 102 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Int.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Int.
Definition at line 110 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Json.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Json.
Definition at line 118 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Json.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Json.
Definition at line 126 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Qubit.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Qubit.
Definition at line 134 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Qubit.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Qubit.
Definition at line 142 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Real.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Real.
Definition at line 150 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type Real.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::Real.
Definition at line 158 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type RealMatrix.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::RealMatrix.
Definition at line 166 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type RealMatrix.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::RealMatrix.
Definition at line 174 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type String.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::String.
Definition at line 182 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type String.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::String.
Definition at line 190 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type TypeBase.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::TypeBase.
Definition at line 198 of file cqasm-v1-types-gen.cpp.
|
virtual |
Interprets this node to a node of type TypeBase.
Returns null if it has the wrong type.
Reimplemented in cqasm::v1::types::TypeBase.
Definition at line 206 of file cqasm-v1-types-gen.cpp.
|
pure virtual |
Serializes this node to the given map.
Implemented in cqasm::v1::types::String, cqasm::v1::types::RealMatrix, cqasm::v1::types::Real, cqasm::v1::types::Qubit, cqasm::v1::types::Json, cqasm::v1::types::Int, cqasm::v1::types::ComplexMatrix, cqasm::v1::types::Complex, cqasm::v1::types::Bool, and cqasm::v1::types::Axis.
|
static |
Deserializes the given node.
Writes a debug dump of this node to the given stream.
Definition at line 213 of file cqasm-v1-types-gen.cpp.