libqasm
library for handling cQASM files
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cqasm::v1::values::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 BitRefsas_bit_refs ()
 Interprets this node to a node of type BitRefs. More...
 
virtual const BitRefsas_bit_refs () const
 Interprets this node to a node of type BitRefs. More...
 
virtual ConstAxisas_const_axis ()
 Interprets this node to a node of type ConstAxis. More...
 
virtual const ConstAxisas_const_axis () const
 Interprets this node to a node of type ConstAxis. More...
 
virtual ConstBoolas_const_bool ()
 Interprets this node to a node of type ConstBool. More...
 
virtual const ConstBoolas_const_bool () const
 Interprets this node to a node of type ConstBool. More...
 
virtual ConstComplexas_const_complex ()
 Interprets this node to a node of type ConstComplex. More...
 
virtual const ConstComplexas_const_complex () const
 Interprets this node to a node of type ConstComplex. More...
 
virtual ConstComplexMatrixas_const_complex_matrix ()
 Interprets this node to a node of type ConstComplexMatrix. More...
 
virtual const ConstComplexMatrixas_const_complex_matrix () const
 Interprets this node to a node of type ConstComplexMatrix. More...
 
virtual ConstIntas_const_int ()
 Interprets this node to a node of type ConstInt. More...
 
virtual const ConstIntas_const_int () const
 Interprets this node to a node of type ConstInt. More...
 
virtual ConstJsonas_const_json ()
 Interprets this node to a node of type ConstJson. More...
 
virtual const ConstJsonas_const_json () const
 Interprets this node to a node of type ConstJson. More...
 
virtual ConstRealas_const_real ()
 Interprets this node to a node of type ConstReal. More...
 
virtual const ConstRealas_const_real () const
 Interprets this node to a node of type ConstReal. More...
 
virtual ConstRealMatrixas_const_real_matrix ()
 Interprets this node to a node of type ConstRealMatrix. More...
 
virtual const ConstRealMatrixas_const_real_matrix () const
 Interprets this node to a node of type ConstRealMatrix. More...
 
virtual ConstStringas_const_string ()
 Interprets this node to a node of type ConstString. More...
 
virtual const ConstStringas_const_string () const
 Interprets this node to a node of type ConstString. More...
 
virtual Constantas_constant ()
 Interprets this node to a node of type Constant. More...
 
virtual const Constantas_constant () const
 Interprets this node to a node of type Constant. More...
 
virtual Functionas_function ()
 Interprets this node to a node of type Function. More...
 
virtual const Functionas_function () const
 Interprets this node to a node of type Function. More...
 
virtual QubitRefsas_qubit_refs ()
 Interprets this node to a node of type QubitRefs. More...
 
virtual const QubitRefsas_qubit_refs () const
 Interprets this node to a node of type QubitRefs. More...
 
virtual Referenceas_reference ()
 Interprets this node to a node of type Reference. More...
 
virtual const Referenceas_reference () const
 Interprets this node to a node of type Reference. More...
 
virtual VariableRefas_variable_ref ()
 Interprets this node to a node of type VariableRef. More...
 
virtual const VariableRefas_variable_ref () const
 Interprets this node to a node of type VariableRef. 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 138 of file cqasm-v1-values-gen.hpp.

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

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

Member Function Documentation

◆ type()

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

◆ copy()

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

◆ clone()

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

◆ equals()

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

◆ operator==()

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

◆ operator!=()

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

Pointer-based inequality operator.

Definition at line 169 of file cqasm-v1-values-gen.hpp.

◆ visit_internal()

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

◆ visit()

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

Visit this object.

Definition at line 2410 of file cqasm-v1-values-gen.hpp.

◆ dump()

void cqasm::v1::values::Node::dump ( std::ostream &  out = std::cout,
int  indent = 0 
)

Writes a debug dump of this node to the given stream.

Definition at line 17 of file cqasm-v1-values-gen.cpp.

◆ dump_seq()

void cqasm::v1::values::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 26 of file cqasm-v1-values-gen.cpp.

