libqasm
library for handling cQASM files
|
A C-style for loop. More...
Public Member Functions | |
ForLoop (const Maybe< SetInstruction > &initialize=Maybe< SetInstruction >(), const One< cqasm::v1::values::Node > &condition=cqasm::v1::primitives::initialize< One< cqasm::v1::values::Node >>(), const Maybe< SetInstruction > &update=Maybe< SetInstruction >(), const One< Block > &body=One< Block >(), const Any< AnnotationData > &annotations=Any< AnnotationData >()) | |
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 ForLoop is complete/fully defined. More... | |
NodeType | type () const override |
Returns the NodeType of this node. More... | |
ForLoop * | as_for_loop () override |
Interprets this node to a node of type ForLoop. More... | |
const ForLoop * | as_for_loop () const override |
Interprets this node to a node of type ForLoop. More... | |
One< Node > | copy () const override |
Returns a shallow copy of this node. More... | |
One< Node > | clone () 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... | |
![]() | |
Structured (const Any< AnnotationData > &annotations=Any< AnnotationData >()) | |
Constructor. More... | |
Structured * | as_structured () override |
Interprets this node to a node of type Structured. More... | |
const Structured * | as_structured () const override |
Interprets this node to a node of type Structured. More... | |
![]() | |
Statement (const Any< AnnotationData > &annotations=Any< AnnotationData >()) | |
Constructor. More... | |
Statement * | as_statement () override |
Interprets this node to a node of type Statement. More... | |
const Statement * | as_statement () const override |
Interprets this node to a node of type Statement. More... | |
![]() | |
Annotated (const Any< AnnotationData > &annotations=Any< AnnotationData >()) | |
Constructor. More... | |
Annotated * | as_annotated () override |
Interprets this node to a node of type Annotated. More... | |
const Annotated * | as_annotated () const override |
Interprets this node to a node of type Annotated. 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 AnnotationData * | as_annotation_data () |
Interprets this node to a node of type AnnotationData. More... | |
virtual const AnnotationData * | as_annotation_data () const |
Interprets this node to a node of type AnnotationData. More... | |
virtual Block * | as_block () |
Interprets this node to a node of type Block. More... | |
virtual const Block * | as_block () const |
Interprets this node to a node of type Block. More... | |
virtual BreakStatement * | as_break_statement () |
Interprets this node to a node of type BreakStatement. More... | |
virtual const BreakStatement * | as_break_statement () const |
Interprets this node to a node of type BreakStatement. More... | |
virtual Bundle * | as_bundle () |
Interprets this node to a node of type Bundle. More... | |
virtual const Bundle * | as_bundle () const |
Interprets this node to a node of type Bundle. More... | |
virtual BundleExt * | as_bundle_ext () |
Interprets this node to a node of type BundleExt. More... | |
virtual const BundleExt * | as_bundle_ext () const |
Interprets this node to a node of type BundleExt. More... | |
virtual ContinueStatement * | as_continue_statement () |
Interprets this node to a node of type ContinueStatement. More... | |
virtual const ContinueStatement * | as_continue_statement () const |
Interprets this node to a node of type ContinueStatement. More... | |
virtual ErrorModel * | as_error_model () |
Interprets this node to a node of type ErrorModel. More... | |
virtual const ErrorModel * | as_error_model () const |
Interprets this node to a node of type ErrorModel. More... | |
virtual ForeachLoop * | as_foreach_loop () |
Interprets this node to a node of type ForeachLoop. More... | |
virtual const ForeachLoop * | as_foreach_loop () const |
Interprets this node to a node of type ForeachLoop. More... | |
virtual GotoInstruction * | as_goto_instruction () |
Interprets this node to a node of type GotoInstruction. More... | |
virtual const GotoInstruction * | as_goto_instruction () const |
Interprets this node to a node of type GotoInstruction. More... | |
virtual IfElse * | as_if_else () |
Interprets this node to a node of type IfElse. More... | |
virtual const IfElse * | as_if_else () const |
Interprets this node to a node of type IfElse. More... | |
virtual IfElseBranch * | as_if_else_branch () |
Interprets this node to a node of type IfElseBranch. More... | |
virtual const IfElseBranch * | as_if_else_branch () const |
Interprets this node to a node of type IfElseBranch. More... | |
virtual Instruction * | as_instruction () |
Interprets this node to a node of type Instruction. More... | |
virtual const Instruction * | as_instruction () const |
Interprets this node to a node of type Instruction. More... | |
virtual InstructionBase * | as_instruction_base () |
Interprets this node to a node of type InstructionBase. More... | |
virtual const InstructionBase * | as_instruction_base () const |
Interprets this node to a node of type InstructionBase. More... | |
virtual Mapping * | as_mapping () |
Interprets this node to a node of type Mapping. More... | |
virtual const Mapping * | as_mapping () const |
Interprets this node to a node of type Mapping. More... | |
virtual Program * | as_program () |
Interprets this node to a node of type Program. More... | |
virtual const Program * | as_program () const |
Interprets this node to a node of type Program. More... | |
virtual RepeatUntilLoop * | as_repeat_until_loop () |
Interprets this node to a node of type RepeatUntilLoop. More... | |
virtual const RepeatUntilLoop * | as_repeat_until_loop () const |
Interprets this node to a node of type RepeatUntilLoop. More... | |
virtual SetInstruction * | as_set_instruction () |
Interprets this node to a node of type SetInstruction. More... | |
virtual const SetInstruction * | as_set_instruction () const |
Interprets this node to a node of type SetInstruction. More... | |
virtual Subcircuit * | as_subcircuit () |
Interprets this node to a node of type Subcircuit. More... | |
virtual const Subcircuit * | as_subcircuit () const |
Interprets this node to a node of type Subcircuit. More... | |
virtual Variable * | as_variable () |
Interprets this node to a node of type Variable. More... | |
virtual const Variable * | as_variable () const |
Interprets this node to a node of type Variable. More... | |
virtual Version * | as_version () |
Interprets this node to a node of type Version. More... | |
virtual const Version * | as_version () const |
Interprets this node to a node of type Version. More... | |
virtual WhileLoop * | as_while_loop () |
Interprets this node to a node of type WhileLoop. More... | |
virtual const WhileLoop * | as_while_loop () const |
Interprets this node to a node of type WhileLoop. More... | |
Static Public Member Functions | |
static std::shared_ptr< ForLoop > | deserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids) |
Deserializes the given node. More... | |
![]() | |
static std::shared_ptr< Structured > | deserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids) |
Deserializes the given node. More... | |
![]() | |
static std::shared_ptr< Statement > | deserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids) |
Deserializes the given node. More... | |
![]() | |
static std::shared_ptr< Annotated > | deserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids) |
Deserializes the given node. More... | |
![]() | |
static std::shared_ptr< Node > | deserialize (const ::tree::cbor::MapReader &map, ::tree::base::IdentifierMap &ids) |
Deserializes the given node. More... | |
Public Attributes | |
Maybe< SetInstruction > | initialize |
The optional initializing assignment, run before the loop starts. More... | |
One< cqasm::v1::values::Node > | condition |
The condition for starting another iteration. More... | |
Maybe< SetInstruction > | update |
The updating assignment, done at the end of the loop body and upon continue. More... | |
One< Block > | body |
The loop body. More... | |
![]() | |
Any< AnnotationData > | annotations |
Zero or more annotations attached to this object. More... | |
Protected Member Functions | |
void | visit_internal (VisitorBase &visitor, void *retval) override |
Helper method for visiting nodes. More... | |
A C-style for loop.
Definition at line 1323 of file cqasm-v1-semantic-gen.hpp.
#include <cqasm-v1-semantic-gen.hpp>
cqasm::v1::semantic::ForLoop::ForLoop | ( | const Maybe< SetInstruction > & | initialize = Maybe<SetInstruction>() , |
const One< cqasm::v1::values::Node > & | condition = cqasm::v1::primitives::initialize<One<cqasm::v1::values::Node>>() , |
||
const Maybe< SetInstruction > & | update = Maybe<SetInstruction>() , |
||
const One< Block > & | body = One<Block>() , |
||
const Any< AnnotationData > & | annotations = Any<AnnotationData>() |
||
) |
Constructor.
Definition at line 1483 of file cqasm-v1-semantic-gen.cpp.
|
override |
Registers all reachable nodes with the given PointerMap.
Definition at line 1490 of file cqasm-v1-semantic-gen.cpp.
|
override |
Returns whether this ForLoop
is complete/fully defined.
Definition at line 1502 of file cqasm-v1-semantic-gen.cpp.
|
overridevirtual |
Returns the NodeType
of this node.
Implements cqasm::v1::semantic::Node.
Definition at line 1514 of file cqasm-v1-semantic-gen.cpp.
|
overrideprotectedvirtual |
Helper method for visiting nodes.
Implements cqasm::v1::semantic::Node.
Definition at line 1521 of file cqasm-v1-semantic-gen.cpp.
|
overridevirtual |
Interprets this node to a node of type ForLoop.
Returns null if it has the wrong type.
Reimplemented from cqasm::v1::semantic::Node.
Definition at line 1529 of file cqasm-v1-semantic-gen.cpp.
|
overridevirtual |
Interprets this node to a node of type ForLoop.
Returns null if it has the wrong type.
Reimplemented from cqasm::v1::semantic::Node.
Definition at line 1537 of file cqasm-v1-semantic-gen.cpp.
Returns a shallow copy of this node.
Implements cqasm::v1::semantic::Node.
Definition at line 1544 of file cqasm-v1-semantic-gen.cpp.
Returns a deep copy of this node.
Implements cqasm::v1::semantic::Node.
Definition at line 1551 of file cqasm-v1-semantic-gen.cpp.
|
overridevirtual |
Value-based equality operator.
Ignores annotations!
Implements cqasm::v1::semantic::Node.
Definition at line 1564 of file cqasm-v1-semantic-gen.cpp.
|
overridevirtual |
Pointer-based equality operator.
Implements cqasm::v1::semantic::Node.
Definition at line 1578 of file cqasm-v1-semantic-gen.cpp.
|
overridevirtual |
Serializes this node to the given map.
Implements cqasm::v1::semantic::Node.
Definition at line 1592 of file cqasm-v1-semantic-gen.cpp.
|
static |
Deserializes the given node.
Writes a debug dump of this node to the given stream.
Definition at line 1619 of file cqasm-v1-semantic-gen.cpp.
Maybe<SetInstruction> cqasm::v1::semantic::ForLoop::initialize |
The optional initializing assignment, run before the loop starts.
Definition at line 1329 of file cqasm-v1-semantic-gen.hpp.
One<cqasm::v1::values::Node> cqasm::v1::semantic::ForLoop::condition |
The condition for starting another iteration.
Definition at line 1334 of file cqasm-v1-semantic-gen.hpp.
Maybe<SetInstruction> cqasm::v1::semantic::ForLoop::update |
The updating assignment, done at the end of the loop body and upon continue.
Definition at line 1340 of file cqasm-v1-semantic-gen.hpp.
The loop body.
Definition at line 1345 of file cqasm-v1-semantic-gen.hpp.