annotate UnitTestsSources/TestMessageBroker2_promise_and_connect_ok.cpp @ 367:face7b7008de am-2

line and circle measure tools are now compatible with WebAssembly
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 01 Nov 2018 12:09:11 +0100
parents 3897f9f28cfa
children b70e9be013e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
299
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
1 /**
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
5 * Copyright (C) 2017-2018 Osimis S.A., Belgium
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
6 *
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
11 *
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
16 *
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
19 **/
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
20
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
21
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
22 #include "gtest/gtest.h"
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
23
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
24 #include <boost/noncopyable.hpp>
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
25 #include <boost/function.hpp>
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
26 #include <boost/bind.hpp>
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
27
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
28 #include <string>
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
29 #include <map>
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
30 #include <set>
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
31
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
32 int testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
33 namespace {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
34
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
35 enum MessageType
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
36 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
37 MessageType_Test1,
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
38 MessageType_Test2,
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
39
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
40 MessageType_CustomMessage,
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
41 MessageType_LastGenericStoneMessage
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
42 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
43
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
44 struct IMessage : public boost::noncopyable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
45 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
46 MessageType messageType_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
47 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
48 IMessage(const MessageType& messageType)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
49 : messageType_(messageType)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
50 {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
51 virtual ~IMessage() {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
52
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
53 virtual int GetType() const {return messageType_;}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
54 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
55
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
56
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
57 struct ICustomMessage : public IMessage
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
58 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
59 int customMessageType_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
60 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
61 ICustomMessage(int customMessageType)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
62 : IMessage(MessageType_CustomMessage),
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
63 customMessageType_(customMessageType)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
64 {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
65 virtual ~ICustomMessage() {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
66
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
67 virtual int GetType() const {return customMessageType_;}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
68 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
69
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
70
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
71 class IObserver;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
72 class IObservable;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
73 class IPromiseTarget;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
74 class IPromiseSource;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
75 class Promise;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
76
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
77 /*
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
78 * This is a central message broker. It keeps track of all observers and knows
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
79 * when an observer is deleted.
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
80 * This way, it can prevent an observable to send a message to a delete observer.
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
81 * It does the same book-keeping for the IPromiseTarget and IPromiseSource
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
82 */
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
83 class MessageBroker : public boost::noncopyable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
84 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
85
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
86 std::set<IObserver*> activeObservers_; // the list of observers that are currently alive (that have not been deleted)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
87 std::set<IPromiseTarget*> activePromiseTargets_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
88 std::set<IPromiseSource*> activePromiseSources_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
89
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
90 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
91
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
92 void Register(IObserver& observer)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
93 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
94 activeObservers_.insert(&observer);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
95 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
96
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
97 void Unregister(IObserver& observer)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
98 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
99 activeObservers_.erase(&observer);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
100 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
101
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
102 void Register(IPromiseTarget& target)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
103 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
104 activePromiseTargets_.insert(&target);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
105 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
106
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
107 void Unregister(IPromiseTarget& target)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
108 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
109 activePromiseTargets_.erase(&target);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
110 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
111
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
112 void Register(IPromiseSource& source)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
113 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
114 activePromiseSources_.insert(&source);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
115 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
116
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
117 void Unregister(IPromiseSource& source)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
118 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
119 activePromiseSources_.erase(&source);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
120 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
121
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
122 void EmitMessage(IObservable& from, std::set<IObserver*> observers, const IMessage& message);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
123
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
124 bool IsActive(IPromiseTarget* target)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
125 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
126 return activePromiseTargets_.find(target) != activePromiseTargets_.end();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
127 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
128
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
129 bool IsActive(IPromiseSource* source)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
130 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
131 return activePromiseSources_.find(source) != activePromiseSources_.end();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
132 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
133
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
134 bool IsActive(IObserver* observer)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
135 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
136 return activeObservers_.find(observer) != activeObservers_.end();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
137 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
138 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
139
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
140 struct IPromiseArgs
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
141 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
142 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
143 virtual ~IPromiseArgs() {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
144 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
145
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
146 class EmptyPromiseArguments : public IPromiseArgs
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
147 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
148
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
149 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
150
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
151 class Promise : public boost::noncopyable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
152 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
153 protected:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
154 MessageBroker& broker_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
155
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
156 IPromiseTarget* successTarget_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
157 boost::function<void (const IPromiseArgs& message)> successCallable_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
158
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
159 IPromiseTarget* failureTarget_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
160 boost::function<void (const IPromiseArgs& message)> failureCallable_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
161
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
162 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
163 Promise(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
164 : broker_(broker),
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
165 successTarget_(NULL),
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
166 failureTarget_(NULL)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
167 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
168 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
169
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
170 void Success(const IPromiseArgs& message)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
171 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
172 // check the target is still alive in the broker
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
173 if (broker_.IsActive(successTarget_))
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
174 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
175 successCallable_(message);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
176 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
177 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
178
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
179 void Failure(const IPromiseArgs& message)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
180 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
181 // check the target is still alive in the broker
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
182 if (broker_.IsActive(failureTarget_))
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
183 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
184 failureCallable_(message);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
185 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
186 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
187
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
188 Promise& Then(IPromiseTarget* target, boost::function<void (const IPromiseArgs& message)> f)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
189 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
190 if (successTarget_ != NULL)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
191 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
192 // TODO: throw throw new "Promise may only have a single success target"
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
193 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
194 successTarget_ = target;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
195 successCallable_ = f;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
196 return *this;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
197 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
198
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
199 Promise& Else(IPromiseTarget* target, boost::function<void (const IPromiseArgs& message)> f)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
200 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
201 if (failureTarget_ != NULL)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
202 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
203 // TODO: throw throw new "Promise may only have a single failure target"
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
204 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
205 failureTarget_ = target;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
206 failureCallable_ = f;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
207 return *this;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
208 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
209
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
210 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
211
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
212 class IObserver : public boost::noncopyable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
213 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
214 protected:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
215 MessageBroker& broker_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
216
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
217 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
218 IObserver(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
219 : broker_(broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
220 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
221 broker_.Register(*this);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
222 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
223
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
224 virtual ~IObserver()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
225 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
226 broker_.Unregister(*this);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
227 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
228
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
229 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
230
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
231 class IPromiseTarget : public boost::noncopyable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
232 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
233 protected:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
234 MessageBroker& broker_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
235
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
236 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
237 IPromiseTarget(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
238 : broker_(broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
239 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
240 broker_.Register(*this);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
241 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
242
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
243 virtual ~IPromiseTarget()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
244 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
245 broker_.Unregister(*this);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
246 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
247 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
248
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
249 class IPromiseSource : public boost::noncopyable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
250 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
251 protected:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
252 MessageBroker& broker_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
253
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
254 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
255 IPromiseSource(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
256 : broker_(broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
257 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
258 broker_.Register(*this);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
259 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
260
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
261 virtual ~IPromiseSource()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
262 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
263 broker_.Unregister(*this);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
264 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
265 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
266
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
267
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
268 struct CallableObserver
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
269 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
270 IObserver* observer;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
271 boost::function<void (IObservable& from, const IMessage& message)> f;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
272 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
273
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
274 class IObservable : public boost::noncopyable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
275 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
276 protected:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
277 MessageBroker& broker_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
278
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
279 std::set<IObserver*> observers_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
280
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
281 std::map<int, std::set<CallableObserver*> > callables_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
282 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
283
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
284 IObservable(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
285 : broker_(broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
286 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
287 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
288 virtual ~IObservable()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
289 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
290 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
291
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
292 void EmitMessage(const IMessage& message)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
293 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
294 //broker_.EmitMessage(*this, observers_, message);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
295 int messageType = message.GetType();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
296 if (callables_.find(messageType) != callables_.end())
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
297 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
298 for (std::set<CallableObserver*>::iterator observer = callables_[messageType].begin(); observer != callables_[messageType].end(); observer++)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
299 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
300 CallableObserver* callable = *observer;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
301 if (broker_.IsActive(callable->observer))
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
302 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
303 callable->f(*this, message);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
304 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
305 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
306 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
307
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
308 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
309
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
310 void RegisterObserver(IObserver& observer)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
311 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
312 observers_.insert(&observer);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
313 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
314
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
315 void UnregisterObserver(IObserver& observer)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
316 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
317 observers_.erase(&observer);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
318 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
319
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
320 //template<typename TObserver> void Connect(MessageType messageType, IObserver& observer, void (TObserver::*ptrToMemberHandler)(IObservable& from, const IMessage& message))
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
321 void Connect(int messageType, IObserver& observer, boost::function<void (IObservable& from, const IMessage& message)> f)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
322 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
323 callables_[messageType] = std::set<CallableObserver*>();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
324 CallableObserver* callable = new CallableObserver();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
325 callable->observer = &observer;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
326 callable->f = f;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
327 callables_[messageType].insert(callable);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
328 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
329 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
330
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
331
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
332 enum CustomMessageType
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
333 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
334 CustomMessageType_First = MessageType_LastGenericStoneMessage + 1,
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
335
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
336 CustomMessageType_Completed
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
337 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
338
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
339 class MyObservable : public IObservable
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
340 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
341 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
342 struct MyCustomMessage: public ICustomMessage
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
343 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
344 int payload_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
345 MyCustomMessage(int payload)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
346 : ICustomMessage(CustomMessageType_Completed),
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
347 payload_(payload)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
348 {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
349 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
350
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
351 MyObservable(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
352 : IObservable(broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
353 {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
354
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
355 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
356
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
357 class MyObserver : public IObserver
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
358 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
359 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
360 MyObserver(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
361 : IObserver(broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
362 {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
363 void HandleCompletedMessage(IObservable& from, const IMessage& message)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
364 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
365 const MyObservable::MyCustomMessage& msg = dynamic_cast<const MyObservable::MyCustomMessage&>(message);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
366 testCounter += msg.payload_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
367 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
368
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
369 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
370
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
371
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
372 class MyPromiseSource : public IPromiseSource
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
373 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
374 Promise* currentPromise_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
375 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
376 struct MyPromiseArgs : public IPromiseArgs
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
377 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
378 int increment;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
379 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
380
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
381 MyPromiseSource(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
382 : IPromiseSource(broker),
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
383 currentPromise_(NULL)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
384 {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
385
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
386 Promise& StartSomethingAsync()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
387 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
388 currentPromise_ = new Promise(broker_);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
389 return *currentPromise_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
390 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
391
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
392 void CompleteSomethingAsyncWithSuccess()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
393 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
394 currentPromise_->Success(EmptyPromiseArguments());
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
395 delete currentPromise_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
396 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
397
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
398 void CompleteSomethingAsyncWithFailure()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
399 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
400 currentPromise_->Failure(EmptyPromiseArguments());
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
401 delete currentPromise_;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
402 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
403 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
404
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
405
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
406 class MyPromiseTarget : public IPromiseTarget
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
407 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
408 public:
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
409 MyPromiseTarget(MessageBroker& broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
410 : IPromiseTarget(broker)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
411 {}
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
412
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
413 void IncrementCounter(const IPromiseArgs& args)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
414 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
415 testCounter++;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
416 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
417
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
418 void DecrementCounter(const IPromiseArgs& args)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
419 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
420 testCounter--;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
421 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
422 };
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
423 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
424
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
425 #define CONNECT_MESSAGES(observablePtr, messageType, observerPtr, observerFnPtr) (observablePtr)->Connect(messageType, *(observerPtr), boost::bind(observerFnPtr, observerPtr, _1, _2))
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
426 #define PTHEN(targetPtr, targetFnPtr) Then(targetPtr, boost::bind(targetFnPtr, targetPtr, _1))
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
427 #define PELSE(targetPtr, targetFnPtr) Else(targetPtr, boost::bind(targetFnPtr, targetPtr, _1))
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
428
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
429
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
430 TEST(MessageBroker2, TestPermanentConnectionSimpleUseCase)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
431 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
432 MessageBroker broker;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
433 MyObservable observable(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
434 MyObserver observer(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
435
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
436 // create a permanent connection between an observable and an observer
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
437 CONNECT_MESSAGES(&observable, CustomMessageType_Completed, &observer, &MyObserver::HandleCompletedMessage);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
438
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
439 testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
440 observable.EmitMessage(MyObservable::MyCustomMessage(12));
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
441 ASSERT_EQ(12, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
442
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
443 // the connection is permanent; if we emit the same message again, the observer will be notified again
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
444 testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
445 observable.EmitMessage(MyObservable::MyCustomMessage(20));
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
446 ASSERT_EQ(20, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
447 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
448
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
449 TEST(MessageBroker2, TestPermanentConnectionDeleteObserver)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
450 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
451 MessageBroker broker;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
452 MyObservable observable(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
453 MyObserver* observer = new MyObserver(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
454
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
455 // create a permanent connection between an observable and an observer
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
456 CONNECT_MESSAGES(&observable, CustomMessageType_Completed, observer, &MyObserver::HandleCompletedMessage);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
457
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
458 testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
459 observable.EmitMessage(MyObservable::MyCustomMessage(12));
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
460 ASSERT_EQ(12, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
461
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
462 // delete the observer and check that the callback is not called anymore
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
463 delete observer;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
464
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
465 // the connection is permanent; if we emit the same message again, the observer will be notified again
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
466 testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
467 observable.EmitMessage(MyObservable::MyCustomMessage(20));
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
468 ASSERT_EQ(0, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
469 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
470
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
471
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
472 TEST(MessageBroker2, TestPromiseSuccessFailure)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
473 {
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
474 MessageBroker broker;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
475 MyPromiseSource source(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
476 MyPromiseTarget target(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
477
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
478 // test a successful promise
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
479 source.StartSomethingAsync()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
480 .PTHEN(&target, &MyPromiseTarget::IncrementCounter)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
481 .PELSE(&target, &MyPromiseTarget::DecrementCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
482
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
483 testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
484 source.CompleteSomethingAsyncWithSuccess();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
485 ASSERT_EQ(1, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
486
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
487 // test a failing promise
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
488 source.StartSomethingAsync()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
489 .PTHEN(&target, &MyPromiseTarget::IncrementCounter)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
490 .PELSE(&target, &MyPromiseTarget::DecrementCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
491
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
492 testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
493 source.CompleteSomethingAsyncWithFailure();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
494 ASSERT_EQ(-1, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
495 }
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
496
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
497 //TEST(MessageBroker2, TestPromiseDeleteTarget)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
498 //{
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
499 // MessageBroker broker;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
500 // MyPromiseSource source(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
501 // MyPromiseTarget target(broker);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
502
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
503 // // test a successful promise
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
504 // source.StartSomethingAsync()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
505 // .PTHEN(&target, &MyPromiseTarget::IncrementCounter)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
506 // .PELSE(&target, &MyPromiseTarget::DecrementCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
507
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
508 // testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
509 // source.CompleteSomethingAsyncWithSuccess();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
510 // ASSERT_EQ(1, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
511
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
512 // // test a failing promise
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
513 // source.StartSomethingAsync()
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
514 // .PTHEN(&target, &MyPromiseTarget::IncrementCounter)
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
515 // .PELSE(&target, &MyPromiseTarget::DecrementCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
516
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
517 // testCounter = 0;
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
518 // source.CompleteSomethingAsyncWithFailure();
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
519 // ASSERT_EQ(-1, testCounter);
3897f9f28cfa backup work in progress: updated messaging framework with ICallable
am@osimis.io
parents:
diff changeset
520 //}