basic implementation of Observer Pattern in C.
gem install ceedling
ceedling test:observerTo add Observable property to certain object,
- Place
Observabletype as the first field of your sturct. - Call
Observable_initto activate - If some module wants to be notified, register appropriate handler with
Observable_attach - Now that will make anything can be updated when
Observable_notifycalled.
See test/test_observable.c for example.