19 #ifndef INCLUDE_RCF_MARSHAL_HPP 20 #define INCLUDE_RCF_MARSHAL_HPP 22 #include <RCF/AmiThreadPool.hpp> 24 #include <RCF/CurrentSerializationProtocol.hpp> 25 #include <RCF/ObjectPool.hpp> 26 #include <RCF/PublishingService.hpp> 29 #include <RCF/SerializationProtocol.hpp> 30 #include <RCF/ThreadLocalData.hpp> 31 #include <RCF/Tools.hpp> 32 #include <RCF/TypeTraits.hpp> 36 #include <SF/memory.hpp> 39 #if RCF_FEATURE_BOOST_SERIALIZATION==1 40 #include <RCF/BsAutoPtr.hpp> 41 #include <boost/serialization/binary_object.hpp> 46 #pragma warning(disable: 4127) // warning C4127: conditional expression is constant 56 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION(type) \ 57 inline void serializeImpl( \ 58 SerializationProtocolOut &out, \ 62 serializeImpl(out, *pt, 0); \ 65 inline void serializeImpl( \ 66 SerializationProtocolOut &out, \ 70 serializeImpl(out, *pt, 0); \ 73 inline void deserializeImpl( \ 74 SerializationProtocolIn &in, \ 78 RCF_ASSERT(pt==NULL); \ 80 deserializeImpl(in, *pt, 0); \ 83 SF_FOR_EACH_FUNDAMENTAL_TYPE( RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION )
85 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(type) \ 86 template<typename T1, typename T2, typename T3> \ 87 inline void serializeImpl( \ 88 SerializationProtocolOut &out, \ 89 const type<T1,T2,T3> *pt, \ 92 serializeImpl(out, *pt, 0); \ 95 template<typename T1, typename T2, typename T3> \ 96 inline void serializeImpl( \ 97 SerializationProtocolOut &out, \ 98 type<T1,T2,T3> *const pt, \ 101 serializeImpl(out, *pt, 0); \ 104 template<typename T1, typename T2, typename T3> \ 105 inline void deserializeImpl( \ 106 SerializationProtocolIn &in, \ 107 type<T1,T2,T3> *&pt, \ 110 RCF_ASSERT(pt==NULL); \ 111 pt = new type<T1,T2,T3>(); \ 112 deserializeImpl(in, *pt, 0); \ 115 #if RCF_FEATURE_BOOST_SERIALIZATION==1 117 RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(std::basic_string)
121 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION 123 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3 128 inline void serializeImpl(
129 SerializationProtocolOut &out,
130 const std::shared_ptr<T> *spt,
133 serialize(out, *spt);
137 inline void serializeImpl(
138 SerializationProtocolOut &out,
139 std::shared_ptr<T> *
const spt,
142 serialize(out, *spt);
146 inline void deserializeImpl(
147 SerializationProtocolIn &in,
148 std::shared_ptr<T> *&spt,
151 spt =
new std::shared_ptr<T>();
152 deserialize(in, *spt);
156 inline void serializeImpl(
157 SerializationProtocolOut &out,
158 const std::shared_ptr<T> &spt,
161 serialize(out, spt.get());
165 inline void deserializeImpl(
166 SerializationProtocolIn &in,
167 std::shared_ptr<T> &spt,
172 spt = std::shared_ptr<T>(pt);
175 #if RCF_FEATURE_BOOST_SERIALIZATION==1 178 namespace boost {
namespace serialization {
180 template<
class Archive>
181 void save(Archive & ar,
const RCF::ByteBuffer &byteBuffer,
unsigned int)
186 std::uint32_t len = byteBuffer.getLength();
188 ar & make_binary_object(byteBuffer.getPtr(), len);
192 template<
class Archive>
198 std::uint32_t len = 0;
201 RCF::ReallocBufferPtr bufferPtr = RCF::getObjectPool().getReallocBufferPtr();
202 bufferPtr->resize(len);
205 ar & make_binary_object(byteBuffer.getPtr(), byteBuffer.getLength());
213 #endif // RCF_FEATURE_BOOST_SERIALIZATION==1 220 bool serializeOverride(SerializationProtocolOut &, U &)
226 bool serializeOverride(SerializationProtocolOut &, U *)
232 bool deserializeOverride(SerializationProtocolIn &, U &)
237 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer & u);
239 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer * pu);
241 RCF_EXPORT
bool deserializeOverride(SerializationProtocolIn &in, ByteBuffer & u);
250 ParmStore() : mptPtr(), mpT(NULL)
254 ParmStore(std::vector<char> & vec) : mptPtr(), mpT(NULL)
259 void allocate(std::vector<char> & vec)
261 RCF_ASSERT(mpT == NULL);
263 getObjectPool().
getObj(mptPtr,
false);
274 vec.resize(
sizeof(T));
275 mpT = (T *) & vec[0];
278 #pragma warning( push ) 279 #pragma warning( disable : 4345 ) // warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized 285 #pragma warning( pop ) 293 RCF_ASSERT(mpT == NULL);
320 std::shared_ptr<T> mptPtr;
329 Deleter(T *& pt) : mpt(pt), mDismissed(false)
334 if ( !mDismissed && mpt )
358 static_assert( !IsPointer<T>::value,
"Incorrect marshaling code." );
359 static_assert( !IsReference<T>::value,
"Incorrect marshaling code." );
361 Sm_Value(std::vector<char> & vec) : mPs(vec)
370 void set(
bool assign,
const T &t)
383 void read(SerializationProtocolIn &in)
385 if (in.getRemainingArchiveLength() != 0)
387 if (!deserializeOverride(in, *mPs))
389 deserialize(in, *mPs);
394 void write(SerializationProtocolOut &)
396 RCF_ASSERT_ALWAYS(
"");
408 Sm_Value(std::vector<char> &)
418 RCF_ASSERT_ALWAYS(
"");
423 void set(bool ,
const Void &)
425 RCF_ASSERT_ALWAYS(
"");
428 void set(
const Void &)
430 RCF_ASSERT_ALWAYS(
"");
433 void read(SerializationProtocolIn &)
435 RCF_ASSERT_ALWAYS(
"");
438 void write(SerializationProtocolOut &)
440 RCF_ASSERT_ALWAYS(
"");
449 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
450 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
452 Sm_Ret(std::vector<char> & vec) : mPs(vec)
461 void set(
bool assign,
const T &t)
474 void read(SerializationProtocolIn &)
476 RCF_ASSERT_ALWAYS(
"");
479 void write(SerializationProtocolOut &out)
481 if (!serializeOverride(out, *mPs))
483 serialize(out, *mPs);
491 template<
typename CRefT>
496 typedef typename RemoveReference<CRefT>::type CT;
497 typedef typename RemoveCv<CT>::type T;
498 static_assert(IsReference<CRefT>::value,
"Incorrect marshaling code.");
499 static_assert(IsConst<CT>::value,
"Incorrect marshaling code.");
500 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
502 Sm_CRef(std::vector<char> & vec) : mPs(), mVec(vec)
510 void set(
bool assign,
const T &t)
523 void read(SerializationProtocolIn &in)
525 if (in.getRemainingArchiveLength() != 0)
527 int ver = in.getRuntimeVersion();
534 Deleter<T> deleter(pt);
543 deserialize(in, *mPs);
551 int sp = in.getSerializationProtocol();
553 && getObjectPool().isCachingEnabled( (T *) NULL ))
556 deserialize(in, *mPs);
561 Deleter<T> deleter(pt);
579 void write(SerializationProtocolOut &)
581 RCF_ASSERT_ALWAYS(
"");
586 std::vector<char> & mVec;
589 template<
typename RefT>
594 typedef typename RemoveReference<RefT>::type T;
595 typedef typename RemoveCv<T>::type U;
596 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
597 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
599 Sm_Ref(std::vector<char> & vec) : mVec(vec)
607 void set(
bool assign,
const T &t)
620 void read(SerializationProtocolIn &in)
622 if (in.getRemainingArchiveLength() != 0)
624 int ver = in.getRuntimeVersion();
631 Deleter<T> deleter(pt);
641 deserialize(in, *mPs);
649 int sp = in.getSerializationProtocol();
651 && getObjectPool().isCachingEnabled( (T *) NULL ))
654 deserialize(in, *mPs);
659 Deleter<T> deleter(pt);
677 void write(SerializationProtocolOut &out)
679 RCF_ASSERT(mPs.get());
681 if (!serializeOverride(out, *mPs))
687 serialize(out, *mPs);
693 std::vector<char> & mVec;
696 template<
typename OutRefT>
701 typedef typename RemoveOut<OutRefT>::type RefT;
702 typedef typename RemoveReference<RefT>::type T;
703 typedef typename RemoveCv<T>::type U;
704 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
705 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
707 Sm_OutRef(std::vector<char> & vec) : mPs(vec)
716 void set(
bool assign,
const T &t)
729 void read(SerializationProtocolIn &)
731 RCF_ASSERT_ALWAYS(
"");
734 void write(SerializationProtocolOut &out)
736 if (!serializeOverride(out, *mPs))
742 serialize(out, *mPs);
750 template<
typename PtrT>
755 typedef typename RemovePointer<PtrT>::type T;
756 typedef typename RemoveCv<T>::type U;
757 static_assert(IsPointer<PtrT>::value,
"Incorrect marshaling code.");
758 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
760 Sm_Ptr(std::vector<char> &)
768 void set(
bool assign,
const T &t)
781 void read(SerializationProtocolIn &in)
783 if (in.getRemainingArchiveLength() != 0)
786 Deleter<T> deleter(pt);
793 void write(SerializationProtocolOut &)
795 RCF_ASSERT_ALWAYS(
"");
810 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
811 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
816 std::vector<char> & vec = pClientStub->getRetValVec();
825 void set(
bool assign,
const T &t)
838 void read(SerializationProtocolIn &in)
840 if (in.getRemainingArchiveLength() != 0)
842 if (!deserializeOverride(in, *mPs))
844 deserialize(in, *mPs);
849 void write(SerializationProtocolOut &)
851 RCF_ASSERT_ALWAYS(
"");
863 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
864 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
868 Cm_Value(
const T &t) : mT( const_cast<T &>(t) )
877 void read(SerializationProtocolIn &in)
879 RCF_UNUSED_VARIABLE(in);
882 void write(SerializationProtocolOut &out)
884 if (!serializeOverride(out, mT))
894 template<
typename PtrT>
899 typedef typename RemovePointer<PtrT>::type T;
901 static_assert(IsPointer<PtrT>::value,
"Incorrect marshaling code.");
902 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
907 Cm_Ptr(T * pt) : mpT(pt)
916 void read(SerializationProtocolIn &in)
918 RCF_UNUSED_VARIABLE(in);
921 void write(SerializationProtocolOut &out)
930 template<
typename CRefT>
935 typedef typename RemoveReference<CRefT>::type CT;
936 typedef typename RemoveCv<CT>::type T;
937 static_assert(IsReference<CRefT>::value,
"Incorrect marshaling code.");
938 static_assert(IsConst<CT>::value,
"Incorrect marshaling code.");
939 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
941 Cm_CRef(
const T &t) : mT(t)
949 void read(SerializationProtocolIn &in)
951 RCF_UNUSED_VARIABLE(in);
954 void write(SerializationProtocolOut &out)
956 int ver = out.getRuntimeVersion();
975 template<
typename RefT>
980 typedef typename RemoveReference<RefT>::type T;
981 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
982 static_assert(!IsConst<RefT>::value,
"Incorrect marshaling code.");
983 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
993 void read(SerializationProtocolIn &in)
995 if (in.getRemainingArchiveLength() != 0)
997 if (!deserializeOverride(in, mT))
1004 void write(SerializationProtocolOut &out)
1006 int ver = out.getRuntimeVersion();
1009 serialize(out, &mT);
1017 serialize(out, &mT);
1025 template<
typename OutRefT>
1030 typedef typename RemoveOut<OutRefT>::type RefT;
1031 typedef typename RemoveReference<RefT>::type T;
1032 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
1033 static_assert(!IsConst<RefT>::value,
"Incorrect marshaling code.");
1034 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
1036 Cm_OutRef(T &t) : mT(t)
1044 void read(SerializationProtocolIn &in)
1046 if (in.getRemainingArchiveLength() != 0)
1048 if (!deserializeOverride(in, mT))
1050 deserialize(in, mT);
1055 void write(SerializationProtocolOut &)
1057 RCF_ASSERT_ALWAYS(
"");
1064 template<
typename T>
1065 struct IsConstReference
1070 IsConst< typename RemoveReference<T>::type >
1073 enum { value = type::value };
1076 template<
typename T>
1077 struct ServerMarshalRet
1081 std::is_same<void, T>,
1083 Sm_Ret<T> >::type type;
1086 template<
typename T>
1087 struct ServerMarshal
1094 IsConstReference<T>,
1112 template<
typename T>
1113 struct ClientMarshal
1120 IsConstReference<T>,
1141 template<
typename T>
1150 typename std::add_lvalue_reference<T>::type,
1151 typename std::add_lvalue_reference<
1152 typename std::add_const<T>::type
1161 virtual ~I_Parameters() {}
1162 virtual void read(SerializationProtocolIn &in) = 0;
1163 virtual void write(SerializationProtocolOut &out) = 0;
1167 template<
typename T>
1168 struct IsInParameter
1170 typedef typename Not< std::is_same<T,Void> >::type NotVoid;
1171 typedef typename Not< IsOut<T> >::type NotExplicitOutParameter;
1173 typedef typename And<
1175 NotExplicitOutParameter
1178 enum { value = type::value };
1181 template<
typename T>
1182 struct IsOutParameter
1189 typename RemoveReference<T>::type
1192 >::type NonConstRef_;
1194 typedef typename IsOut<T>::type ExplicitOutParameter;
1196 enum { value = NonConstRef_::value || ExplicitOutParameter::value };
1199 template<
typename T>
1200 struct IsReturnValue
1202 typedef typename Not< std::is_same<T, Void> >::type type;
1203 enum { value = type::value };
1209 I_Future * find(
const void * pv)
1211 I_Future * pFuture = NULL;
1212 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1214 if (mCandidateList[i].first == pv)
1216 RCF_ASSERT(!pFuture);
1217 pFuture = mCandidateList[i].second;
1223 void erase(
const void * pv)
1225 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1227 if (mCandidateList[i].first == pv)
1229 mCandidateList.erase( mCandidateList.begin() + i );
1233 RCF_ASSERT_ALWAYS(
"");
1236 void add(
const void * pv, I_Future * pFuture)
1238 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1240 if (mCandidateList[i].first == pv)
1242 mCandidateList[i].second = pFuture;
1246 mCandidateList.push_back( std::make_pair(pv, pFuture) );
1251 typedef std::vector< std::pair<const void *, I_Future *> > CandidateList;
1252 CandidateList mCandidateList;
1255 RCF_EXPORT Mutex & gCandidatesMutex();
1256 RCF_EXPORT Candidates & gCandidates();
1275 class ClientParameters :
public I_Parameters
1279 typedef typename RemoveOut<A1 >::type A1_;
1280 typedef typename RemoveOut<A2 >::type A2_;
1281 typedef typename RemoveOut<A3 >::type A3_;
1282 typedef typename RemoveOut<A4 >::type A4_;
1283 typedef typename RemoveOut<A5 >::type A5_;
1284 typedef typename RemoveOut<A6 >::type A6_;
1285 typedef typename RemoveOut<A7 >::type A7_;
1286 typedef typename RemoveOut<A8 >::type A8_;
1287 typedef typename RemoveOut<A9 >::type A9_;
1288 typedef typename RemoveOut<A10>::type A10_;
1289 typedef typename RemoveOut<A11>::type A11_;
1290 typedef typename RemoveOut<A12>::type A12_;
1291 typedef typename RemoveOut<A13>::type A13_;
1292 typedef typename RemoveOut<A14>::type A14_;
1293 typedef typename RemoveOut<A15>::type A15_;
1295 typedef typename ReferenceTo<A1_ >::type A1Ref;
1296 typedef typename ReferenceTo<A2_ >::type A2Ref;
1297 typedef typename ReferenceTo<A3_ >::type A3Ref;
1298 typedef typename ReferenceTo<A4_ >::type A4Ref;
1299 typedef typename ReferenceTo<A5_ >::type A5Ref;
1300 typedef typename ReferenceTo<A6_ >::type A6Ref;
1301 typedef typename ReferenceTo<A7_ >::type A7Ref;
1302 typedef typename ReferenceTo<A8_ >::type A8Ref;
1303 typedef typename ReferenceTo<A9_ >::type A9Ref;
1304 typedef typename ReferenceTo<A10_>::type A10Ref;
1305 typedef typename ReferenceTo<A11_>::type A11Ref;
1306 typedef typename ReferenceTo<A12_>::type A12Ref;
1307 typedef typename ReferenceTo<A13_>::type A13Ref;
1308 typedef typename ReferenceTo<A14_>::type A14Ref;
1309 typedef typename ReferenceTo<A15_>::type A15Ref;
1312 A1Ref a1, A2Ref a2, A3Ref a3, A4Ref a4, A5Ref a5, A6Ref a6,
1313 A7Ref a7, A8Ref a8, A9Ref a9, A10Ref a10, A11Ref a11, A12Ref a12,
1314 A13Ref a13, A14Ref a14, A15Ref a15) :
1315 a1(a1), a2(a2), a3(a3), a4(a4), a5(a5), a6(a6), a7(a7), a8(a8),
1316 a9(a9), a10(a10), a11(a11), a12(a12), a13(a13), a14(a14), a15(a15)
1320 void read(SerializationProtocolIn &in)
1322 if RCF_CONSTEXPR(IsReturnValue<R>::value) r.read(in);
1323 if RCF_CONSTEXPR(IsOutParameter<A1 >::value) a1.read(in);
1324 if RCF_CONSTEXPR(IsOutParameter<A2 >::value) a2.read(in);
1325 if RCF_CONSTEXPR(IsOutParameter<A3 >::value) a3.read(in);
1326 if RCF_CONSTEXPR(IsOutParameter<A4 >::value) a4.read(in);
1327 if RCF_CONSTEXPR(IsOutParameter<A5 >::value) a5.read(in);
1328 if RCF_CONSTEXPR(IsOutParameter<A6 >::value) a6.read(in);
1329 if RCF_CONSTEXPR(IsOutParameter<A7 >::value) a7.read(in);
1330 if RCF_CONSTEXPR(IsOutParameter<A8 >::value) a8.read(in);
1331 if RCF_CONSTEXPR(IsOutParameter<A9 >::value) a9.read(in);
1332 if RCF_CONSTEXPR(IsOutParameter<A10>::value) a10.read(in);
1333 if RCF_CONSTEXPR(IsOutParameter<A11>::value) a11.read(in);
1334 if RCF_CONSTEXPR(IsOutParameter<A12>::value) a12.read(in);
1335 if RCF_CONSTEXPR(IsOutParameter<A13>::value) a13.read(in);
1336 if RCF_CONSTEXPR(IsOutParameter<A14>::value) a14.read(in);
1337 if RCF_CONSTEXPR(IsOutParameter<A15>::value) a15.read(in);
1340 void write(SerializationProtocolOut &out)
1342 if RCF_CONSTEXPR(IsInParameter<A1 >::value) a1.write(out);
1343 if RCF_CONSTEXPR(IsInParameter<A2 >::value) a2.write(out);
1344 if RCF_CONSTEXPR(IsInParameter<A3 >::value) a3.write(out);
1345 if RCF_CONSTEXPR(IsInParameter<A4 >::value) a4.write(out);
1346 if RCF_CONSTEXPR(IsInParameter<A5 >::value) a5.write(out);
1347 if RCF_CONSTEXPR(IsInParameter<A6 >::value) a6.write(out);
1348 if RCF_CONSTEXPR(IsInParameter<A7 >::value) a7.write(out);
1349 if RCF_CONSTEXPR(IsInParameter<A8 >::value) a8.write(out);
1350 if RCF_CONSTEXPR(IsInParameter<A9 >::value) a9.write(out);
1351 if RCF_CONSTEXPR(IsInParameter<A10>::value) a10.write(out);
1352 if RCF_CONSTEXPR(IsInParameter<A11>::value) a11.write(out);
1353 if RCF_CONSTEXPR(IsInParameter<A12>::value) a12.write(out);
1354 if RCF_CONSTEXPR(IsInParameter<A13>::value) a13.write(out);
1355 if RCF_CONSTEXPR(IsInParameter<A14>::value) a14.write(out);
1356 if RCF_CONSTEXPR(IsInParameter<A15>::value) a15.write(out);
1361 bool enrolled =
false;
1363 const void * pva[] = {
1381 for (std::size_t i=0; i<
sizeof(pva)/
sizeof(pva[0]); ++i)
1383 const void *pv = pva[i];
1384 I_Future * pFuture = NULL;
1387 Lock lock(gCandidatesMutex());
1388 pFuture = gCandidates().find(pv);
1391 gCandidates().erase(pv);
1397 pClientStub->enrol( pFuture );
1406 typename ClientMarshal<A1>::type a1;
1407 typename ClientMarshal<A2>::type a2;
1408 typename ClientMarshal<A3>::type a3;
1409 typename ClientMarshal<A4>::type a4;
1410 typename ClientMarshal<A5>::type a5;
1411 typename ClientMarshal<A6>::type a6;
1412 typename ClientMarshal<A7>::type a7;
1413 typename ClientMarshal<A8>::type a8;
1414 typename ClientMarshal<A9>::type a9;
1415 typename ClientMarshal<A10>::type a10;
1416 typename ClientMarshal<A11>::type a11;
1417 typename ClientMarshal<A12>::type a12;
1418 typename ClientMarshal<A13>::type a13;
1419 typename ClientMarshal<A14>::type a14;
1420 typename ClientMarshal<A15>::type a15;
1440 class AllocateClientParameters
1444 typedef typename RemoveOut<A1 >::type A1_;
1445 typedef typename RemoveOut<A2 >::type A2_;
1446 typedef typename RemoveOut<A3 >::type A3_;
1447 typedef typename RemoveOut<A4 >::type A4_;
1448 typedef typename RemoveOut<A5 >::type A5_;
1449 typedef typename RemoveOut<A6 >::type A6_;
1450 typedef typename RemoveOut<A7 >::type A7_;
1451 typedef typename RemoveOut<A8 >::type A8_;
1452 typedef typename RemoveOut<A9 >::type A9_;
1453 typedef typename RemoveOut<A10>::type A10_;
1454 typedef typename RemoveOut<A11>::type A11_;
1455 typedef typename RemoveOut<A12>::type A12_;
1456 typedef typename RemoveOut<A13>::type A13_;
1457 typedef typename RemoveOut<A14>::type A14_;
1458 typedef typename RemoveOut<A15>::type A15_;
1460 typedef typename ReferenceTo<A1_ >::type A1Ref;
1461 typedef typename ReferenceTo<A2_ >::type A2Ref;
1462 typedef typename ReferenceTo<A3_ >::type A3Ref;
1463 typedef typename ReferenceTo<A4_ >::type A4Ref;
1464 typedef typename ReferenceTo<A5_ >::type A5Ref;
1465 typedef typename ReferenceTo<A6_ >::type A6Ref;
1466 typedef typename ReferenceTo<A7_ >::type A7Ref;
1467 typedef typename ReferenceTo<A8_ >::type A8Ref;
1468 typedef typename ReferenceTo<A9_ >::type A9Ref;
1469 typedef typename ReferenceTo<A10_>::type A10Ref;
1470 typedef typename ReferenceTo<A11_>::type A11Ref;
1471 typedef typename ReferenceTo<A12_>::type A12Ref;
1472 typedef typename ReferenceTo<A13_>::type A13Ref;
1473 typedef typename ReferenceTo<A14_>::type A14Ref;
1474 typedef typename ReferenceTo<A15_>::type A15Ref;
1476 typedef ClientParameters<
1478 A1, A2, A3, A4, A5, A6, A7, A8,
1479 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1482 ParametersT &operator()(
1483 ClientStub &clientStub,
1500 CurrentClientStubSentry sentry(clientStub);
1502 clientStub.clearParameters();
1504 clientStub.mParametersVec.resize(
sizeof(ParametersT));
1506 clientStub.mpParameters =
new ( &clientStub.mParametersVec[0] )
1508 a1,a2,a3,a4,a5,a6,a7,a8,
1509 a9,a10,a11,a12,a13,a14,a15);
1511 if (!clientStub.mpParameters)
1513 Exception e(RcfError_ClientStubParms);
1517 return static_cast<ParametersT &
>(*clientStub.mpParameters);
1532 typename A10 = Void,
1533 typename A11 = Void,
1534 typename A12 = Void,
1535 typename A13 = Void,
1536 typename A14 = Void,
1537 typename A15 = Void>
1538 class ServerParameters :
public I_Parameters
1542 ServerParameters(RcfSession &session) :
1543 r(session.mParmsVec[0]),
1544 a1(session.mParmsVec[1]),
1545 a2(session.mParmsVec[2]),
1546 a3(session.mParmsVec[3]),
1547 a4(session.mParmsVec[4]),
1548 a5(session.mParmsVec[5]),
1549 a6(session.mParmsVec[6]),
1550 a7(session.mParmsVec[7]),
1551 a8(session.mParmsVec[8]),
1552 a9(session.mParmsVec[9]),
1553 a10(session.mParmsVec[10]),
1554 a11(session.mParmsVec[11]),
1555 a12(session.mParmsVec[12]),
1556 a13(session.mParmsVec[13]),
1557 a14(session.mParmsVec[14]),
1558 a15(session.mParmsVec[15])
1563 void read(SerializationProtocolIn &in)
1565 if RCF_CONSTEXPR(IsInParameter<A1 >::value) a1.read(in);
1566 if RCF_CONSTEXPR(IsInParameter<A2 >::value) a2.read(in);
1567 if RCF_CONSTEXPR(IsInParameter<A3 >::value) a3.read(in);
1568 if RCF_CONSTEXPR(IsInParameter<A4 >::value) a4.read(in);
1569 if RCF_CONSTEXPR(IsInParameter<A5 >::value) a5.read(in);
1570 if RCF_CONSTEXPR(IsInParameter<A6 >::value) a6.read(in);
1571 if RCF_CONSTEXPR(IsInParameter<A7 >::value) a7.read(in);
1572 if RCF_CONSTEXPR(IsInParameter<A8 >::value) a8.read(in);
1573 if RCF_CONSTEXPR(IsInParameter<A9 >::value) a9.read(in);
1574 if RCF_CONSTEXPR(IsInParameter<A10>::value) a10.read(in);
1575 if RCF_CONSTEXPR(IsInParameter<A11>::value) a11.read(in);
1576 if RCF_CONSTEXPR(IsInParameter<A12>::value) a12.read(in);
1577 if RCF_CONSTEXPR(IsInParameter<A13>::value) a13.read(in);
1578 if RCF_CONSTEXPR(IsInParameter<A14>::value) a14.read(in);
1579 if RCF_CONSTEXPR(IsInParameter<A15>::value) a15.read(in);
1582 void write(SerializationProtocolOut &out)
1584 if RCF_CONSTEXPR(IsReturnValue<R>::value) r.write(out);
1585 if RCF_CONSTEXPR(IsOutParameter<A1>::value) a1.write(out);
1586 if RCF_CONSTEXPR(IsOutParameter<A2>::value) a2.write(out);
1587 if RCF_CONSTEXPR(IsOutParameter<A3>::value) a3.write(out);
1588 if RCF_CONSTEXPR(IsOutParameter<A4>::value) a4.write(out);
1589 if RCF_CONSTEXPR(IsOutParameter<A5>::value) a5.write(out);
1590 if RCF_CONSTEXPR(IsOutParameter<A6>::value) a6.write(out);
1591 if RCF_CONSTEXPR(IsOutParameter<A7>::value) a7.write(out);
1592 if RCF_CONSTEXPR(IsOutParameter<A8>::value) a8.write(out);
1593 if RCF_CONSTEXPR(IsOutParameter<A9>::value) a9.write(out);
1594 if RCF_CONSTEXPR(IsOutParameter<A10>::value) a10.write(out);
1595 if RCF_CONSTEXPR(IsOutParameter<A11>::value) a11.write(out);
1596 if RCF_CONSTEXPR(IsOutParameter<A12>::value) a12.write(out);
1597 if RCF_CONSTEXPR(IsOutParameter<A13>::value) a13.write(out);
1598 if RCF_CONSTEXPR(IsOutParameter<A14>::value) a14.write(out);
1599 if RCF_CONSTEXPR(IsOutParameter<A15>::value) a15.write(out);
1605 RCF_ASSERT_ALWAYS(
"");
1609 typename ServerMarshalRet<R>::type r;
1610 typename ServerMarshal<A1>::type a1;
1611 typename ServerMarshal<A2>::type a2;
1612 typename ServerMarshal<A3>::type a3;
1613 typename ServerMarshal<A4>::type a4;
1614 typename ServerMarshal<A5>::type a5;
1615 typename ServerMarshal<A6>::type a6;
1616 typename ServerMarshal<A7>::type a7;
1617 typename ServerMarshal<A8>::type a8;
1618 typename ServerMarshal<A9>::type a9;
1619 typename ServerMarshal<A10>::type a10;
1620 typename ServerMarshal<A11>::type a11;
1621 typename ServerMarshal<A12>::type a12;
1622 typename ServerMarshal<A13>::type a13;
1623 typename ServerMarshal<A14>::type a14;
1624 typename ServerMarshal<A15>::type a15;
1627 typedef std::shared_ptr<I_Parameters> ParametersPtr;
1640 typename A10 = Void,
1641 typename A11 = Void,
1642 typename A12 = Void,
1643 typename A13 = Void,
1644 typename A14 = Void,
1645 typename A15 = Void>
1646 class AllocateServerParameters
1649 typedef ServerParameters<
1651 A1, A2, A3, A4, A5, A6, A7, A8,
1652 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1654 ParametersT &operator()(RcfSession &session)
const 1656 session.clearParameters();
1658 session.mParametersVec.resize(
sizeof(ParametersT));
1660 session.mpParameters =
new 1661 ( &session.mParametersVec[0] )
1662 ParametersT(session);
1664 if (!session.mpParameters)
1666 Exception e(RcfError_ServerStubParms);
1670 return static_cast<ParametersT &
>(*session.mpParameters);
1676 RCF_EXPORT
void convertRcfSessionToRcfClient(
1677 OnCallbackConnectionCreated func,
1681 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1682 ClientStub & clientStub,
1683 ServerTransport & serverTransport,
1684 bool keepClientConnection =
false);
1686 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1687 ClientStub & clientStub,
1689 bool keepClientConnection =
false);
1692 template<
typename RcfClientT>
1693 inline RcfSessionPtr convertRcfClientToRcfSession(
1694 RcfClientT & client,
1696 bool keepClientConnection =
false)
1698 return convertRcfClientToRcfSession(
1699 client.getClientStub(),
1701 keepClientConnection);
1704 template<
typename RcfClientT>
1705 inline RcfSessionPtr convertRcfClientToRcfSession(
1706 RcfClientT & client,
1707 ServerTransport & serverTransport,
1708 bool keepClientConnection =
false)
1710 return convertRcfClientToRcfSession(
1711 client.getClientStub(),
1713 keepClientConnection);
1718 RCF_EXPORT
void createCallbackConnectionImpl(
1719 ClientStub & client,
1720 ServerTransport & callbackServer);
1722 RCF_EXPORT
void createCallbackConnectionImpl(
1723 ClientStub & client,
1724 RcfServer & callbackServer);
1728 template<
typename RcfClientT>
1729 void createCallbackConnection(
1730 RcfClientT & client,
1731 RcfServer & callbackServer)
1733 createCallbackConnectionImpl(
1734 client.getClientStub(),
1738 template<
typename RcfClientT>
1739 void createCallbackConnectionImpl(
1740 RcfClientT & client,
1741 ServerTransport & callbackServer)
1743 createCallbackConnection(
1744 client.getClientStub(),
1751 #pragma warning(pop) 1754 #endif // ! INCLUDE_RCF_MARSHAL_HPP Definition: AsioFwd.hpp:27
SF binary.
Definition: Enums.hpp:170
Controls the client side of a RCF connection.
Definition: ClientStub.hpp:83
SF text.
Definition: Enums.hpp:173
RemoteCallMode
Remote call mode.
Definition: Enums.hpp:141
Base class for all RCF exceptions.
Definition: Exception.hpp:64
Two-way.
Definition: Enums.hpp:147
Definition: ByteBuffer.hpp:40
Definition: AmiIoHandler.hpp:24
void getObj(std::shared_ptr< T > &objPtr, bool alwaysCreate=true)
Definition: ObjectPool.hpp:192