| Qore DataProvider Module Reference 3.2.2

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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 Functions
bool | deregisterObserver (object observer)
| The method deregisters the given observer.
bool | deregisterObserver (Observer observer)
| The method deregisters the given observer.
bool | isActive ()
| Is this object still generating events.
| log (int level, string fmt,...)
| Reimplement this method to implement logging.
| notifyObservers (string event_id, hash< auto > data_)
| The method notifies all subscribed observers.
| registerObserver (object observer,...)
| The method registers the given observer.
| registerObserver (Observer observer,...)
| The method registers the given observer.
| registerObserverArgs (object observer, *list< auto > event_ids)
| The method registers the given observer.
| registerObserverArgs (Observer observer, *list< auto > event_ids)
| The method registers the given observer.
| registerObserverWithFilter (object observer, AbstractEventFilter filter, list< auto > event_ids)
| The method registers the given observer.
| registerObserverWithFilter (object observer, AbstractEventFilter filter,...)
| The method registers the given observer.
| registerObserverWithFilter (Observer observer, AbstractEventFilter filter,...)
| The method registers the given observer.
| registerObserverWithFilterArgs (Observer observer, AbstractEventFilter filter, *list< auto > event_ids)
| The method registers the given observer.

## Protected Member Functions
hash< ObserverEventInfo > | registerObserverEventsArgs (hash< ObserverEventInfo > info, list< auto > events)
| Registers observer events.

## Protected 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

  observer | the 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

  observer | the observer to be deregistered

Returns
  True if found otherwise False

## ◆ isActive()

bool DataProvider::Observable::isActive | ( |  | ) |

Is this object still generating events.

Override this method in base classes to signal when events are no longer being generated

## ◆ log()

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

Reimplement this method to implement logging.

Parameters

  level | the Logger level
  fmt | the 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_id | unique 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

  observer | the 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

  observer | the observer to be registered
  ... | event IDs for notifications; if no additional arguments are passed, then the observer is notified for all events

Exceptions

  EVENT-ERROR | type error; additional argument is not a string event ID

## ◆ registerObserverArgs() [1/2]

DataProvider::Observable::registerObserverArgs | ( | object | observer,
|  | *list< auto > | event_ids )

The method registers the given observer.

Parameters

  observer | the observer to be registered
  event_ids | event IDs for notifications; if empty, the observer is notified for all events

Note
  this variant is meant for observer objects implemented in other languages

## ◆ registerObserverArgs() [2/2]

DataProvider::Observable::registerObserverArgs | ( | Observer | observer,
|  | *list< auto > | event_ids )

The method registers the given observer.

Parameters

  observer | the observer to be registered
  event_ids | event IDs for notifications; if empty, the observer is notified for all events

Exceptions

  EVENT-ERROR | type error; additional argument is not a string event ID

## ◆ registerObserverWithFilter() [1/3]

DataProvider::Observable::registerObserverWithFilter | ( | object | observer,
|  | AbstractEventFilter | filter,
|  | list< auto > | event_ids )

The method registers the given observer.

Parameters

  observer | the observer to be registered
  filter | the filter object for events
  event_ids | event IDs for notifications; if empty, the observer is notified for all events

Note
  this variant is meant for observer objects implemented in other languages

## ◆ registerObserverWithFilter() [2/3]

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

The method registers the given observer.

Parameters

  observer | the observer to be registered
  filter | the 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() [3/3]

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

The method registers the given observer.

Parameters

  observer | the observer to be registered
  filter | the filter object for events
  ... | event IDs for notifications; if no additional arguments are passed, then the observer is notified for all events

Exceptions

  EVENT-ERROR | type error; additional argument is not a string event ID

## ◆ registerObserverWithFilterArgs()

DataProvider::Observable::registerObserverWithFilterArgs | ( | Observer | observer,
|  | AbstractEventFilter | filter,
|  | *list< auto > | event_ids )

The method registers the given observer.

Parameters

  observer | the observer to be registered
  filter | the filter object for events
  event_ids | event IDs for notifications; if empty, the observer is notified for all events

Exceptions

  EVENT-ERROR | type error; additional argument is not a string event ID