Maestro 0.1.0
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Circuits::ICondition Class Referenceabstract

Interface for a condition. More...

#include <Conditional.h>

Inheritance diagram for Circuits::ICondition:
Circuits::EqualCondition

Public Member Functions

 ICondition (const std::vector< size_t > &ind)
 Construct a new ICondition object.
virtual ~ICondition ()=default
 Virtual destructor.
virtual bool IsConditionMet (OperationState &state) const =0
 Check if the condition is met.
const std::vector< size_t > & GetBitsIndices () const
 Get the indices of the bits used in the condition.
void SetBitsIndices (const std::vector< size_t > &ind)
 Set the indices of the bits used in the condition.
virtual std::shared_ptr< IConditionClone () const =0
 Get a shared pointer to a clone of this object.
virtual std::shared_ptr< IConditionRemap (const std::unordered_map< Types::qubit_t, Types::qubit_t > &bitsMap={}) const =0
 Get a shared pointer to a remapped condition.
std::shared_ptr< IConditiongetptr ()
 Get a shared pointer to this object.

Detailed Description

Interface for a condition.

Interface for a condition that can be used to control the execution of an operation. The condition is based on a classical state (typically the result of a measurement).

Definition at line 35 of file Conditional.h.

Constructor & Destructor Documentation

◆ ICondition()

Circuits::ICondition::ICondition ( const std::vector< size_t > & ind)
inline

Construct a new ICondition object.

Construct a new ICondition object with the given indices.

Parameters
indThe indices of the bits that are used in the condition.

Definition at line 43 of file Conditional.h.

◆ ~ICondition()

virtual Circuits::ICondition::~ICondition ( )
virtualdefault

Virtual destructor.

Destroy the ICondition object. It's a virtual destructor because this class is an abstract class that needs to be derived from.

Member Function Documentation

◆ Clone()

virtual std::shared_ptr< ICondition > Circuits::ICondition::Clone ( ) const
pure virtual

Get a shared pointer to a clone of this object.

Returns a shared pointer to a copy of this object.

Returns
A shared pointer to this object.

Implemented in Circuits::EqualCondition.

◆ GetBitsIndices()

const std::vector< size_t > & Circuits::ICondition::GetBitsIndices ( ) const
inline

Get the indices of the bits used in the condition.

Get the indices of the classical bits used in the condition.

Returns
The indices of the bits used in the condition.

Definition at line 70 of file Conditional.h.

◆ getptr()

std::shared_ptr< ICondition > Circuits::ICondition::getptr ( )
inline

Get a shared pointer to this object.

Returns a shared pointer to this object. The object needs to be already wrapped in a shared pointer.

Returns
A shared pointer to this object.

Definition at line 108 of file Conditional.h.

◆ IsConditionMet()

virtual bool Circuits::ICondition::IsConditionMet ( OperationState & state) const
pure virtual

Check if the condition is met.

Check if the condition is met on the given classical state. This function must be implemented by the derived classes.

Parameters
stateThe state to check the condition against.
Returns
True if the condition is met, false otherwise.

Implemented in Circuits::EqualCondition.

◆ Remap()

virtual std::shared_ptr< ICondition > Circuits::ICondition::Remap ( const std::unordered_map< Types::qubit_t, Types::qubit_t > & bitsMap = {}) const
pure virtual

Get a shared pointer to a remapped condition.

Returns a shared pointer to a copy of the condition with classical bits changed according to the provided map.

Parameters
bitsMapThe map of classical bits to remap.
Returns
A shared pointer to the remapped object.

Implemented in Circuits::EqualCondition.

◆ SetBitsIndices()

void Circuits::ICondition::SetBitsIndices ( const std::vector< size_t > & ind)
inline

Set the indices of the bits used in the condition.

Set the indices of the classical bits used in the condition.

Parameters
indThe indices of the bits used in the condition.

Definition at line 78 of file Conditional.h.


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