refactor SlotConnection class. 04/244204/5
authorSubhransu Mohanty <sub.mohanty@samsung.com>
Tue, 15 Sep 2020 09:24:54 +0000 (18:24 +0900)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Wed, 7 Oct 2020 00:37:53 +0000 (09:37 +0900)
- make SlotConnection a trivial type so that we can keep in container by value.

Change-Id: I331a838ccef8f9fecfd1a2b26830fb3ced801ee4

dali/public-api/signals/signal-slot-connections.cpp
dali/public-api/signals/signal-slot-connections.h

index 589d0ef..1aef5dc 100644 (file)
 
 namespace Dali
 {
+
 SlotConnection::SlotConnection(SlotObserver* slotObserver, CallbackBase* callback)
 : mSlotObserver(slotObserver),
   mCallback(callback)
 {
 }
 
-SlotConnection::~SlotConnection()
-{
-}
-
-CallbackBase* SlotConnection::GetCallback()
-{
-  return mCallback;
-}
-
-SlotObserver* SlotConnection::GetSlotObserver()
-{
-  return mSlotObserver;
-}
-
 void SignalConnection::Disconnect(SlotObserver* slotObserver) noexcept
 {
   if(mSignalObserver)
index 3b34459..b063616 100644 (file)
@@ -56,18 +56,15 @@ public:
   SlotConnection(SlotObserver* slotObserver, CallbackBase* callback);
 
   /**
-   * @brief Non-virtual destructor, not intended as a base class.
-   * @SINCE_1_0.0
-   */
-  ~SlotConnection();
-
-  /**
    * @brief Retrieves the callback.
    *
    * @SINCE_1_0.0
    * @return A pointer to the callback
    */
-  CallbackBase* GetCallback();
+  CallbackBase* GetCallback() const
+  {
+    return mCallback;
+  }
 
   /**
    * @brief Retrieves the slot observer.
@@ -75,17 +72,14 @@ public:
    * @SINCE_1_0.0
    * @return A pointer to the slot observer
    */
-  SlotObserver* GetSlotObserver();
-
-private:
-  SlotConnection(const SlotConnection&) = delete;            ///< Deleted copy constructor. @SINCE_1_0.0
-  SlotConnection(SlotConnection&&)      = delete;            ///< Deleted move constructor. @SINCE_1_9.25
-  SlotConnection& operator=(const SlotConnection&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
-  SlotConnection& operator=(SlotConnection&&) = delete;      ///< Deleted move assignment operator. @SINCE_1_9.25
+  SlotObserver* GetSlotObserver() const
+  {
+    return mSlotObserver;
+  }
 
 private:
-  SlotObserver* mSlotObserver; ///< a pointer to the slot observer (not owned)
-  CallbackBase* mCallback;     ///< The callback. This is not owned, the corresponding SignalConnection has ownership.
+  SlotObserver* mSlotObserver{nullptr}; ///< a pointer to the slot observer (not owned)
+  CallbackBase* mCallback{nullptr};     ///< The callback. This is not owned, the corresponding SignalConnection has ownership.
 };
 
 /**