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 Functions

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...

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

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

## registerObserverWithFilter() [1/2]

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() [2/2]

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