16 m_watcher = dataLink->
watcher();
22 m_observer->setEventSubscription(filter);
23 if (m_watcher && m_watcher->
isConnected()) { reconstruct(); }
26 void CGenericListObserver::reconstruct()
28 m_observer->requestAsync(m_observer->eventSubscription(), [
this](
const CVariant &list) {
29 QMutexLocker lock(&m_listMutex);
30 m_list = list.to<CVariantList>();
32 onGenericElementsReplaced(allValues());
38 QMutexLocker lock(&m_listMutex);
44 QMutexLocker lock(&m_listMutex);
46 [filter = m_observer->eventSubscription()](
const CVariant &value) { return !value.matches(filter); });
49 void CGenericListObserver::handleEvent(
const CVariant ¶m)
51 QMutexLocker lock(&m_listMutex);
54 onGenericElementAdded(param);
int removeIf(Predicate p)
Remove elements for which a given predicate returns true.
void push_back(const T &value)
Appends an element at the end of the sequence.
Wrapper around QVariant which provides transparent access to CValueObject methods of the contained ob...
Value object encapsulating a list of variants.
bool isConnected() const
True if connected to the transport layer.
void connected()
Connection established.
int cleanValues()
Remove any old values that no longer match the filter.
void setFilter(const CVariant &filter)
Set list filter as variant.
virtual void initialize(IDataLink *)
Subscribe using the given transport mechanism.
CVariantList allValues() const
Get filtered list value as variant list.
Interface that provides a transport mechanism for sharing state.
virtual void subscribe(const CPassiveObserver *observer)=0
Register an observer with this transport mechanism.
CDataLinkConnectionWatcher * watcher()
Get a connection status watcher.
Utilities for sharing state between multiple objects.