6 #ifndef SWIFT_MISC_SHAREDSTATE_LISTOBSERVER_H
7 #define SWIFT_MISC_SHAREDSTATE_LISTOBSERVER_H
35 void setFilter(
const CVariant &filter);
45 void handleEvent(
const CVariant ¶m);
46 virtual void onGenericElementAdded(
const CVariant &value) = 0;
47 virtual void onGenericElementsReplaced(
const CVariantList &values) = 0;
51 mutable QMutex m_listMutex;
61 template <
typename T,
typename U = CAnyMatch>
73 if (std::is_same_v<U, CAnyMatch>) {
setFilter({}); }
89 virtual void onGenericElementAdded(
const CVariant &value)
override final
93 virtual void onGenericElementsReplaced(
const CVariantList &values)
override final
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
static CVariant from(T &&value)
Synonym for fromValue().
Value object encapsulating a list of variants.
static auto create(T *parent, F eventHandler)
Factory method.
Observe the connection state of an IDataLink.
Non-template base class for CListObserver.
void setFilter(const CVariant &filter)
Set list filter as variant.
CGenericListObserver(QObject *parent)
Constructor.
virtual void initialize(IDataLink *)
Subscribe using the given transport mechanism.
CVariantList allValues() const
Get filtered list value as variant list.
Base class for an object that shares state with a corresponding CListMutator subclass object.
virtual void onElementsReplaced(const T &values)=0
Called when the whole list is updated wholesale.
CListObserver(QObject *parent)
Constructor.
void setFilter(const U &filter)
Set filter to choose list elements.
virtual void onElementAdded(const typename T::value_type &value)=0
Called when an element matching the filter is added to the list.
T allValues() const
Get list value containing all elements matching the filter.
virtual void initialize(IDataLink *dataLink)
Subscribe using the given transport mechanism.
Interface that provides a transport mechanism for sharing state.
Utilities for sharing state between multiple objects.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.