summaryrefslogtreecommitdiff
path: root/ACE
diff options
context:
space:
mode:
authorFred Hornsey <hornseyf@objectcomputing.com>2021-07-08 19:22:31 -0500
committerFred Hornsey <hornseyf@objectcomputing.com>2021-07-08 19:22:31 -0500
commit2cbdf73f5418ef30639750f25ca5a1362f943a24 (patch)
tree61822acd905f96415c95b419f060ec5f8f3253a9 /ACE
parent2063860a36b5b235cf681b74e8c3ef4909e2032d (diff)
downloadATCD-2cbdf73f5418ef30639750f25ca5a1362f943a24.tar.gz
IDLv4 Explicitly-named Integer Types
Ported from https://github.com/DOCGroup/ACE_TAO/pull/840 to ACE6/TAO2. Also regenerated with Bison 3.7.6 at the same time like in d5819180d02d76ed3c14c421f02ad69c4d0bab9e in https://github.com/DOCGroup/ACE_TAO/pull/1594
Diffstat (limited to 'ACE')
-rw-r--r--ACE/ace/Basic_Types.h15
-rw-r--r--ACE/ace/CDR_Base.h10
-rw-r--r--ACE/ace/CDR_Stream.h36
-rw-r--r--ACE/ace/CDR_Stream.inl111
4 files changed, 165 insertions, 7 deletions
diff --git a/ACE/ace/Basic_Types.h b/ACE/ace/Basic_Types.h
index 67916f8dc06..ac7a13116e3 100644
--- a/ACE/ace/Basic_Types.h
+++ b/ACE/ace/Basic_Types.h
@@ -666,18 +666,21 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# endif /* ACE_SIZEOF_LONG_DOUBLE */
// Max and min sizes for the ACE integer types.
-#define ACE_CHAR_MAX 0x7F
-#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1
-#define ACE_OCTET_MAX 0xFF
+#define ACE_INT8_MAX 0x7F
+#define ACE_INT8_MIN -(ACE_INT8_MAX) - 1
+#define ACE_UINT8_MAX 0xFF
+#define ACE_CHAR_MAX (ACE_INT8_MAX)
+#define ACE_CHAR_MIN (ACE_INT8_MIN)
+#define ACE_OCTET_MAX (ACE_UINT8_MAX)
#define ACE_INT16_MAX 0x7FFF
-#define ACE_INT16_MIN -(ACE_INT16_MAX)-1
+#define ACE_INT16_MIN -(ACE_INT16_MAX) - 1
#define ACE_UINT16_MAX 0xFFFF
#define ACE_WCHAR_MAX ACE_UINT16_MAX
#define ACE_INT32_MAX 0x7FFFFFFF
-#define ACE_INT32_MIN -(ACE_INT32_MAX)-1
+#define ACE_INT32_MIN -(ACE_INT32_MAX) - 1
#define ACE_UINT32_MAX 0xFFFFFFFF
#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
-#define ACE_INT64_MIN -(ACE_INT64_MAX)-1
+#define ACE_INT64_MIN -(ACE_INT64_MAX) - 1
#define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)
// These use ANSI/IEEE format.
diff --git a/ACE/ace/CDR_Base.h b/ACE/ace/CDR_Base.h
index a8b49e5a0a1..cdbb58d875b 100644
--- a/ACE/ace/CDR_Base.h
+++ b/ACE/ace/CDR_Base.h
@@ -198,7 +198,7 @@ public:
*/
//@{
typedef bool Boolean;
- typedef unsigned char Octet;
+ typedef ACE_Byte Octet;
typedef char Char;
typedef ACE_WCHAR_T WChar;
typedef ACE_INT16 Short;
@@ -207,6 +207,14 @@ public:
typedef ACE_UINT32 ULong;
typedef ACE_INT64 LongLong;
typedef ACE_UINT64 ULongLong;
+ typedef ACE_INT8 Int8;
+ typedef ACE_UINT8 UInt8;
+ typedef Short Int16;
+ typedef UShort UInt16;
+ typedef Long Int32;
+ typedef ULong UInt32;
+ typedef LongLong Int64;
+ typedef ULongLong UInt64;
# if ACE_SIZEOF_FLOAT == 4
typedef float Float;
diff --git a/ACE/ace/CDR_Stream.h b/ACE/ace/CDR_Stream.h
index 4ce2402a5fb..059a4633e07 100644
--- a/ACE/ace/CDR_Stream.h
+++ b/ACE/ace/CDR_Stream.h
@@ -197,6 +197,18 @@ public:
ACE_CDR::WChar val_;
};
+ struct ACE_Export from_int8
+ {
+ explicit from_int8 (ACE_CDR::Int8 val);
+ ACE_CDR::Int8 val_;
+ };
+
+ struct ACE_Export from_uint8
+ {
+ explicit from_uint8 (ACE_CDR::UInt8 val);
+ ACE_CDR::UInt8 val_;
+ };
+
struct ACE_Export from_string
{
from_string (ACE_CDR::Char* s,
@@ -260,6 +272,8 @@ public:
ACE_CDR::Boolean write_double (const ACE_CDR::Double &x);
ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x);
ACE_CDR::Boolean write_fixed (const ACE_CDR::Fixed &x);
+ ACE_CDR::Boolean write_int8 (ACE_CDR::Int8 x);
+ ACE_CDR::Boolean write_uint8 (ACE_CDR::UInt8 x);
/// For string we offer methods that accept a precomputed length.
ACE_CDR::Boolean write_string (const ACE_CDR::Char *x);
@@ -306,6 +320,8 @@ public:
ACE_CDR::ULong length);
ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
+ ACE_CDR::Boolean write_int8_array (const ACE_CDR::Int8 *x, ACE_CDR::ULong length);
+ ACE_CDR::Boolean write_uint8_array (const ACE_CDR::UInt8 *x, ACE_CDR::ULong length);
/// Write an octet array contained inside a MB, this can be optimized
/// to minimize copies.
@@ -790,6 +806,18 @@ public:
ACE_CDR::Octet &ref_;
};
+ struct ACE_Export to_int8
+ {
+ explicit to_int8 (ACE_CDR::Int8 &ref);
+ ACE_CDR::Int8 &ref_;
+ };
+
+ struct ACE_Export to_uint8
+ {
+ explicit to_uint8 (ACE_CDR::UInt8 &ref);
+ ACE_CDR::UInt8 &ref_;
+ };
+
struct ACE_Export to_string
{
/**
@@ -856,6 +884,8 @@ public:
ACE_CDR::Boolean read_double (ACE_CDR::Double &x);
ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x);
ACE_CDR::Boolean read_fixed (ACE_CDR::Fixed &x);
+ ACE_CDR::Boolean read_int8 (ACE_CDR::Int8 &x);
+ ACE_CDR::Boolean read_uint8 (ACE_CDR::UInt8 &x);
ACE_CDR::Boolean read_string (ACE_CDR::Char *&x);
ACE_CDR::Boolean read_string (ACE_CString &x);
@@ -898,6 +928,8 @@ public:
ACE_CDR::ULong length);
ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
+ ACE_CDR::Boolean read_int8_array (ACE_CDR::Int8 *x, ACE_CDR::ULong length);
+ ACE_CDR::Boolean read_uint8_array (ACE_CDR::UInt8 *x, ACE_CDR::ULong length);
//@}
/**
@@ -1412,6 +1444,8 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const std::wstring& x);
#endif
+extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_uint8 x);
+extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_int8 x);
// Not used by CORBA or TAO
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
@@ -1467,6 +1501,8 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_InputCDR &os,
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
std::wstring& x);
#endif
+extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &os, ACE_InputCDR::to_uint8 x);
+extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &os, ACE_InputCDR::to_int8 x);
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/ace/CDR_Stream.inl b/ACE/ace/CDR_Stream.inl
index fe25108da85..4723f736fcd 100644
--- a/ACE/ace/CDR_Stream.inl
+++ b/ACE/ace/CDR_Stream.inl
@@ -162,6 +162,30 @@ ACE_OutputCDR::from_std_wstring::from_std_wstring (const std::wstring &ws,
#endif
ACE_INLINE
+ACE_InputCDR::to_int8::to_int8 (ACE_CDR::Int8 &ref)
+ : ref_ (ref)
+{
+}
+
+ACE_INLINE
+ACE_OutputCDR::from_int8::from_int8 (ACE_CDR::Int8 val)
+ : val_ (val)
+{
+}
+
+ACE_INLINE
+ACE_InputCDR::to_uint8::to_uint8 (ACE_CDR::UInt8 &ref)
+ : ref_ (ref)
+{
+}
+
+ACE_INLINE
+ACE_OutputCDR::from_uint8::from_uint8 (ACE_CDR::UInt8 val)
+ : val_ (val)
+{
+}
+
+ACE_INLINE
ACE_InputCDR::Transfer_Contents::Transfer_Contents (ACE_InputCDR &rhs)
: rhs_ (rhs)
{
@@ -356,6 +380,18 @@ ACE_OutputCDR::write_wstring (const std::wstring &x)
#endif
ACE_INLINE ACE_CDR::Boolean
+ACE_OutputCDR::write_int8 (ACE_CDR::Int8 x)
+{
+ return this->write_1 (reinterpret_cast<ACE_CDR::Octet *> (&x));
+}
+
+ACE_INLINE ACE_CDR::Boolean
+ACE_OutputCDR::write_uint8 (ACE_CDR::UInt8 x)
+{
+ return this->write_1 (reinterpret_cast<ACE_CDR::Octet *> (&x));
+}
+
+ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x,
ACE_CDR::ULong length)
{
@@ -491,6 +527,18 @@ ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x,
length);
}
+ACE_INLINE ACE_CDR::Boolean
+ACE_OutputCDR::write_int8_array (const ACE_CDR::Int8 *x, ACE_CDR::ULong length)
+{
+ return write_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
+}
+
+ACE_INLINE ACE_CDR::Boolean
+ACE_OutputCDR::write_uint8_array (const ACE_CDR::UInt8 *x, ACE_CDR::ULong length)
+{
+ return write_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
+}
+
ACE_INLINE bool
ACE_OutputCDR::good_bit (void) const
{
@@ -791,6 +839,18 @@ ACE_InputCDR::read_fixed (ACE_CDR::Fixed &x)
return false;
}
+ACE_INLINE ACE_CDR::Boolean
+ACE_InputCDR::read_int8 (ACE_CDR::Int8 &x)
+{
+ return read_1 (reinterpret_cast<ACE_CDR::Octet *>(&x));
+}
+
+ACE_INLINE ACE_CDR::Boolean
+ACE_InputCDR::read_uint8 (ACE_CDR::UInt8 &x)
+{
+ return read_1 (reinterpret_cast<ACE_CDR::Octet *>(&x));
+}
+
ACE_INLINE size_t
ACE_InputCDR::length (void) const
{
@@ -1022,6 +1082,30 @@ ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x,
}
ACE_INLINE ACE_CDR::Boolean
+ACE_InputCDR::read_int8_array (ACE_CDR::Int8 *x, ACE_CDR::ULong length)
+{
+ if (length * ACE_CDR::OCTET_SIZE > this->length ())
+ {
+ this->good_bit_ = false;
+ return false;
+ }
+
+ return read_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
+}
+
+ACE_INLINE ACE_CDR::Boolean
+ACE_InputCDR::read_uint8_array (ACE_CDR::UInt8 *x, ACE_CDR::ULong length)
+{
+ if (length * ACE_CDR::OCTET_SIZE > this->length ())
+ {
+ this->good_bit_ = false;
+ return false;
+ }
+
+ return read_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
+}
+
+ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_octet (void)
{
ACE_CDR::Octet x;
@@ -1373,6 +1457,20 @@ operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_wstring x)
(ACE_CDR::Boolean) (os.good_bit () && (!x.bound_ || len <= x.bound_));
}
+ACE_INLINE ACE_CDR::Boolean
+operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_uint8 x)
+{
+ os.write_uint8 (x.val_);
+ return (ACE_CDR::Boolean) os.good_bit ();
+}
+
+ACE_INLINE ACE_CDR::Boolean
+operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_int8 x)
+{
+ os.write_int8 (x.val_);
+ return (ACE_CDR::Boolean) os.good_bit ();
+}
+
// ****************************************************************
ACE_INLINE ACE_CDR::Boolean
@@ -1537,6 +1635,19 @@ operator>> (ACE_InputCDR &is, ACE_InputCDR::to_std_wstring x)
|| static_cast<ACE_CDR::ULong> (x.val_.size ()) <= x.bound_));
}
#endif
+
+ACE_INLINE ACE_CDR::Boolean
+operator>> (ACE_InputCDR &is, ACE_InputCDR::to_uint8 x)
+{
+ return is.read_uint8 (x.ref_) && is.good_bit ();
+}
+
+ACE_INLINE ACE_CDR::Boolean
+operator>> (ACE_InputCDR &is, ACE_InputCDR::to_int8 x)
+{
+ return is.read_int8 (x.ref_) && is.good_bit ();
+}
+
// ***************************************************************************
// We must define these methods here because they use the "read_*" inlined
// methods of the ACE_InputCDR class