◆ as_bit_refs() [1/2]

BitRefs * cqasm::v1::values::Node::as_bit_refs ( )
virtual

Interprets this node to a node of type BitRefs.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::BitRefs.

Definition at line 39 of file cqasm-v1-values-gen.cpp.

◆ as_bit_refs() [2/2]

const BitRefs * cqasm::v1::values::Node::as_bit_refs ( ) const
virtual

Interprets this node to a node of type BitRefs.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::BitRefs.

Definition at line 47 of file cqasm-v1-values-gen.cpp.

◆ as_const_axis() [1/2]

ConstAxis * cqasm::v1::values::Node::as_const_axis ( )
virtual

Interprets this node to a node of type ConstAxis.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstAxis.

Definition at line 55 of file cqasm-v1-values-gen.cpp.

◆ as_const_axis() [2/2]

const ConstAxis * cqasm::v1::values::Node::as_const_axis ( ) const
virtual

Interprets this node to a node of type ConstAxis.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstAxis.

Definition at line 63 of file cqasm-v1-values-gen.cpp.

◆ as_const_bool() [1/2]

ConstBool * cqasm::v1::values::Node::as_const_bool ( )
virtual

Interprets this node to a node of type ConstBool.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstBool.

Definition at line 71 of file cqasm-v1-values-gen.cpp.

◆ as_const_bool() [2/2]

const ConstBool * cqasm::v1::values::Node::as_const_bool ( ) const
virtual

Interprets this node to a node of type ConstBool.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstBool.

Definition at line 79 of file cqasm-v1-values-gen.cpp.

◆ as_const_complex() [1/2]

ConstComplex * cqasm::v1::values::Node::as_const_complex ( )
virtual

Interprets this node to a node of type ConstComplex.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstComplex.

Definition at line 87 of file cqasm-v1-values-gen.cpp.

◆ as_const_complex() [2/2]

const ConstComplex * cqasm::v1::values::Node::as_const_complex ( ) const
virtual

Interprets this node to a node of type ConstComplex.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstComplex.

Definition at line 95 of file cqasm-v1-values-gen.cpp.

◆ as_const_complex_matrix() [1/2]

ConstComplexMatrix * cqasm::v1::values::Node::as_const_complex_matrix ( )
virtual

Interprets this node to a node of type ConstComplexMatrix.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstComplexMatrix.

Definition at line 103 of file cqasm-v1-values-gen.cpp.

◆ as_const_complex_matrix() [2/2]

const ConstComplexMatrix * cqasm::v1::values::Node::as_const_complex_matrix ( ) const
virtual

Interprets this node to a node of type ConstComplexMatrix.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstComplexMatrix.

Definition at line 111 of file cqasm-v1-values-gen.cpp.

◆ as_const_int() [1/2]

ConstInt * cqasm::v1::values::Node::as_const_int ( )
virtual

Interprets this node to a node of type ConstInt.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstInt.

Definition at line 119 of file cqasm-v1-values-gen.cpp.

◆ as_const_int() [2/2]

const ConstInt * cqasm::v1::values::Node::as_const_int ( ) const
virtual

Interprets this node to a node of type ConstInt.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstInt.

Definition at line 127 of file cqasm-v1-values-gen.cpp.

◆ as_const_json() [1/2]

ConstJson * cqasm::v1::values::Node::as_const_json ( )
virtual

Interprets this node to a node of type ConstJson.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstJson.

Definition at line 135 of file cqasm-v1-values-gen.cpp.

◆ as_const_json() [2/2]

const ConstJson * cqasm::v1::values::Node::as_const_json ( ) const
virtual

Interprets this node to a node of type ConstJson.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstJson.

Definition at line 143 of file cqasm-v1-values-gen.cpp.

◆ as_const_real() [1/2]

ConstReal * cqasm::v1::values::Node::as_const_real ( )
virtual

Interprets this node to a node of type ConstReal.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstReal.

Definition at line 151 of file cqasm-v1-values-gen.cpp.

◆ as_const_real() [2/2]

