From 312b7f1b4ba9d79a66459221ffa53db9da1cdee9 Mon Sep 17 00:00:00 2001 From: sjdilkes Date: Tue, 5 Sep 2023 11:34:01 +0100 Subject: [PATCH] add MetaOp::is_equal --- tket/include/tket/Ops/MetaOp.hpp | 4 ++++ tket/src/Ops/MetaOp.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/tket/include/tket/Ops/MetaOp.hpp b/tket/include/tket/Ops/MetaOp.hpp index 64b5616889..7b49bb3570 100644 --- a/tket/include/tket/Ops/MetaOp.hpp +++ b/tket/include/tket/Ops/MetaOp.hpp @@ -37,6 +37,10 @@ class MetaOp : public Op { bool is_clifford() const override; ~MetaOp() override; + /** + * Equality check between two MetaOp instances + */ + bool is_equal(const Op &other) const override; private: op_signature_t diff --git a/tket/src/Ops/MetaOp.cpp b/tket/src/Ops/MetaOp.cpp index 2ab18d04ca..255568d1e8 100644 --- a/tket/src/Ops/MetaOp.cpp +++ b/tket/src/Ops/MetaOp.cpp @@ -45,4 +45,9 @@ bool MetaOp::is_clifford() const { return true; } MetaOp::~MetaOp() {} +bool MetaOp::is_equal(const Op& op_other) const { + const MetaOp& other = dynamic_cast(op_other); + return (get_signature() == other.get_signature()); +} + } // namespace tket