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 ()); }
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 ()); }
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 ()); }
void StreamSize::adjust(size_t size, size_t align) { #if !defined (ACE_LACKS_CDR_ALIGNMENT) const size_t offset = ACE_align_binary(size_, align) - size_; size_ += offset; #endif /* ACE_LACKS_CDR_ALIGNMENT */ size_ += size; }
CORBA::ULong TAO::TypeCode::aligned_offset (CORBA::ULong offset) { ptrdiff_t const unaligned_offset = static_cast<ptrdiff_t> (offset); return static_cast<CORBA::ULong> (ACE_align_binary (unaligned_offset, ACE_CDR::LONG_ALIGN)); }
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 ()); }