libqasm
library for handling cQASM files
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
cqasm::v1::values::Function Class Reference

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...

Public Member Functions

 Function (const cqasm::v1::primitives::Str &name=cqasm::v1::primitives::initialize< cqasm::v1::primitives::Str >(), const Any< cqasm::v1::values::Node > &operands=cqasm::v1::primitives::initialize< Any< cqasm::v1::values::Node >>(), const One< cqasm::v1::types::Node > &return_type=cqasm::v1::primitives::initialize< One< cqasm::v1::types::Node >>())
 Constructor. More...
 
void find_reachable (::tree::base::PointerMap &map) const override
 Registers all reachable nodes with the given PointerMap. More...
 
void check_complete (const ::tree::base::PointerMap &map) const override
 Returns whether this Function is complete/fully defined. More...
 
NodeType type () const override
 Returns the NodeType of this node. More...
 
Functionas_function () override
 Interprets this node to a node of type Function. More...
 
const Functionas_function () const override
 Interprets this node to a node of type Function. More...
 
One< Nodecopy () const override
 Returns a shallow copy of this node. More...
 
One< Nodeclone () const override
 Returns a deep copy of this node. More...
 
bool equals (const Node &rhs) const override
 Value-based equality operator. More...
 
bool operator== (const Node &rhs) const override
 Pointer-based equality operator. More...
 
void serialize (::tree::cbor::MapWriter &map, const ::tree::base::PointerMap &ids) const override
 Serializes this node to the given map. More...
 
- Public Member Functions inherited from cqasm::v1::values::Node
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 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...
 

Static Public Member Functions

static std::shared_ptr< Functiondeserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids)
 Deserializes the given node. More...
 
- Static Public Member Functions inherited from cqasm::v1::values::Node
static std::shared_ptr< Nodedeserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids)
 Deserializes the given node. More...
 

Public Attributes

cqasm::v1::primitives::Str name
 Name of the function as it appears or should appear in the cQASM file. More...
 
Any< cqasm::v1::values::Nodeoperands
 Operands for the function. More...
 
One< cqasm::v1::types::Nodereturn_type
 Operands for the function. More...
 

Protected Member Functions

void visit_internal (VisitorBase &visitor, void *retval) override
 Helper method for visiting nodes. More...
 

Detailed Description

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.

Annotations should be used to attach semantic information.

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

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

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

Constructor & Destructor Documentation

◆ Function()

Constructor.

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

Member Function Documentation

◆ find_reachable()

void cqasm::v1::values::Function::find_reachable ( ::tree::base::PointerMap &  map) const
override

Registers all reachable nodes with the given PointerMap.

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

◆ check_complete()

void cqasm::v1::values::Function::check_complete ( const ::tree::base::PointerMap &  map) const
override

Returns whether this Function is complete/fully defined.

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

◆ type()

NodeType cqasm::v1::values::Function::type ( ) const
overridevirtual

Returns the NodeType of this node.

Implements cqasm::v1::values::Node.

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

◆ visit_internal()

void cqasm::v1::values::Function::visit_internal ( VisitorBase visitor,
void *  retval 
)
overrideprotectedvirtual

Helper method for visiting nodes.

Implements cqasm::v1::values::Node.

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

◆ as_function() [1/2]

Function * cqasm::v1::values::Function::as_function ( )
overridevirtual

Interprets this node to a node of type Function.

Returns null if it has the wrong type.

Reimplemented from cqasm::v1::values::Node.

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

◆ as_function() [2/2]

const Function * cqasm::v1::values::Function::as_function ( ) const
overridevirtual

Interprets this node to a node of type Function.

Returns null if it has the wrong type.

Reimplemented from cqasm::v1::values::Node.

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

◆ copy()

One< Node > cqasm::v1::values::Function::copy ( ) const
overridevirtual

Returns a shallow copy of this node.

Implements cqasm::v1::values::Node.

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

◆ clone()

One< Node > cqasm::v1::values::Function::clone ( ) const
overridevirtual

Returns a deep copy of this node.

Implements cqasm::v1::values::Node.

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

◆ equals()

bool cqasm::v1::values::Function::equals ( const Node rhs) const
overridevirtual

Value-based equality operator.

Ignores annotations!

Implements cqasm::v1::values::Node.

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

◆ operator==()

bool cqasm::v1::values::Function::operator== ( const Node rhs) const
overridevirtual

Pointer-based equality operator.

Implements cqasm::v1::values::Node.

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

◆ serialize()

void cqasm::v1::values::Function::serialize ( ::tree::cbor::MapWriter &  map,
const ::tree::base::PointerMap &  ids 
) const
overridevirtual

Serializes this node to the given map.

Implements cqasm::v1::values::Node.

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

◆ deserialize()

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

Member Data Documentation

◆ name

cqasm::v1::primitives::Str cqasm::v1::values::Function::name

Name of the function as it appears or should appear in the cQASM file.

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

◆ operands

Any<cqasm::v1::values::Node> cqasm::v1::values::Function::operands

Operands for the function.

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

◆ return_type

One<cqasm::v1::types::Node> cqasm::v1::values::Function::return_type

Operands for the function.

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


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