19 #ifndef INCLUDE_RCF_REMOTECALLCONTEXT_HPP
20 #define INCLUDE_RCF_REMOTECALLCONTEXT_HPP
22 #include <RCF/AsioServerTransport.hpp>
23 #include <RCF/Export.hpp>
24 #include <RCF/RcfSession.hpp>
25 #include <RCF/ThreadLocalData.hpp>
31 class RCF_EXPORT RemoteCallContextImpl
35 RemoteCallContextImpl(RCF::RcfSession & session) : mCommitted(false)
37 mRcfSessionPtr = session.shared_from_this();
38 mRcfSessionPtr->mAutoSend =
false;
40 mpParametersUntyped = mRcfSessionPtr->mpParameters;
42 AsioSessionState & sessionState =
43 dynamic_cast<AsioSessionState &
>(
44 mRcfSessionPtr->getSessionState());
46 mSessionStatePtr = sessionState.sharedFromThis();
51 RCF_ASSERT(!mCommitted);
53 if (mRcfSessionPtr->mRequest.getOneway())
55 RCF_LOG_3()(
this) <<
"RcfServer - suppressing response to oneway call.";
56 mRcfSessionPtr->mIn.clearByteBuffer();
57 mRcfSessionPtr->clearParameters();
58 setTlsRcfSessionPtr();
59 mRcfSessionPtr->onWriteCompleted();
63 mRcfSessionPtr->sendResponse();
66 mpParametersUntyped = NULL;
67 mRcfSessionPtr.reset();
69 mSessionStatePtr.reset();
74 void commit(
const std::exception &e)
76 RCF_ASSERT(!mCommitted);
78 if (mRcfSessionPtr->mRequest.getOneway())
80 RCF_LOG_3()(
this) <<
"RcfServer - suppressing response to oneway call.";
81 mRcfSessionPtr->mIn.clearByteBuffer();
82 mRcfSessionPtr->clearParameters();
83 setTlsRcfSessionPtr();
84 mRcfSessionPtr->onWriteCompleted();
88 mRcfSessionPtr->sendResponseException(e);
91 mpParametersUntyped = NULL;
92 mRcfSessionPtr.reset();
94 mSessionStatePtr.reset();
99 bool isCommitted()
const
105 RcfSessionPtr mRcfSessionPtr;
106 AsioSessionStatePtr mSessionStatePtr;
110 I_Parameters * mpParametersUntyped;
131 class RemoteCallContext :
public RemoteCallContextImpl
136 typedef typename boost::mpl::if_<
137 boost::is_same<R, void>,
141 typedef ServerParameters<
143 A1, A2, A3, A4, A5, A6, A7, A8,
144 A9, A10, A11, A12, A13, A14, A15> ParametersT;
146 RemoteCallContext(RCF::RcfSession & session) : RemoteCallContextImpl(session)
148 RCF_ASSERT( dynamic_cast<ParametersT *>(mpParametersUntyped) );
151 ParametersT ¶meters()
153 return *
static_cast<ParametersT *
>(mpParametersUntyped);;
159 #endif // ! INCLUDE_RCF_REMOTECALLCONTEXT_HPP