diff options
author | Adam Mitz <mitza@ociweb.com> | 2015-04-16 15:44:26 -0500 |
---|---|---|
committer | Adam Mitz <mitza@ociweb.com> | 2015-04-16 15:44:26 -0500 |
commit | 2018b75b5caecfb209ef67886ca63c1447fabb08 (patch) | |
tree | 5bc34f5423e487d968df0b0e3c71407df0bbf52c /ACE/ace/CDR_Stream.inl | |
parent | b0f102a81e8dafc0f2a80046b4241e9a1f76f6f2 (diff) | |
download | ATCD-2018b75b5caecfb209ef67886ca63c1447fabb08.tar.gz |
CDR Fixed data type: CDR streaming
tao_idl and tao_ifr back ends now generate errors for fixed
updated .gitignore files based on build results
Diffstat (limited to 'ACE/ace/CDR_Stream.inl')
-rw-r--r-- | ACE/ace/CDR_Stream.inl | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/ACE/ace/CDR_Stream.inl b/ACE/ace/CDR_Stream.inl index 6b79c4c6bc9..fdc741146f6 100644 --- a/ACE/ace/CDR_Stream.inl +++ b/ACE/ace/CDR_Stream.inl @@ -268,6 +268,14 @@ ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x) } ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::write_fixed (const ACE_CDR::Fixed &x) +{ + int n; + const ACE_CDR::Octet *arr = x.to_octets (n); + return this->write_array (arr, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, n); +} + +ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_string (const ACE_CDR::Char *x) { if (x) @@ -709,6 +717,25 @@ ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x) return this->read_16 (&x); } +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::read_fixed (ACE_CDR::Fixed &x) +{ + ACE_CDR::Octet a[16]; + for (int i = 0; i < 16; ++i) + { + if (!this->read_1 (a + i)) + return false; + const unsigned low = a[i] & 0xf; + if (low == 0xc || low == 0xd) + { + x = ACE_CDR::Fixed::from_octets (a, i + 1); + return true; + } + } + + return false; +} + ACE_INLINE size_t ACE_InputCDR::length (void) const { @@ -1016,6 +1043,21 @@ ACE_InputCDR::skip_longdouble (void) return this->read_16 (&x); } +ACE_INLINE ACE_CDR::Boolean +ACE_InputCDR::skip_fixed (void) +{ + for (int i = 0; i < 16; ++i) + { + ACE_CDR::Octet x; + if (!this->read_1 (&x)) + return false; + const unsigned low = x & 0xf; + if (low == 0xc || low == 0xd) + return true; + } + return false; +} + ACE_INLINE char* ACE_InputCDR::end (void) { @@ -1157,6 +1199,13 @@ operator<< (ACE_OutputCDR &os, ACE_CDR::Double x) } ACE_INLINE ACE_CDR::Boolean +operator<< (ACE_OutputCDR &os, const ACE_CDR::Fixed &x) +{ + os.write_fixed (x); + return (ACE_CDR::Boolean) os.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, const ACE_CDR::Char *x) { os.write_string (x); @@ -1292,6 +1341,12 @@ operator>> (ACE_InputCDR &is, ACE_CDR::Double &x) } ACE_INLINE ACE_CDR::Boolean +operator>> (ACE_InputCDR &is, ACE_CDR::Fixed &x) +{ + return is.read_fixed (x) && is.good_bit (); +} + +ACE_INLINE ACE_CDR::Boolean operator>> (ACE_InputCDR &is, ACE_CDR::Char *&x) { return is.read_string (x) && is.good_bit (); @@ -1447,6 +1502,13 @@ ACE_OutputCDR::append_longdouble (ACE_InputCDR &stream) } ACE_INLINE ACE_CDR::Boolean +ACE_OutputCDR::append_fixed (ACE_InputCDR &stream) +{ + ACE_CDR::Fixed x; + return stream.read_fixed (x) ? this->write_fixed (x) : false; +} + +ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::append_string (ACE_InputCDR &stream) { ACE_CDR::Char *x = 0; |