Merge lp:~michihenning/unity-scopes-api/proxy-fix into lp:unity-scopes-api

Proposed by Michi Henning
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 67
Merged at revision: 67
Proposed branch: lp:~michihenning/unity-scopes-api/proxy-fix
Merge into: lp:unity-scopes-api
Diff against target: 662 lines (+136/-70)
20 files modified
include/scopes/ObjectProxy.h (+7/-7)
include/scopes/QueryCtrl.h (+6/-7)
include/scopes/Registry.h (+6/-5)
include/scopes/Reply.h (+6/-4)
include/scopes/Scope.h (+6/-5)
include/scopes/internal/ObjectProxyImpl.h (+7/-4)
include/scopes/internal/QueryCtrlImpl.h (+5/-4)
include/scopes/internal/RegistryImpl.h (+3/-2)
include/scopes/internal/ReplyImpl.h (+4/-3)
include/scopes/internal/ScopeImpl.h (+5/-3)
src/ObjectProxy.cpp (+10/-0)
src/QueryCtrl.cpp (+7/-2)
src/Registry.cpp (+8/-3)
src/Reply.cpp (+12/-7)
src/Scope.cpp (+7/-2)
src/internal/ObjectProxyImpl.cpp (+5/-0)
src/internal/QueryCtrlImpl.cpp (+7/-2)
src/internal/RegistryImpl.cpp (+8/-3)
src/internal/ReplyImpl.cpp (+9/-4)
src/internal/ScopeImpl.cpp (+8/-3)
To merge this branch: bzr merge lp:~michihenning/unity-scopes-api/proxy-fix
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+196463@code.launchpad.net

Commit message

Made proxies properly polymorphic, so they derived from a common base and no longer redudantly store
the pimpl and the MWProxy at each level of the hierarchy.

Description of the change

