Moved the AFBClient to singleton
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>
Thu, 14 Sep 2017 12:04:35 +0000 (14:04 +0200)
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>
Thu, 14 Sep 2017 12:04:35 +0000 (14:04 +0200)
original author is Aurelian.

Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
AFBClient.cpp
AFBClient.h

index c4b32db..e67e74b 100644 (file)
@@ -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 */
index fa88663..1005432 100644 (file)
@@ -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);