ADTF  3.18.4
ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >

Model Subject utility to define a Model Subject that notifies one or more observers. More...

Inheritance diagram for ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >:
[legend]

Public Types

typedef EVENT_CODE_T event_code_type
 local definition of the event code type
 
typedef MODEL_SUBJECT_T subject_type
 local definition of the subject type
 
typedef ModelObserverUtility< MODEL_SUBJECT_T, EVENT_CODE_T > observer_type
 local definition of the observer type to notify
 

Public Member Functions

 ModelSubjectUtility ()=default
 CTOR.
 
 ModelSubjectUtility (const ModelSubjectUtility &)
 copy CTOR which removes the observers in case of!
 
ModelSubjectUtilityoperator= (const ModelSubjectUtility &)
 copy assignment operator which removes the observers in case of! More...
 
virtual ~ModelSubjectUtility ()=default
 DTOR.
 
void attachObserver (observer_type *observer)
 adda a observer to notify. More...
 
void detachObserver (observer_type *observer)
 remove a observer if in list. More...
 

Protected Member Functions

void notifyChanged (event_code_type event_code, subject_type &changed_subject, const std::string &additional_info)
 helper utility function to notify the current observers More...
 

Private Attributes

std::vector< observer_type * > _observers
 

Detailed Description

template<typename MODEL_SUBJECT_T, typename EVENT_CODE_T>
class ddl::dd::utility::ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >

Model Subject utility to define a Model Subject that notifies one or more observers.

Template Parameters
MODEL_SUBJECT_Tthe subject type
EVENT_CODE_Tthe event code type

Definition at line 68 of file dd_access_observer.h.

Member Function Documentation

◆ attachObserver()

void attachObserver ( observer_type observer)
inline

adda a observer to notify.

Parameters
observerthe observer instance

Definition at line 112 of file dd_access_observer.h.

◆ detachObserver()

void detachObserver ( observer_type observer)
inline

remove a observer if in list.

Parameters
observerthe observer to remove

Definition at line 126 of file dd_access_observer.h.

◆ notifyChanged()

void notifyChanged ( event_code_type  event_code,
subject_type changed_subject,
const std::string &  additional_info 
)
inlineprotected

helper utility function to notify the current observers

Parameters
event_codethe eventcode
changed_subjectthe subject changed
additional_infoadditional info (see i.e. ddl::dd::datamodel::ModelEventCode)

Definition at line 144 of file dd_access_observer.h.

◆ operator=()

ModelSubjectUtility& operator= ( const ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T > &  )
inline

copy assignment operator which removes the observers in case of!

Returns
ModelSubjectUtility&

Definition at line 95 of file dd_access_observer.h.