6 #ifndef SWIFT_MISC_SHAREDSTATE_PASSIVEOBSERVER_H
7 #define SWIFT_MISC_SHAREDSTATE_PASSIVEOBSERVER_H
11 #include <QSharedPointer>
21 class CActiveObserver;
31 friend QSharedPointer<CPassiveObserver>;
33 template <
typename T,
typename F>
36 m_eventHandler([=](
const CVariant ¶m) { private_ns::invokeMethod(parent, eventHandler, param); })
41 template <
typename T,
typename F>
42 static auto create(T *parent, F eventHandler)
44 return QSharedPointer<CPassiveObserver>::create(parent, eventHandler);
48 void setEventSubscription(
const CVariant ¶m);
54 void handleEvent(
const CVariant ¶m)
const;
57 QWeakPointer<const CPassiveObserver>
weakRef()
const {
return sharedFromThis(); }
64 const std::function<void(
const CVariant ¶m)> m_eventHandler;
66 mutable QMutex m_eventSubscriptionMutex;
Mix of the most commonly used mixin classes.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Extends CPassiveObserver with the ability to send requests and receive replies.
Dummy value class that matches any event.
bool matches(const CVariant &) const
Returns true.
QString convertToQString(bool=false) const
To string.
Endpoint which can subscribe to events emitted by CPassiveMutator.
static auto create(T *parent, F eventHandler)
Factory method.
QWeakPointer< const CPassiveObserver > weakRef() const
Get a QWeakPointer pointing to this object.
void eventSubscriptionChanged(const swift::misc::CVariant ¶m)
Emitted by setEventSubscription.
Utilities for sharing state between multiple objects.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...