10 #if !defined (__ACE_INLINE__) 16 #ifndef OPENDDS_UTIL_BUILD 31 #ifdef OPENDDS_UTIL_BUILD 62 #ifdef ACE_LITTLE_ENDIAN 67 return "little-endian (" 68 #ifndef ACE_LITTLE_ENDIAN 73 return "invalid endianness";
79 , skip_sequence_dheader_(false)
117 switch (encoding.
kind()) {
119 switch (extensibility) {
130 switch (extensibility) {
145 "Got Encoding With Unsupported Kind: %C\n",
167 Extensibility expected_extensibility = expected_extensibility_ptr ?
168 *expected_extensibility_ptr :
FINAL;
169 bool wrong_extensibility =
true;
174 wrong_extensibility = expected_extensibility ==
MUTABLE;
180 wrong_extensibility = expected_extensibility ==
MUTABLE;
186 wrong_extensibility = expected_extensibility !=
MUTABLE;
192 wrong_extensibility = expected_extensibility !=
MUTABLE;
198 wrong_extensibility = expected_extensibility !=
FINAL;
204 wrong_extensibility = expected_extensibility !=
FINAL;
210 wrong_extensibility = expected_extensibility !=
APPENDABLE;
216 wrong_extensibility = expected_extensibility !=
APPENDABLE;
222 wrong_extensibility = expected_extensibility !=
MUTABLE;
228 wrong_extensibility = expected_extensibility !=
MUTABLE;
234 "Unsupported Encoding: %C\n",
to_string().c_str()));
239 if (expected_extensibility_ptr && wrong_extensibility) {
242 "expected %C extensibility, but got %C\n",
255 ACE_ERROR((
LM_ERROR,
"(%P|%t) ERROR: EncapsulationHeader::set_encapsulation_options: " 256 "Insufficient buffer size %B\n", mb->
length()));
269 return "CDR/XCDR1 Big Endian Plain";
271 return "CDR/XCDR1 Little Endian Plain";
273 return "CDR/XCDR1 Big Endian Parameter List";
275 return "CDR/XCDR1 Little Endian Parameter List";
277 return "XCDR2 Big Endian Plain";
279 return "XCDR2 Little Endian Plain";
281 return "XCDR2 Big Endian Delimited";
283 return "XCDR2 Little Endian Delimited";
285 return "XCDR2 Big Endian Parameter List";
287 return "XCDR2 Little Endian Parameter List";
303 value.
kind(static_cast<EncapsulationHeader::Kind>(
304 (static_cast<ACE_UINT16>(data[0]) << 8) | data[1]));
305 value.
options((static_cast<ACE_UINT16>(data[2]) << 8) | data[3]);
316 data[0] = (value.
kind() >> 8) & 0xff;
317 data[1] = value.
kind() & 0xff;
318 data[2] = (value.
options() >> 8) & 0xff;
319 data[3] = value.
options() & 0xff;
333 case KIND_UNALIGNED_CDR:
334 return "Unaligned CDR";
336 return "Unknown: " +
to_dds_string(static_cast<unsigned>(value),
true);
344 if (!zero_init_padding_) {
345 rv +=
", non-initialized padding";
355 , construction_status_(ConstructionSuccessful)
399 , max_align_(ser.
encoding().max_align())
400 , start_rpos_(ser.
rpos())
402 , min_read_(min_read)
403 , start_wpos_(ser.
wpos())
465 to[ 15] = from[ n - 16];
468 to[ 14] = from[ n - 15];
471 to[ 13] = from[ n - 14];
474 to[ 12] = from[ n - 13];
477 to[ 11] = from[ n - 12];
480 to[ 10] = from[ n - 11];
483 to[ 9] = from[ n - 10];
486 to[ 8] = from[ n - 9];
489 to[ 7] = from[ n - 8];
492 to[ 6] = from[ n - 7];
495 to[ 5] = from[ n - 6];
498 to[ 4] = from[ n - 5];
501 to[ 3] = from[ n - 4];
504 to[ 2] = from[ n - 3];
507 to[ 1] = from[ n - 2];
510 to[ 0] = from[ n - 1];
524 if (str_alloc == 0) {
525 #ifdef OPENDDS_UTIL_BUILD 542 if (!(*
this >> length)) {
557 if (
current_ && length <= current_->total_length()) {
559 dest = str_alloc(length - 1);
593 #ifdef OPENDDS_UTIL_BUILD 607 if (str_alloc == 0) {
608 #ifdef OPENDDS_UTIL_BUILD 625 if (!(*
this >> bytecount)) {
635 if (
current_ && bytecount <= current_->total_length()) {
637 dest = str_alloc(length);
644 #if ACE_SIZEOF_WCHAR == 2 647 for (
size_t i = 0; i < length &&
good_bit_; ++i) {
679 #ifdef OPENDDS_UTIL_BUILD 695 for (
size_t remain = n; i && remain; i = i->cont()) {
696 if (i->length() >= remain) {
697 i->wr_ptr(i->rd_ptr() + remain);
704 return dup.release();
716 if (!(*
this >> pid)) {
721 if (!(*
this >> short_size)) {
726 must_understand =
false;
731 if (!(*
this >> long_id) || !(*
this >> long_size)) {
734 const unsigned short_size_left = short_size - 8;
735 if (short_size_left) {
736 skip(short_size_left);
748 if (!(*
this >> emheader)) {
755 const unsigned short lc = (emheader >> 28) & 0x7;
757 size = size_t(1) << lc;
760 if (lc == 4 ? !(*
this >> next_int) : !
peek(next_int)) {
778 id = emheader & 0xfffffff;
797 const bool long_pid =
id > (1 << 14) || size > (1 << 16);
812 if (!(*
this << pid_id)) {
816 if (!(*
this << pid_size)) {
822 !(*
this << static_cast<ACE_CDR::ULong>(
id)) ||
823 !(*
this << static_cast<ACE_CDR::ULong>(size)))) {
830 const ACE_CDR::ULong lc = (size == 1 ? 0 : size == 2 ? 1 : size == 4 ? 2 : size == 8 ? 3 : 4);
832 if (!(*
this << emheader)) {
static const ACE_CDR::UShort pid_must_understand
Encoding()
Encoding with KIND_XCDR1 and ENDIAN_NATIVE.
size_t rpos() const
Examine the logical reading position of the stream.
static String kind_to_string(Kind value)
const LogLevel::Value value
size_t length(void) const
static const ACE_CDR::ULong MEMBER_ID_MAX
Maximum value for member id.
size_t wpos() const
Examine the logical writing position of the stream.
void wstring_free(WChar *const)
ConstructionStatus construction_status_
The way to judge whether tryconstruct trim is able to be properly done.
bool skip(size_t n, int size=1)
Kind kind_
The first two bytes as a big endian integer.
char * string_alloc(ULong len)
String to_dds_string(unsigned short to_convert)
void * memcpy(void *t, const void *s, size_t len)
void string_free(Char *str)
bool write_parameter_id(const unsigned id, size_t size, bool must_understand=false)
Endianness endianness() const
#define OPENDDS_ASSERT(C)
bool read_parameter_id(unsigned &id, size_t &size, bool &must_understand)
String endianness_to_string(Endianness endianness)
void(* WStrFree)(ACE_CDR::WChar *)
bool read_octet_array(ACE_CDR::Octet *x, ACE_CDR::ULong length)
static const ACE_CDR::UShort pid_extended
const size_t uint32_cdr_size
char * rd_ptr(void) const
Char * string_alloc(UnsignedLong len)
void reset_alignment()
Reset alignment as if a new instance were created.
ACE_CDR::UShort options_
The last two bytes as a big endian integer.
bool write_octet_array(const ACE_CDR::Octet *x, ACE_CDR::ULong length)
static bool set_encapsulation_options(Message_Block_Ptr &mb)
bool skip_sequence_dheader_
ACE_CDR::Char *(* StrAllocate)(ACE_CDR::ULong)
void read_array(char *x, size_t size, ACE_CDR::ULong length)
void(* StrFree)(ACE_CDR::Char *)
Class to serialize and deserialize data for DDS.
ACE_CDR::Boolean operator<<(Serializer &serializer, CoherentChangeControl &value)
Marshal/Insertion into a buffer.
ACE_Message_Block * trim(size_t n) const
const size_t xcdr1_pid_alignment
static const size_t padding_marker_byte_index
size_t length() const
Number of bytes left to read in message block chain.
bool from_encoding(const Encoding &encoding, Extensibility extensibility)
unsigned char align_wshift_
Endianness endianness() const
size_t wpos_
Logical writing position of the stream.
ACE_Message_Block * current() const
virtual ACE_Message_Block * release(void)
ScopedAlignmentContext(Serializer &ser, size_t min_read=0)
bool align_r(size_t alignment)
bool to_any_encoding(Encoding &encoding)
ACE_Message_Block * cont(void) const
static const size_t padding_marker_alignment
virtual ACE_Message_Block * duplicate(void) const
WChar * wstring_alloc(ULong len)
size_t read_string(ACE_CDR::Char *&dest, StrAllocate str_alloc=0, StrFree str_free=0)
static const ACE_CDR::ULong emheader_must_understand
char * wr_ptr(void) const
bool read_char_array(ACE_CDR::Char *x, ACE_CDR::ULong length)
OpenDDS_Dcps_Export void align(size_t &value, size_t by)
Align "value" by "by" if it's not already.
bool good_bit_
Indicates the current state of the stream abstraction.
size_t max_align() const
Return the maximum alignment dictated by the alignment policy.
void smemcpy(char *to, const char *from, size_t n)
XcdrVersion xcdr_version() const
OpenDDS_Dcps_Export LogLevel log_level
bool to_encoding_i(Encoding &encoding, Extensibility *expected_extensibility_ptr)
const size_t char16_cdr_size
void swapcpy(char *to, const char *from, size_t n)
bool align_w(size_t alignment)
static const char ALIGN_PAD[Encoding::ALIGN_MAX]
Buffer that is copied for zero padding.
static const ACE_CDR::UShort pid_impl_extension
EncapsulationHeader(Kind k=KIND_CDR_BE, ACE_CDR::UShort options=0)
const Encoding & encoding() const
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
ACE_Message_Block * current_
Currently active message block in chain.
bool peek_helper(ACE_Message_Block *const block, size_t bytes, T &t)
ACE_CDR::Boolean operator>>(Serializer &serializer, CoherentChangeControl &value)
void free_string(ACE_CDR::Char *str, StrFree str_free=0)
static unsigned char offset(char *index, size_t start, size_t align)
Serializer(ACE_Message_Block *chain, const Encoding &encoding)
ACE_CDR::WChar *(* WStrAllocate)(ACE_CDR::ULong)
ACE_HANDLE dup(ACE_HANDLE handle)
unsigned char align_rshift_
void buffer_read(char *dest, size_t size, bool swap)
Read from the chain into a destination buffer.
const DCPS::Encoding encoding(DCPS::Encoding::KIND_UNALIGNED_CDR, DCPS::ENDIAN_BIG)
size_t rpos_
Logical reading position of the stream.
The Internal API and Implementation of OpenDDS.
static const size_t serialized_size
const char * ext_to_string(Extensibility ext)
void restore(Serializer &ser) const
extensibility(MUTABLE) struct TypeLookup_getTypes_In
ACE_UINT16 options() const
bool to_encoding(Encoding &encoding, Extensibility expected_extensibility)