Merge branch 'devel/master' into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / signals / connection-tracker.h
1 #ifndef DALI_CONNECTION_TRACKER_H
2 #define DALI_CONNECTION_TRACKER_H
3
4 /*
5  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <cstddef> // for std::size_t
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/dali-common.h>
26 #include <dali/public-api/signals/connection-tracker-interface.h>
27 #include <dali/public-api/signals/signal-slot-observers.h>
28
29 namespace Dali
30 {
31 /**
32  * @addtogroup dali_core_signals
33  * @{
34  */
35
36 class CallbackBase;
37 class SlotObserver;
38
39 /**
40  * @brief Connection tracker concrete implementation.
41  * @SINCE_1_0.0
42  */
43 class DALI_CORE_API ConnectionTracker : public ConnectionTrackerInterface
44 {
45 public:
46   /**
47    * @brief Constructor.
48    * @SINCE_1_0.0
49    */
50   ConnectionTracker();
51
52   /**
53    * @brief Virtual destructor.
54    * @SINCE_1_0.0
55    */
56   ~ConnectionTracker() override;
57
58   /**
59    * @brief Disconnects all signals from this object.
60    * @SINCE_1_0.0
61    */
62   void DisconnectAll();
63
64   /**
65    * @copydoc ConnectionTrackerInterface::SignalConnected
66    */
67   void SignalConnected(SlotObserver* slotObserver, CallbackBase* callback) override;
68
69   /**
70    * @copydoc ConnectionTrackerInterface::SignalDisconnected
71    */
72   void SignalDisconnected(SlotObserver* slotObserver, CallbackBase* callback) override;
73
74   /**
75    * @brief Returns the connection count.
76    * @SINCE_1_0.0
77    * @return The connection count
78    */
79   std::size_t GetConnectionCount() const;
80
81 private:
82   ConnectionTracker(const ConnectionTracker&) = delete;            ///< Deleted copy constructor. @SINCE_1_0.0
83   ConnectionTracker(ConnectionTracker&&)      = delete;            ///< Deleted move constructor. @SINCE_1_9.25
84   ConnectionTracker& operator=(const ConnectionTracker&) = delete; ///< Deleted copy assignment operator. @SINCE_1_0.0
85   ConnectionTracker& operator=(ConnectionTracker&&) = delete;      ///< Deleted move assignment operator. @SINCE_1_9.25
86
87 private:
88   struct DALI_INTERNAL Impl;
89   Impl*                mCacheImpl; ///< Private internal extra data.
90 };
91
92 /**
93  * @}
94  */
95 } // namespace Dali
96
97 #endif // DALI_CONNECTION_TRACKER_H