summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2021-05-08 12:11:38 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2021-05-08 13:25:11 +0200
commit0989a657c25476f2ab80448b094ef0dd5c9c0beb (patch)
treebee4903f318432157962239b671d7af09f3653a3 /include
parent567156b05183cc63aedbf57c03f26e0eaf43a39e (diff)
FRP: functions to retrieve and compare BhvTime
Diffstat (limited to 'include')
-rw-r--r--include/erebos/frp.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/erebos/frp.h b/include/erebos/frp.h
index b60b29f..466da33 100644
--- a/include/erebos/frp.h
+++ b/include/erebos/frp.h
@@ -17,15 +17,24 @@ using std::monostate;
using std::optional;
using std::shared_ptr;
using std::static_pointer_cast;
-using std::tuple;
using std::vector;
using std::weak_ptr;
+class BhvCurTime;
+
class BhvTime
{
BhvTime(uint64_t t): t(t) {}
- friend class BhvCurTime;
+ friend BhvCurTime;
public:
+ BhvTime(const BhvCurTime &);
+
+ bool operator==(const BhvTime & other) const { return t == other.t; }
+ bool operator!=(const BhvTime & other) const { return t != other.t; }
+ bool operator<(const BhvTime & other) const { return t < other.t; }
+ bool operator<=(const BhvTime & other) const { return t <= other.t; }
+ bool operator>(const BhvTime & other) const { return t > other.t; }
+ bool operator>=(const BhvTime & other) const { return t >= other.t; }
private:
uint64_t t;
@@ -42,6 +51,8 @@ public:
BhvCurTime & operator=(const BhvCurTime &) = delete;
BhvCurTime & operator=(BhvCurTime &&);
+ BhvTime time() const { return t.value(); }
+
private:
optional<BhvTime> t;
};