ADTF
Loading...
Searching...
No Matches
ddl::utility::ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T > Class Template Reference

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

#include <access_observer.h>

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!
 
virtual ~ModelSubjectUtility ()=default
 DTOR.
 
void attachObserver (observer_type *observer)
 adda a observer to notify.
 
void detachObserver (observer_type *observer)
 remove a observer if in list.
 

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
 

Detailed Description

template<typename MODEL_SUBJECT_T, typename EVENT_CODE_T>
class ddl::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

Member Function Documentation

◆ attachObserver()

template<typename MODEL_SUBJECT_T, typename EVENT_CODE_T>
void ddl::dd::utility::ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >::attachObserver ( observer_type * observer)
inline

adda a observer to notify.

Parameters
observerthe observer instance

◆ detachObserver()

template<typename MODEL_SUBJECT_T, typename EVENT_CODE_T>
void ddl::dd::utility::ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >::detachObserver ( observer_type * observer)
inline

remove a observer if in list.

Parameters
observerthe observer to remove

◆ notifyChanged()

template<typename MODEL_SUBJECT_T, typename EVENT_CODE_T>
void ddl::dd::utility::ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >::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)

◆ operator=()

template<typename MODEL_SUBJECT_T, typename EVENT_CODE_T>
ModelSubjectUtility & ddl::dd::utility::ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T >::operator= ( const ModelSubjectUtility< MODEL_SUBJECT_T, EVENT_CODE_T > & )
inline

copy assignment operator which removes the observers in case of!

Returns
ModelSubjectUtility&

The documentation for this class was generated from the following file: