EGS Brachy
An egs++ user code for rapid brachytherapy calculations
Loading...
Searching...
No Matches
/Users/marc/Developer/EGSnrc/HEN_HOUSE/user_codes/egs_brachy/egs_brachy/pubsub.cpp
Go to the documentation of this file.
1
/*
2
################################################################################
3
#
4
# egs_brachy pubsub.cpp
5
# Copyright (C) 2016 Rowan Thomson, Dave Rogers, Randle Taylor, and Marc
6
# Chamberland
7
#
8
# This file is part of egs_brachy
9
#
10
# egs_brachy is free software: you can redistribute it and/or modify it
11
# under the terms of the GNU Affero General Public License as published
12
# by the Free Software Foundation, either version 3 of the License, or
13
# (at your option) any later version.
14
#
15
# egs_brachy is distributed in the hope that it will be useful, but
16
# WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
# Affero General Public License for more details:
19
# <http://www.gnu.org/licenses/>.
20
#
21
################################################################################
22
#
23
# When egs_brachy is used for publications, please cite our paper:
24
# M. J. P. Chamberland, R. E. P. Taylor, D. W. O. Rogers, and R. M. Thomson,
25
# egs brachy: a versatile and fast Monte Carlo code for brachytherapy,
26
# Phys. Med. Biol. 61, 8214-8231 (2016).
27
#
28
################################################################################
29
#
30
# Author: Randle Taylor, 2016
31
#
32
# Contributors: Marc Chamberland
33
# Dave Rogers
34
# Rowan Thomson
35
#
36
################################################################################
37
*/
38
39
/*
40
* Adapted from http://www.cs.sjsu.edu/~pearce/modules/patterns/events/pubsubimp.htm
41
* Programmer: Pearce
42
* Copyright (c): 2000, all rights reserved.
43
*/
44
#include "
pubsub.h
"
45
46
void
Publisher::notify
(
EB_Message
message,
void
*what,
Subscriber
*s) {
47
if
(
notifyEnabled
) {
48
list<Subscriber *>::iterator p;
49
for
(p =
subscribers
[message].begin(); p !=
subscribers
[message].end(); p++) {
50
if
(*p != s) {
51
(*p)->update(message, what);
52
}
53
}
54
}
55
notifyEnabled
=
true
;
56
}
Publisher::subscribers
map< EB_Message, list< Subscriber * > > subscribers
Definition
pubsub.h:97
Publisher::notifyEnabled
bool notifyEnabled
Definition
pubsub.h:98
Publisher::notify
void notify(EB_Message message, void *what=0, Subscriber *s=0)
Definition
pubsub.cpp:46
Subscriber
Definition
pubsub.h:71
pubsub.h
A simple pub/sub module to allow various egs_brachy classes to subscribe to particle events.
EB_Message
EB_Message
Definition
pubsub.h:54
Generated by
1.9.8