Made proxies properly polymorphic, so they derived from a common base and no longer redudantly store
the pimpl and the MWProxy at each level of the hierarchy.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/scopes/ObjectProxy.h'
2--- include/scopes/ObjectProxy.h 2013-11-20 12:33:42 +0000
3+++ include/scopes/ObjectProxy.h 2013-11-25 04:24:33 +0000
4@@ -36,20 +36,20 @@
5 class ObjectProxyImpl;
6 }
7
8-// TODO: currently incomplete, so there is no true base proxy. The technique outlined in http://tinyrul.com/3w6elg
9-// would be suitable to get covariant return for a pimpl() method that returns a shared_ptr. That way, the pimpl()
10-// method could be protected here in the base, and we could use ladder inheritance for both the hierarchies
11-// rooted at ObjectProxy and ObjectProxyImpl.
12-
13 class UNITY_API ObjectProxy
14 {
15 public:
16 ObjectProxy();
17 virtual ~ObjectProxy() noexcept;
18
19+protected:
20+ internal::ObjectProxyImpl* pimpl() const noexcept; // Non-virtual because we can't use covariance with incomplete types
21+ // Each derived proxy type implements a non-virtual fwd() method
22+ // that is called from within each operation to down-cast the pimpl().
23+ ObjectProxy(internal::ObjectProxyImpl*);
24+ friend class internal::ObjectProxyImpl; // Instantiated only by ObjectProxyImpl
25+
26 private:
27- friend class internal::ObjectProxyImpl;
28-
29 std::unique_ptr<internal::ObjectProxyImpl> p;
30 };
31
32
33=== modified file 'include/scopes/QueryCtrl.h'
34--- include/scopes/QueryCtrl.h 2013-11-20 12:33:42 +0000
35+++ include/scopes/QueryCtrl.h 2013-11-25 04:24:33 +0000
36@@ -40,7 +40,7 @@
37 \brief QueryCtrl allows a query to be cancelled.
38 */
39
40-class UNITY_API QueryCtrl : public ObjectProxy
41+class UNITY_API QueryCtrl : public virtual ObjectProxy
42 {
43 public:
44 /**
45@@ -58,13 +58,12 @@
46 */
47 virtual ~QueryCtrl() noexcept;
48
49+protected:
50+ QueryCtrl(internal::QueryCtrlImpl* impl); // Instantiated only by QueryCtrlImpl
51+ friend class internal::QueryCtrlImpl;
52+
53 private:
54- QueryCtrl(internal::QueryCtrlImpl* impl); // Instantiable only by QueryCtrlImpl
55- // @cond
56- friend class internal::QueryCtrlImpl;
57- // @endcond
58-
59- std::unique_ptr<internal::QueryCtrlImpl> p;
60+ internal::QueryCtrlImpl* fwd() const;
61 };
62
63 } // namespace scopes
64
65=== modified file 'include/scopes/Registry.h'
66--- include/scopes/Registry.h 2013-11-22 04:00:45 +0000
67+++ include/scopes/Registry.h 2013-11-25 04:24:33 +0000
68@@ -49,7 +49,7 @@
69 You can obtain a proxy to the registry by calling Runtime::registry().
70 */
71
72-class UNITY_API Registry : public ObjectProxy
73+class UNITY_API Registry : public virtual ObjectProxy
74 {
75 public:
76 /// @cond
77@@ -67,11 +67,12 @@
78 */
79 ScopeMap list() const;
80
81+protected:
82+ Registry(internal::RegistryImpl* impl); // Instantiated only by RegistryImpl
83+ friend class internal::RegistryImpl;
84+
85 private:
86- Registry(internal::RegistryImpl* impl); // Instantiable only by RegistryImpl
87- friend class internal::RegistryImpl;
88-
89- std::unique_ptr<internal::RegistryImpl> p;
90+ internal::RegistryImpl* fwd() const;
91 };
92
93 } // namespace scopes
94
95=== modified file 'include/scopes/Reply.h'
96--- include/scopes/Reply.h 2013-11-22 04:00:45 +0000
97+++ include/scopes/Reply.h 2013-11-25 04:24:33 +0000
98@@ -44,7 +44,7 @@
99 \brief Reply allows the results of a query to be sent to the source of the query.
100 */
101
102-class UNITY_API Reply : public ObjectProxy
103+class UNITY_API Reply : public virtual ObjectProxy
104 {
105 public:
106 Reply(Reply const&) = default;
107@@ -96,11 +96,13 @@
108 */
109 virtual ~Reply() noexcept;
110
111+protected:
112+ Reply(internal::ReplyImpl* impl); // Instantiated only by ReplyImpl
113+ friend class internal::ReplyImpl;
114+
115 private:
116- Reply(internal::ReplyImpl* impl); // Instantiable only by ReplyImpl
117- friend class internal::ReplyImpl;
118+ internal::ReplyImpl* fwd() const;
119
120- std::unique_ptr<internal::ReplyImpl> p;
121 std::shared_ptr<internal::QueryObject> qo; // Points at the corresponding QueryObject, so we can
122 // forward cancellation.
123 };
124
125=== modified file 'include/scopes/Scope.h'
126--- include/scopes/Scope.h 2013-11-21 10:12:45 +0000
127+++ include/scopes/Scope.h 2013-11-25 04:24:33 +0000
128@@ -43,7 +43,7 @@
129 \brief Allows queries to be sent to a scope and results for the query to be retrieved.
130 */
131
132-class UNITY_API Scope : public ObjectProxy
133+class UNITY_API Scope : public virtual ObjectProxy
134 {
135 public:
136 /**
137@@ -61,11 +61,12 @@
138 */
139 virtual ~Scope() noexcept;
140
141+protected:
142+ Scope(internal::ScopeImpl* impl); // Instantiated only by ScopeImpl
143+ friend class internal::ScopeImpl;
144+
145 private:
146- Scope(internal::ScopeImpl* impl); // Instantiable only by ScopeImpl
147- friend class internal::ScopeImpl;
148-
149- std::unique_ptr<internal::ScopeImpl> p;
150+ internal::ScopeImpl* fwd() const;
151 };
152
153 } // namespace scopes
154
155=== modified file 'include/scopes/internal/ObjectProxyImpl.h'
156--- include/scopes/internal/ObjectProxyImpl.h 2013-11-01 12:44:48 +0000
157+++ include/scopes/internal/ObjectProxyImpl.h 2013-11-25 04:24:33 +0000
158@@ -34,17 +34,20 @@
159 namespace internal
160 {
161
162-class ObjectProxyImpl final
163+class ObjectProxyImpl
164 {
165 public:
166 ObjectProxyImpl(MWProxy const& mw_proxy);
167- ~ObjectProxyImpl() noexcept;
168+ virtual ~ObjectProxyImpl() noexcept;
169+
170+protected:
171+ MWProxy proxy() const; // Non-virtual because we cannot use covariance with incomplete types.
172+ // Each derived proxy implements a non-virtual fwd() method
173+ // that is called from within each operation to down-cast the MWProxy.
174
175 private:
176-
177 static Proxy create(MWProxy const& mw_proxy);
178
179-private:
180 MWProxy mw_proxy_;
181 };
182
183
184=== modified file 'include/scopes/internal/QueryCtrlImpl.h'
185--- include/scopes/internal/QueryCtrlImpl.h 2013-11-01 12:44:48 +0000
186+++ include/scopes/internal/QueryCtrlImpl.h 2013-11-25 04:24:33 +0000
187@@ -21,6 +21,7 @@
188
189 #include <scopes/internal/MWQueryCtrlProxyFwd.h>
190 #include <scopes/internal/MWReplyProxyFwd.h>
191+#include <scopes/internal/ObjectProxyImpl.h>
192 #include <scopes/QueryCtrlProxyFwd.h>
193
194 namespace unity
195@@ -41,19 +42,19 @@
196 // Calls to push() after finished() was called are ignored.
197 // If the proxy goes out of scope before finished was called, it implicitly calls finished().
198
199-class QueryCtrlImpl final
200+class QueryCtrlImpl : public virtual ObjectProxyImpl
201 {
202 public:
203- ~QueryCtrlImpl() noexcept;
204+ QueryCtrlImpl(MWQueryCtrlProxy const& ctrl_proxy, MWReplyProxy const& reply_proxy);
205+ virtual ~QueryCtrlImpl() noexcept;
206
207 void cancel();
208
209 static QueryCtrlProxy create(MWQueryCtrlProxy const& ctrl_proxy, MWReplyProxy const& reply_proxy);
210
211 private:
212- QueryCtrlImpl(MWQueryCtrlProxy const& ctrl_proxy, MWReplyProxy const& reply_proxy);
213+ MWQueryCtrlProxy fwd() const;
214
215- MWQueryCtrlProxy ctrl_proxy_;
216 MWReplyProxy reply_proxy_;
217 };
218
219
220=== modified file 'include/scopes/internal/RegistryImpl.h'
221--- include/scopes/internal/RegistryImpl.h 2013-11-18 23:41:30 +0000
222+++ include/scopes/internal/RegistryImpl.h 2013-11-25 04:24:33 +0000
223@@ -20,6 +20,7 @@
224 #define UNITY_INTERNAL_REGISTRYIMPL_H
225
226 #include <scopes/internal/MWRegistryProxyFwd.h>
227+#include <scopes/internal/ObjectProxyImpl.h>
228 #include <scopes/Registry.h>
229
230 namespace unity
231@@ -36,7 +37,7 @@
232
233 class RuntimeImpl;
234
235-class RegistryImpl final
236+class RegistryImpl : public virtual ObjectProxyImpl
237 {
238 public:
239 RegistryImpl(MWRegistryProxy const& mw_proxy, RuntimeImpl* runtime);
240@@ -48,7 +49,7 @@
241 static RegistryProxy create(MWRegistryProxy const& mw_proxy, RuntimeImpl* runtime);
242
243 private:
244- MWRegistryProxy const mw_proxy_;
245+ MWRegistryProxy fwd() const;
246 };
247
248 } // namespace internal
249
250=== modified file 'include/scopes/internal/ReplyImpl.h'
251--- include/scopes/internal/ReplyImpl.h 2013-11-22 04:00:45 +0000
252+++ include/scopes/internal/ReplyImpl.h 2013-11-25 04:24:33 +0000
253@@ -21,6 +21,7 @@
254
255 #include <scopes/internal/MWReplyProxyFwd.h>
256 #include <scopes/internal/CategoryRegistry.h>
257+#include <scopes/internal/ObjectProxyImpl.h>
258 #include <scopes/ReplyProxyFwd.h>
259 #include <scopes/Category.h>
260 #include <scopes/ReceiverBase.h>
261@@ -49,11 +50,11 @@
262 // Calls to push() after finished() was called are ignored.
263 // If the proxy goes out of scope before finished was called, it implicitly calls finished().
264
265-class ReplyImpl final
266+class ReplyImpl : public virtual ObjectProxyImpl
267 {
268 public:
269 ReplyImpl(MWReplyProxy const& mw_proxy, std::shared_ptr<QueryObject>const & qo);
270- ~ReplyImpl() noexcept;
271+ virtual ~ReplyImpl() noexcept;
272
273 Category::SCPtr register_category(std::string const& id, std::string const& title, std::string const &icon, std::string const& renderer_template);
274 void register_category(Category::SCPtr category);
275@@ -70,8 +71,8 @@
276 private:
277 bool push(Category::SCPtr category);
278 bool push(VariantMap const& variant_map);
279+ MWReplyProxy fwd() const;
280
281- MWReplyProxy mw_proxy_;
282 std::shared_ptr<QueryObject> qo_;
283 std::shared_ptr<CategoryRegistry> cat_registry_;
284 std::atomic_bool finished_;
285
286=== modified file 'include/scopes/internal/ScopeImpl.h'
287--- include/scopes/internal/ScopeImpl.h 2013-11-21 10:12:45 +0000
288+++ include/scopes/internal/ScopeImpl.h 2013-11-25 04:24:33 +0000
289@@ -20,6 +20,7 @@
290 #define UNITY_INTERNAL_SCOPEIMPL_H
291
292 #include <scopes/internal/MWScopeProxyFwd.h>
293+#include <scopes/internal/ObjectProxyImpl.h>
294 #include <scopes/QueryCtrlProxyFwd.h>
295 #include <scopes/ReceiverBase.h>
296 #include <scopes/ScopeProxyFwd.h>
297@@ -39,18 +40,19 @@
298
299 class RuntimeImpl;
300
301-class ScopeImpl final
302+class ScopeImpl : public virtual ObjectProxyImpl
303 {
304 public:
305 ScopeImpl(MWScopeProxy const& mw_proxy, RuntimeImpl* runtime);
306- ~ScopeImpl() noexcept;
307+ virtual ~ScopeImpl() noexcept;
308
309 QueryCtrlProxy create_query(std::string const& q, VariantMap const& hints, ReceiverBase::SPtr const& reply) const;
310
311 static ScopeProxy create(MWScopeProxy const& mw_proxy, RuntimeImpl* runtime);
312
313 private:
314- MWScopeProxy mw_proxy_;
315+ MWScopeProxy fwd() const;
316+
317 RuntimeImpl* const runtime_;
318 };
319
320
321=== modified file 'src/ObjectProxy.cpp'
322--- src/ObjectProxy.cpp 2013-11-01 12:44:48 +0000
323+++ src/ObjectProxy.cpp 2013-11-25 04:24:33 +0000
324@@ -42,10 +42,20 @@
325 {
326 }
327
328+ObjectProxy::ObjectProxy(internal::ObjectProxyImpl* pimpl) :
329+ p(pimpl)
330+{
331+}
332+
333 ObjectProxy::~ObjectProxy() noexcept
334 {
335 }
336
337+internal::ObjectProxyImpl* ObjectProxy::pimpl() const noexcept
338+{
339+ return p.get();
340+}
341+
342 //! @endcond
343
344 } // namespace scopes
345
346=== modified file 'src/QueryCtrl.cpp'
347--- src/QueryCtrl.cpp 2013-11-01 12:44:48 +0000
348+++ src/QueryCtrl.cpp 2013-11-25 04:24:33 +0000
349@@ -32,7 +32,7 @@
350 //! @cond
351
352 QueryCtrl::QueryCtrl(internal::QueryCtrlImpl* impl)
353- : p(impl)
354+ : ObjectProxy(impl)
355 {
356 }
357
358@@ -42,7 +42,12 @@
359
360 void QueryCtrl::cancel() const
361 {
362- return p->cancel();
363+ return fwd()->cancel();
364+}
365+
366+internal::QueryCtrlImpl* QueryCtrl::fwd() const
367+{
368+ return dynamic_cast<internal::QueryCtrlImpl*>(pimpl());
369 }
370
371 //! @endcond
372
373=== modified file 'src/Registry.cpp'
374--- src/Registry.cpp 2013-11-01 12:44:48 +0000
375+++ src/Registry.cpp 2013-11-25 04:24:33 +0000
376@@ -32,7 +32,7 @@
377 //! @cond
378
379 Registry::Registry(internal::RegistryImpl* impl) :
380- p(impl)
381+ ObjectProxy(impl)
382 {
383 }
384
385@@ -44,12 +44,17 @@
386
387 ScopeProxy Registry::find(std::string const& scope_name) const
388 {
389- return p->find(scope_name);
390+ return fwd()->find(scope_name);
391 }
392
393 ScopeMap Registry::list() const
394 {
395- return p->list();
396+ return fwd()->list();
397+}
398+
399+internal::RegistryImpl* Registry::fwd() const
400+{
401+ return dynamic_cast<internal::RegistryImpl*>(pimpl());
402 }
403
404 } // namespace scopes
405
406=== modified file 'src/Reply.cpp'
407--- src/Reply.cpp 2013-11-18 14:58:07 +0000
408+++ src/Reply.cpp 2013-11-25 04:24:33 +0000
409@@ -32,8 +32,8 @@
410
411 //! @cond
412
413-Reply::Reply(internal::ReplyImpl* impl)
414- : p(impl)
415+Reply::Reply(internal::ReplyImpl* impl) :
416+ ObjectProxy(impl)
417 {
418 }
419
420@@ -43,27 +43,32 @@
421
422 Category::SCPtr Reply::register_category(std::string const& id, std::string const& title, std::string const &icon, std::string const& renderer_template)
423 {
424- return p->register_category(id, title, icon, renderer_template);
425+ return fwd()->register_category(id, title, icon, renderer_template);
426 }
427
428 void Reply::register_category(Category::SCPtr category)
429 {
430- return p->register_category(category);
431+ return fwd()->register_category(category);
432 }
433
434 Category::SCPtr Reply::lookup_category(std::string const& id) const
435 {
436- return p->lookup_category(id);
437+ return fwd()->lookup_category(id);
438 }
439
440 bool Reply::push(ResultItem const& result) const
441 {
442- return p->push(result);
443+ return fwd()->push(result);
444 }
445
446 void Reply::finished() const
447 {
448- return p->finished();
449+ return fwd()->finished();
450+}
451+
452+internal::ReplyImpl* Reply::fwd() const
453+{
454+ return dynamic_cast<internal::ReplyImpl*>(pimpl());
455 }
456
457 //! @endcond
458
459=== modified file 'src/Scope.cpp'
460--- src/Scope.cpp 2013-11-21 10:12:45 +0000
461+++ src/Scope.cpp 2013-11-25 04:24:33 +0000
462@@ -32,7 +32,7 @@
463 //! @cond
464
465 Scope::Scope(internal::ScopeImpl* impl) :
466- p(impl)
467+ ObjectProxy(impl)
468 {
469 }
470
471@@ -42,7 +42,12 @@
472
473 QueryCtrlProxy Scope::create_query(std::string const& q, VariantMap const& hints, ReceiverBase::SPtr const& reply) const
474 {
475- return p->create_query(q, hints, reply);
476+ return fwd()->create_query(q, hints, reply);
477+}
478+
479+internal::ScopeImpl* Scope::fwd() const
480+{
481+ return dynamic_cast<internal::ScopeImpl*>(pimpl());
482 }
483
484 //! @endcond
485
486=== modified file 'src/internal/ObjectProxyImpl.cpp'
487--- src/internal/ObjectProxyImpl.cpp 2013-11-18 23:53:56 +0000
488+++ src/internal/ObjectProxyImpl.cpp 2013-11-25 04:24:33 +0000
489@@ -49,6 +49,11 @@
490 return make_shared<ObjectProxy>();
491 }
492
493+MWProxy ObjectProxyImpl::proxy() const
494+{
495+ return mw_proxy_;
496+}
497+
498 } // namespace internal
499
500 } // namespace scopes
501
502=== modified file 'src/internal/QueryCtrlImpl.cpp'
503--- src/internal/QueryCtrlImpl.cpp 2013-11-22 04:00:45 +0000
504+++ src/internal/QueryCtrlImpl.cpp 2013-11-25 04:24:33 +0000
505@@ -42,7 +42,7 @@
506 {
507
508 QueryCtrlImpl::QueryCtrlImpl(MWQueryCtrlProxy const& ctrl_proxy, MWReplyProxy const& reply_proxy) :
509- ctrl_proxy_(ctrl_proxy),
510+ ObjectProxyImpl(ctrl_proxy),
511 reply_proxy_(reply_proxy)
512 {
513 assert(ctrl_proxy);
514@@ -60,7 +60,7 @@
515 try
516 {
517 // Forward cancellation down-stream to the query. This does not block.
518- ctrl_proxy_->cancel();
519+ fwd()->cancel();
520
521 // Indicate (to ourselves) that this query is complete. Calling via the MWReplyProxy ensures
522 // the finished() call will be processed by a seperate server-side thread,
523@@ -78,6 +78,11 @@
524 return QueryCtrlProxy(new QueryCtrl(new QueryCtrlImpl(ctrl_proxy, reply_proxy)));
525 }
526
527+MWQueryCtrlProxy QueryCtrlImpl::fwd() const
528+{
529+ return dynamic_pointer_cast<MWQueryCtrl>(proxy());
530+}
531+
532 } // namespace internal
533
534 } // namespace scopes
535
536=== modified file 'src/internal/RegistryImpl.cpp'
537--- src/internal/RegistryImpl.cpp 2013-11-18 23:41:30 +0000
538+++ src/internal/RegistryImpl.cpp 2013-11-25 04:24:33 +0000
539@@ -37,7 +37,7 @@
540 {
541
542 RegistryImpl::RegistryImpl(MWRegistryProxy const& mw_proxy, RuntimeImpl*) :
543- mw_proxy_(mw_proxy)
544+ ObjectProxyImpl(mw_proxy)
545 {
546 }
547
548@@ -47,12 +47,12 @@
549
550 ScopeProxy RegistryImpl::find(std::string const& scope_name)
551 {
552- return mw_proxy_->find(scope_name);
553+ return fwd()->find(scope_name);
554 }
555
556 ScopeMap RegistryImpl::list()
557 {
558- return mw_proxy_->list();
559+ return fwd()->list();
560 }
561
562 RegistryProxy RegistryImpl::create(MWRegistryProxy const& mw_proxy, RuntimeImpl* runtime)
563@@ -60,6 +60,11 @@
564 return RegistryProxy(new Registry(new RegistryImpl(mw_proxy, runtime)));
565 }
566
567+MWRegistryProxy RegistryImpl::fwd() const
568+{
569+ return dynamic_pointer_cast<MWRegistry>(proxy());
570+}
571+
572 } // namespace internal
573
574 } // namespace scopes
575
576=== modified file 'src/internal/ReplyImpl.cpp'
577--- src/internal/ReplyImpl.cpp 2013-11-22 04:00:45 +0000
578+++ src/internal/ReplyImpl.cpp 2013-11-25 04:24:33 +0000
579@@ -45,7 +45,7 @@
580 {
581
582 ReplyImpl::ReplyImpl(MWReplyProxy const& mw_proxy, std::shared_ptr<QueryObject> const& qo) :
583- mw_proxy_(mw_proxy),
584+ ObjectProxyImpl(mw_proxy),
585 qo_(qo),
586 cat_registry_(new CategoryRegistry()),
587 finished_(false)
588@@ -125,7 +125,7 @@
589 {
590 try
591 {
592- mw_proxy_->push(variant_map);
593+ fwd()->push(variant_map);
594 return true;
595 }
596 catch (MiddlewareException const& e)
597@@ -149,7 +149,7 @@
598 {
599 try
600 {
601- mw_proxy_->finished(reason);
602+ fwd()->finished(reason);
603 }
604 catch (MiddlewareException const& e)
605 {
606@@ -160,7 +160,12 @@
607
608 ReplyProxy ReplyImpl::create(MWReplyProxy const& mw_proxy, std::shared_ptr<QueryObject> const& qo)
609 {
610- return ReplyProxy(new Reply(new ReplyImpl(mw_proxy, qo)));
611+ return ReplyProxy(new Reply((new ReplyImpl(mw_proxy, qo))));
612+}
613+
614+MWReplyProxy ReplyImpl::fwd() const
615+{
616+ return dynamic_pointer_cast<MWReply>(proxy());
617 }
618
619 } // namespace internal
620
621=== modified file 'src/internal/ScopeImpl.cpp'
622--- src/internal/ScopeImpl.cpp 2013-11-22 04:00:45 +0000
623+++ src/internal/ScopeImpl.cpp 2013-11-25 04:24:33 +0000
624@@ -40,7 +40,7 @@
625 {
626
627 ScopeImpl::ScopeImpl(MWScopeProxy const& mw_proxy, RuntimeImpl* runtime) :
628- mw_proxy_(mw_proxy),
629+ ObjectProxyImpl(mw_proxy),
630 runtime_(runtime)
631 {
632 assert(runtime);
633@@ -58,7 +58,7 @@
634 // Create a middleware server-side object that can receive incoming
635 // push() and finished() messages over the network.
636 ReplyObject::SPtr ro(make_shared<ReplyObject>(reply, runtime_));
637- MWReplyProxy rp = mw_proxy_->mw_base()->add_reply_object(ro);
638+ MWReplyProxy rp = fwd()->mw_base()->add_reply_object(ro);
639
640 // Forward the the create_query() method across the bus. This is a
641 // synchronous twoway interaction with the scope, so it can return
642@@ -66,7 +66,7 @@
643 // thread for create_query() calls, this is guaranteed not to block for
644 // any length of time. (No application code other than the QueryBase constructor
645 // is called by create_query() on the server side.)
646- ctrl = mw_proxy_->create_query(q, hints, rp);
647+ ctrl = fwd()->create_query(q, hints, rp);
648 assert(ctrl);
649 }
650 catch (unity::Exception const& e)
651@@ -92,6 +92,11 @@
652 return ScopeProxy(new Scope(new ScopeImpl(mw_proxy, runtime)));
653 }
654
655+MWScopeProxy ScopeImpl::fwd() const
656+{
657+ return dynamic_pointer_cast<MWScope>(proxy());
658+}
659+
660 } // namespace internal
661
662 } // namespace scopes

Subscribers

People subscribed via source and target branches

to all changes: