summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-06-06 19:51:50 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2011-06-06 19:51:50 +0000
commitdeedde03168b32d83522619d90bba9442a4bc89b (patch)
treef67be8ba0bec641dcdb18325906a63de7011523b
parent42f1fc3aaa58af625d0e8a65ba7d67b9c74e0c24 (diff)
downloadATCD-deedde03168b32d83522619d90bba9442a4bc89b.tar.gz
ChangeLogTag: Mon Jun 6 19:51:27 UTC 2011 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--ACE/ChangeLog16
-rw-r--r--ACE/ace/CDR_Base.cpp40
-rw-r--r--ACE/ace/CDR_Base.h15
3 files changed, 50 insertions, 21 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 14460b52180..7eb74246bf0 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,19 @@
+Mon Jun 6 19:51:27 UTC 2011 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * ace/CDR_Base.cpp:
+ * ace/CDR_Base.h:
+
+ Added a struct LongDoubleAssign which inherits from LongDouble,
+ and contains the assignment operator and constructors, as well
+ as a cast operator to LongDouble. This scheme allows generated
+ code to use the LongDouble struct (when no 16-byte native long
+ double exists) as a member in C++ unions, and to be initialized
+ (when it appears as a constant) with the default copy constructor
+ from LongDouble, converted from the supplied LongDoubleAssign,
+ which is in turn initialized from the rhs literal. Thanks to
+ Adam Mitz <mitza at ociweb dot com> for the LongDoubleAssign
+ suggestion to work around the C++ union restriction.
+
Mon Jun 6 16:59:29 UTC 2011 Johnny Willemsen <jwillemsen@remedy.nl>
* docs/Download.html:
diff --git a/ACE/ace/CDR_Base.cpp b/ACE/ace/CDR_Base.cpp
index b723e7d4fe6..49e9ce02e4c 100644
--- a/ACE/ace/CDR_Base.cpp
+++ b/ACE/ace/CDR_Base.cpp
@@ -605,15 +605,6 @@ ACE_CDR::LongLong::operator!= (const ACE_CDR::LongLong &rhs) const
#endif /* NONNATIVE_LONGLONG */
#if defined (NONNATIVE_LONGDOUBLE)
-ACE_CDR::LongDouble::LongDouble (void)
-{
-}
-
-ACE_CDR::LongDouble::LongDouble (const long double& val)
-{
- (*this) += (NativeImpl) val;
-}
-
ACE_CDR::LongDouble&
ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble::NativeImpl& rhs)
{
@@ -693,13 +684,6 @@ ACE_CDR::LongDouble::assign (const ACE_CDR::LongDouble& rhs)
return *this;
}
-ACE_CDR::LongDouble&
-ACE_CDR::LongDouble::operator= (const ACE_CDR::LongDouble::NativeImpl& rhs)
-{
- return this->assign (rhs);
-}
-
-
bool
ACE_CDR::LongDouble::operator!= (const ACE_CDR::LongDouble &rhs) const
{
@@ -789,6 +773,30 @@ ACE_CDR::LongDouble::operator== (const ACE_CDR::LongDouble &rhs) const
return ACE_OS::memcmp (this->ld, rhs.ld, 16) == 0;
}
+//=================================================================
+
+ACE_CDR::LongDoubleAssign::LongDoubleAssign (void)
+{
+}
+
+ACE_CDR::LongDoubleAssign::LongDoubleAssign (const long double& val)
+{
+ (*this) += (NativeImpl) val;
+}
+
+ACE_CDR::LongDoubleAssign&
+ACE_CDR::LongDoubleAssign::operator= (
+ const ACE_CDR::LongDouble::NativeImpl& rhs)
+{
+ this->assign (rhs);
+ return *this;
+}
+
+ACE_CDR::LongDoubleAssign::operator ACE_CDR::LongDouble (void)
+{
+ return *this;
+}
+
#endif /* NONNATIVE_LONGDOUBLE */
ACE_END_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/ace/CDR_Base.h b/ACE/ace/CDR_Base.h
index 61285e0c69a..c0c67e72e30 100644
--- a/ACE/ace/CDR_Base.h
+++ b/ACE/ace/CDR_Base.h
@@ -315,14 +315,9 @@ public:
char ld[16];
- LongDouble (void);
- explicit LongDouble (const long double &val);
-
LongDouble& assign (const NativeImpl& rhs);
LongDouble& assign (const LongDouble& rhs);
- LongDouble& operator= (const NativeImpl& rhs);
-
bool operator== (const LongDouble &rhs) const;
bool operator!= (const LongDouble &rhs) const;
@@ -358,6 +353,16 @@ public:
operator NativeImpl () const;
};
+ struct LongDoubleAssign : LongDouble
+ {
+ LongDoubleAssign (void);
+ explicit LongDoubleAssign (const long double &val);
+
+ LongDoubleAssign& operator= (const LongDouble::NativeImpl& rhs);
+
+ operator LongDouble (void);
+ };
+
# endif /* ACE_SIZEOF_LONG_DOUBLE != 16 */
//@}