GCC Code Coverage Report


Directory: ./
File: Ops/include/Ops/MetaOp.hpp
Date: 2022-10-15 05:10:18
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%
Decisions: 0 0 -%

Line Branch Decision Exec Source
1 // Copyright 2019-2022 Cambridge Quantum Computing
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #pragma once
16
17 #include "Op.hpp"
18 #include "Utils/Json.hpp"
19
20 namespace tket {
21
22 class MetaOp : public Op {
23 public:
24 explicit MetaOp(
25 OpType type, op_signature_t signature = {},
26 const std::string &_data = "");
27
28 Op_ptr symbol_substitution(
29 const SymEngine::map_basic_basic &sub_map) const override;
30
31 SymSet free_symbols() const override;
32
33 unsigned n_qubits() const override;
34
35 op_signature_t get_signature() const override;
36
37 2 std::string get_data() const { return data_; }
38
39 bool is_clifford() const override;
40
41 ~MetaOp() override;
42
43 /**
44 * Equality check between two MetaOp instances
45 */
46 bool is_equal(const Op &other) const override;
47
48 nlohmann::json serialize() const override;
49
50 static Op_ptr deserialize(const nlohmann::json &j);
51
52 protected:
53 MetaOp();
54
55 private:
56 op_signature_t
57 signature_; /**< Types of inputs, when not deducible from op type */
58 /**
59 * additional data given by the user, can be passed on to backend
60 */
61 const std::string data_;
62 };
63
64 } // namespace tket
65