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> 51 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION(type) \ 52 inline void serializeImpl( \ 53 SerializationProtocolOut &out, \ 57 serializeImpl(out, *pt, 0); \ 60 inline void serializeImpl( \ 61 SerializationProtocolOut &out, \ 65 serializeImpl(out, *pt, 0); \ 68 inline void deserializeImpl( \ 69 SerializationProtocolIn &in, \ 73 RCF_ASSERT(pt==NULL); \ 75 deserializeImpl(in, *pt, 0); \ 78 SF_FOR_EACH_FUNDAMENTAL_TYPE( RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION )
80 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(type) \ 81 template<typename T1, typename T2, typename T3> \ 82 inline void serializeImpl( \ 83 SerializationProtocolOut &out, \ 84 const type<T1,T2,T3> *pt, \ 87 serializeImpl(out, *pt, 0); \ 90 template<typename T1, typename T2, typename T3> \ 91 inline void serializeImpl( \ 92 SerializationProtocolOut &out, \ 93 type<T1,T2,T3> *const pt, \ 96 serializeImpl(out, *pt, 0); \ 99 template<typename T1, typename T2, typename T3> \ 100 inline void deserializeImpl( \ 101 SerializationProtocolIn &in, \ 102 type<T1,T2,T3> *&pt, \ 105 RCF_ASSERT(pt==NULL); \ 106 pt = new type<T1,T2,T3>(); \ 107 deserializeImpl(in, *pt, 0); \ 110 #if RCF_FEATURE_BOOST_SERIALIZATION==1 112 RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(std::basic_string)
116 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION 118 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3 123 inline void serializeImpl(
124 SerializationProtocolOut &out,
125 const std::shared_ptr<T> *spt,
128 serialize(out, *spt);
132 inline void serializeImpl(
133 SerializationProtocolOut &out,
134 std::shared_ptr<T> *
const spt,
137 serialize(out, *spt);
141 inline void deserializeImpl(
142 SerializationProtocolIn &in,
143 std::shared_ptr<T> *&spt,
146 spt =
new std::shared_ptr<T>();
147 deserialize(in, *spt);
151 inline void serializeImpl(
152 SerializationProtocolOut &out,
153 const std::shared_ptr<T> &spt,
156 serialize(out, spt.get());
160 inline void deserializeImpl(
161 SerializationProtocolIn &in,
162 std::shared_ptr<T> &spt,
167 spt = std::shared_ptr<T>(pt);
170 #if RCF_FEATURE_BOOST_SERIALIZATION==1 173 namespace boost {
namespace serialization {
175 template<
class Archive>
176 void save(Archive & ar,
const RCF::ByteBuffer &byteBuffer,
unsigned int)
181 std::uint32_t len = byteBuffer.getLength();
183 ar & make_binary_object(byteBuffer.getPtr(), len);
187 template<
class Archive>
193 std::uint32_t len = 0;
196 RCF::ReallocBufferPtr bufferPtr = RCF::getObjectPool().getReallocBufferPtr();
197 bufferPtr->resize(len);
200 ar & make_binary_object(byteBuffer.getPtr(), byteBuffer.getLength());
208 #endif // RCF_FEATURE_BOOST_SERIALIZATION==1 215 bool serializeOverride(SerializationProtocolOut &, U &)
221 bool serializeOverride(SerializationProtocolOut &, U *)
227 bool deserializeOverride(SerializationProtocolIn &, U &)
232 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer & u);
234 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer * pu);
236 RCF_EXPORT
bool deserializeOverride(SerializationProtocolIn &in, ByteBuffer & u);
245 ParmStore() : mptPtr(), mpT(NULL)
249 ParmStore(std::vector<char> & vec) : mptPtr(), mpT(NULL)
254 void allocate(std::vector<char> & vec)
256 RCF_ASSERT(mpT == NULL);
258 getObjectPool().
getObj(mptPtr,
false);
269 vec.resize(
sizeof(T));
270 mpT = (T *) & vec[0];
273 #pragma warning( push ) 274 #pragma warning( disable : 4345 ) // warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized 280 #pragma warning( pop ) 288 RCF_ASSERT(mpT == NULL);
315 std::shared_ptr<T> mptPtr;
324 Deleter(T *& pt) : mpt(pt), mDismissed(false)
329 if ( !mDismissed && mpt )
353 static_assert( !IsPointer<T>::value,
"Incorrect marshaling code." );
354 static_assert( !IsReference<T>::value,
"Incorrect marshaling code." );
356 Sm_Value(std::vector<char> & vec) : mPs(vec)
365 void set(
bool assign,
const T &t)
378 void read(SerializationProtocolIn &in)
380 if (in.getRemainingArchiveLength() != 0)
382 if (!deserializeOverride(in, *mPs))
384 deserialize(in, *mPs);
389 void write(SerializationProtocolOut &)
391 RCF_ASSERT_ALWAYS(
"");
403 Sm_Value(std::vector<char> &)
413 RCF_ASSERT_ALWAYS(
"");
418 void set(bool ,
const Void &)
420 RCF_ASSERT_ALWAYS(
"");
423 void set(
const Void &)
425 RCF_ASSERT_ALWAYS(
"");
428 void read(SerializationProtocolIn &)
430 RCF_ASSERT_ALWAYS(
"");
433 void write(SerializationProtocolOut &)
435 RCF_ASSERT_ALWAYS(
"");
444 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
445 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
447 Sm_Ret(std::vector<char> & vec) : mPs(vec)
456 void set(
bool assign,
const T &t)
469 void read(SerializationProtocolIn &)
471 RCF_ASSERT_ALWAYS(
"");
474 void write(SerializationProtocolOut &out)
476 if (!serializeOverride(out, *mPs))
478 serialize(out, *mPs);
486 template<
typename CRefT>
491 typedef typename RemoveReference<CRefT>::type CT;
492 typedef typename RemoveCv<CT>::type T;
493 static_assert(IsReference<CRefT>::value,
"Incorrect marshaling code.");
494 static_assert(IsConst<CT>::value,
"Incorrect marshaling code.");
495 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
497 Sm_CRef(std::vector<char> & vec) : mPs(), mVec(vec)
505 void set(
bool assign,
const T &t)
518 void read(SerializationProtocolIn &in)
520 if (in.getRemainingArchiveLength() != 0)
522 int ver = in.getRuntimeVersion();
529 Deleter<T> deleter(pt);
538 deserialize(in, *mPs);
546 int sp = in.getSerializationProtocol();
548 && getObjectPool().isCachingEnabled( (T *) NULL ))
551 deserialize(in, *mPs);
556 Deleter<T> deleter(pt);
574 void write(SerializationProtocolOut &)
576 RCF_ASSERT_ALWAYS(
"");
581 std::vector<char> & mVec;
584 template<
typename RefT>
589 typedef typename RemoveReference<RefT>::type T;
590 typedef typename RemoveCv<T>::type U;
591 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
592 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
594 Sm_Ref(std::vector<char> & vec) : mVec(vec)
602 void set(
bool assign,
const T &t)
615 void read(SerializationProtocolIn &in)
617 if (in.getRemainingArchiveLength() != 0)
619 int ver = in.getRuntimeVersion();
626 Deleter<T> deleter(pt);
636 deserialize(in, *mPs);
644 int sp = in.getSerializationProtocol();
646 && getObjectPool().isCachingEnabled( (T *) NULL ))
649 deserialize(in, *mPs);
654 Deleter<T> deleter(pt);
672 void write(SerializationProtocolOut &out)
674 RCF_ASSERT(mPs.get());
676 if (!serializeOverride(out, *mPs))
682 serialize(out, *mPs);
688 std::vector<char> & mVec;
691 template<
typename OutRefT>
696 typedef typename RemoveOut<OutRefT>::type RefT;
697 typedef typename RemoveReference<RefT>::type T;
698 typedef typename RemoveCv<T>::type U;
699 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
700 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
702 Sm_OutRef(std::vector<char> & vec) : mPs(vec)
711 void set(
bool assign,
const T &t)
724 void read(SerializationProtocolIn &)
726 RCF_ASSERT_ALWAYS(
"");
729 void write(SerializationProtocolOut &out)
731 if (!serializeOverride(out, *mPs))
737 serialize(out, *mPs);
745 template<
typename PtrT>
750 typedef typename RemovePointer<PtrT>::type T;
751 typedef typename RemoveCv<T>::type U;
752 static_assert(IsPointer<PtrT>::value,
"Incorrect marshaling code.");
753 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
755 Sm_Ptr(std::vector<char> &)
763 void set(
bool assign,
const T &t)
776 void read(SerializationProtocolIn &in)
778 if (in.getRemainingArchiveLength() != 0)
781 Deleter<T> deleter(pt);
788 void write(SerializationProtocolOut &)
790 RCF_ASSERT_ALWAYS(
"");
805 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
806 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
811 std::vector<char> & vec = pClientStub->getRetValVec();
820 void set(
bool assign,
const T &t)
833 void read(SerializationProtocolIn &in)
835 if (in.getRemainingArchiveLength() != 0)
837 if (!deserializeOverride(in, *mPs))
839 deserialize(in, *mPs);
844 void write(SerializationProtocolOut &)
846 RCF_ASSERT_ALWAYS(
"");
858 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
859 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
863 Cm_Value(
const T &t) : mT( const_cast<T &>(t) )
872 void read(SerializationProtocolIn &in)
874 RCF_UNUSED_VARIABLE(in);
877 void write(SerializationProtocolOut &out)
879 if (!serializeOverride(out, mT))
889 template<
typename PtrT>
894 typedef typename RemovePointer<PtrT>::type T;
896 static_assert(IsPointer<PtrT>::value,
"Incorrect marshaling code.");
897 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
902 Cm_Ptr(T * pt) : mpT(pt)
911 void read(SerializationProtocolIn &in)
913 RCF_UNUSED_VARIABLE(in);
916 void write(SerializationProtocolOut &out)
925 template<
typename CRefT>
930 typedef typename RemoveReference<CRefT>::type CT;
931 typedef typename RemoveCv<CT>::type T;
932 static_assert(IsReference<CRefT>::value,
"Incorrect marshaling code.");
933 static_assert(IsConst<CT>::value,
"Incorrect marshaling code.");
934 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
936 Cm_CRef(
const T &t) : mT(t)
944 void read(SerializationProtocolIn &in)
946 RCF_UNUSED_VARIABLE(in);
949 void write(SerializationProtocolOut &out)
951 int ver = out.getRuntimeVersion();
970 template<
typename RefT>
975 typedef typename RemoveReference<RefT>::type T;
976 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
977 static_assert(!IsConst<RefT>::value,
"Incorrect marshaling code.");
978 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
988 void read(SerializationProtocolIn &in)
990 if (in.getRemainingArchiveLength() != 0)
992 if (!deserializeOverride(in, mT))
999 void write(SerializationProtocolOut &out)
1001 int ver = out.getRuntimeVersion();
1004 serialize(out, &mT);
1012 serialize(out, &mT);
1020 template<
typename OutRefT>
1025 typedef typename RemoveOut<OutRefT>::type RefT;
1026 typedef typename RemoveReference<RefT>::type T;
1027 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
1028 static_assert(!IsConst<RefT>::value,
"Incorrect marshaling code.");
1029 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
1031 Cm_OutRef(T &t) : mT(t)
1039 void read(SerializationProtocolIn &in)
1041 if (in.getRemainingArchiveLength() != 0)
1043 if (!deserializeOverride(in, mT))
1045 deserialize(in, mT);
1050 void write(SerializationProtocolOut &)
1052 RCF_ASSERT_ALWAYS(
"");
1059 template<
typename T>
1060 struct IsConstReference
1065 IsConst< typename RemoveReference<T>::type >
1068 enum { value = type::value };
1071 template<
typename T>
1072 struct ServerMarshalRet
1076 std::is_same<void, T>,
1078 Sm_Ret<T> >::type type;
1081 template<
typename T>
1082 struct ServerMarshal
1089 IsConstReference<T>,
1107 template<
typename T>
1108 struct ClientMarshal
1115 IsConstReference<T>,
1136 template<
typename T>
1145 typename std::add_lvalue_reference<T>::type,
1146 typename std::add_lvalue_reference<
1147 typename std::add_const<T>::type
1156 virtual ~I_Parameters() {}
1157 virtual void read(SerializationProtocolIn &in) = 0;
1158 virtual void write(SerializationProtocolOut &out) = 0;
1162 template<
typename T>
1163 struct IsInParameter
1165 typedef typename Not< std::is_same<T,Void> >::type NotVoid;
1166 typedef typename Not< IsOut<T> >::type NotExplicitOutParameter;
1168 typedef typename And<
1170 NotExplicitOutParameter
1173 enum { value = type::value };
1176 template<
typename T>
1177 struct IsOutParameter
1184 typename RemoveReference<T>::type
1187 >::type NonConstRef_;
1189 typedef typename IsOut<T>::type ExplicitOutParameter;
1191 enum { value = NonConstRef_::value || ExplicitOutParameter::value };
1194 template<
typename T>
1195 struct IsReturnValue
1197 typedef typename Not< std::is_same<T, Void> >::type type;
1198 enum { value = type::value };
1204 I_Future * find(
const void * pv)
1206 I_Future * pFuture = NULL;
1207 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1209 if (mCandidateList[i].first == pv)
1211 RCF_ASSERT(!pFuture);
1212 pFuture = mCandidateList[i].second;
1218 void erase(
const void * pv)
1220 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1222 if (mCandidateList[i].first == pv)
1224 mCandidateList.erase( mCandidateList.begin() + i );
1228 RCF_ASSERT_ALWAYS(
"");
1231 void add(
const void * pv, I_Future * pFuture)
1233 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1235 if (mCandidateList[i].first == pv)
1237 mCandidateList[i].second = pFuture;
1241 mCandidateList.push_back( std::make_pair(pv, pFuture) );
1246 typedef std::vector< std::pair<const void *, I_Future *> > CandidateList;
1247 CandidateList mCandidateList;
1250 RCF_EXPORT Mutex & gCandidatesMutex();
1251 RCF_EXPORT Candidates & gCandidates();
1270 class ClientParameters :
public I_Parameters
1274 typedef typename RemoveOut<A1 >::type A1_;
1275 typedef typename RemoveOut<A2 >::type A2_;
1276 typedef typename RemoveOut<A3 >::type A3_;
1277 typedef typename RemoveOut<A4 >::type A4_;
1278 typedef typename RemoveOut<A5 >::type A5_;
1279 typedef typename RemoveOut<A6 >::type A6_;
1280 typedef typename RemoveOut<A7 >::type A7_;
1281 typedef typename RemoveOut<A8 >::type A8_;
1282 typedef typename RemoveOut<A9 >::type A9_;
1283 typedef typename RemoveOut<A10>::type A10_;
1284 typedef typename RemoveOut<A11>::type A11_;
1285 typedef typename RemoveOut<A12>::type A12_;
1286 typedef typename RemoveOut<A13>::type A13_;
1287 typedef typename RemoveOut<A14>::type A14_;
1288 typedef typename RemoveOut<A15>::type A15_;
1290 typedef typename ReferenceTo<A1_ >::type A1Ref;
1291 typedef typename ReferenceTo<A2_ >::type A2Ref;
1292 typedef typename ReferenceTo<A3_ >::type A3Ref;
1293 typedef typename ReferenceTo<A4_ >::type A4Ref;
1294 typedef typename ReferenceTo<A5_ >::type A5Ref;
1295 typedef typename ReferenceTo<A6_ >::type A6Ref;
1296 typedef typename ReferenceTo<A7_ >::type A7Ref;
1297 typedef typename ReferenceTo<A8_ >::type A8Ref;
1298 typedef typename ReferenceTo<A9_ >::type A9Ref;
1299 typedef typename ReferenceTo<A10_>::type A10Ref;
1300 typedef typename ReferenceTo<A11_>::type A11Ref;
1301 typedef typename ReferenceTo<A12_>::type A12Ref;
1302 typedef typename ReferenceTo<A13_>::type A13Ref;
1303 typedef typename ReferenceTo<A14_>::type A14Ref;
1304 typedef typename ReferenceTo<A15_>::type A15Ref;
1307 A1Ref a1, A2Ref a2, A3Ref a3, A4Ref a4, A5Ref a5, A6Ref a6,
1308 A7Ref a7, A8Ref a8, A9Ref a9, A10Ref a10, A11Ref a11, A12Ref a12,
1309 A13Ref a13, A14Ref a14, A15Ref a15) :
1310 a1(a1), a2(a2), a3(a3), a4(a4), a5(a5), a6(a6), a7(a7), a8(a8),
1311 a9(a9), a10(a10), a11(a11), a12(a12), a13(a13), a14(a14), a15(a15)
1315 void read(SerializationProtocolIn &in)
1317 if RCF_CONSTEXPR(IsReturnValue<R>::value) r.read(in);
1318 if RCF_CONSTEXPR(IsOutParameter<A1 >::value) a1.read(in);
1319 if RCF_CONSTEXPR(IsOutParameter<A2 >::value) a2.read(in);
1320 if RCF_CONSTEXPR(IsOutParameter<A3 >::value) a3.read(in);
1321 if RCF_CONSTEXPR(IsOutParameter<A4 >::value) a4.read(in);
1322 if RCF_CONSTEXPR(IsOutParameter<A5 >::value) a5.read(in);
1323 if RCF_CONSTEXPR(IsOutParameter<A6 >::value) a6.read(in);
1324 if RCF_CONSTEXPR(IsOutParameter<A7 >::value) a7.read(in);
1325 if RCF_CONSTEXPR(IsOutParameter<A8 >::value) a8.read(in);
1326 if RCF_CONSTEXPR(IsOutParameter<A9 >::value) a9.read(in);
1327 if RCF_CONSTEXPR(IsOutParameter<A10>::value) a10.read(in);
1328 if RCF_CONSTEXPR(IsOutParameter<A11>::value) a11.read(in);
1329 if RCF_CONSTEXPR(IsOutParameter<A12>::value) a12.read(in);
1330 if RCF_CONSTEXPR(IsOutParameter<A13>::value) a13.read(in);
1331 if RCF_CONSTEXPR(IsOutParameter<A14>::value) a14.read(in);
1332 if RCF_CONSTEXPR(IsOutParameter<A15>::value) a15.read(in);
1335 void write(SerializationProtocolOut &out)
1337 if RCF_CONSTEXPR(IsInParameter<A1 >::value) a1.write(out);
1338 if RCF_CONSTEXPR(IsInParameter<A2 >::value) a2.write(out);
1339 if RCF_CONSTEXPR(IsInParameter<A3 >::value) a3.write(out);
1340 if RCF_CONSTEXPR(IsInParameter<A4 >::value) a4.write(out);
1341 if RCF_CONSTEXPR(IsInParameter<A5 >::value) a5.write(out);
1342 if RCF_CONSTEXPR(IsInParameter<A6 >::value) a6.write(out);
1343 if RCF_CONSTEXPR(IsInParameter<A7 >::value) a7.write(out);
1344 if RCF_CONSTEXPR(IsInParameter<A8 >::value) a8.write(out);
1345 if RCF_CONSTEXPR(IsInParameter<A9 >::value) a9.write(out);
1346 if RCF_CONSTEXPR(IsInParameter<A10>::value) a10.write(out);
1347 if RCF_CONSTEXPR(IsInParameter<A11>::value) a11.write(out);
1348 if RCF_CONSTEXPR(IsInParameter<A12>::value) a12.write(out);
1349 if RCF_CONSTEXPR(IsInParameter<A13>::value) a13.write(out);
1350 if RCF_CONSTEXPR(IsInParameter<A14>::value) a14.write(out);
1351 if RCF_CONSTEXPR(IsInParameter<A15>::value) a15.write(out);
1356 bool enrolled =
false;
1358 const void * pva[] = {
1376 for (std::size_t i=0; i<
sizeof(pva)/
sizeof(pva[0]); ++i)
1378 const void *pv = pva[i];
1379 I_Future * pFuture = NULL;
1382 Lock lock(gCandidatesMutex());
1383 pFuture = gCandidates().find(pv);
1386 gCandidates().erase(pv);
1392 pClientStub->enrol( pFuture );
1401 typename ClientMarshal<A1>::type a1;
1402 typename ClientMarshal<A2>::type a2;
1403 typename ClientMarshal<A3>::type a3;
1404 typename ClientMarshal<A4>::type a4;
1405 typename ClientMarshal<A5>::type a5;
1406 typename ClientMarshal<A6>::type a6;
1407 typename ClientMarshal<A7>::type a7;
1408 typename ClientMarshal<A8>::type a8;
1409 typename ClientMarshal<A9>::type a9;
1410 typename ClientMarshal<A10>::type a10;
1411 typename ClientMarshal<A11>::type a11;
1412 typename ClientMarshal<A12>::type a12;
1413 typename ClientMarshal<A13>::type a13;
1414 typename ClientMarshal<A14>::type a14;
1415 typename ClientMarshal<A15>::type a15;
1435 class AllocateClientParameters
1439 typedef typename RemoveOut<A1 >::type A1_;
1440 typedef typename RemoveOut<A2 >::type A2_;
1441 typedef typename RemoveOut<A3 >::type A3_;
1442 typedef typename RemoveOut<A4 >::type A4_;
1443 typedef typename RemoveOut<A5 >::type A5_;
1444 typedef typename RemoveOut<A6 >::type A6_;
1445 typedef typename RemoveOut<A7 >::type A7_;
1446 typedef typename RemoveOut<A8 >::type A8_;
1447 typedef typename RemoveOut<A9 >::type A9_;
1448 typedef typename RemoveOut<A10>::type A10_;
1449 typedef typename RemoveOut<A11>::type A11_;
1450 typedef typename RemoveOut<A12>::type A12_;
1451 typedef typename RemoveOut<A13>::type A13_;
1452 typedef typename RemoveOut<A14>::type A14_;
1453 typedef typename RemoveOut<A15>::type A15_;
1455 typedef typename ReferenceTo<A1_ >::type A1Ref;
1456 typedef typename ReferenceTo<A2_ >::type A2Ref;
1457 typedef typename ReferenceTo<A3_ >::type A3Ref;
1458 typedef typename ReferenceTo<A4_ >::type A4Ref;
1459 typedef typename ReferenceTo<A5_ >::type A5Ref;
1460 typedef typename ReferenceTo<A6_ >::type A6Ref;
1461 typedef typename ReferenceTo<A7_ >::type A7Ref;
1462 typedef typename ReferenceTo<A8_ >::type A8Ref;
1463 typedef typename ReferenceTo<A9_ >::type A9Ref;
1464 typedef typename ReferenceTo<A10_>::type A10Ref;
1465 typedef typename ReferenceTo<A11_>::type A11Ref;
1466 typedef typename ReferenceTo<A12_>::type A12Ref;
1467 typedef typename ReferenceTo<A13_>::type A13Ref;
1468 typedef typename ReferenceTo<A14_>::type A14Ref;
1469 typedef typename ReferenceTo<A15_>::type A15Ref;
1471 typedef ClientParameters<
1473 A1, A2, A3, A4, A5, A6, A7, A8,
1474 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1477 ParametersT &operator()(
1478 ClientStub &clientStub,
1495 CurrentClientStubSentry sentry(clientStub);
1497 clientStub.clearParameters();
1499 clientStub.mParametersVec.resize(
sizeof(ParametersT));
1501 clientStub.mpParameters =
new ( &clientStub.mParametersVec[0] )
1503 a1,a2,a3,a4,a5,a6,a7,a8,
1504 a9,a10,a11,a12,a13,a14,a15);
1506 if (!clientStub.mpParameters)
1508 Exception e(RcfError_ClientStubParms);
1512 return static_cast<ParametersT &
>(*clientStub.mpParameters);
1527 typename A10 = Void,
1528 typename A11 = Void,
1529 typename A12 = Void,
1530 typename A13 = Void,
1531 typename A14 = Void,
1532 typename A15 = Void>
1533 class ServerParameters :
public I_Parameters
1537 ServerParameters(RcfSession &session) :
1538 r(session.mParmsVec[0]),
1539 a1(session.mParmsVec[1]),
1540 a2(session.mParmsVec[2]),
1541 a3(session.mParmsVec[3]),
1542 a4(session.mParmsVec[4]),
1543 a5(session.mParmsVec[5]),
1544 a6(session.mParmsVec[6]),
1545 a7(session.mParmsVec[7]),
1546 a8(session.mParmsVec[8]),
1547 a9(session.mParmsVec[9]),
1548 a10(session.mParmsVec[10]),
1549 a11(session.mParmsVec[11]),
1550 a12(session.mParmsVec[12]),
1551 a13(session.mParmsVec[13]),
1552 a14(session.mParmsVec[14]),
1553 a15(session.mParmsVec[15])
1558 void read(SerializationProtocolIn &in)
1560 if RCF_CONSTEXPR(IsInParameter<A1 >::value) a1.read(in);
1561 if RCF_CONSTEXPR(IsInParameter<A2 >::value) a2.read(in);
1562 if RCF_CONSTEXPR(IsInParameter<A3 >::value) a3.read(in);
1563 if RCF_CONSTEXPR(IsInParameter<A4 >::value) a4.read(in);
1564 if RCF_CONSTEXPR(IsInParameter<A5 >::value) a5.read(in);
1565 if RCF_CONSTEXPR(IsInParameter<A6 >::value) a6.read(in);
1566 if RCF_CONSTEXPR(IsInParameter<A7 >::value) a7.read(in);
1567 if RCF_CONSTEXPR(IsInParameter<A8 >::value) a8.read(in);
1568 if RCF_CONSTEXPR(IsInParameter<A9 >::value) a9.read(in);
1569 if RCF_CONSTEXPR(IsInParameter<A10>::value) a10.read(in);
1570 if RCF_CONSTEXPR(IsInParameter<A11>::value) a11.read(in);
1571 if RCF_CONSTEXPR(IsInParameter<A12>::value) a12.read(in);
1572 if RCF_CONSTEXPR(IsInParameter<A13>::value) a13.read(in);
1573 if RCF_CONSTEXPR(IsInParameter<A14>::value) a14.read(in);
1574 if RCF_CONSTEXPR(IsInParameter<A15>::value) a15.read(in);
1577 void write(SerializationProtocolOut &out)
1579 if RCF_CONSTEXPR(IsReturnValue<R>::value) r.write(out);
1580 if RCF_CONSTEXPR(IsOutParameter<A1>::value) a1.write(out);
1581 if RCF_CONSTEXPR(IsOutParameter<A2>::value) a2.write(out);
1582 if RCF_CONSTEXPR(IsOutParameter<A3>::value) a3.write(out);
1583 if RCF_CONSTEXPR(IsOutParameter<A4>::value) a4.write(out);
1584 if RCF_CONSTEXPR(IsOutParameter<A5>::value) a5.write(out);
1585 if RCF_CONSTEXPR(IsOutParameter<A6>::value) a6.write(out);
1586 if RCF_CONSTEXPR(IsOutParameter<A7>::value) a7.write(out);
1587 if RCF_CONSTEXPR(IsOutParameter<A8>::value) a8.write(out);
1588 if RCF_CONSTEXPR(IsOutParameter<A9>::value) a9.write(out);
1589 if RCF_CONSTEXPR(IsOutParameter<A10>::value) a10.write(out);
1590 if RCF_CONSTEXPR(IsOutParameter<A11>::value) a11.write(out);
1591 if RCF_CONSTEXPR(IsOutParameter<A12>::value) a12.write(out);
1592 if RCF_CONSTEXPR(IsOutParameter<A13>::value) a13.write(out);
1593 if RCF_CONSTEXPR(IsOutParameter<A14>::value) a14.write(out);
1594 if RCF_CONSTEXPR(IsOutParameter<A15>::value) a15.write(out);
1600 RCF_ASSERT_ALWAYS(
"");
1604 typename ServerMarshalRet<R>::type r;
1605 typename ServerMarshal<A1>::type a1;
1606 typename ServerMarshal<A2>::type a2;
1607 typename ServerMarshal<A3>::type a3;
1608 typename ServerMarshal<A4>::type a4;
1609 typename ServerMarshal<A5>::type a5;
1610 typename ServerMarshal<A6>::type a6;
1611 typename ServerMarshal<A7>::type a7;
1612 typename ServerMarshal<A8>::type a8;
1613 typename ServerMarshal<A9>::type a9;
1614 typename ServerMarshal<A10>::type a10;
1615 typename ServerMarshal<A11>::type a11;
1616 typename ServerMarshal<A12>::type a12;
1617 typename ServerMarshal<A13>::type a13;
1618 typename ServerMarshal<A14>::type a14;
1619 typename ServerMarshal<A15>::type a15;
1622 typedef std::shared_ptr<I_Parameters> ParametersPtr;
1635 typename A10 = Void,
1636 typename A11 = Void,
1637 typename A12 = Void,
1638 typename A13 = Void,
1639 typename A14 = Void,
1640 typename A15 = Void>
1641 class AllocateServerParameters
1644 typedef ServerParameters<
1646 A1, A2, A3, A4, A5, A6, A7, A8,
1647 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1649 ParametersT &operator()(RcfSession &session)
const 1651 session.clearParameters();
1653 session.mParametersVec.resize(
sizeof(ParametersT));
1655 session.mpParameters =
new 1656 ( &session.mParametersVec[0] )
1657 ParametersT(session);
1659 if (!session.mpParameters)
1661 Exception e(RcfError_ServerStubParms);
1665 return static_cast<ParametersT &
>(*session.mpParameters);
1671 RCF_EXPORT
void convertRcfSessionToRcfClient(
1672 OnCallbackConnectionCreated func,
1676 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1677 ClientStub & clientStub,
1678 ServerTransport & serverTransport,
1679 bool keepClientConnection =
false);
1681 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1682 ClientStub & clientStub,
1684 bool keepClientConnection =
false);
1687 template<
typename RcfClientT>
1688 inline RcfSessionPtr convertRcfClientToRcfSession(
1689 RcfClientT & client,
1691 bool keepClientConnection =
false)
1693 return convertRcfClientToRcfSession(
1694 client.getClientStub(),
1696 keepClientConnection);
1699 template<
typename RcfClientT>
1700 inline RcfSessionPtr convertRcfClientToRcfSession(
1701 RcfClientT & client,
1702 ServerTransport & serverTransport,
1703 bool keepClientConnection =
false)
1705 return convertRcfClientToRcfSession(
1706 client.getClientStub(),
1708 keepClientConnection);
1713 RCF_EXPORT
void createCallbackConnectionImpl(
1714 ClientStub & client,
1715 ServerTransport & callbackServer);
1717 RCF_EXPORT
void createCallbackConnectionImpl(
1718 ClientStub & client,
1719 RcfServer & callbackServer);
1723 template<
typename RcfClientT>
1724 void createCallbackConnection(
1725 RcfClientT & client,
1726 RcfServer & callbackServer)
1728 createCallbackConnectionImpl(
1729 client.getClientStub(),
1733 template<
typename RcfClientT>
1734 void createCallbackConnectionImpl(
1735 RcfClientT & client,
1736 ServerTransport & callbackServer)
1738 createCallbackConnection(
1739 client.getClientStub(),
1745 #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:69
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