ICF 3.1.1.10
Technical documentation of ICF Libraries
IObserver.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef imod_IObserver_included
7#define imod_IObserver_included
8
9
10// ICF includes
11#include <istd/IPolymorphic.h>
12#include <istd/IChangeable.h>
13#include <imod/imod.h>
14
15
16namespace imod
17{
18
19
20class IModel;
21
22
29class IObserver: virtual public istd::IPolymorphic
30{
31public:
37 virtual bool IsModelAttached(const IModel* modelPtr = nullptr) const = 0;
46 virtual bool OnModelAttached(IModel* modelPtr, istd::IChangeable::ChangeSet& changeMask) = 0;
47
51 virtual bool OnModelDetached(IModel* modelPtr) = 0;
52
57 virtual void BeforeModelChange(IModel* modelPtr) = 0;
58
62 virtual void AfterModelChange(IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet) = 0;
63};
64
65
66} // namespace imod
67
68
69#endif // !imod_IObserver_included
70
71
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:29
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition IObserver.h:30
virtual bool OnModelAttached(IModel *modelPtr, istd::IChangeable::ChangeSet &changeMask)=0
This call back function will be called, if an observable object is about to be attached.
virtual bool IsModelAttached(const IModel *modelPtr=nullptr) const =0
Check if specified model is attached.
virtual bool OnModelDetached(IModel *modelPtr)=0
This call back function will be called, if an observable object is about to be detached.
virtual void BeforeModelChange(IModel *modelPtr)=0
This function will be called before update of the observer contents occures.
virtual void AfterModelChange(IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet)=0
This function will be called after update of the observer contents occures.
Set of change flags (its IDs).
Definition IChangeable.h:38
This namespace containes basic implementation of Model/Observer design pattern This package is system...
Definition CModelBase.h:20

© Witold Gantzke and Kirill Lepskiy