当前位置: 首页>>代码示例>>C++>>正文


C++ TAO_OutputCDR::write_octet_array_mb方法代码示例

本文整理汇总了C++中TAO_OutputCDR::write_octet_array_mb方法的典型用法代码示例。如果您正苦于以下问题:C++ TAO_OutputCDR::write_octet_array_mb方法的具体用法?C++ TAO_OutputCDR::write_octet_array_mb怎么用?C++ TAO_OutputCDR::write_octet_array_mb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TAO_OutputCDR的用法示例。


在下文中一共展示了TAO_OutputCDR::write_octet_array_mb方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: marshal

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 ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:60,代码来源:Union_TypeCode_Static.cpp

示例2: marshal

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 ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:35,代码来源:Alias_TypeCode.cpp

示例3: marshal

bool
TAO::TypeCode::Value<StringType,
                     TypeCodeType,
                     FieldArrayType,
                     RefCountPolicy>::tao_marshal (
  TAO_OutputCDR & cdr,
  CORBA::ULong offset) const
{
  // A tk_value 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->type_modifier_)
    && marshal (enc,
                Traits<StringType>::get_typecode (this->concrete_base_),
                offset + enc.total_length ())
    && (enc << this->nfields_);

  if (!success)
    return false;

  Value_Field<StringType, TypeCodeType> const * const begin =
    &this->fields_[0];
  Value_Field<StringType, TypeCodeType> const * const end =
    begin + this->nfields_;

  for (Value_Field<StringType, TypeCodeType> const * i = begin; i != end; ++i)
    {
      Value_Field<StringType, TypeCodeType> const & field = *i;

      if (!(enc << Traits<StringType>::get_string (field.name))
          || !marshal (enc,
                       Traits<StringType>::get_typecode (field.type),
                       offset + enc.total_length ())
          || !(enc << field.visibility))
        return false;
    }

  return
    cdr << static_cast<CORBA::ULong> (enc.total_length ())
    && cdr.write_octet_array_mb (enc.begin ());
}
开发者ID:CCJY,项目名称:ATCD,代码行数:58,代码来源:Value_TypeCode.cpp

示例4:

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;

}
开发者ID:colding,项目名称:lorica,代码行数:13,代码来源:EvaluatorBase.cpp

示例5:

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 ());
}
开发者ID:asdlei00,项目名称:ACE,代码行数:42,代码来源:Enum_TypeCode_Static.cpp

示例6:

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

bool
TAO::TypeCode::Objref<char const *, TAO::Null_RefCount_Policy>::tao_marshal (
  TAO_OutputCDR & cdr,
  CORBA::ULong) const
{
  // A tk_objref 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;

  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)
    && cdr << static_cast<CORBA::ULong> (enc.total_length ())
    && cdr.write_octet_array_mb (enc.begin ());
}
开发者ID:CCJY,项目名称:ATCD,代码行数:22,代码来源:Objref_TypeCode_Static.cpp

示例7: ACE_TMAIN

int ACE_TMAIN (int, ACE_TCHAR *[])
{
  // setup mb's
  char buf[1024];
  m1=new ACE_Message_Block(1024);
  ACE_OS::memset(buf,'1',512);
  m1->copy(buf,512);
  m2=new ACE_Message_Block(1024);
  ACE_OS::memset(buf,'2',512);
  m2->copy(buf,512);
  m3=new ACE_Message_Block(1024);
  ACE_OS::memset(buf,'3',512);
  m3->copy(buf,512);

  m1->cont(m2);
  m2->cont(m3);
  dump("expect 1,1,1");

  ACE_Message_Block* m = ACE_Message_Block::duplicate (m1);
  dump("expect 2,2,2");

  {
    TAO_OutputCDR cdr;
    cdr.write_octet_array_mb(m1);
    dump("expect 3,3,3"); // that's what I expected, anyway
    ACE_DEBUG ((LM_INFO, "total cdr length is %u\n",
                static_cast<u_int> (cdr.total_length())));
  }
  dump("expect 2,2,2"); // that's what I expected, anyway

  ACE_Message_Block::release (m);
  dump("expect 1,1,1"); // that's what I expected, anyway
  ACE_Message_Block::release (m1);

  return 0;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:36,代码来源:octet_sequence.cpp

示例8:

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

bool
TAO::TypeCode::Struct<char const *,
                      CORBA::TypeCode_ptr const *,
                      TAO::TypeCode::Struct_Field<char const *,
                                                  CORBA::TypeCode_ptr const *> const *,
                      TAO::Null_RefCount_Policy>::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_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))
    && (enc << this->nfields_);

  if (!success)
    return false;

  Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const begin =
    &this->fields_[0];
  Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * const end =
    begin + this->nfields_;

  for (Struct_Field<char const *, CORBA::TypeCode_ptr const *> const * i =
         begin;
       i != end;
       ++i)
    {
      Struct_Field<char const *, CORBA::TypeCode_ptr const *> const & field =
        *i;

      if (!(enc << TAO_OutputCDR::from_string (
                       Traits<char const *>::get_string (field.name), 0))
          || !marshal (enc,
                       Traits<char const *>::get_typecode (field.type),
                       ACE_Utils::truncate_cast<CORBA::ULong> (
                           offset + enc.total_length ())))
        return false;
    }

  return
    cdr << static_cast<CORBA::ULong> (enc.total_length ())
    && cdr.write_octet_array_mb (enc.begin ());
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:63,代码来源:Struct_TypeCode_Static.cpp

