CGEM BOSS
6.6.5.h
BESIII Offline Software System
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
w
x
z
Typedefs
b
c
d
e
g
h
i
l
m
n
o
p
r
s
t
v
Enumerations
Enumerator
a
b
c
d
e
f
i
k
l
m
n
o
p
r
s
t
u
w
x
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
v
w
Enumerations
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
v
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Related Symbols
:
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
w
x
Files
File List
File Members
All
!
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
!
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
!
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
k
m
n
o
p
r
s
t
u
w
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
CGEM BOSS
Used Packages
Requirements
►
How to use the ERS package
Todo List
►
Namespaces
►
Classes
▼
Files
▼
File List
▼
6.6.5.h
►
Analysis
►
BesCxxPolicy
►
BesExamples
►
BesPolicy
▼
Calibration
►
CalibData
►
CalibSvc
►
calibUtil
▼
facilities
▼
facilities-00-00-04
▼
facilities
►
Adapter.h
►
binarystream.h
►
bitmanip.h
►
bpkt_streams.h
►
Clock.h
►
Commissioner.h
►
Converter.h
►
error.h
►
FIFO.h
►
filemap.h
►
Observer.h
►
ScheduledEvent.h
►
Scheduler.h
►
SimpleEvent.h
►
Timestamp.h
►
Util.h
►
Utility.h
►
src
►
rdbModel
►
xmlBase
►
Cgem
►
Control
►
Database
►
DetectorDescription
►
DistBoss
►
DQA
►
Emc
►
Event
►
EventDisplay
►
EventFilter
►
EvtPreSelect
►
External
►
FileFilterAlg
►
Generator
►
InstallArea
►
LumTauAlg
►
MagneticField
►
Mdc
►
Mrpc
►
Muc
►
Reconstruction
►
RootPolicy
►
Simulation
►
Tof
►
Trigger
►
Utilities
►
Validation
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
Observer.h
Go to the documentation of this file.
1
//## begin module%352D11EA00FB.cm preserve=no
2
// %X% %Q% %Z% %W%
3
//## end module%352D11EA00FB.cm
4
5
//## Module: Observer%352D11EA00FB; Package specification
6
// Implementation of the Observer class.
7
//## Subsystem: facilities%3550CC6801AC
8
//## Source file: D:\code\glastsim\facilities\Observer.h
9
10
#ifndef Observer_h
11
#define Observer_h 1
12
13
#include "
facilities/Adapter.h
"
14
//## begin module%352D11EA00FB.declarations preserve=yes
15
#ifdef _MSC_VER
16
# pragma warning(disable: 4786)
17
#endif
18
19
#include <vector>
20
//## end module%352D11EA00FB.declarations
21
22
23
//## Class: Observer%352D0D8F02E2
24
// Abstract observer class. Encapsulates the update()
25
// behavior.
26
//## Category: facilities%3550CC5302A6
27
//## Subsystem: facilities%3550CC6801AC
28
//## Persistence: Transient
29
//## Cardinality/Multiplicity: n
30
31
class
Observer
32
{
33
public
:
34
//## Constructors (specified)
35
//## Operation: Observer%894312585
36
// constructor
37
Observer
()
38
//## begin Observer::Observer%894312585.initialization preserve=yes
39
//## end Observer::Observer%894312585.initialization
40
{
41
//## begin Observer::Observer%894312585.body preserve=yes
42
//## end Observer::Observer%894312585.body
43
}
37
Observer
() {
…
}
44
45
46
//## Other Operations (specified)
47
//## Operation: update%892143866
48
// Encapsulate the update behavior for the Subject-Observer
49
// pattern. Respond to a change in the state of the Subject
50
// to which this observer (when instatiated) is attached.
51
virtual
void
update
() = 0;
52
53
protected
:
54
55
};
31
class
Observer
{
…
};
56
57
//## Class: Subject%352D0AF10220; Abstract
58
// Abstract subject pattern. Follows Observer behavioral
59
// pattern described in 'Design Patterns'.
60
//## Category: facilities%3550CC5302A6
61
//## Subsystem: facilities%3550CC6801AC
62
//## Persistence: Transient
63
//## Cardinality/Multiplicity: n
64
65
//## Uses: <unnamed>%352D101A02D4;Observer { -> }
66
67
class
Subject
68
{
69
public
:
70
//## Constructors (specified)
71
//## Operation: Subject%894312586
72
// constructor
73
Subject
()
74
//## begin Subject::Subject%894312586.initialization preserve=yes
75
: m_observers()
76
//## end Subject::Subject%894312586.initialization
77
{
78
//## begin Subject::Subject%894312586.body preserve=yes
79
//## end Subject::Subject%894312586.body
80
}
73
Subject
() {
…
}
81
82
83
//## Other Operations (specified)
84
//## Operation: attach%892143867
85
// Attach an observer to this subject.
86
void
attach
(
Observer
* anObserver)
87
{
88
//## begin Subject::attach%892143867.body preserve=yes
89
m_observers.push_back(anObserver);
90
//## end Subject::attach%892143867.body
91
}
86
void
attach
(
Observer
* anObserver) {
…
}
92
93
//## Operation: detach%892143868
94
// Detach an observer from this subject.
95
void
detach
(
Observer
* )
96
{
97
//## begin Subject::detach%892143868.body preserve=yes
98
//std::vector<Observer*>::const_iterator it = m_observers.find(anObserver);
99
//if (it != m_observers.end()) m_observers.erase(it);
100
//## end Subject::detach%892143868.body
101
}
95
void
detach
(
Observer
* ) {
…
}
102
103
//## Operation: notify%892143869
104
// Notify all subjects of a change.
105
void
notify
()
106
{
107
//## begin Subject::notify%892143869.body preserve=yes
108
std::vector<Observer*>::iterator it = m_observers.begin();
109
while
(it != m_observers.end()) {
110
if
(*it) (*it)->update();
111
it++;
112
}
113
//## end Subject::notify%892143869.body
114
}
105
void
notify
() {
…
}
115
116
protected
:
117
private
:
118
private
:
//## implementation
119
// Data Members for Class Attributes
120
121
//## Attribute: m_observers%352D1996009B
122
// List of all of the observers of this subject.
123
//## begin Subject::m_observers%352D1996009B.attr preserve=no private: set<Observer*> {U}
124
std::vector<Observer*> m_observers;
125
//## end Subject::m_observers%352D1996009B.attr
126
127
};
67
class
Subject
{
…
};
128
129
//## Class: ObserverAdapter%3552473D03A8; Parameterized Class
130
// Subclass of Observer which incorporates a callback
131
// Adapter to another object.
132
//## Category: facilities%3550CC5302A6
133
//## Subsystem: facilities%3550CC6801AC
134
//## Persistence: Transient
135
//## Cardinality/Multiplicity: n
136
137
template
<
class
T,
class
Y =
int
>
138
class
ObserverAdapter
:
public
Observer
//## Inherits: <unnamed>%3552488300D6
139
{
140
public
:
141
//## Constructors (specified)
142
//## Operation: ObserverAdapter%894312604
143
// constructor
144
ObserverAdapter
(
Adapter<Y>
* anAdapter = 0)
145
//## begin ObserverAdapter::ObserverAdapter%894312604.initialization preserve=yes
146
: itsAdapter(anAdapter)
147
//## end ObserverAdapter::ObserverAdapter%894312604.initialization
148
{
149
//## begin ObserverAdapter::ObserverAdapter%894312604.body preserve=yes
150
//## end ObserverAdapter::ObserverAdapter%894312604.body
151
}
144
ObserverAdapter
(
Adapter<Y>
* anAdapter = 0) {
…
}
152
153
virtual
~ObserverAdapter
()
154
{
155
delete
itsAdapter;
156
itsAdapter = 0;
157
}
153
virtual
~ObserverAdapter
() {
…
}
158
159
160
//## Other Operations (specified)
161
//## Operation: setAdapter%894312605
162
// sets the adapter to use
163
void
setAdapter
(
Adapter<Y>
* anAdapter = 0)
164
{
165
//## begin ObserverAdapter::setAdapter%894312605.body preserve=yes
166
delete
itsAdapter;
167
itsAdapter = anAdapter;
168
//## end ObserverAdapter::setAdapter%894312605.body
169
}
163
void
setAdapter
(
Adapter<Y>
* anAdapter = 0) {
…
}
170
171
//## Operation: getAdapter%894312606
172
// access to the adapter object
173
Adapter<Y>
*
getAdapter
()
174
{
175
//## begin ObserverAdapter::getAdapter%894312606.body preserve=yes
176
return
itsAdapter;
177
//## end ObserverAdapter::getAdapter%894312606.body
178
}
173
Adapter<Y>
*
getAdapter
() {
…
}
179
180
//## Operation: update%894312607
181
// update overload. calls itsAdapter to execute the adapted
182
// function
183
void
update
()
184
{
185
//## begin ObserverAdapter::update%894312607.body preserve=yes
186
if
(itsAdapter) (*itsAdapter)();
187
//## end ObserverAdapter::update%894312607.body
188
}
183
void
update
() {
…
}
189
190
protected
:
191
private
:
192
private
:
//## implementation
193
// Data Members for Associations
194
195
//## Association: facilities::<unnamed>%3550D15301CA
196
//## Role: ObserverAdapter::itsAdapter%3550D1540059
197
// adapter to call upon notification of a change in a
198
// Subject
199
//## begin ObserverAdapter::itsAdapter%3550D1540059.role preserve=no private: ActionAdapter { -> 0..1RHN}
200
Adapter<Y>
*itsAdapter;
201
//## end ObserverAdapter::itsAdapter%3550D1540059.role
202
203
};
138
class
ObserverAdapter
:
public
Observer
//## Inherits: <unnamed>%3552488300D6
{
…
};
204
205
206
207
#endif
Adapter.h
Adapter
Definition
Adapter.h:31
ObserverAdapter
Definition
Observer.h:139
ObserverAdapter::~ObserverAdapter
virtual ~ObserverAdapter()
Definition
Observer.h:153
ObserverAdapter::ObserverAdapter
ObserverAdapter(Adapter< Y > *anAdapter=0)
Definition
Observer.h:144
ObserverAdapter::getAdapter
Adapter< Y > * getAdapter()
Definition
Observer.h:173
ObserverAdapter::update
void update()
Definition
Observer.h:183
ObserverAdapter::setAdapter
void setAdapter(Adapter< Y > *anAdapter=0)
Definition
Observer.h:163
Observer
Definition
Observer.h:32
Observer::Observer
Observer()
Definition
Observer.h:37
Observer::update
virtual void update()=0
Subject
Definition
Observer.h:68
Subject::attach
void attach(Observer *anObserver)
Definition
Observer.h:86
Subject::detach
void detach(Observer *)
Definition
Observer.h:95
Subject::Subject
Subject()
Definition
Observer.h:73
Subject::notify
void notify()
Definition
Observer.h:105
6.6.5.h
Calibration
facilities
facilities-00-00-04
facilities
Observer.h
Generated by
1.12.0