libqasm
library for handling cQASM files
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cqasm::v1::types::Node Class Referenceabstract

Main class for all nodes. More...

Public Member Functions

virtual NodeType type () const =0
 Returns the NodeType of this node. More...
 
virtual One< Nodecopy () const =0
 Returns a shallow copy of this node. More...
 
virtual One< Nodeclone () 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 >
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 Axisas_axis ()
 Interprets this node to a node of type Axis. More...
 
virtual const Axisas_axis () const
 Interprets this node to a node of type Axis. More...
 
virtual Boolas_bool ()
 Interprets this node to a node of type Bool. More...
 
virtual const Boolas_bool () const
 Interprets this node to a node of type Bool. More...
 
virtual Complexas_complex ()
 Interprets this node to a node of type Complex. More...
 
virtual const Complexas_complex () const
 Interprets this node to a node of type Complex. More...
 
virtual ComplexMatrixas_complex_matrix ()
 Interprets this node to a node of type ComplexMatrix. More...
 
virtual const ComplexMatrixas_complex_matrix () const
 Interprets this node to a node of type ComplexMatrix. More...
 
virtual Intas_int ()
 Interprets this node to a node of type Int. More...
 
virtual const Intas_int () const
 Interprets this node to a node of type Int. More...
 
virtual Jsonas_json ()
 Interprets this node to a node of type Json. More...
 
virtual const Jsonas_json () const
 Interprets this node to a node of type Json. More...
 
virtual Qubitas_qubit ()
 Interprets this node to a node of type Qubit. More...
 
virtual const Qubitas_qubit () const
 Interprets this node to a node of type Qubit. More...
 
virtual Realas_real ()
 Interprets this node to a node of type Real. More...
 
virtual const Realas_real () const
 Interprets this node to a node of type Real. More...
 
virtual RealMatrixas_real_matrix ()
 Interprets this node to a node of type RealMatrix. More...
 
virtual const RealMatrixas_real_matrix () const
 Interprets this node to a node of type RealMatrix. More...
 
virtual Stringas_string ()
 Interprets this node to a node of type String. More...
 
virtual const Stringas_string () const
 Interprets this node to a node of type String. More...
 
virtual TypeBaseas_type_base ()
 Interprets this node to a node of type TypeBase. More...
 
virtual const TypeBaseas_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< Nodedeserialize (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...
 

Detailed Description

Main class for all nodes.

Definition at line 107 of file cqasm-v1-types-gen.hpp.

#include <cqasm-v1-types-gen.hpp>

Inheritance diagram for cqasm::v1::types::Node:
Inheritance graph
[legend]
Collaboration diagram for cqasm::v1::types::Node:
Collaboration graph
[legend]

Member Function Documentation

◆ type()

virtual NodeType cqasm::v1::types::Node::type ( ) const
pure virtual

◆ copy()

virtual One<Node> cqasm::v1::types::Node::copy ( ) const
pure virtual

◆ clone()

virtual One<Node> cqasm::v1::types::Node::clone ( ) const
pure virtual

◆ equals()

virtual bool cqasm::v1::types::Node::equals ( const Node rhs) const
pure virtual

◆ operator==()

virtual bool cqasm::v1::types::Node::operator== ( const Node rhs) const
pure virtual

◆ operator!=()

bool cqasm::v1::types::Node::operator!= ( const Node rhs) const
inline

Pointer-based inequality operator.

Definition at line 138 of file cqasm-v1-types-gen.hpp.

◆ visit_internal()

virtual void cqasm::v1::types::Node::visit_internal ( VisitorBase visitor,
void *  retval = nullptr 
)
protectedpure virtual

◆ visit()

template<typename T >
T cqasm::v1::types::Node::visit ( Visitor< T > &  visitor)

Visit this object.

Definition at line 1834 of file cqasm-v1-types-gen.hpp.

◆ dump()

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.

◆ dump_seq()

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.

◆ as_axis() [1/2]

Axis * cqasm::v1::types::Node::as_axis ( )
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.

◆ as_axis() [2/2]

const Axis * cqasm::v1::types::Node::as_axis ( ) const
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.

◆ as_bool() [1/2]

Bool * cqasm::v1::types::Node::as_bool ( )
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.

◆ as_bool() [2/2]

const Bool * cqasm::v1::types::Node::as_bool ( ) const
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.

◆ as_complex() [1/2]

Complex * cqasm::v1::types::Node::as_complex ( )
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.

◆ as_complex() [2/2]

const Complex * cqasm::v1::types::Node::as_complex ( ) const
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.

◆ as_complex_matrix() [1/2]

ComplexMatrix * cqasm::v1::types::Node::as_complex_matrix ( )
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.

◆ as_complex_matrix() [2/2]

const ComplexMatrix * cqasm::v1::types::Node::as_complex_matrix ( ) const
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.

◆ as_int() [1/2]

Int * cqasm::v1::types::Node::as_int ( )
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.

◆ as_int() [2/2]

const Int * cqasm::v1::types::Node::as_int ( ) const
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.

◆ as_json() [1/2]

Json * cqasm::v1::types::Node::as_json ( )
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.

◆ as_json() [2/2]

const Json * cqasm::v1::types::Node::as_json ( ) const
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.

◆ as_qubit() [1/2]

Qubit * cqasm::v1::types::Node::as_qubit ( )
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.

◆ as_qubit() [2/2]

const Qubit * cqasm::v1::types::Node::as_qubit ( ) const
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.

◆ as_real() [1/2]

Real * cqasm::v1::types::Node::as_real ( )
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.

◆ as_real() [2/2]

const Real * cqasm::v1::types::Node::as_real ( ) const
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.

◆ as_real_matrix() [1/2]

RealMatrix * cqasm::v1::types::Node::as_real_matrix ( )
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.

◆ as_real_matrix() [2/2]

const RealMatrix * cqasm::v1::types::Node::as_real_matrix ( ) const
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.

◆ as_string() [1/2]

String * cqasm::v1::types::Node::as_string ( )
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.

◆ as_string() [2/2]

const String * cqasm::v1::types::Node::as_string ( ) const
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.

◆ as_type_base() [1/2]

TypeBase * cqasm::v1::types::Node::as_type_base ( )
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.

◆ as_type_base() [2/2]

const TypeBase * cqasm::v1::types::Node::as_type_base ( ) const
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.

◆ serialize()

virtual void cqasm::v1::types::Node::serialize ( ::tree::cbor::MapWriter &  map,
const ::tree::base::PointerMap &  ids 
) const
pure virtual

◆ deserialize()

std::shared_ptr< Node > cqasm::v1::types::Node::deserialize ( const ::tree::cbor::MapReader &  map,
::tree::base::IdentifierMap &  ids 
)
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.


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