本文整理汇总了C++中TAO_OutputCDR类的典型用法代码示例。如果您正苦于以下问题:C++ TAO_OutputCDR类的具体用法?C++ TAO_OutputCDR怎么用?C++ TAO_OutputCDR使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TAO_OutputCDR类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CORBA::Boolean
TAO_ChunkInfo::write_previous_chunk_size(TAO_OutputCDR &strm)
{
if (this->chunk_size_pos_ != 0)
{
// Calculate the chunk size.
CORBA::Long const chunk_size =
static_cast<CORBA::Long> (strm.total_length () - this->length_to_chunk_octets_pos_);
// This should not happen since this is called in end_chunk() and
// the idl generated code always have the matched start_chunk() and
// end_chunk() pair. There is always data written to the stream between
// the start_chunk() and end_chunk() calls.
if (chunk_size == 0)
{
return false;
}
// Write the actual chunk size to the reserved chunk size position
// in the stream.
if (!strm.replace (chunk_size, this->chunk_size_pos_))
{
return false;
}
// We finish writing the actual chunk size, now we need reset the state.
this->chunk_size_pos_ = 0;
this->length_to_chunk_octets_pos_ = 0;
}
return true;
}
示例2: ACE_align_binary
bool
TAO::TypeCode::Alias<StringType,
TypeCodeType,
RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
CORBA::ULong offset) const
{
// A tk_alias TypeCode has a "complex" parameter list type (see
// Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
// the CORBA specification), meaning that it must be marshaled into
// a CDR encapsulation.
// Create a CDR encapsulation.
TAO_OutputCDR enc;
// Account for the encoded CDR encapsulation length and byte order.
//
// Aligning on an octet since the next value after the CDR
// encapsulation length will always be the byte order octet/boolean
// in this case.
offset = ACE_Utils::truncate_cast<CORBA::ULong> (
ACE_align_binary (offset + 4,
ACE_CDR::OCTET_ALIGN));
return
enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)
&& enc << TAO_OutputCDR::from_string (this->attributes_.id (), 0)
&& enc << TAO_OutputCDR::from_string (this->attributes_.name (), 0)
&& marshal (enc,
Traits<StringType>::get_typecode (this->content_type_),
ACE_Utils::truncate_cast<CORBA::ULong> (
offset + enc.total_length ()))
&& cdr << static_cast<CORBA::ULong> (enc.total_length ())
&& cdr.write_octet_array_mb (enc.begin ());
}
示例3: ACE_align_binary
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
bool
TAO::TypeCode::Union<char const *,
CORBA::TypeCode_ptr const *,
TAO::TypeCode::Case<char const *,
CORBA::TypeCode_ptr const *> const * const *,
TAO::Null_RefCount_Policy>::tao_marshal (
TAO_OutputCDR & cdr,
CORBA::ULong offset) const
{
// A tk_union TypeCode has a "complex" parameter list type (see
// Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
// the CORBA specification), meaning that it must be marshaled into
// a CDR encapsulation.
// Create a CDR encapsulation.
TAO_OutputCDR enc;
// Account for the encoded CDR encapsulation length and byte order.
//
// Aligning on an octet since the next value after the CDR
// encapsulation length will always be the byte order octet/boolean
// in this case.
offset = ACE_Utils::truncate_cast<CORBA::ULong> (
ACE_align_binary (offset + 4,
ACE_CDR::OCTET_ALIGN));
bool const success =
(enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
&& (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
&& (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
&& marshal (enc,
Traits<char const *>::get_typecode (this->discriminant_type_),
ACE_Utils::truncate_cast<CORBA::ULong> (
offset + enc.total_length ()))
&& (enc << this->default_index_)
&& (enc << this->ncases_);
if (!success)
{
return false;
}
// Note that we handle the default case below, too.
for (CORBA::ULong i = 0; i < this->ncases_; ++i)
{
case_type const & c = *this->cases_[i];
if (!c.marshal (enc, offset))
{
return false;
}
}
return
cdr << static_cast<CORBA::ULong> (enc.total_length ())
&& cdr.write_octet_array_mb (enc.begin ());
}
示例4: catch
bool
TAO_Operation_Details::marshal_args (TAO_OutputCDR &cdr)
{
try {
for (CORBA::ULong i = 0; i != this->num_args_; ++i)
{
if (!((*this->args_[i]).marshal (cdr)))
return false;
}
// Nothing else to fragment. We're also guaranteed to have
// data in the CDR stream since the operation was a marshaling
// operation, not a fragmentation operation.
cdr.more_fragments (false);
#ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION
cdr.reset_vt_indirect_maps ();
#endif
}
catch (...) {
#ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION
cdr.reset_vt_indirect_maps ();
#endif
throw;
}
return true;
}
示例5: replicate_request
void Replication_Service::replicate_request(const FtRtecEventChannelAdmin::Operation& update,
RollbackOperation rollback)
{
TAO_OutputCDR cdr;
cdr << update;
ACE_Message_Block mb;
ACE_CDR::consolidate(&mb, cdr.begin());
#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
FTRT::State state(mb.length(), &mb);
#else
// If the form of the constructor is not available, we will need
// to do the copy manually. First, set the octet sequence length.
FTRT::State state;
CORBA::ULong length = mb.length ();
state.length (length);
// Now copy over each byte.
char* base = mb.data_block ()->base ();
for(CORBA::ULong i = 0; i < length; i++)
{
state[i] = base[i];
}
#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
replication_strategy->replicate_request(
state,
rollback,
update.object_id);
}
示例6: operator
bool operator ()( DeviceProxy& device, CORBA::ULong cmd, CORBA::ULong cls ) const {
TAO_OutputCDR cdr;
device.prepare_data( cdr ) << cmd;
cdr << cls;
cdr << d_;
return device.sendto( cdr.begin() );
}
示例7: VERIFY_MAP
CORBA::Boolean
CORBA::ValueBase::_tao_write_repository_id (TAO_OutputCDR &strm,
ACE_CString& id)
{
#ifdef TAO_HAS_VALUETYPE_OUT_INDIRECTION
VERIFY_MAP (TAO_OutputCDR, repo_id_map, Repo_Id_Map);
char* pos = 0;
if (strm.get_repo_id_map ()->get()->find (id, pos) == 0)
{
if (!strm.write_long (TAO_OBV_GIOP_Flags::Indirection_tag))
{
return false;
}
CORBA::Long offset= -strm.offset (pos);
if (TAO_debug_level)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_write_repository_id, id %C indirection %d\n"),
id.c_str(), offset));
}
if (!strm.write_long (offset))
{
return false;
}
}
else
{
if (strm.align_write_ptr (ACE_CDR::LONG_SIZE) != 0)
{
throw CORBA::INTERNAL ();
}
if (strm.get_repo_id_map ()->get ()->bind (id, strm.current()->wr_ptr ()) != 0)
{
throw CORBA::INTERNAL ();
}
if (TAO_debug_level)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - %N:%l ValueBase::_tao_write_repository_id, bound %C - %x\n"),
id.c_str (), strm.current()->wr_ptr ()));
}
if (! strm.write_string (id.c_str ()))
{
return false;
}
}
#else
if (! strm.write_string (id.c_str ()))
{
return 0;
}
#endif
return 1;
}
示例8:
void
Logging::commit_to_task()
{
// Broker::EventLog, that is not EventLog
if ( msg.get().format.in() && *msg.get().format.in() != 0 ) {
TAO_OutputCDR cdr;
cdr << msg.get();
ACE_Message_Block * mb = cdr.begin()->duplicate();
mb->msg_type( constants::MB_EVENTLOG );
iTask::instance()->putq( mb );
}
}
示例9: ACE_align_binary
bool
TAO::TypeCode::Struct<StringType,
TypeCodeType,
FieldArrayType,
RefCountPolicy>::tao_marshal (TAO_OutputCDR & cdr,
CORBA::ULong offset) const
{
// A tk_struct TypeCode has a "complex" parameter list type (see
// Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
// the CORBA specification), meaning that it must be marshaled into
// a CDR encapsulation.
// Create a CDR encapsulation.
TAO_OutputCDR enc;
// Account for the encoded CDR encapsulation length and byte order.
//
// Aligning on an octet since the next value after the CDR
// encapsulation length will always be the byte order octet/boolean
// in this case.
offset = ACE_align_binary (offset + 4,
ACE_CDR::OCTET_ALIGN);
bool const success =
(enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
&& (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
&& (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
&& (enc << this->nfields_);
if (!success)
return false;
Struct_Field<StringType, TypeCodeType> const * const begin =
&this->fields_[0];
Struct_Field<StringType, TypeCodeType> const * const end =
begin + this->nfields_;
for (Struct_Field<StringType, TypeCodeType> const * i = begin; i != end; ++i)
{
Struct_Field<StringType, TypeCodeType> const & field = *i;
if (!(enc << TAO_OutputCDR::from_string (
Traits<StringType>::get_string (field.name), 0))
|| !marshal (enc,
Traits<StringType>::get_typecode (field.type),
offset + enc.total_length ()))
return false;
}
return
cdr << static_cast<CORBA::ULong> (enc.total_length ())
&& cdr.write_octet_array_mb (enc.begin ());
}
示例10:
void
CORBA::SystemException::_tao_encode (TAO_OutputCDR &cdr) const
{
if (cdr.write_string (this->_rep_id ())
&& cdr.write_ulong (this->minor ())
&& cdr.write_ulong (this->completed ()))
{
return;
}
throw ::CORBA::MARSHAL ();
}
示例11:
void
Delivery_Request::marshal (TAO_OutputCDR & cdr)
{
if (this->delivery_type_ != 0)
{
cdr.write_octet (this->delivery_type_);
CORBA::ULong dest_count =
ACE_Utils::truncate_cast<CORBA::ULong> (this->destination_id_.size ());
cdr.write_ulong (dest_count);
for (size_t ndest = 0; ndest < dest_count; ++ ndest)
{
cdr.write_ulong (this->destination_id_ [ndest]);
}
}
}
示例12: return
CORBA::Boolean
operator<< (TAO_OutputCDR & cdr, CORBA::Principal * x)
{
if (x != 0)
{
CORBA::ULong length = x->id.length ();
cdr.write_long (length);
cdr.write_octet_array (x->id.get_buffer (), length);
}
else
{
cdr.write_ulong (0);
}
return (CORBA::Boolean) cdr.good_bit ();
}
示例13: lock
void
Task::dispatch_command( ACE_Message_Block * mblk )
{
CORBA::ULong cmd = marshal<CORBA::ULong>::get( mblk ); //SESSION_INITIALIZE, MB_COMMAND );
acewrapper::scoped_mutex_t<> lock( mutex_ );
for ( map_type::iterator it = device_proxies_.begin(); it != device_proxies_.end(); ++it ) {
TAO_OutputCDR cdr;
it->second->prepare_data( cdr ) << cmd;
const ACE_Message_Block * mb = cdr.begin();
logger log;
log.dump( mb->length(), mb->rd_ptr() );
log << " sendto: " << it->first;
it->second->sendto( cdr.begin() );
}
}
示例14: switch
void
TAO_AMH_DSI_Response_Handler::gateway_exception_reply (
CORBA::ULong reply_status,
TAO_OutputCDR & 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_AMI_REPLY_USER_EXCEPTION:
this->reply_status_ = GIOP::USER_EXCEPTION;
break;
case TAO_AMI_REPLY_SYSTEM_EXCEPTION:
this->reply_status_ = GIOP::SYSTEM_EXCEPTION;
break;
// TODO: 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_char_array (encap.buffer (), encap.length ());
// 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:
}
}
示例15:
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
bool
TAO::TypeCode::Enum<char const *,
char const * const *,
TAO::Null_RefCount_Policy>::tao_marshal (
TAO_OutputCDR & cdr,
CORBA::ULong) const
{
// A tk_enum TypeCode has a "complex" parameter list type (see
// Table 15-2 in Section 15.3.5.1 "TypeCode" in the CDR section of
// the CORBA specification), meaning that it must be marshaled into
// a CDR encapsulation.
// Create a CDR encapsulation.
TAO_OutputCDR enc;
bool const success =
(enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
&& (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0))
&& (enc << TAO_OutputCDR::from_string (this->base_attributes_.name (), 0))
&& (enc << this->nenumerators_);
if (!success)
return false;
char const * const * const begin = &this->enumerators_[0];
char const * const * const end = begin + this->nenumerators_;
for (char const * const * i = begin; i != end; ++i)
{
char const * const & enumerator = *i;
if (!(enc << TAO_OutputCDR::from_string (
Traits<char const *>::get_string (enumerator), 0)))
return false;
}
return
cdr << static_cast<CORBA::ULong> (enc.total_length ())
&& cdr.write_octet_array_mb (enc.begin ());
}