本文整理汇总了C++中TAO_InputCDR::byte_order方法的典型用法代码示例。如果您正苦于以下问题:C++ TAO_InputCDR::byte_order方法的具体用法?C++ TAO_InputCDR::byte_order怎么用?C++ TAO_InputCDR::byte_order使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAO_InputCDR
的用法示例。
在下文中一共展示了TAO_InputCDR::byte_order方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new_mb
void
TAO::Unknown_IDL_Type::_tao_decode (TAO_InputCDR & cdr)
{
// @@ (JP) The following code depends on the fact that
// TAO_InputCDR does not contain chained message blocks,
// otherwise <begin> and <end> could be part of
// different buffers!
// This will be the start of a new message block.
char const * const begin = cdr.rd_ptr ();
// Skip over the next argument.
TAO::traverse_status const status =
TAO_Marshal_Object::perform_skip (this->type_, &cdr);
if (status != TAO::TRAVERSE_CONTINUE)
{
throw ::CORBA::MARSHAL ();
}
// This will be the end of the new message block.
char const * const end = cdr.rd_ptr ();
// The ACE_CDR::mb_align() call can shift the rd_ptr by up to
// ACE_CDR::MAX_ALIGNMENT - 1 bytes. Similarly, the offset adjustment
// can move the rd_ptr by up to the same amount. We accommodate
// this by including 2 * ACE_CDR::MAX_ALIGNMENT bytes of additional
// space in the message block.
size_t const size = end - begin;
ACE_Message_Block new_mb (size + 2 * ACE_CDR::MAX_ALIGNMENT);
ACE_CDR::mb_align (&new_mb);
ptrdiff_t offset = ptrdiff_t (begin) % ACE_CDR::MAX_ALIGNMENT;
if (offset < 0)
{
offset += ACE_CDR::MAX_ALIGNMENT;
}
new_mb.rd_ptr (offset);
new_mb.wr_ptr (offset + size);
ACE_OS::memcpy (new_mb.rd_ptr (), begin, size);
this->cdr_.reset (&new_mb, cdr.byte_order ());
this->cdr_.char_translator (cdr.char_translator ());
this->cdr_.wchar_translator (cdr.wchar_translator ());
this->cdr_.set_repo_id_map (cdr.get_repo_id_map ());
this->cdr_.set_codebase_url_map (cdr.get_codebase_url_map ());
this->cdr_.set_value_map (cdr.get_value_map ());
// Take over the GIOP version, the input cdr can have a different
// version then our current GIOP version.
ACE_CDR::Octet major_version;
ACE_CDR::Octet minor_version;
cdr.get_version (major_version, minor_version);
this->cdr_.set_version (major_version, minor_version);
}
示例2: switch
void
Test::AMI_ControllerHandler::worker_finished_reply_stub (
TAO_InputCDR &_tao_in,
::Messaging::ReplyHandler_ptr _tao_reply_handler,
::CORBA::ULong reply_status)
{
// Retrieve Reply Handler object.
Test::AMI_ControllerHandler_var _tao_reply_handler_object =
Test::AMI_ControllerHandler::_narrow (_tao_reply_handler);
// Exception handling
switch (reply_status)
{
case TAO_AMI_REPLY_OK:
{
// Demarshall all the arguments.
// Invoke the call back method.
_tao_reply_handler_object->worker_finished (
);
break;
}
case TAO_AMI_REPLY_USER_EXCEPTION:
case TAO_AMI_REPLY_SYSTEM_EXCEPTION:
{
const ACE_Message_Block* cdr = _tao_in.start ();
::CORBA::OctetSeq _tao_marshaled_exception (
static_cast <CORBA::ULong> (cdr->length ()),
static_cast <CORBA::ULong> (cdr->length ()),
reinterpret_cast <unsigned char*> (cdr->rd_ptr ()),
0
);
::Messaging::ExceptionHolder* exception_holder_ptr = 0;
ACE_NEW (
exception_holder_ptr,
::TAO::ExceptionHolder (
(reply_status == TAO_AMI_REPLY_SYSTEM_EXCEPTION),
_tao_in.byte_order (),
_tao_marshaled_exception,
0,
0,
_tao_in.char_translator (),
_tao_in.wchar_translator ())
);
::Messaging::ExceptionHolder_var exception_holder_var = exception_holder_ptr;
_tao_reply_handler_object->worker_finished_excep (
exception_holder_var
);
break;
}
case TAO_AMI_REPLY_NOT_OK:
// @@ Michael: Not even the spec mentions this case.
// We have to think about this case.
break;
}
}
示例3: switch
void
TAO_AMH_DSI_Response_Handler::gateway_exception_reply (
CORBA::ULong reply_status,
TAO_InputCDR &encap)
{
// for this to be effective, ACE & TAO must be built with
// ACE_ENABLE_SWAP_ON_WRITE defined in ace/config.h
this->_tao_out.reset_byte_order(encap.byte_order());
// This reply path handles only user exceptions.
switch (reply_status)
{
//case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION:
case TAO_AMI_REPLY_USER_EXCEPTION:
this->reply_status_ = GIOP::USER_EXCEPTION;
break;
case TAO_AMI_REPLY_SYSTEM_EXCEPTION:
this->reply_status_ = GIOP::SYSTEM_EXCEPTION;
break;
// we don't handle location forward at this moment.
// need to be addressed later.
//
//case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD:
// this->exception_type_ = TAO_GIOP_LOCATION_FORWARD;
// break;
}
try
{
this->_tao_rh_init_reply ();
// We know nothing about this exception, so we marshal it as a block
// of bytes. The outgoing stream's byte order has already been matched
// to the original source of the reply.
this->_tao_out.write_octet_array_mb (encap.start());
// This will prevent the marshaling of any parameters into this reply.
// this->sent_gateway_exception_ = 1;
this->_tao_rh_send_reply ();
}
catch (const CORBA::Exception &)
{
// TODO:
}
}
示例4: switch
void
CORBA::Request::handle_response (TAO_InputCDR &incoming,
GIOP::ReplyStatusType reply_status)
{
// If this request was created by a gateway, then result_
// and/or args_ are shared by a CORBA::ServerRequest, whose
// reply must be in the same byte order as the reply we are
// handling here. So we set the member to be accessed later.
this->byte_order_ = incoming.byte_order ();
switch (reply_status)
{
case GIOP::NO_EXCEPTION:
if (this->result_ != 0)
{
// We can be sure that the impl is a TAO::Unknown_IDL_Type.
this->result_->value ()->impl ()->_tao_decode (incoming);
}
this->args_->_tao_incoming_cdr (incoming,
CORBA::ARG_OUT | CORBA::ARG_INOUT,
this->lazy_evaluation_);
{
ACE_GUARD (TAO_SYNCH_MUTEX,
ace_mon,
this->lock_);
this->response_received_ = true;
}
break;
case GIOP::USER_EXCEPTION:
case GIOP::SYSTEM_EXCEPTION:
case GIOP::LOCATION_FORWARD:
case GIOP::LOCATION_FORWARD_PERM:
default:
// @@ (JP) Don't know what to do about any of these yet.
TAOLIB_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) unhandled reply status\n")));
}
}
示例5: sizeof
CORBA::Boolean
CORBA::ValueBase::_tao_unmarshal_value_indirection_pre (TAO_InputCDR &strm,
TAO_InputCDR &indirected_strm)
{
CORBA::Long offset = 0;
if (!strm.read_long (offset) || offset >= 0)
{
return false;
}
size_t const buffer_size = -(offset) + sizeof (CORBA::Long);
// Cribbed from tc_demarshal_indirection in Typecode_CDR_Extraction.cpp
indirected_strm = TAO_InputCDR (strm.rd_ptr () + offset - sizeof (CORBA::Long),
buffer_size,
strm.byte_order ());
indirected_strm.set_repo_id_map (strm.get_repo_id_map ());
indirected_strm.set_codebase_url_map (strm.get_codebase_url_map ());
indirected_strm.set_value_map (strm.get_value_map ());
return indirected_strm.good_bit ();
}
示例6: _tao_unmarshal_codebase_url_indirection
CORBA::Boolean
CORBA::ValueBase::_tao_read_codebase_url (TAO_InputCDR& strm,
ACE_CString& codebase_url)
{
CORBA::ULong length = 0;
size_t buffer_size = strm.length();
if (!strm.read_ulong (length))
{
return 0;
}
VERIFY_MAP (TAO_InputCDR, codebase_url_map, Codebase_URL_Map);
char * pos = strm.rd_ptr();
// 'length' may not be the codebase url length - it could be the
// FFFFFFF indirection marker instead. If it is an indirection marker, we
// get the offset following the indirection marker, otherwise we can follow
// the same logic using the offset to simply rewind to the start of length
// and re-read the length as part of the string
if (TAO_OBV_GIOP_Flags::is_indirection_tag (length))
{
return _tao_unmarshal_codebase_url_indirection (strm, codebase_url);
}
pos -= sizeof (CORBA::ULong);
// Cribbed from tc_demarshal_indirection in Typecode_CDR_Extraction.cpp
TAO_InputCDR url_stream (pos,
buffer_size,
strm.byte_order ());
if (!url_stream.good_bit ())
{
return 0;
}
if (! url_stream.read_string (codebase_url))
return 0;
// It's possible the codebase url is read again from an indirection stream,
// so make sure the codebase url is the same.
ACE_CString mapped_url;
if (strm.get_codebase_url_map ()->get()->find (pos, mapped_url) == 0)
{
if (TAO_debug_level)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_read_codebase_url, found %x=%C\n"),
pos, mapped_url.c_str ()));
}
if (ACE_OS::strcmp (mapped_url.c_str (), codebase_url.c_str ()) != 0)
throw CORBA::INTERNAL ();
}
else if (strm.get_codebase_url_map ()->get()->bind (pos, codebase_url) != 0)
{
throw CORBA::INTERNAL ();
}
else
{
if (TAO_debug_level)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_read_codebase_url, bound %x=%C\n"),
pos, codebase_url.c_str ()));
}
}
// Since the codebase url is always read from the indirection cdr we have to skip
// the main CDR forward if we were in fact reading from the current
// location and not rewinding back some offset.
strm.skip_bytes (length);
return 1;
}