示例9: i

void
CORBA::NVList::_tao_encode (TAO_OutputCDR &cdr, int flag)
{
  ACE_GUARD (TAO_SYNCH_MUTEX,
             ace_mon,
             this->lock_);

  if (this->incoming_ != 0)
    {
      if (this->max_ == 0)
        {
          // The list is empty aggressively reduce copies and just send
          // the CDR stream, we assume that
          // TAO_Server_Request::init_reply
          // has inserted appropriated padding already to make this
          // operation correct
          cdr.write_octet_array_mb (this->incoming_->start ());
          return;
        }

      // Then unmarshal each "in" and "inout" parameter.
      ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);

      for (i.first (); !i.done (); i.advance ())
        {
          CORBA::NamedValue_ptr *item = 0;
          (void) i.next (item);

          CORBA::NamedValue_ptr nv = *item;

          if (ACE_BIT_DISABLED (nv->flags (), flag))
            {
              continue;
            }

          if (TAO_debug_level > 3)
            {
              const char* arg = nv->name ();

              if (arg == 0)
                {
                  arg = "(nil)";
                }

              TAOLIB_DEBUG ((LM_DEBUG,
                          ACE_TEXT ("NVList::_tao_encode - parameter <%C>\n"),
                          arg));
            }
          CORBA::TypeCode_ptr tc = nv->value ()->_tao_get_typecode ();
          (void) TAO_Marshal_Object::perform_append (tc,
                                                     this->incoming_,
                                                     &cdr);
        }

      delete this->incoming_;
      this->incoming_ = 0;
      return;
    }

  // The list is already evaluated, we cannot optimize the copies, go
  // ahead with the slow way to do things.

  // Then marshal each "in" and "inout" parameter.
  ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);

  for (i.first (); !i.done (); i.advance ())
    {
      CORBA::NamedValue_ptr *item = 0;
      (void) i.next (item);

      CORBA::NamedValue_ptr nv = *item;

      if (ACE_BIT_DISABLED (nv->flags (), flag))
        {
          continue;
        }

      nv->value ()->impl ()->marshal_value (cdr);
    }
}
开发者ID:CCJY,项目名称:ATCD,代码行数:80,代码来源:NVList.cpp

示例10: ACE_TMAIN

int ACE_TMAIN (int, ACE_TCHAR *[])
{
  int status = 0;

  for (CORBA::ULong i = 16; i != 64; ++i)
    {
      ACE_Message_Block mb (i + ACE_CDR::MAX_ALIGNMENT);
      ACE_CDR::mb_align (&mb);
      mb.wr_ptr (i);

      CORBA::Double dbl = i;

      TAO_OutputCDR cdr;
      cdr.write_ulong (i); // length
      cdr.write_octet_array_mb (&mb);
      cdr.write_double (dbl);
      cdr.write_double (dbl);

      TAO_InputCDR input (cdr);

      CORBA::ULong len;

      input.read_ulong (len);

      if (len != i)
        {
          ACE_DEBUG ((LM_DEBUG,
                      "ERROR: mismatched lengths,"
                      " got %d, expected %d\n",
                      len, i));
        }

      ACE_Message_Block read_mb (len + ACE_CDR::MAX_ALIGNMENT);
      ACE_CDR::mb_align (&mb);
      mb.wr_ptr (len);
      input.read_char_array (mb.rd_ptr (), len);

      CORBA::Double read_dbl;
      if (input.read_double (read_dbl) == 0)
        ACE_DEBUG ((LM_DEBUG, "Failure reading double...\n"));

      if (!ACE::is_equal (read_dbl, dbl))
        {
          status = 1;
          ACE_DEBUG ((LM_DEBUG,
                      "ERROR: mismatched doubles,"
                      " got %f, expected %f\n",
                      read_dbl, dbl));
          for (const ACE_Message_Block *j = cdr.begin ();
               j != cdr.end ();
               j = j->cont ())
            {
              ACE_HEX_DUMP ((LM_DEBUG,
                             j->rd_ptr (),
                             j->length (),
                             ACE_TEXT("Output CDR stream")));
            }
          TAO_InputCDR debug (cdr);
          ACE_HEX_DUMP ((LM_DEBUG,
                         debug.rd_ptr (),
                         debug.length (),
                         ACE_TEXT("Input CDR stream")));
        }
    }

  return status;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:67,代码来源:alignment.cpp


注:本文中的TAO_OutputCDR::write_octet_array_mb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。