本文整理汇总了C++中TAO_InputCDR类的典型用法代码示例。如果您正苦于以下问题:C++ TAO_InputCDR类的具体用法?C++ TAO_InputCDR怎么用?C++ TAO_InputCDR使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TAO_InputCDR类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: INTERNAL
CORBA::Boolean
CORBA::ValueBase::_tao_unmarshal_codebase_url_indirection (TAO_InputCDR &strm,
ACE_CString& codebase_url)
{
CORBA::Long offset = 0;
if (!strm.read_long (offset) || offset >= 0)
{
return false;
}
void* pos = strm.rd_ptr () + offset - sizeof (CORBA::Long);
if (strm.get_codebase_url_map()->get()->find (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_unmarshal_codebase_url_indirection, found %x=%C\n"),
pos, codebase_url.c_str ()));
}
return 1;
}
示例2: in
void
TAO_ConstantDef_i::value_i (const CORBA::Any &value)
{
CORBA::TypeCode_var my_tc =
this->type_i ();
CORBA::TypeCode_var val_tc = value.type ();
CORBA::Boolean const equal_tc =
my_tc.in ()->equal (val_tc.in ());
if (!equal_tc)
{
return;
}
ACE_Message_Block *mb = 0;
TAO::Any_Impl *impl = value.impl ();
if (impl->encoded ())
{
TAO::Unknown_IDL_Type *unk =
dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
mb = unk->_tao_get_cdr ().steal_contents ();
}
else
{
TAO_OutputCDR out;
impl->marshal_value (out);
TAO_InputCDR in (out);
mb = in.steal_contents ();
}
ACE_Auto_Ptr<ACE_Message_Block> safe (mb);
CORBA::TCKind kind = val_tc->kind ();
switch (kind)
{
// The data for these types will be aligned to an 8-byte
// boundary, while the rd_ptr may not.
case CORBA::tk_double:
case CORBA::tk_ulonglong:
case CORBA::tk_longlong:
case CORBA::tk_longdouble:
mb->rd_ptr (ACE_ptr_align_binary (mb->rd_ptr (),
ACE_CDR::MAX_ALIGNMENT));
break;
default:
break;
}
mb->crunch ();
this->repo_->config ()->set_binary_value (this->section_key_,
"value",
mb->base (),
mb->length ());
}
示例3: 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;
}
}
示例4: request
bool
Routing_Slip::unmarshal (TAO_Notify_EventChannelFactory &ecf, TAO_InputCDR & cdr)
{
CORBA::ULong count = 0;
cdr.read_ulong (count);
for (size_t nreq = 0; nreq < count; ++nreq)
{
ACE_CDR::Octet code = 0;
while (cdr.read_octet(code))
{
try
{
if (code == TAO_Notify_Method_Request_Dispatch::persistence_code)
{
Delivery_Request * prequest;
ACE_NEW_THROW_EX (
prequest,
Delivery_Request(this_ptr_, this->delivery_requests_.size ()),
CORBA::NO_MEMORY ());
Delivery_Request_Ptr request(prequest);
TAO_Notify_Method_Request_Dispatch_Queueable * method =
TAO_Notify_Method_Request_Dispatch::unmarshal (
request,
ecf,
cdr);
if (method != 0)
{
this->delivery_requests_.push_back (request);
this->delivery_methods_.push_back (method);
}
}
else if (code == TAO_Notify_Method_Request_Lookup::persistence_code)
{
Delivery_Request_Ptr request(new Delivery_Request(this_ptr_, this->delivery_requests_.size ()));
TAO_Notify_Method_Request_Lookup_Queueable * method =
TAO_Notify_Method_Request_Lookup::unmarshal (
request,
ecf,
cdr);
if (method != 0)
{
this->delivery_requests_.push_back (request);
this->delivery_methods_.push_back (method);
}
}
}
catch (const CORBA::Exception&)
{
// @@todo should we log this?
// just ignore failures
}
}
}
return this->delivery_requests_.size () > 0;
}
示例5: 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);
}
示例6: cdr
/*static*/ CORBA::Boolean
PG_Utils::get_tagged_component (
PortableGroup::ObjectGroup *&ior,
PortableGroup::TagGroupTaggedComponent &tg)
{
if (ior->_stubobj () == 0)
return 0;
TAO_MProfile &mprofile =
ior->_stubobj ()->base_profiles ();
// Looking for a tagged component with a TAG_FT_GROUP flag.
IOP::TaggedComponent tc;
tc.tag = IOP::TAG_FT_GROUP;
CORBA::ULong count =
mprofile.profile_count ();
for (CORBA::ULong i = 0;
i < count;
i++)
{
// Get the Tagged Components
const TAO_Tagged_Components &pfile_tagged =
mprofile.get_profile (i)->tagged_components ();
// Look for the primary
if (pfile_tagged.get_component (tc) == 1)
{
TAO_InputCDR cdr (reinterpret_cast<const char*> (tc.component_data.get_buffer ()),
tc.component_data.length ());
CORBA::Boolean byte_order;
cdr >> ACE_InputCDR::to_boolean (byte_order);
if (!cdr.good_bit ())
return 0;
cdr.reset_byte_order (static_cast<int> (byte_order));
cdr >> tg;
if (cdr.good_bit ())
return 1;
}
}
示例7:
CORBA::Boolean
CORBA::ValueBase::_tao_read_repository_id_list (TAO_InputCDR& strm,
Repository_Id_List& ids)
{
CORBA::Long num_ids = 0;
if (!strm.read_long (num_ids))
{
return 0;
}
if (num_ids == TAO_OBV_GIOP_Flags::Indirection_tag)
{
// Multiple repo id is not indirected.
return 0;
}
else
{
for (CORBA::Long i = 0; i < num_ids; ++i)
{
ACE_CString id;
if (!_tao_read_repository_id (strm, id))
{
return 0;
}
ids.push_back (id);
}
}
return 1;
}
示例8:
void
CORBA::SystemException::_tao_decode (TAO_InputCDR &cdr)
{
// The string is read by the caller, to determine the exact type of
// the exception. We just decode the fields...
// cdr.read_string (this->id ());
CORBA::ULong tmp;
if (cdr.read_ulong (this->minor_)
&& cdr.read_ulong (tmp))
{
this->completed_ = CORBA::CompletionStatus (tmp);
return;
}
throw ::CORBA::MARSHAL ();
}
示例9: catch
bool
TAO_Operation_Details::demarshal_args (TAO_InputCDR &cdr)
{
try {
for (CORBA::ULong i = 0; i != this->num_args_; ++i)
{
if (!((*this->args_[i]).demarshal (cdr)))
return false;
}
cdr.reset_vt_indirect_maps ();
}
catch (...) {
cdr.reset_vt_indirect_maps ();
throw;
}
return true;
}
示例10: 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:
}
}
示例11: 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 ();
}
示例12: for_reading
CORBA::Boolean
TAO_DynEnum_i::equal (DynamicAny::DynAny_ptr rhs)
{
CORBA::TypeCode_var tc = rhs->type ();
CORBA::Boolean equivalent = tc->equivalent (this->type_.in ());
if (!equivalent)
{
return false;
}
CORBA::Any_var any = rhs->to_any ();
TAO::Any_Impl *impl = any->impl ();
CORBA::ULong value;
if (impl->encoded ())
{
TAO::Unknown_IDL_Type * const unk =
dynamic_cast<TAO::Unknown_IDL_Type *> (impl);
if (!unk)
throw CORBA::INTERNAL ();
// We don't want unk's rd_ptr to move, in case we are shared by
// another Any, so we use this to copy the state, not the buffer.
TAO_InputCDR for_reading (unk->_tao_get_cdr ());
for_reading.read_ulong (value);
}
else
{
TAO_OutputCDR out;
impl->marshal_value (out);
TAO_InputCDR in (out);
in.read_ulong (value);
}
return value == this->value_;
}
示例13:
bool
Lorica::EvaluatorBase::evaluate_exception(const char *,
PortableServer::POA_ptr,
const char *ex_type,
TAO_InputCDR &incoming,
TAO_OutputCDR &encap ) const
{
const ACE_Message_Block *buffer = incoming.start();
encap << ex_type;
encap.write_octet_array_mb (buffer);
return true;
}
示例14: if
CORBA::Boolean
TAO_ChunkInfo::skip_chunks (TAO_InputCDR &strm)
{
if (!this->chunking_)
{
return 1;
}
// This function is called after reading data of the truncated parent and
// skips the remaining chunks until the outmost endtag (-1).
// The tag read here is suppoused to be an endtag.
CORBA::Long tag;
if (!strm.read_long(tag))
{
return 0;
}
// end of the whole valuetype.
if (tag == -1)
{
return 1;
}
else if (tag < 0)
{
// continue skip the chunk.
return this->skip_chunks (strm);
}
else if (tag < TAO_OBV_GIOP_Flags::Value_tag_base)
{
// Read the chunk size and move forward to skip the data.
ACE_Message_Block* current =
const_cast<ACE_Message_Block*>(strm.start ());
current->rd_ptr (tag);
return this->skip_chunks (strm);
}
else
return 0;
}
示例15: test_read
static int
test_read (TAO_InputCDR &cdr, int n)
{
CORBA::Long xl;
for (int i = 0; i < n; ++i)
{
if (cdr.read_long (xl) == 0)
ACE_ERROR_RETURN ((LM_ERROR,
"read_long[%d] failed\n",
i),
1);
}
return 0;
}