Mercurial > hg > orthanc-stone
annotate Framework/Messages/IObserver.h @ 1121:0073f95a1df1
merge
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 05 Nov 2019 16:31:08 +0100 |
parents | f6be9412e42a |
children | e713f1a99861 ca2058bd74ef |
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 |
439 | 5 * Copyright (C) 2017-2019 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 |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Affero General Public License |
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 |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
15 * Affero General Public License for more details. |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
16 * |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Affero General Public License |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
19 **/ |
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 #pragma once |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
23 |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
24 #include "MessageBroker.h" |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
439
diff
changeset
|
25 |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
26 namespace OrthancStone |
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
27 { |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
28 class IObserver : public boost::noncopyable |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
29 { |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
30 private: |
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
31 MessageBroker& broker_; |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
439
diff
changeset
|
32 // the following is a UUID that is used to disambiguate different observers |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
439
diff
changeset
|
33 // that may have the same address |
975
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
34 char fingerprint_[37]; |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
35 |
1048
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
36 public: |
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
37 IObserver(MessageBroker& broker); |
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
38 |
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
39 virtual ~IObserver(); |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
40 |
975
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
41 const char* GetFingerprint() const |
973
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
439
diff
changeset
|
42 { |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
439
diff
changeset
|
43 return fingerprint_; |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
439
diff
changeset
|
44 } |
38409549db43
Log with addresses + added fingerprint mechanism to avoid calling zombie objects
Benjamin Golinvaux <bgo@osimis.io>
parents:
439
diff
changeset
|
45 |
1048
f6be9412e42a
cleaning up IObservable.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
991
diff
changeset
|
46 bool DoesFingerprintLookGood() const; |
975
e75fd08d6c75
Cleaning in ICallable + changed fingerprint to plain char array to allow for
Benjamin Golinvaux <bgo@osimis.io>
parents:
973
diff
changeset
|
47 |
393
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
48 MessageBroker& GetBroker() const |
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
49 { |
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
50 return broker_; |
e7a494bdd956
removed Messages/MessageType.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
300
diff
changeset
|
51 } |
250
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
52 }; |
5e642859267e
added new Observable/Observer & MessageBroker (not used yet)
am@osimis.io
parents:
diff
changeset
|
53 } |