19 #ifndef INCLUDE_RCF_SERVERSTUB_HPP
20 #define INCLUDE_RCF_SERVERSTUB_HPP
26 #include <boost/shared_ptr.hpp>
28 #include <RCF/Config.hpp>
29 #include <RCF/Export.hpp>
30 #include <RCF/GetInterfaceName.hpp>
31 #include <RCF/RcfClient.hpp>
32 #include <RCF/RcfSession.hpp>
33 #include <RCF/SerializationProtocol.hpp>
34 #include <RCF/Token.hpp>
41 typedef boost::shared_ptr<I_RcfClient> RcfClientPtr;
48 virtual T &deref() = 0;
55 typedef boost::shared_ptr< I_Deref<T> > type;
59 class DerefObj :
public I_Deref<T>
76 class DerefSharedPtr :
public I_Deref<T>
79 DerefSharedPtr(boost::shared_ptr<T> tPtr) :
89 boost::shared_ptr<T> mTPtr;
93 class DerefWeakPtr :
public I_Deref<T>
96 DerefWeakPtr(boost::weak_ptr<T> tWeakPtr) :
102 boost::shared_ptr<T> tPtr(mTWeakPtr);
107 Exception e(_RcfError_ServerStubExpired());
112 boost::weak_ptr<T> mTWeakPtr;
116 class DerefAutoPtr :
public I_Deref<T>
119 DerefAutoPtr(
const std::auto_ptr<T> &tAutoPtr) :
120 mTAutoPtr( const_cast<std::auto_ptr<T> &>(tAutoPtr))
129 std::auto_ptr<T> mTAutoPtr;
132 typedef boost::function2<
135 RcfSession &> InvokeFunctor;
137 typedef std::map<std::string, InvokeFunctor> InvokeFunctorMap;
139 RCF_EXPORT
void setCurrentCallDesc(std::string& desc, RCF::MethodInvocationRequest& request,
const char * szFunc,
const char * szArity);
146 #pragma warning( push )
147 #pragma warning( disable: 4702 )
150 template<
typename InterfaceT,
typename IdT,
typename ImplementationT>
152 InterfaceT & interface_,
154 RcfSession & session,
157 setCurrentCallDesc(session.mCurrentCallDesc, session.mRequest, interface_.getFunctionName(
id), interface_.getArity(
id));
158 RCF_LOG_2() <<
"RcfServer - begin remote call. " << session.mCurrentCallDesc;
159 interface_.invoke(
id, session, t);
163 #pragma warning( pop )
166 template<
typename InterfaceT,
typename DerefPtrT>
167 void registerInvokeFunctors(
168 InterfaceT & interface_,
169 InvokeFunctorMap & invokeFunctorMap,
172 interface_.registerInvokeFunctors(invokeFunctorMap, derefPtr);
175 template<
typename InheritT,
typename InterfaceT,
typename DerefPtrT>
176 void registerParentInvokeFunctors(
178 InterfaceT & interface_,
179 InvokeFunctorMap & invokeFunctorMap,
181 boost::mpl::false_ *)
183 typedef typename GetInterface<InheritT>::type ParentInterfaceT;
184 interface_.ParentInterfaceT::registerInvokeFunctors(
189 template<
typename InheritT,
typename InterfaceT,
typename DerefPtrT>
190 void registerParentInvokeFunctors(
198 template<
typename InheritT,
typename InterfaceT,
typename DerefPtrT>
199 void registerParentInvokeFunctors(
201 InterfaceT & interface_,
202 InvokeFunctorMap & invokeFunctorMap,
206 typedef BOOST_DEDUCED_TYPENAME boost::is_same<
208 BOOST_DEDUCED_TYPENAME GetInterface<InheritT>::type >::type type;
210 registerParentInvokeFunctors(
218 template<
typename InheritT,
typename InterfaceT>
219 void setClientStubPtr(
221 InterfaceT &interface_,
222 boost::mpl::false_ *)
224 typedef typename InheritT::RcfClientT ParentInterfaceT;
225 interface_.ParentInterfaceT::setClientStubPtr(
226 interface_.mClientStubPtr);
229 template<
typename InheritT,
typename InterfaceT>
230 void setClientStubPtr(
236 template<
typename InheritT,
typename InterfaceT>
237 void setClientStubPtr(
239 InterfaceT &interface_)
242 typedef BOOST_DEDUCED_TYPENAME boost::is_same<
244 BOOST_DEDUCED_TYPENAME GetInterface<InheritT>::type >::type type;
246 setClientStubPtr(i, interface_, (type *) NULL);
249 template<
typename Archive,
typename RcfClientT>
252 RcfClientT & rcfClient)
256 rcfClient.mClientStubPtr ?
257 ar &
true & rcfClient.getClientStub() :
262 bool hasClientStub =
false;
266 if (!rcfClient.mClientStubPtr)
268 typedef typename RcfClientT::Interface Interface;
269 std::string interfaceName = getInterfaceName( (Interface*) 0);
270 ClientStubPtr clientStubPtr(
new ClientStub(interfaceName));
271 rcfClient.setClientStubPtr(clientStubPtr);
273 ar & rcfClient.getClientStub();
277 rcfClient.setClientStubPtr( ClientStubPtr());
282 template<
typename Archive,
typename RcfClientT>
285 RcfClientT & rcfClient,
288 typedef typename Archive::is_saving IsSaving;
289 const bool isSaving = IsSaving::value;
293 bool hasClientStub = rcfClient.mClientStubPtr;
297 ar & rcfClient.getClientStub();
302 bool hasClientStub =
false;
307 if (!rcfClient.mClientStubPtr)
309 typedef typename RcfClientT::Interface Interface;
310 std::string interfaceName = getInterfaceName( (Interface*) 0);
311 ClientStubPtr clientStubPtr(
new ClientStub(interfaceName));
312 rcfClient.setClientStubPtr(clientStubPtr);
314 ar & rcfClient.getClientStub();
318 rcfClient.setClientStubPtr( ClientStubPtr());
323 template<
typename RcfClientT>
324 ClientStubPtr getClientStubPtr(
const RcfClientT &rcfClient)
326 return rcfClient.mClientStubPtr;
331 template<
typename InterfaceT,
typename ImplementationT>
333 InterfaceT & interface_,
336 RcfSession & session)
339 case 0: StubAccess().invoke(interface_, boost::mpl::int_< 0>(), session, t);
break;
340 case 1: StubAccess().invoke(interface_, boost::mpl::int_< 1>(), session, t);
break;
341 case 2: StubAccess().invoke(interface_, boost::mpl::int_< 2>(), session, t);
break;
342 case 3: StubAccess().invoke(interface_, boost::mpl::int_< 3>(), session, t);
break;
343 case 4: StubAccess().invoke(interface_, boost::mpl::int_< 4>(), session, t);
break;
344 case 5: StubAccess().invoke(interface_, boost::mpl::int_< 5>(), session, t);
break;
345 case 6: StubAccess().invoke(interface_, boost::mpl::int_< 6>(), session, t);
break;
346 case 7: StubAccess().invoke(interface_, boost::mpl::int_< 7>(), session, t);
break;
347 case 8: StubAccess().invoke(interface_, boost::mpl::int_< 8>(), session, t);
break;
348 case 9: StubAccess().invoke(interface_, boost::mpl::int_< 9>(), session, t);
break;
349 case 10: StubAccess().invoke(interface_, boost::mpl::int_< 10>(), session, t);
break;
350 case 11: StubAccess().invoke(interface_, boost::mpl::int_< 11>(), session, t);
break;
351 case 12: StubAccess().invoke(interface_, boost::mpl::int_< 12>(), session, t);
break;
352 case 13: StubAccess().invoke(interface_, boost::mpl::int_< 13>(), session, t);
break;
353 case 14: StubAccess().invoke(interface_, boost::mpl::int_< 14>(), session, t);
break;
354 case 15: StubAccess().invoke(interface_, boost::mpl::int_< 15>(), session, t);
break;
355 case 16: StubAccess().invoke(interface_, boost::mpl::int_< 16>(), session, t);
break;
356 case 17: StubAccess().invoke(interface_, boost::mpl::int_< 17>(), session, t);
break;
357 case 18: StubAccess().invoke(interface_, boost::mpl::int_< 18>(), session, t);
break;
358 case 19: StubAccess().invoke(interface_, boost::mpl::int_< 19>(), session, t);
break;
359 case 20: StubAccess().invoke(interface_, boost::mpl::int_< 20>(), session, t);
break;
360 case 21: StubAccess().invoke(interface_, boost::mpl::int_< 21>(), session, t);
break;
361 case 22: StubAccess().invoke(interface_, boost::mpl::int_< 22>(), session, t);
break;
362 case 23: StubAccess().invoke(interface_, boost::mpl::int_< 23>(), session, t);
break;
363 case 24: StubAccess().invoke(interface_, boost::mpl::int_< 24>(), session, t);
break;
364 case 25: StubAccess().invoke(interface_, boost::mpl::int_< 25>(), session, t);
break;
365 case 26: StubAccess().invoke(interface_, boost::mpl::int_< 26>(), session, t);
break;
366 case 27: StubAccess().invoke(interface_, boost::mpl::int_< 27>(), session, t);
break;
367 case 28: StubAccess().invoke(interface_, boost::mpl::int_< 28>(), session, t);
break;
368 case 29: StubAccess().invoke(interface_, boost::mpl::int_< 29>(), session, t);
break;
369 case 30: StubAccess().invoke(interface_, boost::mpl::int_< 30>(), session, t);
break;
370 case 31: StubAccess().invoke(interface_, boost::mpl::int_< 31>(), session, t);
break;
371 case 32: StubAccess().invoke(interface_, boost::mpl::int_< 32>(), session, t);
break;
372 case 33: StubAccess().invoke(interface_, boost::mpl::int_< 33>(), session, t);
break;
373 case 34: StubAccess().invoke(interface_, boost::mpl::int_< 34>(), session, t);
break;
374 case 35: StubAccess().invoke(interface_, boost::mpl::int_< 35>(), session, t);
break;
375 case 36: StubAccess().invoke(interface_, boost::mpl::int_< 36>(), session, t);
break;
376 case 37: StubAccess().invoke(interface_, boost::mpl::int_< 37>(), session, t);
break;
377 case 38: StubAccess().invoke(interface_, boost::mpl::int_< 38>(), session, t);
break;
378 case 39: StubAccess().invoke(interface_, boost::mpl::int_< 39>(), session, t);
break;
379 case 40: StubAccess().invoke(interface_, boost::mpl::int_< 40>(), session, t);
break;
380 case 41: StubAccess().invoke(interface_, boost::mpl::int_< 41>(), session, t);
break;
381 case 42: StubAccess().invoke(interface_, boost::mpl::int_< 42>(), session, t);
break;
382 case 43: StubAccess().invoke(interface_, boost::mpl::int_< 43>(), session, t);
break;
383 case 44: StubAccess().invoke(interface_, boost::mpl::int_< 44>(), session, t);
break;
384 case 45: StubAccess().invoke(interface_, boost::mpl::int_< 45>(), session, t);
break;
385 case 46: StubAccess().invoke(interface_, boost::mpl::int_< 46>(), session, t);
break;
386 case 47: StubAccess().invoke(interface_, boost::mpl::int_< 47>(), session, t);
break;
387 case 48: StubAccess().invoke(interface_, boost::mpl::int_< 48>(), session, t);
break;
388 case 49: StubAccess().invoke(interface_, boost::mpl::int_< 49>(), session, t);
break;
389 case 50: StubAccess().invoke(interface_, boost::mpl::int_< 50>(), session, t);
break;
390 case 51: StubAccess().invoke(interface_, boost::mpl::int_< 51>(), session, t);
break;
391 case 52: StubAccess().invoke(interface_, boost::mpl::int_< 52>(), session, t);
break;
392 case 53: StubAccess().invoke(interface_, boost::mpl::int_< 53>(), session, t);
break;
393 case 54: StubAccess().invoke(interface_, boost::mpl::int_< 54>(), session, t);
break;
394 case 55: StubAccess().invoke(interface_, boost::mpl::int_< 55>(), session, t);
break;
395 case 56: StubAccess().invoke(interface_, boost::mpl::int_< 56>(), session, t);
break;
396 case 57: StubAccess().invoke(interface_, boost::mpl::int_< 57>(), session, t);
break;
397 case 58: StubAccess().invoke(interface_, boost::mpl::int_< 58>(), session, t);
break;
398 case 59: StubAccess().invoke(interface_, boost::mpl::int_< 59>(), session, t);
break;
399 case 60: StubAccess().invoke(interface_, boost::mpl::int_< 60>(), session, t);
break;
400 case 61: StubAccess().invoke(interface_, boost::mpl::int_< 61>(), session, t);
break;
401 case 62: StubAccess().invoke(interface_, boost::mpl::int_< 62>(), session, t);
break;
402 case 63: StubAccess().invoke(interface_, boost::mpl::int_< 63>(), session, t);
break;
403 case 64: StubAccess().invoke(interface_, boost::mpl::int_< 64>(), session, t);
break;
404 case 65: StubAccess().invoke(interface_, boost::mpl::int_< 65>(), session, t);
break;
405 case 66: StubAccess().invoke(interface_, boost::mpl::int_< 66>(), session, t);
break;
406 case 67: StubAccess().invoke(interface_, boost::mpl::int_< 67>(), session, t);
break;
407 case 68: StubAccess().invoke(interface_, boost::mpl::int_< 68>(), session, t);
break;
408 case 69: StubAccess().invoke(interface_, boost::mpl::int_< 69>(), session, t);
break;
409 case 70: StubAccess().invoke(interface_, boost::mpl::int_< 70>(), session, t);
break;
410 case 71: StubAccess().invoke(interface_, boost::mpl::int_< 71>(), session, t);
break;
411 case 72: StubAccess().invoke(interface_, boost::mpl::int_< 72>(), session, t);
break;
412 case 73: StubAccess().invoke(interface_, boost::mpl::int_< 73>(), session, t);
break;
413 case 74: StubAccess().invoke(interface_, boost::mpl::int_< 74>(), session, t);
break;
414 case 75: StubAccess().invoke(interface_, boost::mpl::int_< 75>(), session, t);
break;
415 case 76: StubAccess().invoke(interface_, boost::mpl::int_< 76>(), session, t);
break;
416 case 77: StubAccess().invoke(interface_, boost::mpl::int_< 77>(), session, t);
break;
417 case 78: StubAccess().invoke(interface_, boost::mpl::int_< 78>(), session, t);
break;
418 case 79: StubAccess().invoke(interface_, boost::mpl::int_< 79>(), session, t);
break;
419 case 80: StubAccess().invoke(interface_, boost::mpl::int_< 80>(), session, t);
break;
420 case 81: StubAccess().invoke(interface_, boost::mpl::int_< 81>(), session, t);
break;
421 case 82: StubAccess().invoke(interface_, boost::mpl::int_< 82>(), session, t);
break;
422 case 83: StubAccess().invoke(interface_, boost::mpl::int_< 83>(), session, t);
break;
423 case 84: StubAccess().invoke(interface_, boost::mpl::int_< 84>(), session, t);
break;
424 case 85: StubAccess().invoke(interface_, boost::mpl::int_< 85>(), session, t);
break;
425 case 86: StubAccess().invoke(interface_, boost::mpl::int_< 86>(), session, t);
break;
426 case 87: StubAccess().invoke(interface_, boost::mpl::int_< 87>(), session, t);
break;
427 case 88: StubAccess().invoke(interface_, boost::mpl::int_< 88>(), session, t);
break;
428 case 89: StubAccess().invoke(interface_, boost::mpl::int_< 89>(), session, t);
break;
429 case 90: StubAccess().invoke(interface_, boost::mpl::int_< 90>(), session, t);
break;
430 case 91: StubAccess().invoke(interface_, boost::mpl::int_< 91>(), session, t);
break;
431 case 92: StubAccess().invoke(interface_, boost::mpl::int_< 92>(), session, t);
break;
432 case 93: StubAccess().invoke(interface_, boost::mpl::int_< 93>(), session, t);
break;
433 case 94: StubAccess().invoke(interface_, boost::mpl::int_< 94>(), session, t);
break;
434 case 95: StubAccess().invoke(interface_, boost::mpl::int_< 95>(), session, t);
break;
435 case 96: StubAccess().invoke(interface_, boost::mpl::int_< 96>(), session, t);
break;
436 case 97: StubAccess().invoke(interface_, boost::mpl::int_< 97>(), session, t);
break;
437 case 98: StubAccess().invoke(interface_, boost::mpl::int_< 98>(), session, t);
break;
438 case 99: StubAccess().invoke(interface_, boost::mpl::int_< 99>(), session, t);
break;
439 case 100: StubAccess().invoke(interface_, boost::mpl::int_<100>(), session, t);
break;
440 case 101: StubAccess().invoke(interface_, boost::mpl::int_<101>(), session, t);
break;
441 case 102: StubAccess().invoke(interface_, boost::mpl::int_<102>(), session, t);
break;
442 case 103: StubAccess().invoke(interface_, boost::mpl::int_<103>(), session, t);
break;
443 case 104: StubAccess().invoke(interface_, boost::mpl::int_<104>(), session, t);
break;
444 case 105: StubAccess().invoke(interface_, boost::mpl::int_<105>(), session, t);
break;
445 case 106: StubAccess().invoke(interface_, boost::mpl::int_<106>(), session, t);
break;
446 case 107: StubAccess().invoke(interface_, boost::mpl::int_<107>(), session, t);
break;
447 case 108: StubAccess().invoke(interface_, boost::mpl::int_<108>(), session, t);
break;
448 case 109: StubAccess().invoke(interface_, boost::mpl::int_<109>(), session, t);
break;
449 case 110: StubAccess().invoke(interface_, boost::mpl::int_<110>(), session, t);
break;
450 case 111: StubAccess().invoke(interface_, boost::mpl::int_<111>(), session, t);
break;
451 case 112: StubAccess().invoke(interface_, boost::mpl::int_<112>(), session, t);
break;
452 case 113: StubAccess().invoke(interface_, boost::mpl::int_<113>(), session, t);
break;
453 case 114: StubAccess().invoke(interface_, boost::mpl::int_<114>(), session, t);
break;
454 case 115: StubAccess().invoke(interface_, boost::mpl::int_<115>(), session, t);
break;
455 case 116: StubAccess().invoke(interface_, boost::mpl::int_<116>(), session, t);
break;
456 case 117: StubAccess().invoke(interface_, boost::mpl::int_<117>(), session, t);
break;
457 case 118: StubAccess().invoke(interface_, boost::mpl::int_<118>(), session, t);
break;
458 case 119: StubAccess().invoke(interface_, boost::mpl::int_<119>(), session, t);
break;
459 case 120: StubAccess().invoke(interface_, boost::mpl::int_<120>(), session, t);
break;
460 case 121: StubAccess().invoke(interface_, boost::mpl::int_<121>(), session, t);
break;
461 case 122: StubAccess().invoke(interface_, boost::mpl::int_<122>(), session, t);
break;
462 case 123: StubAccess().invoke(interface_, boost::mpl::int_<123>(), session, t);
break;
463 case 124: StubAccess().invoke(interface_, boost::mpl::int_<124>(), session, t);
break;
464 case 125: StubAccess().invoke(interface_, boost::mpl::int_<125>(), session, t);
break;
465 case 126: StubAccess().invoke(interface_, boost::mpl::int_<126>(), session, t);
break;
466 case 127: StubAccess().invoke(interface_, boost::mpl::int_<127>(), session, t);
break;
467 case 128: StubAccess().invoke(interface_, boost::mpl::int_<128>(), session, t);
break;
468 case 129: StubAccess().invoke(interface_, boost::mpl::int_<129>(), session, t);
break;
469 case 130: StubAccess().invoke(interface_, boost::mpl::int_<130>(), session, t);
break;
470 case 131: StubAccess().invoke(interface_, boost::mpl::int_<131>(), session, t);
break;
471 case 132: StubAccess().invoke(interface_, boost::mpl::int_<132>(), session, t);
break;
472 case 133: StubAccess().invoke(interface_, boost::mpl::int_<133>(), session, t);
break;
473 case 134: StubAccess().invoke(interface_, boost::mpl::int_<134>(), session, t);
break;
474 case 135: StubAccess().invoke(interface_, boost::mpl::int_<135>(), session, t);
break;
475 case 136: StubAccess().invoke(interface_, boost::mpl::int_<136>(), session, t);
break;
476 case 137: StubAccess().invoke(interface_, boost::mpl::int_<137>(), session, t);
break;
477 case 138: StubAccess().invoke(interface_, boost::mpl::int_<138>(), session, t);
break;
478 case 139: StubAccess().invoke(interface_, boost::mpl::int_<139>(), session, t);
break;
479 case 140: StubAccess().invoke(interface_, boost::mpl::int_<140>(), session, t);
break;
480 case 141: StubAccess().invoke(interface_, boost::mpl::int_<141>(), session, t);
break;
481 case 142: StubAccess().invoke(interface_, boost::mpl::int_<142>(), session, t);
break;
482 case 143: StubAccess().invoke(interface_, boost::mpl::int_<143>(), session, t);
break;
483 case 144: StubAccess().invoke(interface_, boost::mpl::int_<144>(), session, t);
break;
484 case 145: StubAccess().invoke(interface_, boost::mpl::int_<145>(), session, t);
break;
485 case 146: StubAccess().invoke(interface_, boost::mpl::int_<146>(), session, t);
break;
486 case 147: StubAccess().invoke(interface_, boost::mpl::int_<147>(), session, t);
break;
487 case 148: StubAccess().invoke(interface_, boost::mpl::int_<148>(), session, t);
break;
488 case 149: StubAccess().invoke(interface_, boost::mpl::int_<149>(), session, t);
break;
489 case 150: StubAccess().invoke(interface_, boost::mpl::int_<150>(), session, t);
break;
490 case 151: StubAccess().invoke(interface_, boost::mpl::int_<151>(), session, t);
break;
491 case 152: StubAccess().invoke(interface_, boost::mpl::int_<152>(), session, t);
break;
492 case 153: StubAccess().invoke(interface_, boost::mpl::int_<153>(), session, t);
break;
493 case 154: StubAccess().invoke(interface_, boost::mpl::int_<154>(), session, t);
break;
494 case 155: StubAccess().invoke(interface_, boost::mpl::int_<155>(), session, t);
break;
495 case 156: StubAccess().invoke(interface_, boost::mpl::int_<156>(), session, t);
break;
496 case 157: StubAccess().invoke(interface_, boost::mpl::int_<157>(), session, t);
break;
497 case 158: StubAccess().invoke(interface_, boost::mpl::int_<158>(), session, t);
break;
498 case 159: StubAccess().invoke(interface_, boost::mpl::int_<159>(), session, t);
break;
499 case 160: StubAccess().invoke(interface_, boost::mpl::int_<160>(), session, t);
break;
500 case 161: StubAccess().invoke(interface_, boost::mpl::int_<161>(), session, t);
break;
501 case 162: StubAccess().invoke(interface_, boost::mpl::int_<162>(), session, t);
break;
502 case 163: StubAccess().invoke(interface_, boost::mpl::int_<163>(), session, t);
break;
503 case 164: StubAccess().invoke(interface_, boost::mpl::int_<164>(), session, t);
break;
504 case 165: StubAccess().invoke(interface_, boost::mpl::int_<165>(), session, t);
break;
505 case 166: StubAccess().invoke(interface_, boost::mpl::int_<166>(), session, t);
break;
506 case 167: StubAccess().invoke(interface_, boost::mpl::int_<167>(), session, t);
break;
507 case 168: StubAccess().invoke(interface_, boost::mpl::int_<168>(), session, t);
break;
508 case 169: StubAccess().invoke(interface_, boost::mpl::int_<169>(), session, t);
break;
509 case 170: StubAccess().invoke(interface_, boost::mpl::int_<170>(), session, t);
break;
510 case 171: StubAccess().invoke(interface_, boost::mpl::int_<171>(), session, t);
break;
511 case 172: StubAccess().invoke(interface_, boost::mpl::int_<172>(), session, t);
break;
512 case 173: StubAccess().invoke(interface_, boost::mpl::int_<173>(), session, t);
break;
513 case 174: StubAccess().invoke(interface_, boost::mpl::int_<174>(), session, t);
break;
514 case 175: StubAccess().invoke(interface_, boost::mpl::int_<175>(), session, t);
break;
515 case 176: StubAccess().invoke(interface_, boost::mpl::int_<176>(), session, t);
break;
516 case 177: StubAccess().invoke(interface_, boost::mpl::int_<177>(), session, t);
break;
517 case 178: StubAccess().invoke(interface_, boost::mpl::int_<178>(), session, t);
break;
518 case 179: StubAccess().invoke(interface_, boost::mpl::int_<179>(), session, t);
break;
519 case 180: StubAccess().invoke(interface_, boost::mpl::int_<180>(), session, t);
break;
520 case 181: StubAccess().invoke(interface_, boost::mpl::int_<181>(), session, t);
break;
521 case 182: StubAccess().invoke(interface_, boost::mpl::int_<182>(), session, t);
break;
522 case 183: StubAccess().invoke(interface_, boost::mpl::int_<183>(), session, t);
break;
523 case 184: StubAccess().invoke(interface_, boost::mpl::int_<184>(), session, t);
break;
524 case 185: StubAccess().invoke(interface_, boost::mpl::int_<185>(), session, t);
break;
525 case 186: StubAccess().invoke(interface_, boost::mpl::int_<186>(), session, t);
break;
526 case 187: StubAccess().invoke(interface_, boost::mpl::int_<187>(), session, t);
break;
527 case 188: StubAccess().invoke(interface_, boost::mpl::int_<188>(), session, t);
break;
528 case 189: StubAccess().invoke(interface_, boost::mpl::int_<189>(), session, t);
break;
529 case 190: StubAccess().invoke(interface_, boost::mpl::int_<190>(), session, t);
break;
530 case 191: StubAccess().invoke(interface_, boost::mpl::int_<191>(), session, t);
break;
531 case 192: StubAccess().invoke(interface_, boost::mpl::int_<192>(), session, t);
break;
532 case 193: StubAccess().invoke(interface_, boost::mpl::int_<193>(), session, t);
break;
533 case 194: StubAccess().invoke(interface_, boost::mpl::int_<194>(), session, t);
break;
534 case 195: StubAccess().invoke(interface_, boost::mpl::int_<195>(), session, t);
break;
535 case 196: StubAccess().invoke(interface_, boost::mpl::int_<196>(), session, t);
break;
536 case 197: StubAccess().invoke(interface_, boost::mpl::int_<197>(), session, t);
break;
537 case 198: StubAccess().invoke(interface_, boost::mpl::int_<198>(), session, t);
break;
538 case 199: StubAccess().invoke(interface_, boost::mpl::int_<199>(), session, t);
break;
539 case 200: StubAccess().invoke(interface_, boost::mpl::int_<200>(), session, t);
break;
541 default: RCF_THROW(Exception(_RcfError_FnId(fnId)));
545 template<
typename InterfaceT,
typename DerefPtrT>
546 class InterfaceInvocator
549 InterfaceInvocator(InterfaceT &interface_, DerefPtrT derefPtr) :
550 mInterface(interface_),
556 RcfSession & session)
558 invoke<InterfaceT>(mInterface, mDerefPtr->deref(), fnId, session);
562 InterfaceT & mInterface;
566 template<
typename InterfaceT,
typename DerefPtrT>
567 void registerInvokeFunctors(
568 InterfaceT & interface_,
569 InvokeFunctorMap & invokeFunctorMap,
577 typedef typename InterfaceT::Interface Interface;
578 std::string interfaceName = ::RCF::getInterfaceName( (Interface *) NULL);
580 invokeFunctorMap[ interfaceName ] =
581 InterfaceInvocator<InterfaceT, DerefPtrT>(interface_, derefPtr);
586 typedef boost::shared_ptr<ServerBinding> ServerBindingPtr;
588 class RCF_EXPORT ServerBinding
592 typedef boost::function<bool(int)> CbAccessControl;
594 void setAccessControl(CbAccessControl cbAccessControl);
596 template<
typename InterfaceT,
typename DerefPtrT>
597 void registerInvokeFunctors(InterfaceT &interface_, DerefPtrT derefPtr)
600 access.registerInvokeFunctors(
606 void merge(RcfClientPtr rcfClientPtr);
610 friend class RcfServer;
611 friend class RcfSession;
614 const std::string & subInterface,
616 RcfSession & session);
623 InvokeFunctorMap mInvokeFunctorMap;
624 std::vector<RcfClientPtr> mMergedStubs;
626 CbAccessControl mCbAccessControl;
629 template<
typename InterfaceT,
typename ImplementationT,
typename ImplementationPtrT>
630 RcfClientPtr createServerStub(
633 ImplementationPtrT px)
635 typedef typename InterfaceT::RcfClientT RcfClientT;
636 return RcfClientPtr(
new RcfClientT(
637 ServerBindingPtr(
new ServerBinding()),
639 (boost::mpl::true_ *) NULL));
644 #endif // ! INCLUDE_RCF_SERVERSTUB_HPP