const ConstReal * cqasm::v1::values::Node::as_const_real ( ) const
virtual

Interprets this node to a node of type ConstReal.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstReal.

Definition at line 159 of file cqasm-v1-values-gen.cpp.

◆ as_const_real_matrix() [1/2]

ConstRealMatrix * cqasm::v1::values::Node::as_const_real_matrix ( )
virtual

Interprets this node to a node of type ConstRealMatrix.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstRealMatrix.

Definition at line 167 of file cqasm-v1-values-gen.cpp.

◆ as_const_real_matrix() [2/2]

const ConstRealMatrix * cqasm::v1::values::Node::as_const_real_matrix ( ) const
virtual

Interprets this node to a node of type ConstRealMatrix.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstRealMatrix.

Definition at line 175 of file cqasm-v1-values-gen.cpp.

◆ as_const_string() [1/2]

ConstString * cqasm::v1::values::Node::as_const_string ( )
virtual

Interprets this node to a node of type ConstString.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstString.

Definition at line 183 of file cqasm-v1-values-gen.cpp.

◆ as_const_string() [2/2]

const ConstString * cqasm::v1::values::Node::as_const_string ( ) const
virtual

Interprets this node to a node of type ConstString.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::ConstString.

Definition at line 191 of file cqasm-v1-values-gen.cpp.

◆ as_constant() [1/2]

Constant * cqasm::v1::values::Node::as_constant ( )
virtual

Interprets this node to a node of type Constant.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::Constant.

Definition at line 199 of file cqasm-v1-values-gen.cpp.

◆ as_constant() [2/2]

const Constant * cqasm::v1::values::Node::as_constant ( ) const
virtual

Interprets this node to a node of type Constant.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::Constant.

Definition at line 207 of file cqasm-v1-values-gen.cpp.

◆ as_function() [1/2]

Function * cqasm::v1::values::Node::as_function ( )
virtual

Interprets this node to a node of type Function.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::Function.

Definition at line 215 of file cqasm-v1-values-gen.cpp.

◆ as_function() [2/2]

const Function * cqasm::v1::values::Node::as_function ( ) const
virtual

Interprets this node to a node of type Function.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::Function.

Definition at line 223 of file cqasm-v1-values-gen.cpp.

◆ as_qubit_refs() [1/2]

QubitRefs * cqasm::v1::values::Node::as_qubit_refs ( )
virtual

Interprets this node to a node of type QubitRefs.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::QubitRefs.

Definition at line 231 of file cqasm-v1-values-gen.cpp.

◆ as_qubit_refs() [2/2]

const QubitRefs * cqasm::v1::values::Node::as_qubit_refs ( ) const
virtual

Interprets this node to a node of type QubitRefs.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::QubitRefs.

Definition at line 239 of file cqasm-v1-values-gen.cpp.

◆ as_reference() [1/2]

Reference * cqasm::v1::values::Node::as_reference ( )
virtual

Interprets this node to a node of type Reference.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::Reference.

Definition at line 247 of file cqasm-v1-values-gen.cpp.

◆ as_reference() [2/2]

const Reference * cqasm::v1::values::Node::as_reference ( ) const
virtual

Interprets this node to a node of type Reference.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::Reference.

Definition at line 255 of file cqasm-v1-values-gen.cpp.

◆ as_variable_ref() [1/2]

VariableRef * cqasm::v1::values::Node::as_variable_ref ( )
virtual

Interprets this node to a node of type VariableRef.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::VariableRef.

Definition at line 263 of file cqasm-v1-values-gen.cpp.

◆ as_variable_ref() [2/2]

const VariableRef * cqasm::v1::values::Node::as_variable_ref ( ) const
virtual

Interprets this node to a node of type VariableRef.

Returns null if it has the wrong type.

Reimplemented in cqasm::v1::values::VariableRef.

Definition at line 271 of file cqasm-v1-values-gen.cpp.

◆ serialize()

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

◆ deserialize()

std::shared_ptr< Node > cqasm::v1::values::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 278 of file cqasm-v1-values-gen.cpp.


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