15#ifndef DD_ACCESS_OBSERVER_INTERFACE_H_INCLUDED
16#define DD_ACCESS_OBSERVER_INTERFACE_H_INCLUDED
33template <
typename MODEL_SUBJECT_T,
typename EVENT_CODE_T>
58 const std::string& additional_info) = 0;
67template <
typename MODEL_SUBJECT_T,
typename EVENT_CODE_T>
114 for (
auto& current: _observers) {
115 if (current == observer) {
119 _observers.push_back(observer);
128 for (
auto current = _observers.begin(); current != _observers.end(); ++current) {
129 if (*current == observer) {
130 _observers.erase(current);
146 const std::string& additional_info)
149 auto observers_copy = _observers;
150 for (
auto& current: observers_copy) {
151 current->modelChanged(event_code, changed_subject, additional_info);
156 std::vector<observer_type*> _observers;
162 using dd::utility::ModelSubjectUtility;
163 using dd::utility::ModelObserverUtility;
The ModelObserver utility template.
Definition access_observer.h:34
virtual void modelChanged(event_code_type event_code, subject_type &changed_subject, const std::string &additional_info)=0
interface function to override.
TYPE subject_type
Definition access_observer.h:39
virtual ~ModelObserverUtility()
protected DTOR
Definition access_observer.h:46
ModelEventCode event_code_type
Definition access_observer.h:37
void attachObserver(observer_type *observer)
adda a observer to notify.
Definition access_observer.h:112
ModelObserverUtility< TYPE, ModelEventCode > observer_type
Definition access_observer.h:75
void notifyChanged(event_code_type event_code, subject_type &changed_subject, const std::string &additional_info)
helper utility function to notify the current observers
Definition access_observer.h:144
ModelSubjectUtility(const ModelSubjectUtility &)
copy CTOR which removes the observers in case of!
Definition access_observer.h:85
TYPE subject_type
Definition access_observer.h:73
void detachObserver(observer_type *observer)
remove a observer if in list.
Definition access_observer.h:126
ModelEventCode event_code_type
Definition access_observer.h:71
ModelSubjectUtility & operator=(const ModelSubjectUtility &)
copy assignment operator which removes the observers in case of!
Definition access_observer.h:95
virtual ~ModelSubjectUtility()=default
DTOR.
ModelSubjectUtility()=default
CTOR.
definition of the old compatibility utility namespace
Definition datamodel_keyvalue.h:160
definition of the dd namespace
Definition datamodel_base.h:26
definition of the ddl namespace
Definition codec.h:21