Qore DataProvider Module Reference 2.7.5
Loading...
Searching...
No Matches
DataProvider::Observable Class Reference

This class represents an observable subject that will notify all of its registered observers. More...

#include <Observable.qc.dox.h>

Inheritance diagram for DataProvider::Observable:
[legend]

Public Member Methods

bool deregisterObserver (object observer)
 The method deregisters the given observer. More...
 
bool deregisterObserver (Observer observer)
 The method deregisters the given observer. More...
 
 log (int level, string fmt)
 Reimplement this method to implement logging. More...
 
 notifyObservers (string event_id, hash< auto > data_)
 The method notifies all subscribed observers. More...
 
 registerObserver (object observer)
 The method registers the given observer. More...
 
 registerObserver (Observer observer)
 The method registers the given observer. More...
 
 registerObserverWithFilter (object observer, AbstractEventFilter filter)
 The method registers the given observer. More...
 
 registerObserverWithFilter (Observer observer, AbstractEventFilter filter)
 The method registers the given observer. More...
 

Private Member Methods

hash< ObserverEventInfo > registerObserverEventsArgs (hash< ObserverEventInfo > info, list< auto > events)
 Registers observer events.
 

Private Attributes

hash< string, hash< ObserverEventInfo > > observer_map
 maps from object hash -> object
 

Detailed Description

This class represents an observable subject that will notify all of its registered observers.

Member Function Documentation

◆ deregisterObserver() [1/2]

bool DataProvider::Observable::deregisterObserver ( object  observer)

The method deregisters the given observer.

Parameters
observerthe observer to be deregistered
Returns
True if found otherwise False
Note
this variant is meant for observer objects implemented in other languages

◆ deregisterObserver() [2/2]

bool DataProvider::Observable::deregisterObserver ( Observer  observer)

The method deregisters the given observer.

Parameters
observerthe observer to be deregistered
Returns
True if found otherwise False

◆ log()

DataProvider::Observable::log ( int  level,
string  fmt 
)

Reimplement this method to implement logging.

Parameters
levelthe Logger level
fmtthe format string
...any arguments for any format placeholders in fmt

◆ notifyObservers()

DataProvider::Observable::notifyObservers ( string  event_id,
hash< auto >  data_ 
)

The method notifies all subscribed observers.

Parameters
event_idunique ID identifying an event
data_hash representing new data to be passed to observers' update() methods

◆ registerObserver() [1/2]

DataProvider::Observable::registerObserver ( object  observer)

The method registers the given observer.

Parameters
observerthe observer to be registered
...event IDs for notifications; if no additional arguments are passed, then the observer is notified for all events
Note
this variant is meant for observer objects implemented in other languages

◆ registerObserver() [2/2]

DataProvider::Observable::registerObserver ( Observer  observer)

The method registers the given observer.

Parameters
observerthe observer to be registered
...event IDs for notifications; if no additional arguments are passed, then the observer is notified for all events
Exceptions
EVENT-ERRORtype error; additional argument is not a string event ID

◆ registerObserverWithFilter() [1/2]

DataProvider::Observable::registerObserverWithFilter ( object  observer,
AbstractEventFilter  filter 
)

The method registers the given observer.

Parameters
observerthe observer to be registered
filterthe filter object for events
...event IDs for notifications; if no additional arguments are passed, then the observer is notified for all events
Note
this variant is meant for observer objects implemented in other languages

◆ registerObserverWithFilter() [2/2]

DataProvider::Observable::registerObserverWithFilter ( Observer  observer,
AbstractEventFilter  filter 
)

The method registers the given observer.

Parameters
observerthe observer to be registered
filterthe filter object for events
...event IDs for notifications; if no additional arguments are passed, then the observer is notified for all events
Exceptions
EVENT-ERRORtype error; additional argument is not a string event ID