1 #ifndef __DALI_SIGNAL_SLOT_CONNECTIONS_H__
2 #define __DALI_SIGNAL_SLOT_CONNECTIONS_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/signals/signal-slot-observers.h>
30 * @brief Slot connection is the connection information held by a connection tracker.
32 * A slot can have zero to many connection objects, depending
33 * on how many signals it is connected to.
35 * A connection contains:
37 * - SlotObserver -interface provided by the signal
39 * It holds a pointer to the callback, but does not own it.
41 class DALI_IMPORT_API SlotConnection
48 * @param[in] slotObserver The slot observer.
49 * @param[in] callback A callback object (not owned).
51 SlotConnection(SlotObserver* slotObserver, CallbackBase* callback);
54 * @brief Non-virtual destructor, not intended as a base class.
59 * @brief Retrieve the callback.
61 * @return A pointer to the callback.
63 CallbackBase* GetCallback();
66 * @brief Retrieve the slot observer.
68 * @return A pointer to the slot observer.
70 SlotObserver* GetSlotObserver();
74 SlotConnection( const SlotConnection& ); ///< undefined copy constructor
75 SlotConnection& operator=( const SlotConnection& ); ///< undefined assignment operator
79 SlotObserver* mSlotObserver; ///< a pointer to the slot observer (not owned)
80 CallbackBase* mCallback; ///< The callback. This is not owned, the corresponding SignalConnection has ownership.
84 * @brief SignalConnection is the connection information held by the signal.
86 * A signal can have zero to many connections, depending on how
87 * many slots are connected to this signal.
89 * A connection contains:
91 * - SignalObserver - interface provided by a slot owning object.
93 * It takes ownership of the callback, and will delete it when
94 * the connection is destroyed.
96 class DALI_IMPORT_API SignalConnection
101 * @brief Constructor.
103 * @param[in] callback The callback which should be a C function.
105 SignalConnection( CallbackBase* callback );
108 * @brief Constructor.
110 * @param[in] signalObserver The signal observer.
111 * @param[in] callback Ownership of this callback object is taken.
113 SignalConnection( SignalObserver* signalObserver, CallbackBase* callback );
116 * @brief Non-virtual destructor, not intended as a base class.
121 * @brief Disconnect the signal from the slot.
123 * @param[in] slotObserver The signal disconnecting from the slot.
125 void Disconnect( SlotObserver* slotObserver );
128 * @brief Retrieve the callback.
130 * @return A pointer to the callback.
132 CallbackBase* GetCallback();
136 SignalConnection( const SignalConnection& ); ///< undefined copy constructor
137 SignalConnection& operator=( const SignalConnection& ); ///< undefined assignment operator
141 SignalObserver* mSignalObserver; ///< a pointer to the signal observer (not owned)
142 CallbackBase* mCallback; ///< The callback, has ownership.
147 #endif // __DALI_SIGNAL_SLOT_CONNECTIONS_H__