19 #ifndef INCLUDE_RCF_MARSHAL_HPP
20 #define INCLUDE_RCF_MARSHAL_HPP
22 #include <RCF/AmiThreadPool.hpp>
23 #include <RCF/ClientStub.hpp>
24 #include <RCF/CurrentSerializationProtocol.hpp>
25 #include <RCF/ObjectPool.hpp>
26 #include <RCF/PublishingService.hpp>
27 #include <RCF/RcfServer.hpp>
28 #include <RCF/RcfSession.hpp>
29 #include <RCF/SerializationProtocol.hpp>
30 #include <RCF/ThreadLocalData.hpp>
31 #include <RCF/Tools.hpp>
32 #include <RCF/TypeTraits.hpp>
33 #include <RCF/Version.hpp>
35 #include <boost/mpl/and.hpp>
36 #include <boost/mpl/assert.hpp>
37 #include <boost/mpl/and.hpp>
38 #include <boost/mpl/if.hpp>
39 #include <boost/mpl/not.hpp>
40 #include <boost/mpl/or.hpp>
41 #include <boost/scoped_ptr.hpp>
42 #include <boost/static_assert.hpp>
43 #include <boost/type_traits.hpp>
45 #ifdef RCF_USE_SF_SERIALIZATION
46 #include <SF/memory.hpp>
49 #ifdef RCF_USE_BOOST_SERIALIZATION
50 #include <RCF/BsAutoPtr.hpp>
51 #include <boost/serialization/binary_object.hpp>
54 #include <SF/Tools.hpp>
63 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION(type) \
64 inline void serializeImpl( \
65 SerializationProtocolOut &out, \
69 serializeImpl(out, *pt, 0); \
72 inline void serializeImpl( \
73 SerializationProtocolOut &out, \
77 serializeImpl(out, *pt, 0); \
80 inline void deserializeImpl( \
81 SerializationProtocolIn &in, \
85 RCF_ASSERT(pt==NULL); \
87 deserializeImpl(in, *pt, 0); \
90 SF_FOR_EACH_FUNDAMENTAL_TYPE( RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION )
92 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(type) \
93 template<typename T1, typename T2, typename T3> \
94 inline void serializeImpl( \
95 SerializationProtocolOut &out, \
96 const type<T1,T2,T3> *pt, \
99 serializeImpl(out, *pt, 0); \
102 template<typename T1, typename T2, typename T3> \
103 inline void serializeImpl( \
104 SerializationProtocolOut &out, \
105 type<T1,T2,T3> *const pt, \
108 serializeImpl(out, *pt, 0); \
111 template<typename T1, typename T2, typename T3> \
112 inline void deserializeImpl( \
113 SerializationProtocolIn &in, \
114 type<T1,T2,T3> *&pt, \
117 RCF_ASSERT(pt==NULL); \
118 pt = new type<T1,T2,T3>(); \
119 deserializeImpl(in, *pt, 0); \
122 #ifdef RCF_USE_BOOST_SERIALIZATION
124 RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(std::basic_string)
128 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION
130 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3
134 #define RefCountSmartPtr boost::shared_ptr
137 inline void serializeImpl(
138 SerializationProtocolOut &out,
139 const RefCountSmartPtr<T> *spt,
142 serialize(out, *spt);
146 inline void serializeImpl(
147 SerializationProtocolOut &out,
148 RefCountSmartPtr<T> *
const spt,
151 serialize(out, *spt);
155 inline void deserializeImpl(
156 SerializationProtocolIn &in,
157 RefCountSmartPtr<T> *&spt,
160 spt =
new RefCountSmartPtr<T>();
161 deserialize(in, *spt);
165 inline void serializeImpl(
166 SerializationProtocolOut &out,
167 const RefCountSmartPtr<T> &spt,
170 serialize(out, spt.get());
174 inline void deserializeImpl(
175 SerializationProtocolIn &in,
176 RefCountSmartPtr<T> &spt,
181 spt = RefCountSmartPtr<T>(pt);
184 #undef RefCountSmartPtr
186 #ifdef RCF_USE_BOOST_SERIALIZATION
189 namespace boost {
namespace serialization {
191 template<
class Archive>
192 void save(Archive & ar,
const RCF::ByteBuffer &byteBuffer,
unsigned int)
197 boost::uint32_t len = byteBuffer.getLength();
199 ar & make_binary_object(byteBuffer.getPtr(), len);
203 template<
class Archive>
204 void load(Archive &ar, RCF::ByteBuffer &byteBuffer,
unsigned int)
209 boost::uint32_t len = 0;
212 RCF::ReallocBufferPtr bufferPtr = RCF::getObjectPool().getReallocBufferPtr();
213 bufferPtr->resize(len);
214 byteBuffer = RCF::ByteBuffer(bufferPtr);
216 ar & make_binary_object(byteBuffer.getPtr(), byteBuffer.getLength());
221 BOOST_SERIALIZATION_SPLIT_FREE(RCF::ByteBuffer);
224 #endif // RCF_USE_BOOST_SERIALIZATION
231 bool serializeOverride(SerializationProtocolOut &, U &)
237 bool serializeOverride(SerializationProtocolOut &, U *)
243 bool deserializeOverride(SerializationProtocolIn &, U &)
248 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer & u);
250 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer * pu);
252 RCF_EXPORT
bool deserializeOverride(SerializationProtocolIn &in, ByteBuffer & u);
256 template<
typename T>
void vc6DefaultInit(T *) {}
265 ParmStore() : mptPtr(), mpT(NULL)
269 ParmStore(std::vector<char> & vec) : mptPtr(), mpT(NULL)
274 void allocate(std::vector<char> & vec)
276 RCF_ASSERT(mpT == NULL);
278 getObjectPool().getObj(mptPtr,
false);
289 vec.resize(
sizeof(T));
290 mpT = (T *) & vec[0];
293 #pragma warning( push )
294 #pragma warning( disable : 4345 ) // warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
302 #pragma warning( pop )
310 RCF_ASSERT(mpT == NULL);
337 boost::shared_ptr<T> mptPtr;
350 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
351 BOOST_MPL_ASSERT(( boost::mpl::not_< IsReference<T> > ));
353 Sm_Value(std::vector<char> & vec) : mPs(vec)
362 void set(
bool assign,
const T &t)
375 void read(SerializationProtocolIn &in)
377 if (in.getRemainingArchiveLength() != 0)
379 if (!deserializeOverride(in, *mPs))
381 deserialize(in, *mPs);
386 void write(SerializationProtocolOut &)
400 Sm_Value(std::vector<char> &)
415 void set(bool ,
const Void &)
420 void set(
const Void &)
425 void read(SerializationProtocolIn &)
430 void write(SerializationProtocolOut &)
441 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
442 BOOST_MPL_ASSERT(( boost::mpl::not_< IsReference<T> > ));
444 Sm_Ret(std::vector<char> & vec) : mPs(vec)
453 void set(
bool assign,
const T &t)
466 void read(SerializationProtocolIn &)
471 void write(SerializationProtocolOut &out)
473 if (!serializeOverride(out, *mPs))
475 serialize(out, *mPs);
483 template<
typename CRefT>
488 typedef typename RemoveReference<CRefT>::type CT;
489 typedef typename RemoveCv<CT>::type T;
490 BOOST_MPL_ASSERT(( IsReference<CRefT> ));
492 BOOST_MPL_ASSERT(( IsConst<CT> ));
494 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
496 Sm_CRef(std::vector<char> & vec) : mPs(), mVec(vec)
504 void set(
bool assign,
const T &t)
517 void read(SerializationProtocolIn &in)
519 if (in.getRemainingArchiveLength() != 0)
521 int ver = in.getRuntimeVersion();
535 deserialize(in, *mPs);
543 int sp = in.getSerializationProtocol();
544 if ( (sp == Sp_SfBinary || sp == Sp_SfText)
545 && getObjectPool().isCachingEnabled( (T *) NULL ))
548 deserialize(in, *mPs);
556 RCF::Exception e(RCF::_RcfError_DeserializationNullPointer());
569 void write(SerializationProtocolOut &)
576 std::vector<char> & mVec;
579 template<
typename RefT>
584 typedef typename RemoveReference<RefT>::type T;
585 typedef typename RemoveCv<T>::type U;
586 BOOST_MPL_ASSERT(( IsReference<RefT> ));
587 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
589 Sm_Ref(std::vector<char> & vec) : mVec(vec)
597 void set(
bool assign,
const T &t)
610 void read(SerializationProtocolIn &in)
612 if (in.getRemainingArchiveLength() != 0)
614 int ver = in.getRuntimeVersion();
629 deserialize(in, *mPs);
637 int sp = in.getSerializationProtocol();
638 if ( (sp == Sp_SfBinary || sp == Sp_SfText)
639 && getObjectPool().isCachingEnabled( (T *) NULL ))
642 deserialize(in, *mPs);
650 RCF::Exception e(RCF::_RcfError_DeserializationNullPointer());
663 void write(SerializationProtocolOut &out)
665 RCF_ASSERT(mPs.get());
667 if (!serializeOverride(out, *mPs))
673 serialize(out, *mPs);
679 std::vector<char> & mVec;
682 template<
typename OutRefT>
687 typedef typename RemoveOut<OutRefT>::type RefT;
688 typedef typename RemoveReference<RefT>::type T;
689 typedef typename RemoveCv<T>::type U;
690 BOOST_MPL_ASSERT(( IsReference<RefT> ));
691 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
693 Sm_OutRef(std::vector<char> & vec) : mPs(vec)
702 void set(
bool assign,
const T &t)
715 void read(SerializationProtocolIn &)
720 void write(SerializationProtocolOut &out)
722 if (!serializeOverride(out, *mPs))
728 serialize(out, *mPs);
736 template<
typename PtrT>
741 typedef typename RemovePointer<PtrT>::type T;
742 typedef typename RemoveCv<T>::type U;
743 BOOST_MPL_ASSERT(( IsPointer<PtrT> ));
744 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
746 Sm_Ptr(std::vector<char> &)
754 void set(
bool assign,
const T &t)
767 void read(SerializationProtocolIn &in)
769 if (in.getRemainingArchiveLength() != 0)
777 void write(SerializationProtocolOut &)
794 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
795 BOOST_MPL_ASSERT(( boost::mpl::not_< IsReference<T> > ));
799 RCF::ClientStub * pClientStub = getTlsClientStubPtr();
800 std::vector<char> & vec = pClientStub->getRetValVec();
809 void set(
bool assign,
const T &t)
822 void read(SerializationProtocolIn &in)
824 if (in.getRemainingArchiveLength() != 0)
826 if (!deserializeOverride(in, *mPs))
828 deserialize(in, *mPs);
833 void write(SerializationProtocolOut &)
847 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
848 BOOST_MPL_ASSERT(( boost::mpl::not_< IsReference<T> > ));
852 Cm_Value(
const T &t) : mT( const_cast<T &>(t) )
861 void read(SerializationProtocolIn &in)
863 RCF_UNUSED_VARIABLE(in);
866 void write(SerializationProtocolOut &out)
868 if (!serializeOverride(out, mT))
878 template<
typename PtrT>
883 typedef typename RemovePointer<PtrT>::type T;
885 BOOST_MPL_ASSERT(( IsPointer<PtrT> ));
887 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
892 Cm_Ptr(T * pt) : mpT(pt)
901 void read(SerializationProtocolIn &in)
903 RCF_UNUSED_VARIABLE(in);
906 void write(SerializationProtocolOut &out)
915 template<
typename CRefT>
920 typedef typename RemoveReference<CRefT>::type CT;
921 typedef typename RemoveCv<CT>::type T;
922 BOOST_MPL_ASSERT(( IsReference<CRefT> ));
924 BOOST_MPL_ASSERT(( IsConst<CT> ));
926 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
928 Cm_CRef(
const T &t) : mT(t)
936 void read(SerializationProtocolIn &in)
938 RCF_UNUSED_VARIABLE(in);
941 void write(SerializationProtocolOut &out)
943 int ver = out.getRuntimeVersion();
962 template<
typename RefT>
967 typedef typename RemoveReference<RefT>::type T;
968 BOOST_MPL_ASSERT(( IsReference<RefT> ));
969 BOOST_MPL_ASSERT(( boost::mpl::not_< IsConst<RefT> > ));
970 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
980 void read(SerializationProtocolIn &in)
982 if (in.getRemainingArchiveLength() != 0)
984 if (!deserializeOverride(in, mT))
991 void write(SerializationProtocolOut &out)
993 int ver = out.getRuntimeVersion();
1004 serialize(out, &mT);
1012 template<
typename OutRefT>
1017 typedef typename RemoveOut<OutRefT>::type RefT;
1018 typedef typename RemoveReference<RefT>::type T;
1019 BOOST_MPL_ASSERT(( IsReference<RefT> ));
1020 BOOST_MPL_ASSERT(( boost::mpl::not_< IsConst<RefT> > ));
1021 BOOST_MPL_ASSERT(( boost::mpl::not_< IsPointer<T> > ));
1023 Cm_OutRef(T &t) : mT(t)
1031 void read(SerializationProtocolIn &in)
1033 if (in.getRemainingArchiveLength() != 0)
1035 if (!deserializeOverride(in, mT))
1037 deserialize(in, mT);
1042 void write(SerializationProtocolOut &)
1051 template<
typename T>
1052 struct IsConstReference
1057 IsConst< typename RemoveReference<T>::type >
1060 enum { value = type::value };
1063 template<
typename T>
1064 struct ServerMarshalRet
1068 boost::is_same<void, T>,
1070 Sm_Ret<T> >::type type;
1073 template<
typename T>
1074 struct ServerMarshal
1080 typename boost::mpl::if_<
1081 IsConstReference<T>,
1083 typename boost::mpl::if_<
1086 typename boost::mpl::if_<
1099 template<
typename T>
1100 struct ClientMarshal
1106 typename boost::mpl::if_<
1107 IsConstReference<T>,
1109 typename boost::mpl::if_<
1112 typename boost::mpl::if_<
1128 template<
typename T>
1135 typename boost::mpl::if_<
1137 typename boost::add_reference<T>::type,
1138 typename boost::add_reference<
1139 typename boost::add_const<T>::type
1148 virtual ~I_Parameters() {}
1149 virtual void read(SerializationProtocolIn &in) = 0;
1150 virtual void write(SerializationProtocolOut &out) = 0;
1151 virtual bool enrolFutures(RCF::ClientStub *pClientStub) = 0;
1154 template<
typename T>
1155 struct IsInParameter
1157 typedef typename boost::mpl::not_< boost::is_same<T,Void> >::type NotVoid;
1158 typedef typename boost::mpl::not_< IsOut<T> >::type NotExplicitOutParameter;
1160 typedef typename boost::mpl::and_<
1162 NotExplicitOutParameter
1165 enum { value = type::value };
1168 template<
typename T>
1169 struct IsOutParameter
1176 typename RemoveReference<T>::type
1179 >::type NonConstRef_;
1181 typedef typename IsOut<T>::type ExplicitOutParameter;
1190 enum { value = NonConstRef_::value || ExplicitOutParameter::value };
1193 template<
typename T>
1194 struct IsReturnValue
1196 typedef typename boost::mpl::not_< boost::is_same<T, Void> >::type type;
1197 enum { value = type::value };
1203 I_Future * find(
const void * pv)
1205 I_Future * pFuture = NULL;
1206 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1208 if (mCandidateList[i].first == pv)
1210 RCF_ASSERT(!pFuture);
1211 pFuture = mCandidateList[i].second;
1217 void erase(
const void * pv)
1219 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1221 if (mCandidateList[i].first == pv)
1223 mCandidateList.erase( mCandidateList.begin() + i );
1230 void add(
const void * pv, I_Future * pFuture)
1232 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1234 if (mCandidateList[i].first == pv)
1236 mCandidateList[i].second = pFuture;
1240 mCandidateList.push_back( std::make_pair(pv, pFuture) );
1245 typedef std::vector< std::pair<const void *, I_Future *> > CandidateList;
1246 CandidateList mCandidateList;
1251 RCF_EXPORT Mutex & gCandidatesMutex();
1252 RCF_EXPORT Candidates & gCandidates();
1271 class ClientParameters :
public I_Parameters
1275 typedef typename RemoveOut<A1 >::type A1_;
1276 typedef typename RemoveOut<A2 >::type A2_;
1277 typedef typename RemoveOut<A3 >::type A3_;
1278 typedef typename RemoveOut<A4 >::type A4_;
1279 typedef typename RemoveOut<A5 >::type A5_;
1280 typedef typename RemoveOut<A6 >::type A6_;
1281 typedef typename RemoveOut<A7 >::type A7_;
1282 typedef typename RemoveOut<A8 >::type A8_;
1283 typedef typename RemoveOut<A9 >::type A9_;
1284 typedef typename RemoveOut<A10>::type A10_;
1285 typedef typename RemoveOut<A11>::type A11_;
1286 typedef typename RemoveOut<A12>::type A12_;
1287 typedef typename RemoveOut<A13>::type A13_;
1288 typedef typename RemoveOut<A14>::type A14_;
1289 typedef typename RemoveOut<A15>::type A15_;
1291 typedef typename ReferenceTo<A1_ >::type A1Ref;
1292 typedef typename ReferenceTo<A2_ >::type A2Ref;
1293 typedef typename ReferenceTo<A3_ >::type A3Ref;
1294 typedef typename ReferenceTo<A4_ >::type A4Ref;
1295 typedef typename ReferenceTo<A5_ >::type A5Ref;
1296 typedef typename ReferenceTo<A6_ >::type A6Ref;
1297 typedef typename ReferenceTo<A7_ >::type A7Ref;
1298 typedef typename ReferenceTo<A8_ >::type A8Ref;
1299 typedef typename ReferenceTo<A9_ >::type A9Ref;
1300 typedef typename ReferenceTo<A10_>::type A10Ref;
1301 typedef typename ReferenceTo<A11_>::type A11Ref;
1302 typedef typename ReferenceTo<A12_>::type A12Ref;
1303 typedef typename ReferenceTo<A13_>::type A13Ref;
1304 typedef typename ReferenceTo<A14_>::type A14Ref;
1305 typedef typename ReferenceTo<A15_>::type A15Ref;
1308 A1Ref a1, A2Ref a2, A3Ref a3, A4Ref a4, A5Ref a5, A6Ref a6,
1309 A7Ref a7, A8Ref a8, A9Ref a9, A10Ref a10, A11Ref a11, A12Ref a12,
1310 A13Ref a13, A14Ref a14, A15Ref a15) :
1311 a1(a1), a2(a2), a3(a3), a4(a4), a5(a5), a6(a6), a7(a7), a8(a8),
1312 a9(a9), a10(a10), a11(a11), a12(a12), a13(a13), a14(a14), a15(a15)
1316 void read(SerializationProtocolIn &in)
1318 if (IsReturnValue<R>::value) r.read(in);
1319 if (IsOutParameter<A1 >::value) a1.read(in);
1320 if (IsOutParameter<A2 >::value) a2.read(in);
1321 if (IsOutParameter<A3 >::value) a3.read(in);
1322 if (IsOutParameter<A4 >::value) a4.read(in);
1323 if (IsOutParameter<A5 >::value) a5.read(in);
1324 if (IsOutParameter<A6 >::value) a6.read(in);
1325 if (IsOutParameter<A7 >::value) a7.read(in);
1326 if (IsOutParameter<A8 >::value) a8.read(in);
1327 if (IsOutParameter<A9 >::value) a9.read(in);
1328 if (IsOutParameter<A10>::value) a10.read(in);
1329 if (IsOutParameter<A11>::value) a11.read(in);
1330 if (IsOutParameter<A12>::value) a12.read(in);
1331 if (IsOutParameter<A13>::value) a13.read(in);
1332 if (IsOutParameter<A14>::value) a14.read(in);
1333 if (IsOutParameter<A15>::value) a15.read(in);
1336 void write(SerializationProtocolOut &out)
1338 if (IsInParameter<A1 >::value) a1.write(out);
1339 if (IsInParameter<A2 >::value) a2.write(out);
1340 if (IsInParameter<A3 >::value) a3.write(out);
1341 if (IsInParameter<A4 >::value) a4.write(out);
1342 if (IsInParameter<A5 >::value) a5.write(out);
1343 if (IsInParameter<A6 >::value) a6.write(out);
1344 if (IsInParameter<A7 >::value) a7.write(out);
1345 if (IsInParameter<A8 >::value) a8.write(out);
1346 if (IsInParameter<A9 >::value) a9.write(out);
1347 if (IsInParameter<A10>::value) a10.write(out);
1348 if (IsInParameter<A11>::value) a11.write(out);
1349 if (IsInParameter<A12>::value) a12.write(out);
1350 if (IsInParameter<A13>::value) a13.write(out);
1351 if (IsInParameter<A14>::value) a14.write(out);
1352 if (IsInParameter<A15>::value) a15.write(out);
1355 bool enrolFutures(RCF::ClientStub *pClientStub)
1357 bool enrolled =
false;
1359 const void * pva[] = {
1377 for (std::size_t i=0; i<
sizeof(pva)/
sizeof(pva[0]); ++i)
1379 const void *pv = pva[i];
1380 I_Future * pFuture = NULL;
1383 Lock lock(gCandidatesMutex());
1384 pFuture = gCandidates().find(pv);
1387 gCandidates().erase(pv);
1393 pClientStub->enrol( pFuture );
1402 typename ClientMarshal<A1>::type a1;
1403 typename ClientMarshal<A2>::type a2;
1404 typename ClientMarshal<A3>::type a3;
1405 typename ClientMarshal<A4>::type a4;
1406 typename ClientMarshal<A5>::type a5;
1407 typename ClientMarshal<A6>::type a6;
1408 typename ClientMarshal<A7>::type a7;
1409 typename ClientMarshal<A8>::type a8;
1410 typename ClientMarshal<A9>::type a9;
1411 typename ClientMarshal<A10>::type a10;
1412 typename ClientMarshal<A11>::type a11;
1413 typename ClientMarshal<A12>::type a12;
1414 typename ClientMarshal<A13>::type a13;
1415 typename ClientMarshal<A14>::type a14;
1416 typename ClientMarshal<A15>::type a15;
1436 class AllocateClientParameters
1440 typedef typename RemoveOut<A1 >::type A1_;
1441 typedef typename RemoveOut<A2 >::type A2_;
1442 typedef typename RemoveOut<A3 >::type A3_;
1443 typedef typename RemoveOut<A4 >::type A4_;
1444 typedef typename RemoveOut<A5 >::type A5_;
1445 typedef typename RemoveOut<A6 >::type A6_;
1446 typedef typename RemoveOut<A7 >::type A7_;
1447 typedef typename RemoveOut<A8 >::type A8_;
1448 typedef typename RemoveOut<A9 >::type A9_;
1449 typedef typename RemoveOut<A10>::type A10_;
1450 typedef typename RemoveOut<A11>::type A11_;
1451 typedef typename RemoveOut<A12>::type A12_;
1452 typedef typename RemoveOut<A13>::type A13_;
1453 typedef typename RemoveOut<A14>::type A14_;
1454 typedef typename RemoveOut<A15>::type A15_;
1456 typedef typename ReferenceTo<A1_ >::type A1Ref;
1457 typedef typename ReferenceTo<A2_ >::type A2Ref;
1458 typedef typename ReferenceTo<A3_ >::type A3Ref;
1459 typedef typename ReferenceTo<A4_ >::type A4Ref;
1460 typedef typename ReferenceTo<A5_ >::type A5Ref;
1461 typedef typename ReferenceTo<A6_ >::type A6Ref;
1462 typedef typename ReferenceTo<A7_ >::type A7Ref;
1463 typedef typename ReferenceTo<A8_ >::type A8Ref;
1464 typedef typename ReferenceTo<A9_ >::type A9Ref;
1465 typedef typename ReferenceTo<A10_>::type A10Ref;
1466 typedef typename ReferenceTo<A11_>::type A11Ref;
1467 typedef typename ReferenceTo<A12_>::type A12Ref;
1468 typedef typename ReferenceTo<A13_>::type A13Ref;
1469 typedef typename ReferenceTo<A14_>::type A14Ref;
1470 typedef typename ReferenceTo<A15_>::type A15Ref;
1472 typedef ClientParameters<
1474 A1, A2, A3, A4, A5, A6, A7, A8,
1475 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1478 ParametersT &operator()(
1479 ClientStub &clientStub,
1496 CurrentClientStubSentry sentry(clientStub);
1498 clientStub.clearParameters();
1500 clientStub.mParametersVec.resize(
sizeof(ParametersT));
1502 clientStub.mpParameters =
new ( &clientStub.mParametersVec[0] )
1504 a1,a2,a3,a4,a5,a6,a7,a8,
1505 a9,a10,a11,a12,a13,a14,a15);
1507 return static_cast<ParametersT &
>(*clientStub.mpParameters);
1522 typename A10 = Void,
1523 typename A11 = Void,
1524 typename A12 = Void,
1525 typename A13 = Void,
1526 typename A14 = Void,
1527 typename A15 = Void>
1528 class ServerParameters :
public I_Parameters
1532 ServerParameters(RcfSession &session) :
1533 r(session.mParmsVec[0]),
1534 a1(session.mParmsVec[1]),
1535 a2(session.mParmsVec[2]),
1536 a3(session.mParmsVec[3]),
1537 a4(session.mParmsVec[4]),
1538 a5(session.mParmsVec[5]),
1539 a6(session.mParmsVec[6]),
1540 a7(session.mParmsVec[7]),
1541 a8(session.mParmsVec[8]),
1542 a9(session.mParmsVec[9]),
1543 a10(session.mParmsVec[10]),
1544 a11(session.mParmsVec[11]),
1545 a12(session.mParmsVec[12]),
1546 a13(session.mParmsVec[13]),
1547 a14(session.mParmsVec[14]),
1548 a15(session.mParmsVec[15])
1553 void read(SerializationProtocolIn &in)
1555 if (IsInParameter<A1 >::value) a1.read(in);
1556 if (IsInParameter<A2 >::value) a2.read(in);
1557 if (IsInParameter<A3 >::value) a3.read(in);
1558 if (IsInParameter<A4 >::value) a4.read(in);
1559 if (IsInParameter<A5 >::value) a5.read(in);
1560 if (IsInParameter<A6 >::value) a6.read(in);
1561 if (IsInParameter<A7 >::value) a7.read(in);
1562 if (IsInParameter<A8 >::value) a8.read(in);
1563 if (IsInParameter<A9 >::value) a9.read(in);
1564 if (IsInParameter<A10>::value) a10.read(in);
1565 if (IsInParameter<A11>::value) a11.read(in);
1566 if (IsInParameter<A12>::value) a12.read(in);
1567 if (IsInParameter<A13>::value) a13.read(in);
1568 if (IsInParameter<A14>::value) a14.read(in);
1569 if (IsInParameter<A15>::value) a15.read(in);
1572 void write(SerializationProtocolOut &out)
1574 if (IsReturnValue<R>::value) r.write(out);
1575 if (IsOutParameter<A1>::value) a1.write(out);
1576 if (IsOutParameter<A2>::value) a2.write(out);
1577 if (IsOutParameter<A3>::value) a3.write(out);
1578 if (IsOutParameter<A4>::value) a4.write(out);
1579 if (IsOutParameter<A5>::value) a5.write(out);
1580 if (IsOutParameter<A6>::value) a6.write(out);
1581 if (IsOutParameter<A7>::value) a7.write(out);
1582 if (IsOutParameter<A8>::value) a8.write(out);
1583 if (IsOutParameter<A9>::value) a9.write(out);
1584 if (IsOutParameter<A10>::value) a10.write(out);
1585 if (IsOutParameter<A11>::value) a11.write(out);
1586 if (IsOutParameter<A12>::value) a12.write(out);
1587 if (IsOutParameter<A13>::value) a13.write(out);
1588 if (IsOutParameter<A14>::value) a14.write(out);
1589 if (IsOutParameter<A15>::value) a15.write(out);
1593 bool enrolFutures(RCF::ClientStub *)
1599 typename ServerMarshalRet<R>::type r;
1600 typename ServerMarshal<A1>::type a1;
1601 typename ServerMarshal<A2>::type a2;
1602 typename ServerMarshal<A3>::type a3;
1603 typename ServerMarshal<A4>::type a4;
1604 typename ServerMarshal<A5>::type a5;
1605 typename ServerMarshal<A6>::type a6;
1606 typename ServerMarshal<A7>::type a7;
1607 typename ServerMarshal<A8>::type a8;
1608 typename ServerMarshal<A9>::type a9;
1609 typename ServerMarshal<A10>::type a10;
1610 typename ServerMarshal<A11>::type a11;
1611 typename ServerMarshal<A12>::type a12;
1612 typename ServerMarshal<A13>::type a13;
1613 typename ServerMarshal<A14>::type a14;
1614 typename ServerMarshal<A15>::type a15;
1617 typedef boost::shared_ptr<I_Parameters> ParametersPtr;
1630 typename A10 = Void,
1631 typename A11 = Void,
1632 typename A12 = Void,
1633 typename A13 = Void,
1634 typename A14 = Void,
1635 typename A15 = Void>
1636 class AllocateServerParameters
1639 typedef ServerParameters<
1641 A1, A2, A3, A4, A5, A6, A7, A8,
1642 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1644 ParametersT &operator()(RcfSession &session)
const
1646 session.clearParameters();
1648 session.mParametersVec.resize(
sizeof(ParametersT));
1650 session.mpParameters =
new
1651 ( &session.mParametersVec[0] )
1652 ParametersT(session);
1654 return static_cast<ParametersT &
>(*session.mpParameters);
1660 RCF_EXPORT
void convertRcfSessionToRcfClient(
1661 OnCallbackConnectionCreated func,
1662 RemoteCallSemantics rcs = RCF::Twoway);
1665 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1666 ClientStub & clientStub,
1667 ServerTransport & serverTransport,
1668 bool keepClientConnection =
false);
1670 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1671 ClientStub & clientStub,
1673 bool keepClientConnection =
false);
1676 template<
typename RcfClientT>
1677 inline RcfSessionPtr convertRcfClientToRcfSession(
1678 RcfClientT & client,
1680 bool keepClientConnection =
false)
1682 return convertRcfClientToRcfSession(
1683 client.getClientStub(),
1685 keepClientConnection);
1688 template<
typename RcfClientT>
1689 inline RcfSessionPtr convertRcfClientToRcfSession(
1690 RcfClientT & client,
1691 ServerTransport & serverTransport,
1692 bool keepClientConnection =
false)
1694 return convertRcfClientToRcfSession(
1695 client.getClientStub(),
1697 keepClientConnection);
1702 RCF_EXPORT
void createCallbackConnectionImpl(
1703 ClientStub & client,
1704 ServerTransport & callbackServer);
1706 RCF_EXPORT
void createCallbackConnectionImpl(
1707 ClientStub & client,
1708 RcfServer & callbackServer);
1712 template<
typename RcfClientT>
1713 void createCallbackConnection(
1714 RcfClientT & client,
1715 RcfServer & callbackServer)
1717 createCallbackConnectionImpl(
1718 client.getClientStub(),
1722 template<
typename RcfClientT>
1723 void createCallbackConnectionImpl(
1724 RcfClientT & client,
1725 ServerTransport & callbackServer)
1727 createCallbackConnection(
1728 client.getClientStub(),
1734 #endif // ! INCLUDE_RCF_MARSHAL_HPP