Mercurial > hg > orthanc-stone
annotate OrthancStone/Sources/Messages/IObservable.h @ 1652:fa9e6bf84958
integrating pdf.js into Stone Web viewer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 16 Nov 2020 20:47:53 +0100 |
parents | 8563ea5d8ae4 |
children | 9ac2a65d4172 |
rev | line source |
---|---|
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
1 /** |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
2 * Stone of Orthanc |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
643
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
6 * |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
7 * This program is free software: you can redistribute it and/or |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
10 * the License, or (at your option) any later version. |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
11 * |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
15 * Lesser General Public License for more details. |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
16 * |
1598
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
18 * License along with this program. If not, see |
8563ea5d8ae4
relicensing some files, cf. osimis bm26 and chu agreement on 2020-05-20
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1512
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
20 **/ |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
21 |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
22 |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
23 #pragma once |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
24 |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
25 #include "../StoneEnumerations.h" |
299
3897f9f28cfa
backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
268
diff
changeset
|
26 #include "ICallable.h" |
267 | 27 #include "IObserver.h" |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
28 |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
29 #include <set> |
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
30 #include <map> |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
31 |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
32 namespace OrthancStone |
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
33 { |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
34 class IObservable : public boost::noncopyable |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
35 { |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
36 private: |
643
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
623
diff
changeset
|
37 typedef std::map<MessageIdentifier, std::set<ICallable*> > Callables; |
f0008c55e5f7
getting rid of MessageType enumeration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
623
diff
changeset
|
38 |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
317
diff
changeset
|
39 Callables callables_; |
302
4a79193ffb58
support for custom messages + no leaks in unit-tests
am@osimis.io
parents:
300
diff
changeset
|
40 |
623
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
41 void EmitMessageInternal(const IObserver* receiver, |
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
42 const IMessage& message); |
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
43 |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
44 public: |
403 | 45 virtual ~IObservable(); |
302
4a79193ffb58
support for custom messages + no leaks in unit-tests
am@osimis.io
parents:
300
diff
changeset
|
46 |
1311
3d26447ddd28
warning fixes + doc + indentation + header files in cmake for VC++ sln browsing
Benjamin Golinvaux <bgo@osimis.io>
parents:
1279
diff
changeset
|
47 // Takes ownership of the callable |
1065
9d42f89b8c3c
improved readability
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1064
diff
changeset
|
48 void RegisterCallable(ICallable* callable); |
428
751fb354149e
ability to change the scene of the RadiographyWidget
am@osimis.io
parents:
403
diff
changeset
|
49 |
623
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
50 void BroadcastMessage(const IMessage& message); |
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
51 |
1098
17660df24c36
simplification of IOracleRunner
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1075
diff
changeset
|
52 void EmitMessage(boost::weak_ptr<IObserver> observer, |
623
42dadae61fa9
renamed IObservable::EmitMessage() as BroadcastMessage()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
440
diff
changeset
|
53 const IMessage& message); |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
54 }; |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
55 } |