From 8a0b0cb3d7d564daec6ad3e0ec3aaa69866e0f26 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 23 Jul 2017 22:13:41 -0400 Subject: [PATCH] Extended both classes to allow copy assignment, copy construction and implicit zero-length construction. --- Components/ClockReceiver.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Components/ClockReceiver.hpp b/Components/ClockReceiver.hpp index 2e2a0501d..6334889e9 100644 --- a/Components/ClockReceiver.hpp +++ b/Components/ClockReceiver.hpp @@ -13,8 +13,15 @@ class Cycles { public: Cycles(int l) : length_(l) {} + Cycles(const Cycles &cycles) : length_(int(cycles)) {} + Cycles() : length_(0) {} operator int() const { return length_; } + Cycles &operator =(const Cycles &cycles) { + length_ = cycles.length_; + return *this; + } + private: int length_; }; @@ -24,6 +31,14 @@ class HalfCycles { public: HalfCycles(int l) : length_(l) {} HalfCycles(const Cycles &cycles) : length_(int(cycles) << 1) {} + HalfCycles(const HalfCycles &half_cycles) : length_(int(half_cycles)) {} + HalfCycles() : length_(0) {} + + HalfCycles &operator =(const HalfCycles &half_cycles) { + length_ = half_cycles.length_; + return *this; + } + operator int() const { return length_; } private: