本文整理汇总了C++中ObjectPtr::GetCDRStream方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPtr::GetCDRStream方法的具体用法?C++ ObjectPtr::GetCDRStream怎么用?C++ ObjectPtr::GetCDRStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectPtr
的用法示例。
在下文中一共展示了ObjectPtr::GetCDRStream方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guard
IException* OOCore::Channel::SendAndReceive(TypeInfo::MethodAttributes_t attribs, Remoting::IMessage* pSend, Remoting::IMessage*& pRecv)
{
// Get the object manager
OOBase::Guard<OOBase::SpinLock> guard(m_lock);
// The OM is actually the 'controlling' object for open state
if (!m_ptrOM)
throw Remoting::IChannelClosedException::Create(OMEGA_CREATE_INTERNAL("SendAndReceive() called on disconnected channel"));
ObjectPtr<Remoting::IMarshaller> ptrMarshaller = m_ptrMarshaller;
guard.release();
// We need to wrap the message
ObjectPtr<ObjectImpl<CDRMessage> > ptrEnvelope = ObjectImpl<CDRMessage>::CreateObject();
ptrMarshaller->MarshalInterface(string_t::constant("payload"),ptrEnvelope,OMEGA_GUIDOF(Remoting::IMessage),pSend);
OOBase::CDRStream response;
try
{
m_pSession->send_request(m_channel_id,ptrEnvelope->GetCDRStream(),&response,attribs);
}
catch (Remoting::IChannelClosedException* pE)
{
ptrMarshaller->ReleaseMarshalData(string_t::constant("payload"),ptrEnvelope,OMEGA_GUIDOF(Remoting::IMessage),pSend);
disconnect();
pE->Rethrow();
}
catch (...)
{
ptrMarshaller->ReleaseMarshalData(string_t::constant("payload"),ptrEnvelope,OMEGA_GUIDOF(Remoting::IMessage),pSend);
throw;
}
if (!(attribs & TypeInfo::Asynchronous))
{
try
{
// Wrap the response
ObjectPtr<ObjectImpl<CDRMessage> > ptrRecv = ObjectImpl<CDRMessage>::CreateObject();
ptrRecv->init(response);
// Unwrap the payload...
IObject* pObj = NULL;
ptrMarshaller->UnmarshalInterface(string_t::constant("payload"),ptrRecv,OMEGA_GUIDOF(Remoting::IMessage),pObj);
pRecv = static_cast<Remoting::IMessage*>(pObj);
}
catch (IException* pE)
{
return pE;
}
}
return NULL;
}
示例2: guard
IException* User::Channel::SendAndReceive(TypeInfo::MethodAttributes_t attribs, Remoting::IMessage* pSend, Remoting::IMessage*& pRecv)
{
// Get the object manager
OOBase::Guard<OOBase::SpinLock> guard(m_lock);
ObjectPtr<Remoting::IMarshaller> ptrMarshaller = m_ptrMarshaller;
if (!ptrMarshaller)
throw Remoting::IChannelClosedException::Create(OMEGA_CREATE_INTERNAL("SendAndReceive() called on disconnected channel"));
guard.release();
// We need to wrap the message
ObjectPtr<ObjectImpl<OOCore::CDRMessage> > ptrEnvelope = ObjectImpl<OOCore::CDRMessage>::CreateObject();
ptrMarshaller->MarshalInterface(string_t::constant("payload"),ptrEnvelope,OMEGA_GUIDOF(Remoting::IMessage),pSend);
OOBase::CDRStream response;
try
{
OOServer::MessageHandler::io_result::type res = Manager::instance()->send_request(m_channel_id,ptrEnvelope->GetCDRStream(),&response,attribs);
if (res != OOServer::MessageHandler::io_result::success)
{
if (res == OOServer::MessageHandler::io_result::channel_closed)
{
disconnect();
throw Omega::Remoting::IChannelClosedException::Create(OMEGA_CREATE_INTERNAL("Failed to send request"));
}
disconnect();
OMEGA_THROW("Internal server exception");
}
}
catch (...)
{
ptrMarshaller->ReleaseMarshalData(string_t::constant("payload"),ptrEnvelope,OMEGA_GUIDOF(Remoting::IMessage),pSend);
throw;
}
if (!(attribs & TypeInfo::Asynchronous))
{
try
{
// Wrap the response
ObjectPtr<ObjectImpl<OOCore::CDRMessage> > ptrRecv = ObjectImpl<OOCore::CDRMessage>::CreateObject();
ptrRecv->init(response);
// Unwrap the payload...
IObject* pObj = NULL;
ptrMarshaller->UnmarshalInterface(string_t::constant("payload"),ptrRecv,OMEGA_GUIDOF(Remoting::IMessage),pObj);
pRecv = static_cast<Remoting::IMessage*>(pObj);
}
catch (IException* pE)
{
return pE;
}
}
return NULL;
}