From 67df8203b206ef5aeef860a0447103600ea69700 Mon Sep 17 00:00:00 2001 From: Marcus Fritzsch Date: Thu, 14 Sep 2017 14:04:35 +0200 Subject: [PATCH] Moved the AFBClient to singleton original author is Aurelian. Signed-off-by: Marcus Fritzsch --- AFBClient.cpp | 10 ++++++++++ AFBClient.h | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/AFBClient.cpp b/AFBClient.cpp index c4b32db..e67e74b 100644 --- a/AFBClient.cpp +++ b/AFBClient.cpp @@ -18,6 +18,16 @@ AFBClient::AFBClient() : itf() itf.on_event = AFBClient::onEvent; } +AFBClient& AFBClient::operator =(const AFBClient &that) +{ + itf = that.itf; + return *this; +} + +AFBClient::~AFBClient() +{ +} + bool AFBClient::init() { /* get the default event loop */ diff --git a/AFBClient.h b/AFBClient.h index fa88663..1005432 100644 --- a/AFBClient.h +++ b/AFBClient.h @@ -15,8 +15,18 @@ extern "C" class AFBClient { + explicit AFBClient(); + AFBClient(const AFBClient& that) = delete; + AFBClient& operator=(AFBClient const&); + virtual~AFBClient(); + public: - AFBClient(); + static AFBClient &instance() + { + static AFBClient obj; + return obj; + } + bool init(); void requestSurface(const char *label); void activateSurface(const char *label); -- 2.16.6