cosapp.patterns.observer¶
Classes
|
Generic interface for observers |
|
Prototype of subject for Observer objects. |
- class cosapp.patterns.observer.Observer(subject=None)[source]¶
Bases:
ABC
Generic interface for observers
- class cosapp.patterns.observer.Subject(obs_type=<class 'cosapp.patterns.observer.Observer'>)[source]¶
Bases:
object
Prototype of subject for Observer objects. The philosophy is that observers are responsible for signing in or out. Therefore, the subject should not unilaterally add or remove observers, except when it is cleared.
- add(observer)[source]¶
Add an observer to the list of observers. Invoked by outside observers when they sign in; should not be called by self directly.
- property n_observers: int¶
number of observers of current subject
- Type:
int