Orfeo Toolbox
3.16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
OTB
Code
Visualization
otbMVCModel.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: ORFEO Toolbox
4
Language: C++
5
Date: $Date$
6
Version: $Revision$
7
8
9
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10
See OTBCopyright.txt for details.
11
12
13
This software is distributed WITHOUT ANY WARRANTY; without even
14
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
PURPOSE. See the above copyright notices for more information.
16
17
=========================================================================*/
18
#ifndef __otbMVCModel_h
19
#define __otbMVCModel_h
20
21
#include <set>
22
#include "
itkObject.h
"
23
#include "
itkObjectFactory.h
"
24
25
namespace
otb
26
{
33
template
<
class
TListener>
34
class
MVCModel
35
{
36
public
:
38
typedef
MVCModel
Self
;
39
typedef
itk::Object
Superclass
;
40
typedef
itk::SmartPointer<Self>
Pointer
;
41
typedef
itk::SmartPointer<const Self>
ConstPointer
;
42
43
// Define the listener type
44
typedef
TListener
ListenerType
;
45
47
typedef
std::set<ListenerType *>
ListenersSetType
;
48
50
virtual
bool
RegisterListener
(
ListenerType
* listener)
51
{
52
return
(
m_RegisteredListeners
.insert(listener).second);
53
}
54
56
virtual
void
UnRegisterListener
(
ListenerType
* listener)
57
{
58
m_RegisteredListeners
.erase(listener);
59
}
60
61
virtual
void
UnRegisterAllListeners
()
62
{
63
m_RegisteredListeners
.clear();
64
}
65
67
virtual
void
NotifyAll
()
68
{
69
for
(
typename
ListenersSetType::iterator it =
m_RegisteredListeners
.begin();
70
it !=
m_RegisteredListeners
.end();
71
++it)
72
{
73
this->
NotifyListener
(*it);
74
}
75
}
76
78
virtual
void
NotifyListener
(
ListenerType
* listener)
79
{
80
listener->
Notify
();
81
}
82
83
protected
:
85
MVCModel
() {}
87
virtual
~MVCModel
() {}
88
89
private
:
90
MVCModel
(
const
Self
&);
//purposely not implemented
91
void
operator =
(
const
Self
&);
//purposely not implemented
92
94
ListenersSetType
m_RegisteredListeners
;
95
};
96
}
97
#endif
Generated at Sun May 19 2013 00:41:17 for
Orfeo Toolbox
with
doxygen 1.8.3.1