From 9aa116b885081311d8813daca48bf0c1d8de0c1e Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 15 Apr 2019 11:17:26 +0200 Subject: [PATCH] Enforce RsEvent not being instantiable without inheriting --- libretroshare/src/retroshare/rsevents.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libretroshare/src/retroshare/rsevents.h b/libretroshare/src/retroshare/rsevents.h index d441936a6..edf1ea8fa 100644 --- a/libretroshare/src/retroshare/rsevents.h +++ b/libretroshare/src/retroshare/rsevents.h @@ -59,11 +59,13 @@ enum class RsEventType : uint32_t */ struct RsEvent : RsSerializable { - RsEvent() = delete; +protected: RsEvent(RsEventType type) : mType(type), mTimePoint(std::chrono::system_clock::now()) {} - virtual ~RsEvent(); + RsEvent() = delete; + +public: RsEventType mType; std::chrono::system_clock::time_point mTimePoint; @@ -81,6 +83,8 @@ struct RsEvent : RsSerializable RS_SERIAL_PROCESS(mTime); mTimePoint = std::chrono::system_clock::from_time_t(mTime); } + + virtual ~RsEvent(); }; typedef uint32_t RsEventsHandlerId_t;