PSCF
v1.2
src
util
signal
Signal.cpp
1
/*
2
* Util Package - C++ Utilities for Scientific Computation
3
*
4
* Copyright 2010 - 2017, The Regents of the University of Minnesota
5
* Distributed under the terms of the GNU General Public License.
6
*/
7
8
#include "Signal.h"
9
10
namespace
Util
11
{
12
13
/*
14
* Destructor.
15
*/
16
Signal<>::~Signal
()
17
{ clear(); }
18
19
/*
20
* Notify observers (call associated methods).
21
*/
22
void
Signal<>::notify
()
23
{
24
std::list< IFunctor<>* >::iterator pos;
25
pos = functorPtrs_.begin();
26
while
(pos != functorPtrs_.end())
27
{
28
(**pos)();
29
++pos;
30
}
31
}
32
33
/*
34
* Notify observers (call associated methods).
35
*/
36
void
Signal<>::clear
()
37
{
38
std::list< IFunctor<>* >::iterator pos;
39
pos = functorPtrs_.begin();
40
while
(pos != functorPtrs_.end())
41
{
42
delete
*pos;
43
++pos;
44
}
45
functorPtrs_.clear();
46
}
47
48
/*
49
* Get number of registered observers.
50
*/
51
int
Signal<>::nObserver
()
const
52
{
return
functorPtrs_.size(); }
53
54
}
Util::Signal::~Signal
~Signal()
Destructor.
Definition
Signal.cpp:16
Util::Signal::clear
void clear()
Clear all observerse from list.
Definition
Signal.cpp:36
Util::Signal::nObserver
int nObserver() const
Get number of registered observers.
Definition
Signal.cpp:51
Util::Signal::notify
void notify(const T &t)
Notify all observers.
Definition
Signal.cpp:22
Util
Utility classes for scientific computation.
Definition
accumulators.mod:1
Generated on Fri Mar 28 2025 00:57:29 for PSCF by
1.12.0