Skip to content

Commit

Permalink
🚨 change reference members to pointer type in ApplicationScheme
Browse files Browse the repository at this point in the history
Signed-off-by: burgholzer <[email protected]>
  • Loading branch information
burgholzer committed Jan 5, 2024
1 parent a319430 commit 15385e0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions include/checker/dd/applicationscheme/ApplicationScheme.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ template <class DDType, class Config> class ApplicationScheme {

public:
ApplicationScheme(TM& tm1, TM& tm2) noexcept
: taskManager1(tm1), taskManager2(tm2){};
: taskManager1(&tm1), taskManager2(&tm2){};

virtual ~ApplicationScheme() = default;

// get how many gates from either circuit shall be applied next
virtual std::pair<std::size_t, std::size_t> operator()() = 0;

protected:
TM& taskManager1;
TM& taskManager2;
TM* taskManager1;
TM* taskManager2;
};

} // namespace ec
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class GateCostApplicationScheme final
return {1U, 1U};
}

const auto& op = this->taskManager1();
const auto& op = (*this->taskManager1)();
const auto key =
GateCostLookupTableKeyType{op->getType(), op->getNcontrols()};
std::size_t cost = 1U;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class LookaheadApplicationScheme final

if (!cached1) {
// cache the current operation
op1 = this->taskManager1.getDD();
op1 = this->taskManager1->getDD();
package->incRef(op1);
cached1 = true;
}

if (!cached2) {
// cache the current operation
op2 = this->taskManager2.getInverseDD();
op2 = this->taskManager2->getInverseDD();
package->incRef(op2);
cached2 = true;
}
Expand All @@ -54,13 +54,13 @@ class LookaheadApplicationScheme final
*internalState = dd1;
package->decRef(op1);
cached1 = false;
this->taskManager1.advanceIterator();
this->taskManager1->advanceIterator();
} else {
assert(!this->taskManager2.finished());
*internalState = dd2;
package->decRef(op2);
cached2 = false;
this->taskManager2.advanceIterator();
this->taskManager2->advanceIterator();
}

// properly track reference counts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class ProportionalApplicationScheme final

private:
[[nodiscard]] std::size_t computeGateRatio() const noexcept {
const std::size_t size1 = this->taskManager1.getCircuit()->size();
const std::size_t size2 = this->taskManager2.getCircuit()->size();
const std::size_t size1 = this->taskManager1->getCircuit()->size();
const std::size_t size2 = this->taskManager2->getCircuit()->size();
if (size1 == 0U) {
return size2;
}
Expand Down

0 comments on commit 15385e0

Please sign in to comment.