33 #ifndef DART_COMMON_SIGNAL_HPP_ 34 #define DART_COMMON_SIGNAL_HPP_ 40 #include "dart/common/Deprecated.hpp" 41 #include "dart/common/detail/ConnectionBody.hpp" 75 template <
typename _Signature,
template <
class>
class Combiner>
81 const std::weak_ptr<signal::detail::ConnectionBodyBase>& _connectionBody);
85 std::weak_ptr<signal::detail::ConnectionBodyBase>&& _connectionBody);
89 std::weak_ptr<signal::detail::ConnectionBodyBase> mWeakConnectionBody;
112 template <
typename _Res,
typename... _ArgTypes,
template <
class>
class Combiner>
113 class Signal<_Res(_ArgTypes...), Combiner>
116 using ResultType = _Res;
117 using SlotType = std::function<ResultType(_ArgTypes...)>;
121 using ConnectionSetType = std::set<
122 std::shared_ptr<ConnectionBodyType>,
123 std::owner_less<std::shared_ptr<ConnectionBodyType>>>;
141 void disconnect(
const std::shared_ptr<ConnectionBodyType>& connectionBody);
144 void disconnectAll();
147 DART_DEPRECATED(6.10)
148 void cleanupConnections();
153 std::size_t getNumConnections()
const;
156 template <
typename... ArgTypes>
157 ResultType
raise(ArgTypes&&... _args);
160 template <
typename... ArgTypes>
161 ResultType operator()(ArgTypes&&... _args);
165 ConnectionSetType mConnectionBodies;
169 template <
typename... _ArgTypes>
173 using SlotType = std::function<void(_ArgTypes...)>;
177 using ConnectionSetType = std::set<
178 std::shared_ptr<ConnectionBodyType>,
179 std::owner_less<std::shared_ptr<ConnectionBodyType>>>;
197 void disconnect(
const std::shared_ptr<ConnectionBodyType>& connectionBody);
200 void disconnectAll();
203 DART_DEPRECATED(6.10)
204 void cleanupConnections();
209 std::size_t getNumConnections()
const;
212 template <
typename... ArgTypes>
213 void raise(ArgTypes&&... _args);
216 template <
typename... ArgTypes>
217 void operator()(ArgTypes&&... _args);
221 ConnectionSetType mConnectionBodies;
227 template <
typename T>
231 using SlotType =
typename T::SlotType;
232 using SignalType =
typename T::SignalType;
242 typename T::SignalType& mSignal;
248 #include "dart/common/detail/Signal.hpp" 250 #endif // DART_COMMON_SIGNAL_HPP_ bool isConnected() const
Get true if the slot is connected.
Definition: Signal.cpp:95
DefaultCombiner – return the last result.
Definition: ConnectionBody.hpp:134
Connection()
Default constructor.
Definition: Signal.cpp:39
Signal implements a signal/slot mechanism for the slots don't return a value.
Definition: Signal.hpp:170
Definition: Aspect.cpp:40
Definition: Signal.hpp:109
Connection & operator=(const Connection &_other)
Assignment operator.
Definition: Signal.cpp:59
Signal implements a signal/slot mechanism.
Definition: Signal.hpp:113
void disconnect() const
Disconnect the connection.
Definition: Signal.cpp:101
SlotRegister can be used as a public member for connecting slots to a private Signal member...
Definition: Signal.hpp:228
virtual ~Connection()
Destructor.
Definition: Signal.cpp:89
class Connection
Definition: Signal.hpp:47
class ScopedConnection
Definition: Signal.hpp:93
class ConnectionBody
Definition: ConnectionBody.hpp:60