18 #ifndef INCLUDE_RCF_MARSHAL_HPP 19 #define INCLUDE_RCF_MARSHAL_HPP 21 #include <RCF/AmiThreadPool.hpp> 23 #include <RCF/CurrentSerializationProtocol.hpp> 24 #include <RCF/ObjectPool.hpp> 25 #include <RCF/PublishingService.hpp> 28 #include <RCF/SerializationProtocol.hpp> 29 #include <RCF/ThreadLocalData.hpp> 30 #include <RCF/Tools.hpp> 31 #include <RCF/TypeTraits.hpp> 35 #include <SF/memory.hpp> 38 #if RCF_FEATURE_BOOST_SERIALIZATION==1 39 #include <RCF/BsAutoPtr.hpp> 40 #include <boost/serialization/binary_object.hpp> 45 #pragma warning(disable: 4127) // warning C4127: conditional expression is constant 55 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION(type) \ 56 inline void serializeImpl( \ 57 SerializationProtocolOut &out, \ 61 serializeImpl(out, *pt, 0); \ 64 inline void serializeImpl( \ 65 SerializationProtocolOut &out, \ 69 serializeImpl(out, *pt, 0); \ 72 inline void deserializeImpl( \ 73 SerializationProtocolIn &in, \ 77 RCF_ASSERT(pt==NULL); \ 79 deserializeImpl(in, *pt, 0); \ 82 SF_FOR_EACH_FUNDAMENTAL_TYPE( RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION )
84 #define RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(type) \ 85 template<typename T1, typename T2, typename T3> \ 86 inline void serializeImpl( \ 87 SerializationProtocolOut &out, \ 88 const type<T1,T2,T3> *pt, \ 91 serializeImpl(out, *pt, 0); \ 94 template<typename T1, typename T2, typename T3> \ 95 inline void serializeImpl( \ 96 SerializationProtocolOut &out, \ 97 type<T1,T2,T3> *const pt, \ 100 serializeImpl(out, *pt, 0); \ 103 template<typename T1, typename T2, typename T3> \ 104 inline void deserializeImpl( \ 105 SerializationProtocolIn &in, \ 106 type<T1,T2,T3> *&pt, \ 109 RCF_ASSERT(pt==NULL); \ 110 pt = new type<T1,T2,T3>(); \ 111 deserializeImpl(in, *pt, 0); \ 114 #if RCF_FEATURE_BOOST_SERIALIZATION==1 116 RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3(std::basic_string)
120 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION 122 #undef RCF_DEFINE_PRIMITIVE_POINTER_SERIALIZATION_T3 127 inline void serializeImpl(
128 SerializationProtocolOut &out,
129 const std::shared_ptr<T> *spt,
132 serialize(out, *spt);
136 inline void serializeImpl(
137 SerializationProtocolOut &out,
138 std::shared_ptr<T> *
const spt,
141 serialize(out, *spt);
145 inline void deserializeImpl(
146 SerializationProtocolIn &in,
147 std::shared_ptr<T> *&spt,
150 spt =
new std::shared_ptr<T>();
151 deserialize(in, *spt);
155 inline void serializeImpl(
156 SerializationProtocolOut &out,
157 const std::shared_ptr<T> &spt,
160 serialize(out, spt.get());
164 inline void deserializeImpl(
165 SerializationProtocolIn &in,
166 std::shared_ptr<T> &spt,
171 spt = std::shared_ptr<T>(pt);
174 #if RCF_FEATURE_BOOST_SERIALIZATION==1 177 namespace boost {
namespace serialization {
179 template<
class Archive>
180 void save(Archive & ar,
const RCF::ByteBuffer &byteBuffer,
unsigned int)
185 std::uint32_t len = byteBuffer.getLength();
187 ar & make_binary_object(byteBuffer.getPtr(), len);
191 template<
class Archive>
197 std::uint32_t len = 0;
200 RCF::ReallocBufferPtr bufferPtr = RCF::getObjectPool().getReallocBufferPtr();
201 bufferPtr->resize(len);
204 ar & make_binary_object(byteBuffer.getPtr(), byteBuffer.getLength());
212 #endif // RCF_FEATURE_BOOST_SERIALIZATION==1 219 bool serializeOverride(SerializationProtocolOut &, U &)
225 bool serializeOverride(SerializationProtocolOut &, U *)
231 bool deserializeOverride(SerializationProtocolIn &, U &)
236 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer & u);
238 RCF_EXPORT
bool serializeOverride(SerializationProtocolOut &out, ByteBuffer * pu);
240 RCF_EXPORT
bool deserializeOverride(SerializationProtocolIn &in, ByteBuffer & u);
249 ParmStore() : mptPtr(), mpT(NULL)
253 ParmStore(std::vector<char> & vec) : mptPtr(), mpT(NULL)
258 void allocate(std::vector<char> & vec)
260 RCF_ASSERT(mpT == NULL);
262 getObjectPool().
getObj(mptPtr,
false);
273 vec.resize(
sizeof(T));
274 mpT = (T *) & vec[0];
277 #pragma warning( push ) 278 #pragma warning( disable : 4345 ) // warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized 284 #pragma warning( pop ) 292 RCF_ASSERT(mpT == NULL);
319 std::shared_ptr<T> mptPtr;
328 Deleter(T *& pt) : mpt(pt), mDismissed(false)
333 if ( !mDismissed && mpt )
357 static_assert( !IsPointer<T>::value,
"Incorrect marshaling code." );
358 static_assert( !IsReference<T>::value,
"Incorrect marshaling code." );
360 Sm_Value(std::vector<char> & vec) : mPs(vec)
369 void set(
bool assign,
const T &t)
382 void read(SerializationProtocolIn &in)
384 if (in.getRemainingArchiveLength() != 0)
386 if (!deserializeOverride(in, *mPs))
388 deserialize(in, *mPs);
393 void write(SerializationProtocolOut &)
395 RCF_ASSERT_ALWAYS(
"");
407 Sm_Value(std::vector<char> &)
417 RCF_ASSERT_ALWAYS(
"");
422 void set(bool ,
const Void &)
424 RCF_ASSERT_ALWAYS(
"");
427 void set(
const Void &)
429 RCF_ASSERT_ALWAYS(
"");
432 void read(SerializationProtocolIn &)
434 RCF_ASSERT_ALWAYS(
"");
437 void write(SerializationProtocolOut &)
439 RCF_ASSERT_ALWAYS(
"");
448 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
449 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
451 Sm_Ret(std::vector<char> & vec) : mPs(vec)
460 void set(
bool assign,
const T &t)
473 void read(SerializationProtocolIn &)
475 RCF_ASSERT_ALWAYS(
"");
478 void write(SerializationProtocolOut &out)
480 if (!serializeOverride(out, *mPs))
482 serialize(out, *mPs);
490 template<
typename CRefT>
495 typedef typename RemoveReference<CRefT>::type CT;
496 typedef typename RemoveCv<CT>::type T;
497 static_assert(IsReference<CRefT>::value,
"Incorrect marshaling code.");
498 static_assert(IsConst<CT>::value,
"Incorrect marshaling code.");
499 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
501 Sm_CRef(std::vector<char> & vec) : mPs(), mVec(vec)
509 void set(
bool assign,
const T &t)
522 void read(SerializationProtocolIn &in)
524 if (in.getRemainingArchiveLength() != 0)
526 int ver = in.getRuntimeVersion();
533 Deleter<T> deleter(pt);
542 deserialize(in, *mPs);
550 int sp = in.getSerializationProtocol();
552 && getObjectPool().isCachingEnabled( (T *) NULL ))
555 deserialize(in, *mPs);
560 Deleter<T> deleter(pt);
578 void write(SerializationProtocolOut &)
580 RCF_ASSERT_ALWAYS(
"");
585 std::vector<char> & mVec;
588 template<
typename RefT>
593 typedef typename RemoveReference<RefT>::type T;
594 typedef typename RemoveCv<T>::type U;
595 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
596 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
598 Sm_Ref(std::vector<char> & vec) : mVec(vec)
606 void set(
bool assign,
const T &t)
619 void read(SerializationProtocolIn &in)
621 if (in.getRemainingArchiveLength() != 0)
623 int ver = in.getRuntimeVersion();
630 Deleter<T> deleter(pt);
640 deserialize(in, *mPs);
648 int sp = in.getSerializationProtocol();
650 && getObjectPool().isCachingEnabled( (T *) NULL ))
653 deserialize(in, *mPs);
658 Deleter<T> deleter(pt);
676 void write(SerializationProtocolOut &out)
678 RCF_ASSERT(mPs.get());
680 if (!serializeOverride(out, *mPs))
686 serialize(out, *mPs);
692 std::vector<char> & mVec;
695 template<
typename OutRefT>
700 typedef typename RemoveOut<OutRefT>::type RefT;
701 typedef typename RemoveReference<RefT>::type T;
702 typedef typename RemoveCv<T>::type U;
703 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
704 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
706 Sm_OutRef(std::vector<char> & vec) : mPs(vec)
715 void set(
bool assign,
const T &t)
728 void read(SerializationProtocolIn &)
730 RCF_ASSERT_ALWAYS(
"");
733 void write(SerializationProtocolOut &out)
735 if (!serializeOverride(out, *mPs))
741 serialize(out, *mPs);
749 template<
typename PtrT>
754 typedef typename RemovePointer<PtrT>::type T;
755 typedef typename RemoveCv<T>::type U;
756 static_assert(IsPointer<PtrT>::value,
"Incorrect marshaling code.");
757 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
759 Sm_Ptr(std::vector<char> &)
767 void set(
bool assign,
const T &t)
780 void read(SerializationProtocolIn &in)
782 if (in.getRemainingArchiveLength() != 0)
785 Deleter<T> deleter(pt);
792 void write(SerializationProtocolOut &)
794 RCF_ASSERT_ALWAYS(
"");
809 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
810 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
815 std::vector<char> & vec = pClientStub->getRetValVec();
824 void set(
bool assign,
const T &t)
837 void read(SerializationProtocolIn &in)
839 if (in.getRemainingArchiveLength() != 0)
841 if (!deserializeOverride(in, *mPs))
843 deserialize(in, *mPs);
848 void write(SerializationProtocolOut &)
850 RCF_ASSERT_ALWAYS(
"");
862 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
863 static_assert(!IsReference<T>::value,
"Incorrect marshaling code.");
867 Cm_Value(
const T &t) : mT( const_cast<T &>(t) )
876 void read(SerializationProtocolIn &in)
878 RCF_UNUSED_VARIABLE(in);
881 void write(SerializationProtocolOut &out)
883 if (!serializeOverride(out, mT))
893 template<
typename PtrT>
898 typedef typename RemovePointer<PtrT>::type T;
900 static_assert(IsPointer<PtrT>::value,
"Incorrect marshaling code.");
901 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
906 Cm_Ptr(T * pt) : mpT(pt)
915 void read(SerializationProtocolIn &in)
917 RCF_UNUSED_VARIABLE(in);
920 void write(SerializationProtocolOut &out)
929 template<
typename CRefT>
934 typedef typename RemoveReference<CRefT>::type CT;
935 typedef typename RemoveCv<CT>::type T;
936 static_assert(IsReference<CRefT>::value,
"Incorrect marshaling code.");
937 static_assert(IsConst<CT>::value,
"Incorrect marshaling code.");
938 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
940 Cm_CRef(
const T &t) : mT(t)
948 void read(SerializationProtocolIn &in)
950 RCF_UNUSED_VARIABLE(in);
953 void write(SerializationProtocolOut &out)
955 int ver = out.getRuntimeVersion();
974 template<
typename RefT>
979 typedef typename RemoveReference<RefT>::type T;
980 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
981 static_assert(!IsConst<RefT>::value,
"Incorrect marshaling code.");
982 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
992 void read(SerializationProtocolIn &in)
994 if (in.getRemainingArchiveLength() != 0)
996 if (!deserializeOverride(in, mT))
1003 void write(SerializationProtocolOut &out)
1005 int ver = out.getRuntimeVersion();
1008 serialize(out, &mT);
1016 serialize(out, &mT);
1024 template<
typename OutRefT>
1029 typedef typename RemoveOut<OutRefT>::type RefT;
1030 typedef typename RemoveReference<RefT>::type T;
1031 static_assert(IsReference<RefT>::value,
"Incorrect marshaling code.");
1032 static_assert(!IsConst<RefT>::value,
"Incorrect marshaling code.");
1033 static_assert(!IsPointer<T>::value,
"Incorrect marshaling code.");
1035 Cm_OutRef(T &t) : mT(t)
1043 void read(SerializationProtocolIn &in)
1045 if (in.getRemainingArchiveLength() != 0)
1047 if (!deserializeOverride(in, mT))
1049 deserialize(in, mT);
1054 void write(SerializationProtocolOut &)
1056 RCF_ASSERT_ALWAYS(
"");
1063 template<
typename T>
1064 struct IsConstReference
1069 IsConst< typename RemoveReference<T>::type >
1072 enum { value = type::value };
1075 template<
typename T>
1076 struct ServerMarshalRet
1080 std::is_same<void, T>,
1082 Sm_Ret<T> >::type type;
1085 template<
typename T>
1086 struct ServerMarshal
1093 IsConstReference<T>,
1111 template<
typename T>
1112 struct ClientMarshal
1119 IsConstReference<T>,
1140 template<
typename T>
1149 typename std::add_lvalue_reference<T>::type,
1150 typename std::add_lvalue_reference<
1151 typename std::add_const<T>::type
1160 virtual ~I_Parameters() {}
1161 virtual void read(SerializationProtocolIn &in) = 0;
1162 virtual void write(SerializationProtocolOut &out) = 0;
1166 template<
typename T>
1167 struct IsInParameter
1169 typedef typename Not< std::is_same<T,Void> >::type NotVoid;
1170 typedef typename Not< IsOut<T> >::type NotExplicitOutParameter;
1172 typedef typename And<
1174 NotExplicitOutParameter
1177 enum { value = type::value };
1180 template<
typename T>
1181 struct IsOutParameter
1188 typename RemoveReference<T>::type
1191 >::type NonConstRef_;
1193 typedef typename IsOut<T>::type ExplicitOutParameter;
1195 enum { value = NonConstRef_::value || ExplicitOutParameter::value };
1198 template<
typename T>
1199 struct IsReturnValue
1201 typedef typename Not< std::is_same<T, Void> >::type type;
1202 enum { value = type::value };
1208 I_Future * find(
const void * pv)
1210 I_Future * pFuture = NULL;
1211 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1213 if (mCandidateList[i].first == pv)
1215 RCF_ASSERT(!pFuture);
1216 pFuture = mCandidateList[i].second;
1222 void erase(
const void * pv)
1224 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1226 if (mCandidateList[i].first == pv)
1228 mCandidateList.erase( mCandidateList.begin() + i );
1232 RCF_ASSERT_ALWAYS(
"");
1235 void add(
const void * pv, I_Future * pFuture)
1237 for (std::size_t i=0; i<mCandidateList.size(); ++i)
1239 if (mCandidateList[i].first == pv)
1241 mCandidateList[i].second = pFuture;
1245 mCandidateList.push_back( std::make_pair(pv, pFuture) );
1250 typedef std::vector< std::pair<const void *, I_Future *> > CandidateList;
1251 CandidateList mCandidateList;
1254 RCF_EXPORT Mutex & gCandidatesMutex();
1255 RCF_EXPORT Candidates & gCandidates();
1274 class ClientParameters :
public I_Parameters
1278 typedef typename RemoveOut<A1 >::type A1_;
1279 typedef typename RemoveOut<A2 >::type A2_;
1280 typedef typename RemoveOut<A3 >::type A3_;
1281 typedef typename RemoveOut<A4 >::type A4_;
1282 typedef typename RemoveOut<A5 >::type A5_;
1283 typedef typename RemoveOut<A6 >::type A6_;
1284 typedef typename RemoveOut<A7 >::type A7_;
1285 typedef typename RemoveOut<A8 >::type A8_;
1286 typedef typename RemoveOut<A9 >::type A9_;
1287 typedef typename RemoveOut<A10>::type A10_;
1288 typedef typename RemoveOut<A11>::type A11_;
1289 typedef typename RemoveOut<A12>::type A12_;
1290 typedef typename RemoveOut<A13>::type A13_;
1291 typedef typename RemoveOut<A14>::type A14_;
1292 typedef typename RemoveOut<A15>::type A15_;
1294 typedef typename ReferenceTo<A1_ >::type A1Ref;
1295 typedef typename ReferenceTo<A2_ >::type A2Ref;
1296 typedef typename ReferenceTo<A3_ >::type A3Ref;
1297 typedef typename ReferenceTo<A4_ >::type A4Ref;
1298 typedef typename ReferenceTo<A5_ >::type A5Ref;
1299 typedef typename ReferenceTo<A6_ >::type A6Ref;
1300 typedef typename ReferenceTo<A7_ >::type A7Ref;
1301 typedef typename ReferenceTo<A8_ >::type A8Ref;
1302 typedef typename ReferenceTo<A9_ >::type A9Ref;
1303 typedef typename ReferenceTo<A10_>::type A10Ref;
1304 typedef typename ReferenceTo<A11_>::type A11Ref;
1305 typedef typename ReferenceTo<A12_>::type A12Ref;
1306 typedef typename ReferenceTo<A13_>::type A13Ref;
1307 typedef typename ReferenceTo<A14_>::type A14Ref;
1308 typedef typename ReferenceTo<A15_>::type A15Ref;
1311 A1Ref a1, A2Ref a2, A3Ref a3, A4Ref a4, A5Ref a5, A6Ref a6,
1312 A7Ref a7, A8Ref a8, A9Ref a9, A10Ref a10, A11Ref a11, A12Ref a12,
1313 A13Ref a13, A14Ref a14, A15Ref a15) :
1314 a1(a1), a2(a2), a3(a3), a4(a4), a5(a5), a6(a6), a7(a7), a8(a8),
1315 a9(a9), a10(a10), a11(a11), a12(a12), a13(a13), a14(a14), a15(a15)
1319 void read(SerializationProtocolIn &in)
1321 if RCF_CONSTEXPR(IsReturnValue<R>::value) r.read(in);
1322 if RCF_CONSTEXPR(IsOutParameter<A1 >::value) a1.read(in);
1323 if RCF_CONSTEXPR(IsOutParameter<A2 >::value) a2.read(in);
1324 if RCF_CONSTEXPR(IsOutParameter<A3 >::value) a3.read(in);
1325 if RCF_CONSTEXPR(IsOutParameter<A4 >::value) a4.read(in);
1326 if RCF_CONSTEXPR(IsOutParameter<A5 >::value) a5.read(in);
1327 if RCF_CONSTEXPR(IsOutParameter<A6 >::value) a6.read(in);
1328 if RCF_CONSTEXPR(IsOutParameter<A7 >::value) a7.read(in);
1329 if RCF_CONSTEXPR(IsOutParameter<A8 >::value) a8.read(in);
1330 if RCF_CONSTEXPR(IsOutParameter<A9 >::value) a9.read(in);
1331 if RCF_CONSTEXPR(IsOutParameter<A10>::value) a10.read(in);
1332 if RCF_CONSTEXPR(IsOutParameter<A11>::value) a11.read(in);
1333 if RCF_CONSTEXPR(IsOutParameter<A12>::value) a12.read(in);
1334 if RCF_CONSTEXPR(IsOutParameter<A13>::value) a13.read(in);
1335 if RCF_CONSTEXPR(IsOutParameter<A14>::value) a14.read(in);
1336 if RCF_CONSTEXPR(IsOutParameter<A15>::value) a15.read(in);
1339 void write(SerializationProtocolOut &out)
1341 if RCF_CONSTEXPR(IsInParameter<A1 >::value) a1.write(out);
1342 if RCF_CONSTEXPR(IsInParameter<A2 >::value) a2.write(out);
1343 if RCF_CONSTEXPR(IsInParameter<A3 >::value) a3.write(out);
1344 if RCF_CONSTEXPR(IsInParameter<A4 >::value) a4.write(out);
1345 if RCF_CONSTEXPR(IsInParameter<A5 >::value) a5.write(out);
1346 if RCF_CONSTEXPR(IsInParameter<A6 >::value) a6.write(out);
1347 if RCF_CONSTEXPR(IsInParameter<A7 >::value) a7.write(out);
1348 if RCF_CONSTEXPR(IsInParameter<A8 >::value) a8.write(out);
1349 if RCF_CONSTEXPR(IsInParameter<A9 >::value) a9.write(out);
1350 if RCF_CONSTEXPR(IsInParameter<A10>::value) a10.write(out);
1351 if RCF_CONSTEXPR(IsInParameter<A11>::value) a11.write(out);
1352 if RCF_CONSTEXPR(IsInParameter<A12>::value) a12.write(out);
1353 if RCF_CONSTEXPR(IsInParameter<A13>::value) a13.write(out);
1354 if RCF_CONSTEXPR(IsInParameter<A14>::value) a14.write(out);
1355 if RCF_CONSTEXPR(IsInParameter<A15>::value) a15.write(out);
1360 bool enrolled =
false;
1362 const void * pva[] = {
1380 for (std::size_t i=0; i<
sizeof(pva)/
sizeof(pva[0]); ++i)
1382 const void *pv = pva[i];
1383 I_Future * pFuture = NULL;
1386 Lock lock(gCandidatesMutex());
1387 pFuture = gCandidates().find(pv);
1390 gCandidates().erase(pv);
1396 pClientStub->enrol( pFuture );
1405 typename ClientMarshal<A1>::type a1;
1406 typename ClientMarshal<A2>::type a2;
1407 typename ClientMarshal<A3>::type a3;
1408 typename ClientMarshal<A4>::type a4;
1409 typename ClientMarshal<A5>::type a5;
1410 typename ClientMarshal<A6>::type a6;
1411 typename ClientMarshal<A7>::type a7;
1412 typename ClientMarshal<A8>::type a8;
1413 typename ClientMarshal<A9>::type a9;
1414 typename ClientMarshal<A10>::type a10;
1415 typename ClientMarshal<A11>::type a11;
1416 typename ClientMarshal<A12>::type a12;
1417 typename ClientMarshal<A13>::type a13;
1418 typename ClientMarshal<A14>::type a14;
1419 typename ClientMarshal<A15>::type a15;
1439 class AllocateClientParameters
1443 typedef typename RemoveOut<A1 >::type A1_;
1444 typedef typename RemoveOut<A2 >::type A2_;
1445 typedef typename RemoveOut<A3 >::type A3_;
1446 typedef typename RemoveOut<A4 >::type A4_;
1447 typedef typename RemoveOut<A5 >::type A5_;
1448 typedef typename RemoveOut<A6 >::type A6_;
1449 typedef typename RemoveOut<A7 >::type A7_;
1450 typedef typename RemoveOut<A8 >::type A8_;
1451 typedef typename RemoveOut<A9 >::type A9_;
1452 typedef typename RemoveOut<A10>::type A10_;
1453 typedef typename RemoveOut<A11>::type A11_;
1454 typedef typename RemoveOut<A12>::type A12_;
1455 typedef typename RemoveOut<A13>::type A13_;
1456 typedef typename RemoveOut<A14>::type A14_;
1457 typedef typename RemoveOut<A15>::type A15_;
1459 typedef typename ReferenceTo<A1_ >::type A1Ref;
1460 typedef typename ReferenceTo<A2_ >::type A2Ref;
1461 typedef typename ReferenceTo<A3_ >::type A3Ref;
1462 typedef typename ReferenceTo<A4_ >::type A4Ref;
1463 typedef typename ReferenceTo<A5_ >::type A5Ref;
1464 typedef typename ReferenceTo<A6_ >::type A6Ref;
1465 typedef typename ReferenceTo<A7_ >::type A7Ref;
1466 typedef typename ReferenceTo<A8_ >::type A8Ref;
1467 typedef typename ReferenceTo<A9_ >::type A9Ref;
1468 typedef typename ReferenceTo<A10_>::type A10Ref;
1469 typedef typename ReferenceTo<A11_>::type A11Ref;
1470 typedef typename ReferenceTo<A12_>::type A12Ref;
1471 typedef typename ReferenceTo<A13_>::type A13Ref;
1472 typedef typename ReferenceTo<A14_>::type A14Ref;
1473 typedef typename ReferenceTo<A15_>::type A15Ref;
1475 typedef ClientParameters<
1477 A1, A2, A3, A4, A5, A6, A7, A8,
1478 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1481 ParametersT &operator()(
1482 ClientStub &clientStub,
1499 CurrentClientStubSentry sentry(clientStub);
1501 clientStub.clearParameters();
1503 clientStub.mParametersVec.resize(
sizeof(ParametersT));
1505 clientStub.mpParameters =
new ( &clientStub.mParametersVec[0] )
1507 a1,a2,a3,a4,a5,a6,a7,a8,
1508 a9,a10,a11,a12,a13,a14,a15);
1510 if (!clientStub.mpParameters)
1512 Exception e(RcfError_ClientStubParms);
1516 return static_cast<ParametersT &
>(*clientStub.mpParameters);
1531 typename A10 = Void,
1532 typename A11 = Void,
1533 typename A12 = Void,
1534 typename A13 = Void,
1535 typename A14 = Void,
1536 typename A15 = Void>
1537 class ServerParameters :
public I_Parameters
1541 ServerParameters(RcfSession &session) :
1542 r(session.mParmsVec[0]),
1543 a1(session.mParmsVec[1]),
1544 a2(session.mParmsVec[2]),
1545 a3(session.mParmsVec[3]),
1546 a4(session.mParmsVec[4]),
1547 a5(session.mParmsVec[5]),
1548 a6(session.mParmsVec[6]),
1549 a7(session.mParmsVec[7]),
1550 a8(session.mParmsVec[8]),
1551 a9(session.mParmsVec[9]),
1552 a10(session.mParmsVec[10]),
1553 a11(session.mParmsVec[11]),
1554 a12(session.mParmsVec[12]),
1555 a13(session.mParmsVec[13]),
1556 a14(session.mParmsVec[14]),
1557 a15(session.mParmsVec[15])
1562 void read(SerializationProtocolIn &in)
1564 if RCF_CONSTEXPR(IsInParameter<A1 >::value) a1.read(in);
1565 if RCF_CONSTEXPR(IsInParameter<A2 >::value) a2.read(in);
1566 if RCF_CONSTEXPR(IsInParameter<A3 >::value) a3.read(in);
1567 if RCF_CONSTEXPR(IsInParameter<A4 >::value) a4.read(in);
1568 if RCF_CONSTEXPR(IsInParameter<A5 >::value) a5.read(in);
1569 if RCF_CONSTEXPR(IsInParameter<A6 >::value) a6.read(in);
1570 if RCF_CONSTEXPR(IsInParameter<A7 >::value) a7.read(in);
1571 if RCF_CONSTEXPR(IsInParameter<A8 >::value) a8.read(in);
1572 if RCF_CONSTEXPR(IsInParameter<A9 >::value) a9.read(in);
1573 if RCF_CONSTEXPR(IsInParameter<A10>::value) a10.read(in);
1574 if RCF_CONSTEXPR(IsInParameter<A11>::value) a11.read(in);
1575 if RCF_CONSTEXPR(IsInParameter<A12>::value) a12.read(in);
1576 if RCF_CONSTEXPR(IsInParameter<A13>::value) a13.read(in);
1577 if RCF_CONSTEXPR(IsInParameter<A14>::value) a14.read(in);
1578 if RCF_CONSTEXPR(IsInParameter<A15>::value) a15.read(in);
1581 void write(SerializationProtocolOut &out)
1583 if RCF_CONSTEXPR(IsReturnValue<R>::value) r.write(out);
1584 if RCF_CONSTEXPR(IsOutParameter<A1>::value) a1.write(out);
1585 if RCF_CONSTEXPR(IsOutParameter<A2>::value) a2.write(out);
1586 if RCF_CONSTEXPR(IsOutParameter<A3>::value) a3.write(out);
1587 if RCF_CONSTEXPR(IsOutParameter<A4>::value) a4.write(out);
1588 if RCF_CONSTEXPR(IsOutParameter<A5>::value) a5.write(out);
1589 if RCF_CONSTEXPR(IsOutParameter<A6>::value) a6.write(out);
1590 if RCF_CONSTEXPR(IsOutParameter<A7>::value) a7.write(out);
1591 if RCF_CONSTEXPR(IsOutParameter<A8>::value) a8.write(out);
1592 if RCF_CONSTEXPR(IsOutParameter<A9>::value) a9.write(out);
1593 if RCF_CONSTEXPR(IsOutParameter<A10>::value) a10.write(out);
1594 if RCF_CONSTEXPR(IsOutParameter<A11>::value) a11.write(out);
1595 if RCF_CONSTEXPR(IsOutParameter<A12>::value) a12.write(out);
1596 if RCF_CONSTEXPR(IsOutParameter<A13>::value) a13.write(out);
1597 if RCF_CONSTEXPR(IsOutParameter<A14>::value) a14.write(out);
1598 if RCF_CONSTEXPR(IsOutParameter<A15>::value) a15.write(out);
1604 RCF_ASSERT_ALWAYS(
"");
1608 typename ServerMarshalRet<R>::type r;
1609 typename ServerMarshal<A1>::type a1;
1610 typename ServerMarshal<A2>::type a2;
1611 typename ServerMarshal<A3>::type a3;
1612 typename ServerMarshal<A4>::type a4;
1613 typename ServerMarshal<A5>::type a5;
1614 typename ServerMarshal<A6>::type a6;
1615 typename ServerMarshal<A7>::type a7;
1616 typename ServerMarshal<A8>::type a8;
1617 typename ServerMarshal<A9>::type a9;
1618 typename ServerMarshal<A10>::type a10;
1619 typename ServerMarshal<A11>::type a11;
1620 typename ServerMarshal<A12>::type a12;
1621 typename ServerMarshal<A13>::type a13;
1622 typename ServerMarshal<A14>::type a14;
1623 typename ServerMarshal<A15>::type a15;
1626 typedef std::shared_ptr<I_Parameters> ParametersPtr;
1639 typename A10 = Void,
1640 typename A11 = Void,
1641 typename A12 = Void,
1642 typename A13 = Void,
1643 typename A14 = Void,
1644 typename A15 = Void>
1645 class AllocateServerParameters
1648 typedef ServerParameters<
1650 A1, A2, A3, A4, A5, A6, A7, A8,
1651 A9, A10, A11, A12, A13, A14, A15> ParametersT;
1653 ParametersT &operator()(RcfSession &session)
const 1655 session.clearParameters();
1657 session.mParametersVec.resize(
sizeof(ParametersT));
1659 session.mpParameters =
new 1660 ( &session.mParametersVec[0] )
1661 ParametersT(session);
1663 if (!session.mpParameters)
1665 Exception e(RcfError_ServerStubParms);
1669 return static_cast<ParametersT &
>(*session.mpParameters);
1675 RCF_EXPORT
void convertRcfSessionToRcfClient(
1676 OnCallbackConnectionCreated func,
1680 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1681 ClientStub & clientStub,
1682 ServerTransport & serverTransport,
1683 bool keepClientConnection =
false);
1685 RCF_EXPORT RcfSessionPtr convertRcfClientToRcfSession(
1686 ClientStub & clientStub,
1688 bool keepClientConnection =
false);
1691 template<
typename RcfClientT>
1692 inline RcfSessionPtr convertRcfClientToRcfSession(
1693 RcfClientT & client,
1695 bool keepClientConnection =
false)
1697 return convertRcfClientToRcfSession(
1698 client.getClientStub(),
1700 keepClientConnection);
1703 template<
typename RcfClientT>
1704 inline RcfSessionPtr convertRcfClientToRcfSession(
1705 RcfClientT & client,
1706 ServerTransport & serverTransport,
1707 bool keepClientConnection =
false)
1709 return convertRcfClientToRcfSession(
1710 client.getClientStub(),
1712 keepClientConnection);
1717 RCF_EXPORT
void createCallbackConnectionImpl(
1718 ClientStub & client,
1719 ServerTransport & callbackServer);
1721 RCF_EXPORT
void createCallbackConnectionImpl(
1722 ClientStub & client,
1723 RcfServer & callbackServer);
1727 template<
typename RcfClientT>
1728 void createCallbackConnection(
1729 RcfClientT & client,
1730 RcfServer & callbackServer)
1732 createCallbackConnectionImpl(
1733 client.getClientStub(),
1737 template<
typename RcfClientT>
1738 void createCallbackConnectionImpl(
1739 RcfClientT & client,
1740 ServerTransport & callbackServer)
1742 createCallbackConnection(
1743 client.getClientStub(),
1750 #pragma warning(pop) 1753 #endif // ! INCLUDE_RCF_MARSHAL_HPP Definition: AsioFwd.hpp:26
SF binary.
Definition: Enums.hpp:169
Controls the client side of a RCF connection.
Definition: ClientStub.hpp:82
SF text.
Definition: Enums.hpp:172
RemoteCallMode
Remote call mode.
Definition: Enums.hpp:140
Base class for all RCF exceptions.
Definition: Exception.hpp:67
Two-way.
Definition: Enums.hpp:146
Definition: ByteBuffer.hpp:39
Definition: AmiIoHandler.hpp:23
void getObj(std::shared_ptr< T > &objPtr, bool alwaysCreate=true)
Definition: ObjectPool.hpp:191