本文整理汇总了C++中TAO_OutputCDR::good_bit方法的典型用法代码示例。如果您正苦于以下问题:C++ TAO_OutputCDR::good_bit方法的具体用法?C++ TAO_OutputCDR::good_bit怎么用?C++ TAO_OutputCDR::good_bit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAO_OutputCDR
的用法示例。
在下文中一共展示了TAO_OutputCDR::good_bit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CORBA::Boolean
operator<< (TAO_OutputCDR& cdr, ECM_Data& x)
{
// We are a little careless about error checking in this routine,
// because one the CDR gets the error bit on it is never disabled.
CORBA::ULong count = x.inventory.current_size ();
if (cdr << x.description.in ()
&& cdr << count )
{
for (ECM_Data::Inventory::ITERATOR i = x.inventory.begin ();
i != x.inventory.end () && cdr.good_bit ();
++i)
{
const ECM_Data::Inventory::ENTRY& v = *i;
cdr << v.ext_id_;
cdr << v.int_id_;
}
}
return cdr.good_bit ();
}
示例2: 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 ();
}
示例3: tv
int
ECMS_Driver::supplier_task (Test_Supplier *supplier,
void* /* cookie */)
{
try
{
ACE_Time_Value tv (0, this->event_period_);
CORBA::ULong n = this->event_size_;
ECM_IDLData::Info info;
info.mobile_name = CORBA::string_dup ("test");
info.mobile_speed = 1;
info.trajectory.length (n);
ECM_Data other;
other.description = CORBA::string_dup ("some data");
for (CORBA::ULong j = 0; j < n; ++j)
{
info.trajectory[j].x = j;
info.trajectory[j].y = j * j;
other.inventory.bind (j, j + 1);
}
ACE_DEBUG ((LM_DEBUG,
"The inventory contains (%d) elements\n",
other.inventory.current_size ()));
// We have to make it big enough so we get a contiguous block,
// otherwise the octet sequence will not work correctly.
// NOTE: we could pre-allocate enough memory in the CDR stream
// but we want to show that chaining works!
TAO_OutputCDR cdr;
CORBA::Boolean byte_order = TAO_ENCAP_BYTE_ORDER;
cdr << CORBA::Any::from_boolean (byte_order);
// The typecode name standard, the encode method is not (in
// general the CDR interface is not specified).
if (!(cdr << info))
throw CORBA::MARSHAL ();
// Here we marshall a non-IDL type.
cdr << other;
if (!cdr.good_bit ())
ACE_ERROR ((LM_ERROR, "Problem marshalling C++ data\n"));
const ACE_Message_Block* mb = cdr.begin ();
// NOTE: total_length () return the length of the complete
// chain.
CORBA::ULong mblen = cdr.total_length ();
for (CORBA::Long i = 0; i < this->event_count_; ++i)
{
RtecEventComm::EventSet event (1);
event.length (1);
event[0].header.source = supplier->supplier_id ();
event[0].header.ttl = 1;
ACE_hrtime_t t = ACE_OS::gethrtime ();
ORBSVCS_Time::hrtime_to_TimeT (event[0].header.creation_time, t);
if (i == static_cast<CORBA::Long> (this->event_count_) - 1)
event[0].header.type = ACE_ES_EVENT_SHUTDOWN;
else if (i % 2 == 0)
event[0].header.type = this->event_a_;
else
event[0].header.type = this->event_b_;
// We use replace to minimize the copies, this should result
// in just one memory allocation;
#if (TAO_NO_COPY_OCTET_SEQUENCES == 1)
event[0].data.payload.replace (mblen, mb);
#else
// If the replace method is not available, we will need
// to do the copy manually. First, set the octet sequence length.
event[0].data.payload.length (mblen);
// Now copy over each byte.
char* base = mb->data_block ()->base ();
for(CORBA::ULong i = 0; i < mblen; i++)
{
event[0].data.payload[i] = base[i];
}
#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 1 */
supplier->consumer_proxy ()->push(event);
// ACE_DEBUG ((LM_DEBUG, "(%t) supplier push event\n"));
ACE_OS::sleep (tv);
}
}
catch (const CORBA::SystemException& sys_ex)
{
sys_ex._tao_print_exception ("SYS_EX");
}
catch (const CORBA::Exception& ex)
//.........这里部分代码省略.........
示例4: return
CORBA::Boolean
TAO_Stub::marshal (TAO_OutputCDR &cdr)
{
// do as many outside of locked else-branch as posssible
// STRING, a type ID hint
if ((cdr << this->type_id.in()) == 0)
return 0;
if ( ! this->forward_profiles_perm_)
{
const TAO_MProfile& mprofile = this->base_profiles_;
CORBA::ULong const profile_count = mprofile.profile_count ();
if ((cdr << profile_count) == 0)
return 0;
// @@ The MProfile should be locked during this iteration, is there
// anyway to achieve that?
for (CORBA::ULong i = 0; i < profile_count; ++i)
{
const TAO_Profile* p = mprofile.get_profile (i);
if (p->encode (cdr) == 0)
return 0;
}
}
else
{
ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
guard,
this->profile_lock_,
0));
if (TAO_debug_level > 5)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - Stub::marshal, acquired ")
ACE_TEXT ("profile lock this = 0x%x\n"),
this));
}
ACE_ASSERT(this->forward_profiles_ !=0);
// paranoid - in case of FT the basic_profiles_ would do, too,
// but might be dated
const TAO_MProfile& mprofile =
this->forward_profiles_perm_
? *(this->forward_profiles_perm_)
: this->base_profiles_;
CORBA::ULong const profile_count = mprofile.profile_count ();
if ((cdr << profile_count) == 0)
return 0;
// @@ The MProfile should be locked during this iteration, is there
// anyway to achieve that?
for (CORBA::ULong i = 0; i < profile_count; ++i)
{
const TAO_Profile* p = mprofile.get_profile (i);
if (p->encode (cdr) == 0)
return 0;
}
// release ACE_Lock
}
return (CORBA::Boolean) cdr.good_bit ();
}
示例5: return
CORBA::Boolean
operator<< (TAO_OutputCDR &strm, const CORBA::AbstractBase_ptr abs)
{
CORBA::Boolean discriminator = true;
// We marshal a null abstract interface ptr as a discriminator
// plus null object reference (see CORBA::Object::marshal()
// and operator << for CORBA::Object).
if (CORBA::is_nil (abs))
{
// Marshal discriminator, then empty type hint.
strm << ACE_OutputCDR::from_boolean (discriminator);
return strm << CORBA::Object::_nil ();
}
if (abs->_is_objref ())
{
if (strm << ACE_OutputCDR::from_boolean (discriminator))
{
TAO_Stub *stubobj = abs->_stubobj ();
if (stubobj == 0)
{
return false;
}
// STRING, a type ID hint
if ((strm << stubobj->type_id.in ()) == 0)
{
return false;
}
const TAO_MProfile& mprofile = stubobj->base_profiles ();
CORBA::ULong const profile_count = mprofile.profile_count ();
if ((strm << profile_count) == 0)
{
return false;
}
// @@ The MProfile should be locked during this iteration, is there
// anyway to achieve that?
for (CORBA::ULong i = 0; i < profile_count; ++i)
{
const TAO_Profile *p = mprofile.get_profile (i);
if (p->encode (strm) == 0)
{
return false;
}
}
return (CORBA::Boolean) strm.good_bit ();
}
}
else
{
discriminator = false;
if (strm << ACE_OutputCDR::from_boolean (discriminator))
{
CORBA::ULong value_tag = TAO_OBV_GIOP_Flags::Value_tag_base
| TAO_OBV_GIOP_Flags::Type_info_single;
if ((strm.write_ulong (value_tag)) == 0)
{
return false;
}
if ((strm << abs->_tao_obv_repository_id ()) == 0)
{
return false;
}
return abs->_tao_marshal_v (strm);
}
}
return false;
}