summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-98b28
-rw-r--r--ace/Functor.cpp8
-rw-r--r--ace/Functor.h303
-rw-r--r--ace/Functor.i191
-rw-r--r--ace/Functor_T.cpp12
-rw-r--r--ace/Functor_T.h156
-rw-r--r--ace/Functor_T.i34
-rw-r--r--ace/Hash_Map_Manager.h209
-rw-r--r--ace/Hash_Map_Manager.i133
-rw-r--r--ace/Hash_Map_Manager_T.h26
-rw-r--r--ace/Hash_Map_Manager_T.i13
-rw-r--r--ace/OS.h8
-rw-r--r--ace/RB_Tree.cpp130
-rw-r--r--ace/RB_Tree.h33
-rw-r--r--ace/RB_Tree.i44
-rw-r--r--ace/config-psos-diab.h8
-rw-r--r--include/makeinclude/platform_psos_diab.GNU6
-rw-r--r--tests/Handle_Set_Test.cpp4
-rw-r--r--tests/Process_Strategy_Test.cpp2
-rw-r--r--tests/RB_Tree_Test.cpp104
-rw-r--r--tests/Reactor_Performance_Test.cpp2
-rw-r--r--tests/TSS_Test.cpp5
22 files changed, 741 insertions, 718 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b
index 66a1870e236..ef82b5ff0c7 100644
--- a/ChangeLog-98b
+++ b/ChangeLog-98b
@@ -1,3 +1,31 @@
+Wed Dec 30 13:22:50 1998 Chris Gill <cdgill@cs.wustl.edu>
+
+ * ace/Functor.{cpp, h, i}
+ ace/Functor_T.{cpp, h, i}
+ ace/Hash_Map_Manager.{h, i}
+ ace/Hash_Map_Manager_T.{h, i}: Moved ACE_Hash and ACE_Equal_To
+ STL-style functors from the Hash_Map_Manager files into the
+ Functor files (so other containers can use these from a central
+ place). Added ACE_Less_Than STL-style functor. Thanks to Doug
+ Schmidt, Carlos O'Ryan, and Irfan Pyarali for comments on the
+ distinctions between GOF command pattern functors and STL-style
+ functors.
+
+ * ace/RB_Tree.{cpp, h, i}: Reworked templates so RB_Tree can take
+ advantage of template specialization for strcmp semantics without
+ the overhead of a virtual function call. Thanks to Carlos O'Ryan
+ for his suggestions on how to achieve this.
+
+ * ace/OS.h
+ ace/config-psos-diab.h
+ include/makeinclude/platform_psos_diab.GNU
+ tests/Handle_Set_Test.cpp
+ tests/Process_Strategy_Test.cpp
+ tests/RB_Tree_Test.cpp
+ tests/Reactor_Performance_Test.cpp
+ tests/TSS_Test.cpp: A number of fixes to allow ACE pSOS tests to
+ compile and link successfully.
+
Wed Dec 30 10:36:36 1998 David L. Levine <levine@cs.wustl.edu>
* tests/Env_Value_Test.cpp: protected tests of doubles with
diff --git a/ace/Functor.cpp b/ace/Functor.cpp
index 625a8ff578f..9cab490320f 100644
--- a/ace/Functor.cpp
+++ b/ace/Functor.cpp
@@ -11,8 +11,8 @@
//
// = DESCRIPTION
// Non-inlinable method definitions for non-templatized classes
-// implementing the GOF Command Pattern, also known as functors
-// or function objects.
+// and template specializations implementing the GOF Command Pattern,
+// and STL-style functors.
//
// = AUTHOR
// Chris Gill <cdgill@cs.wustl.edu>
@@ -23,6 +23,10 @@
// Douglas C. Schmidt <schmidt@cs.wustl.edu> and
// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
//
+// and on STL-style functor implementations originally done by
+//
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
// ============================================================================
#if !defined (ACE_FUNCTOR_C)
diff --git a/ace/Functor.h b/ace/Functor.h
index 40f58dbca53..55b42143e9b 100644
--- a/ace/Functor.h
+++ b/ace/Functor.h
@@ -10,6 +10,13 @@
// Functor.h
//
// = DESCRIPTION
+// Non-templatized classes and class template specializations for
+// implementing function objects that are used in various places
+// in ACE. There are currently two major categories of function
+// objects in ACE: GOF Command Pattern objects, and STL-style
+// functors for comparison of container elements. The command objects
+// are invoked via an execute () method, while the STL-style functors are
+// invoked via an operator() () method.
// Non-templatized classes for implementing the GOF Command Pattern,
// also known as functors or function objects.
//
@@ -22,6 +29,10 @@
// Douglas C. Schmidt <schmidt@cs.wustl.edu> and
// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
//
+// and on STL-style functor implementations originally done by
+//
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
// ============================================================================
#ifndef ACE_FUNCTOR_H
@@ -33,6 +44,10 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+//////////////////////////////////////////////////////////////
+// GOF Command Pattern Classes and Template Specializations //
+//////////////////////////////////////////////////////////////
+
class ACE_Export ACE_Command_Base
{
// = TITLE
@@ -59,6 +74,294 @@ public:
// will never occur.
};
+////////////////////////////////////////////////////////////
+// STL-style Functor Classes and Template Specializations //
+////////////////////////////////////////////////////////////
+
+// Forward declaration since we are going to specialize that template
+// here. The template itself requires this file so every user of the
+// template should also see the specialization.
+template <class TYPE> class ACE_Hash;
+template <class TYPE> class ACE_Equal_To;
+template <class TYPE> class ACE_Less_Than;
+
+class ACE_Export ACE_Hash<char>
+{
+ // = TITLE
+ // Function object for hashing a char
+public:
+ u_long operator () (char t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<signed char>
+{
+ // = TITLE
+ // Function object for hashing a signed char
+public:
+ u_long operator () (signed char t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<unsigned char>
+{
+ // = TITLE
+ // Function object for hashing an unsigned char
+public:
+ u_long operator () (unsigned char t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<short>
+{
+ // = TITLE
+ // Function object for hashing a short
+public:
+ u_long operator () (short t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<unsigned short>
+{
+ // = TITLE
+ // Function object for hashing an unsigned short
+public:
+ u_long operator () (unsigned short t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<int>
+{
+ // = TITLE
+ // Function object for hashing an int
+public:
+ u_long operator () (int t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<unsigned int>
+{
+ // = TITLE
+ // Function object for hashing an unsigned int
+public:
+ u_long operator () (unsigned int t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<long>
+{
+ // = TITLE
+ // Function object for hashing a long
+public:
+ u_long operator () (long t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<unsigned long>
+{
+ // = TITLE
+ // Function object for hashing an unsigned long
+public:
+ u_long operator () (unsigned long t) const;
+ // Simply returns t
+};
+
+class ACE_Export ACE_Hash<const char *>
+{
+ // = TITLE
+ // Function object for hashing a const string
+public:
+ u_long operator () (const char *t) const;
+ // Calls ACE::hash_pjw
+};
+
+class ACE_Export ACE_Hash<char *>
+{
+ // = TITLE
+ // Function object for hashing a string
+public:
+ u_long operator () (const char *t) const;
+ // Calls ACE::hash_pjw
+};
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
+class ACE_Export ACE_Hash<const wchar_t *>
+{
+ // = TITLE
+ // Function object for hashing a const wide string
+public:
+ u_long operator () (const wchar_t *t) const;
+ // Calls ACE::hash_pjw
+};
+
+class ACE_Export ACE_Hash<wchar_t *>
+{
+ // = TITLE
+ // Function object for hashing a wide string
+public:
+ u_long operator () (const wchar_t *t) const;
+ // Calls ACE::hash_pjw
+};
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
+class ACE_Export ACE_Hash<const ACE_USHORT16 *>
+{
+ // = TITLE
+ // Function object for hashing a const wide string
+public:
+ u_long operator () (const ACE_USHORT16 *t) const;
+ // Calls ACE::hash_pjw
+};
+
+class ACE_Export ACE_Hash<ACE_USHORT16 *>
+{
+ // = TITLE
+ // Function object for hashing a wide string
+public:
+ u_long operator () (const ACE_USHORT16 *t) const;
+ // Calls ACE::hash_pjw
+};
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
+
+class ACE_Export ACE_Equal_To<const char *>
+{
+ // = TITLE
+ // Function object for determining whether two const strings are equal.
+public:
+ int operator () (const char *lhs,
+ const char *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+class ACE_Export ACE_Equal_To<char *>
+{
+ // = TITLE
+ // Function object for determining whether two non-const
+ // strings are equal.
+public:
+ int operator () (const char *lhs,
+ const char *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
+class ACE_Export ACE_Equal_To<const wchar_t *>
+{
+ // = TITLE
+ // Function object for determining whether two const wide
+ // strings are equal.
+public:
+ int operator () (const wchar_t *lhs,
+ const wchar_t *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+class ACE_Export ACE_Equal_To<wchar_t *>
+{
+ // = TITLE
+ // Function object for determining whether two wide strings are equal.
+public:
+ int operator () (const wchar_t *lhs,
+ const wchar_t *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
+class ACE_Export ACE_Equal_To<const ACE_USHORT16 *>
+{
+ // = TITLE
+ // Function object for determining whether two const wide
+ // strings are equal.
+public:
+ int operator () (const ACE_USHORT16 *lhs,
+ const ACE_USHORT16 *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+class ACE_Export ACE_Equal_To<ACE_USHORT16 *>
+{
+ // = TITLE
+ // Function object for determining whether two wide strings are equal.
+public:
+ int operator () (const ACE_USHORT16 *lhs,
+ const ACE_USHORT16 *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
+
+
+class ACE_Export ACE_Less_Than<const char *>
+{
+ // = TITLE
+ // Function object for determining whether the first const string
+ // is less than the second const string.
+public:
+ int operator () (const char *lhs,
+ const char *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+class ACE_Export ACE_Less_Than<char *>
+{
+ // = TITLE
+ // Function object for determining whether the first string
+ // is less than the second string.
+public:
+ int operator () (const char *lhs,
+ const char *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
+class ACE_Export ACE_Less_Than<const wchar_t *>
+{
+ // = TITLE
+ // Function object for determining whether the first const wide string
+ // is less than the second const wide string.
+public:
+ int operator () (const wchar_t *lhs,
+ const wchar_t *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+class ACE_Export ACE_Less_Than<wchar_t *>
+{
+ // = TITLE
+ // Function object for determining whether the first wide string
+ // is less than the second wide string.
+public:
+ int operator () (const wchar_t *lhs,
+ const wchar_t *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
+class ACE_Export ACE_Less_Than<const ACE_USHORT16 *>
+{
+ // = TITLE
+ // Function object for determining whether the first const wide string
+ // is less than the second const wide string.
+public:
+ int operator () (const ACE_USHORT16 *lhs,
+ const ACE_USHORT16 *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+
+class ACE_Export ACE_Less_Than<ACE_USHORT16 *>
+{
+ // = TITLE
+ // Function object for determining whether the first wide string
+ // is less than the second wide string.
+public:
+ int operator () (const ACE_USHORT16 *lhs,
+ const ACE_USHORT16 *rhs) const;
+ // Simply calls ACE_OS::strcmp
+};
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
+
#if defined (__ACE_INLINE__)
#include "ace/Functor.i"
#endif /* __ACE_INLINE__ */
diff --git a/ace/Functor.i b/ace/Functor.i
index 1c8dc99a25c..39599c3ef5c 100644
--- a/ace/Functor.i
+++ b/ace/Functor.i
@@ -11,8 +11,8 @@
//
// = DESCRIPTION
// Inlinable method definitions for non-templatized classes
-// implementing the GOF Command Pattern, also known as functors
-// or function objects.
+// and template specializations implementing the GOF Command Pattern,
+// and STL-style functors.
//
// = AUTHOR
// Chris Gill <cdgill@cs.wustl.edu>
@@ -23,8 +23,16 @@
// Douglas C. Schmidt <schmidt@cs.wustl.edu> and
// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
//
+// and on STL-style functor implementations originally done by
+//
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
// ============================================================================
+//////////////////////////////////////////////////////////////
+// GOF Command Pattern Classes and Template Specializations //
+//////////////////////////////////////////////////////////////
+
// Default constructor.
ACE_INLINE
@@ -38,3 +46,182 @@ ACE_INLINE
ACE_Command_Base::~ACE_Command_Base (void)
{
}
+
+////////////////////////////////////////////////////////////
+// STL-style Functor Classes and Template Specializations //
+////////////////////////////////////////////////////////////
+
+ACE_INLINE u_long
+ACE_Hash<char>::operator () (char t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<signed char>::operator () (signed char t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<unsigned char>::operator () (unsigned char t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<short>::operator () (short t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<unsigned short>::operator () (unsigned short t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<int>::operator () (int t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<unsigned int>::operator () (unsigned int t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<long>::operator () (long t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<unsigned long>::operator () (unsigned long t) const
+{
+ return t;
+}
+
+ACE_INLINE u_long
+ACE_Hash<const char *>::operator () (const char *t) const
+{
+ return ACE::hash_pjw (t);
+}
+
+ACE_INLINE u_long
+ACE_Hash<char *>::operator () (const char *t) const
+{
+ return ACE::hash_pjw (t);
+}
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
+ACE_INLINE u_long
+ACE_Hash<const wchar_t *>::operator () (const wchar_t *t) const
+{
+ return ACE::hash_pjw (t);
+}
+
+ACE_INLINE u_long
+ACE_Hash<wchar_t *>::operator () (const wchar_t *t) const
+{
+ return ACE::hash_pjw (t);
+}
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
+ACE_INLINE u_long
+ACE_Hash<const ACE_USHORT16 *>::operator () (const ACE_USHORT16 *t) const
+{
+ return ACE::hash_pjw (t);
+}
+
+ACE_INLINE u_long
+ACE_Hash<ACE_USHORT16 *>::operator () (const ACE_USHORT16 *t) const
+{
+ return ACE::hash_pjw (t);
+}
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
+
+ACE_INLINE int
+ACE_Equal_To<const char *>::operator () (const char *lhs, const char *rhs) const
+{
+ return !ACE_OS::strcmp (lhs, rhs);
+}
+
+ACE_INLINE int
+ACE_Equal_To<char *>::operator () (const char *lhs, const char *rhs) const
+{
+ return !ACE_OS::strcmp (lhs, rhs);
+}
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
+ACE_INLINE int
+ACE_Equal_To<const wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
+{
+ return !ACE_OS::strcmp (lhs, rhs);
+}
+
+ACE_INLINE int
+ACE_Equal_To<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
+{
+ return !ACE_OS::strcmp (lhs, rhs);
+}
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
+ACE_INLINE int
+ACE_Equal_To<const ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const
+{
+ return !ACE_OS::strcmp (lhs, rhs);
+}
+
+ACE_INLINE int
+ACE_Equal_To<ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const
+{
+ return !ACE_OS::strcmp (lhs, rhs);
+}
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
+
+ACE_INLINE int
+ACE_Less_Than<const char *>::operator () (const char *lhs, const char *rhs) const
+{
+ return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
+}
+
+ACE_INLINE int
+ACE_Less_Than<char *>::operator () (const char *lhs, const char *rhs) const
+{
+ return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
+}
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
+ACE_INLINE int
+ACE_Less_Than<const wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
+{
+ return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
+}
+
+ACE_INLINE int
+ACE_Less_Than<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
+{
+ return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
+}
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
+
+#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
+ACE_INLINE int
+ACE_Less_Than<const ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const
+{
+ return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
+}
+
+ACE_INLINE int
+ACE_Less_Than<ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const
+{
+ return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0;
+}
+
+#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
diff --git a/ace/Functor_T.cpp b/ace/Functor_T.cpp
index 534edb64401..42fafc62c74 100644
--- a/ace/Functor_T.cpp
+++ b/ace/Functor_T.cpp
@@ -11,8 +11,7 @@
//
// = DESCRIPTION
// Non-inlinable method definitions for templatized classes
-// implementing the GOF Command Pattern, also known as functors
-// or function objects.
+// implementing the GOF Command Pattern, or STL-style functors.
//
// = AUTHOR
// Chris Gill <cdgill@cs.wustl.edu>
@@ -23,6 +22,10 @@
// Douglas C. Schmidt <schmidt@cs.wustl.edu> and
// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
//
+// and on STL-style functor implementations originally done by
+//
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
// ============================================================================
#ifndef ACE_FUNCTOR_T_C
@@ -43,6 +46,11 @@ ACE_RCSID(ace, Functor_T, "$Id$")
ACE_ALLOC_HOOK_DEFINE(ACE_Command_Callback)
+
+///////////////////////////////////
+// GOF Command Pattern Templates //
+///////////////////////////////////
+
// Constructor.
template <class RECEIVER, class ACTION>
diff --git a/ace/Functor_T.h b/ace/Functor_T.h
index 4f671652a10..052b10fa993 100644
--- a/ace/Functor_T.h
+++ b/ace/Functor_T.h
@@ -10,8 +10,12 @@
// Functor_T.h
//
// = DESCRIPTION
-// Templatized classes for implementing the GOF Command Pattern,
-// also known as functors or function objects.
+// Templatized classes for implementing function objects that are used in
+// various places in ACE. There are currently two major categories of
+// function objects in ACE: GOF Command Pattern objects, and STL-style
+// functors for comparison of container elements. The command objects
+// are invoked via an execute () method, while the STL-style functors are
+// invoked via an operator() () method.
//
// = AUTHOR
// Chris Gill <cdgill@cs.wustl.edu>
@@ -22,6 +26,10 @@
// Douglas C. Schmidt <schmidt@cs.wustl.edu> and
// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
//
+// and on STL-style functor implementations originally done by
+//
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
// ============================================================================
#ifndef ACE_FUNCTOR_T_H
@@ -33,12 +41,17 @@
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
+///////////////////////////////////
+// GOF Command Pattern Templates //
+///////////////////////////////////
+
template <class RECEIVER, class ACTION>
class ACE_Command_Callback : public ACE_Command_Base
{
// = TITLE
- // Defines a class template that allows us to invoke a callback to an
- // object without knowing anything about the object except its type.
+ // Defines a class template that allows us to invoke a GOF command style
+ // callback to an object without knowing anything about the object except
+ // its type.
//
// = DESCRIPTION
// This class declares an interface to execute operations,
@@ -66,139 +79,48 @@ private:
// Method that is going to be invoked.
};
-/////////////////////////////
-// Unary functor templates //
-/////////////////////////////
-
-template <class OPERAND>
-class ACE_Unary_Functor_Base
-{
- // = TITLE
- // Defines a class template that allows us to invoke a function object
- // over a single non-const parameterized type without knowing anything
- // about the function and operand objects except their types.
- //
- // = DESCRIPTION
- // This class declares an interface to execute a unary operation over a
- // single object of the non-const paramterized type. A class can invoke
- // such operation without knowing anything about it, or how it was
- // implemented.
- //
-public:
-
- virtual ~ACE_Unary_Functor_Base () {};
- // Virtual destructor.
-
- virtual int execute (OPERAND &operand) = 0;
- // Invokes the function object.
-
- virtual ACE_Unary_Functor_Base * clone () = 0;
- // Creates another object of the same type.
-};
-
-template <class OPERAND>
-class ACE_Const_Unary_Functor_Base
-{
- // = TITLE
- // Defines a class template that allows us to invoke a function object
- // over a single parameterized type without knowing anything about
- // the function and operand objects except their types.
- //
- // = DESCRIPTION
- // This class declares an interface to execute a unary operation over a
- // single object of the paramterized type. A class can invoke such
- // an operation without knowing anything about it, or its implementation.
- //
-public:
-
- virtual ~ACE_Const_Unary_Functor_Base () {};
- // Virtual destructor.
-
- virtual int execute (const OPERAND &operand) = 0;
- // Invokes the function object.
-
- virtual ACE_Const_Unary_Functor_Base * clone () = 0;
- // Creates another object of the same type.
-};
-
-/////////////////////////////
-// Binary functor templates //
-/////////////////////////////
+/////////////////////////////////
+// STL-style Functor Templates //
+/////////////////////////////////
-template <class OPERAND1, class OPERAND2>
-class ACE_Binary_Functor_Base
+template <class TYPE>
+class ACE_Hash
{
// = TITLE
- // Defines a class template that allows us to invoke a binary function
- // object over two non-const parameterized types without knowing anything
- // about the function and operand objects except their types.
//
- // = DESCRIPTION
- // This class declares an interface to execute a binary operation over two
- // objects of the paramterized non-const types. A class can invoke such
- // an operation without knowing anything about it, or its implementation.
+ // Function object for hashing
//
public:
-
- virtual ~ACE_Binary_Functor_Base () {};
- // Virtual destructor.
-
- virtual int execute (OPERAND1 &operand1, OPERAND2 &operand2) = 0;
- // Invokes the function object.
-
- virtual ACE_Binary_Functor_Base * clone () = 0;
- // Creates another object of the same type.
+ u_long operator () (const TYPE &t) const;
+ // Simply calls t.hash ()
};
-template <class OPERAND1, class OPERAND2>
-class ACE_Const_Binary_Functor_Base
+template <class TYPE>
+class ACE_Equal_To
{
// = TITLE
- // Defines a class template that allows us to invoke a binary function
- // object over two parameterized types without knowing anything about
- // the function and operand objects except their types.
//
- // = DESCRIPTION
- // This class declares an interface to execute a binary operation over two
- // objects of the paramterized types. A class can invoke such
- // an operation without knowing anything about it, or its implementation.
+ // Function object for comparing two objects of
+ // the given type for equality.
//
public:
-
- virtual ~ACE_Const_Binary_Functor_Base () {};
- // Virtual destructor.
-
- virtual int execute (const OPERAND1 &operand1, const OPERAND2 &operand2) = 0;
- // Invokes the function object.
-
- virtual ACE_Const_Binary_Functor_Base * clone () = 0;
- // Creates another object of the same type.
+ int operator () (const TYPE &lhs,
+ const TYPE &rhs) const;
+ // Simply calls operator==
};
-
-template <class OPERAND1, class OPERAND2>
-class ACE_Less_Than_Functor :
- public ACE_Const_Binary_Functor_Base<OPERAND1, OPERAND2>
+template <class TYPE>
+class ACE_Less_Than
{
// = TITLE
- // Defines a class template that allows us to invoke a binary less than
- // function over two parameterized types without knowing anything about
- // the function and operand objects except their types.
//
- // = DESCRIPTION
- // This class depends on the definition
- // objects of the paramterized types. A class can invoke such
- // an operation without knowing anything about it, or its implementation.
+ // Function object for determining whether the first object of the
+ // given type is less than the second object of the same type.
//
public:
-
- virtual int execute (const OPERAND1 &operand1, const OPERAND2 &operand2);
- // Invokes the function object.
-
- virtual
- ACE_Const_Binary_Functor_Base<OPERAND1, OPERAND2>
- * clone ();
- // Creates another object of the same type.
+ int operator () (const TYPE &lhs,
+ const TYPE &rhs) const;
+ // Simply calls operator<
};
diff --git a/ace/Functor_T.i b/ace/Functor_T.i
index cf4171c0984..0024cd3fd23 100644
--- a/ace/Functor_T.i
+++ b/ace/Functor_T.i
@@ -11,8 +11,7 @@
//
// = DESCRIPTION
// Inlinable method definitions for templatized classes
-// implementing the GOF Command Pattern, also known as functors
-// or function objects.
+// implementing the GOF Command Pattern, or STL-style functors.
//
// = AUTHOR
// Chris Gill <cdgill@cs.wustl.edu>
@@ -23,23 +22,34 @@
// Douglas C. Schmidt <schmidt@cs.wustl.edu> and
// Sergio Flores-Gaitan <sergio@cs.wustl.edu>
//
+// and on STL-style functor implementations originally done by
+//
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
// ============================================================================
-// Invokes the less than function object.
+/////////////////////////////////
+// STL-style Functor Templates //
+/////////////////////////////////
-template <class OPERAND1, class OPERAND2> ACE_INLINE int
-ACE_Less_Than_Functor<OPERAND1, OPERAND2>::execute (const OPERAND1 &operand1,
- const OPERAND2 &operand2)
+template <class TYPE> ACE_INLINE u_long
+ACE_Hash<TYPE>::operator () (const TYPE &t) const
{
- return (operand1 < operand2) ? 1 : 0;
+ return t.hash ();
}
-// Creates another object of the same type.
+template <class TYPE> ACE_INLINE int
+ACE_Equal_To<TYPE>::operator () (const TYPE &lhs,
+ const TYPE &rhs) const
+{
+ return lhs == rhs;
+}
-template <class OPERAND1, class OPERAND2> ACE_INLINE
-ACE_Const_Binary_Functor_Base<OPERAND1, OPERAND2> *
-ACE_Less_Than_Functor<OPERAND1, OPERAND2>::clone ()
+template <class TYPE> ACE_INLINE int
+ACE_Less_Than<TYPE>::operator () (const TYPE &lhs,
+ const TYPE &rhs) const
{
- return new ACE_Less_Than_Functor<OPERAND1, OPERAND2>;
+ return (lhs < rhs) ? 1 : 0;
}
+
diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h
index e7f2bc612eb..f2735981288 100644
--- a/ace/Hash_Map_Manager.h
+++ b/ace/Hash_Map_Manager.h
@@ -18,219 +18,12 @@
#define ACE_HASH_MAP_MANAGER_H
#include "ace/OS.h"
+#include "ace/Functor.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-// Forward declaration since we are going to specialize that template
-// here. The template itself requires this file so every user of the
-// template should also see the specialization.
-template <class TYPE> class ACE_Hash;
-template <class TYPE> class ACE_Equal_To;
-
-class ACE_Export ACE_Hash<char>
-{
- // = TITLE
- // Function object for hashing a char
-public:
- u_long operator () (char t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<signed char>
-{
- // = TITLE
- // Function object for hashing a signed char
-public:
- u_long operator () (signed char t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<unsigned char>
-{
- // = TITLE
- // Function object for hashing an unsigned char
-public:
- u_long operator () (unsigned char t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<short>
-{
- // = TITLE
- // Function object for hashing a short
-public:
- u_long operator () (short t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<unsigned short>
-{
- // = TITLE
- // Function object for hashing an unsigned short
-public:
- u_long operator () (unsigned short t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<int>
-{
- // = TITLE
- // Function object for hashing an int
-public:
- u_long operator () (int t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<unsigned int>
-{
- // = TITLE
- // Function object for hashing an unsigned int
-public:
- u_long operator () (unsigned int t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<long>
-{
- // = TITLE
- // Function object for hashing a long
-public:
- u_long operator () (long t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<unsigned long>
-{
- // = TITLE
- // Function object for hashing an unsigned long
-public:
- u_long operator () (unsigned long t) const;
- // Simply returns t
-};
-
-class ACE_Export ACE_Hash<const char *>
-{
- // = TITLE
- // Function object for hashing a const string
-public:
- u_long operator () (const char *t) const;
- // Calls ACE::hash_pjw
-};
-
-class ACE_Export ACE_Hash<char *>
-{
- // = TITLE
- // Function object for hashing a string
-public:
- u_long operator () (const char *t) const;
- // Calls ACE::hash_pjw
-};
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
-class ACE_Export ACE_Hash<const wchar_t *>
-{
- // = TITLE
- // Function object for hashing a const wide string
-public:
- u_long operator () (const wchar_t *t) const;
- // Calls ACE::hash_pjw
-};
-
-class ACE_Export ACE_Hash<wchar_t *>
-{
- // = TITLE
- // Function object for hashing a wide string
-public:
- u_long operator () (const wchar_t *t) const;
- // Calls ACE::hash_pjw
-};
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
-class ACE_Export ACE_Hash<const ACE_USHORT16 *>
-{
- // = TITLE
- // Function object for hashing a const wide string
-public:
- u_long operator () (const ACE_USHORT16 *t) const;
- // Calls ACE::hash_pjw
-};
-
-class ACE_Export ACE_Hash<ACE_USHORT16 *>
-{
- // = TITLE
- // Function object for hashing a wide string
-public:
- u_long operator () (const ACE_USHORT16 *t) const;
- // Calls ACE::hash_pjw
-};
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
-
-class ACE_Export ACE_Equal_To<const char *>
-{
- // = TITLE
- // Function object for comparing two const strings
-public:
- int operator () (const char *lhs,
- const char *rhs) const;
- // Simply calls strcmp
-};
-
-class ACE_Export ACE_Equal_To<char *>
-{
- // = TITLE
- // Function object for comparing two strings
-public:
- int operator () (const char *lhs,
- const char *rhs) const;
- // Simply calls strcmp
-};
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
-class ACE_Export ACE_Equal_To<const wchar_t *>
-{
- // = TITLE
- // Function object for comparing two const wide strings
-public:
- int operator () (const wchar_t *lhs,
- const wchar_t *rhs) const;
- // Simply calls strcmp
-};
-
-class ACE_Export ACE_Equal_To<wchar_t *>
-{
- // = TITLE
- // Function object for comparing two wide strings
-public:
- int operator () (const wchar_t *lhs,
- const wchar_t *rhs) const;
- // Simply calls strcmp
-};
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
-class ACE_Export ACE_Equal_To<const ACE_USHORT16 *>
-{
- // = TITLE
- // Function object for comparing two const wide strings
-public:
- int operator () (const ACE_USHORT16 *lhs,
- const ACE_USHORT16 *rhs) const;
- // Simply calls strcmp
-};
-
-class ACE_Export ACE_Equal_To<ACE_USHORT16 *>
-{
- // = TITLE
- // Function object for comparing two wide strings
-public:
- int operator () (const ACE_USHORT16 *lhs,
- const ACE_USHORT16 *rhs) const;
- // Simply calls strcmp
-};
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
// Include the templates here.
#include "ace/Hash_Map_Manager_T.h"
diff --git a/ace/Hash_Map_Manager.i b/ace/Hash_Map_Manager.i
index 038ad1157f5..74e88caa0c5 100644
--- a/ace/Hash_Map_Manager.i
+++ b/ace/Hash_Map_Manager.i
@@ -1,135 +1,2 @@
// $Id$
-ACE_INLINE u_long
-ACE_Hash<char>::operator () (char t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<signed char>::operator () (signed char t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<unsigned char>::operator () (unsigned char t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<short>::operator () (short t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<unsigned short>::operator () (unsigned short t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<int>::operator () (int t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<unsigned int>::operator () (unsigned int t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<long>::operator () (long t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<unsigned long>::operator () (unsigned long t) const
-{
- return t;
-}
-
-ACE_INLINE u_long
-ACE_Hash<const char *>::operator () (const char *t) const
-{
- return ACE::hash_pjw (t);
-}
-
-ACE_INLINE u_long
-ACE_Hash<char *>::operator () (const char *t) const
-{
- return ACE::hash_pjw (t);
-}
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
-ACE_INLINE u_long
-ACE_Hash<const wchar_t *>::operator () (const wchar_t *t) const
-{
- return ACE::hash_pjw (t);
-}
-
-ACE_INLINE u_long
-ACE_Hash<wchar_t *>::operator () (const wchar_t *t) const
-{
- return ACE::hash_pjw (t);
-}
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
-ACE_INLINE u_long
-ACE_Hash<const ACE_USHORT16 *>::operator () (const ACE_USHORT16 *t) const
-{
- return ACE::hash_pjw (t);
-}
-
-ACE_INLINE u_long
-ACE_Hash<ACE_USHORT16 *>::operator () (const ACE_USHORT16 *t) const
-{
- return ACE::hash_pjw (t);
-}
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
-
-ACE_INLINE int
-ACE_Equal_To<const char *>::operator () (const char *lhs, const char *rhs) const
-{
- return !ACE_OS::strcmp (lhs, rhs);
-}
-
-ACE_INLINE int
-ACE_Equal_To<char *>::operator () (const char *lhs, const char *rhs) const
-{
- return !ACE_OS::strcmp (lhs, rhs);
-}
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR)
-ACE_INLINE int
-ACE_Equal_To<const wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
-{
- return !ACE_OS::strcmp (lhs, rhs);
-}
-
-ACE_INLINE int
-ACE_Equal_To<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) const
-{
- return !ACE_OS::strcmp (lhs, rhs);
-}
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_CHAR */
-
-#if !defined (ACE_HAS_WCHAR_TYPEDEFS_USHORT)
-ACE_INLINE int
-ACE_Equal_To<const ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const
-{
- return !ACE_OS::strcmp (lhs, rhs);
-}
-
-ACE_INLINE int
-ACE_Equal_To<ACE_USHORT16 *>::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const
-{
- return !ACE_OS::strcmp (lhs, rhs);
-}
-#endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */
diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h
index 0280d93630e..a05bee99170 100644
--- a/ace/Hash_Map_Manager_T.h
+++ b/ace/Hash_Map_Manager_T.h
@@ -18,36 +18,12 @@
#define ACE_HASH_MAP_MANAGER_T_H
#include "ace/OS.h"
+#include "ace/Functor.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-template <class TYPE>
-class ACE_Hash
-{
- // = TITLE
- //
- // Function object for hashing
- //
-public:
- u_long operator () (const TYPE &t);
- // Simply calls t.hash ()
-};
-
-template <class TYPE>
-class ACE_Equal_To
-{
- // = TITLE
- //
- // Function object for comparing types
- //
-public:
- int operator () (const TYPE &lhs,
- const TYPE &rhs);
- // Simply calls operator==
-};
-
template <class EXT_ID, class INT_ID>
class ACE_Hash_Map_Entry
{
diff --git a/ace/Hash_Map_Manager_T.i b/ace/Hash_Map_Manager_T.i
index e9be5323221..c0decdeaf7e 100644
--- a/ace/Hash_Map_Manager_T.i
+++ b/ace/Hash_Map_Manager_T.i
@@ -2,19 +2,6 @@
#include "ace/Synch.h"
-template <class TYPE> ACE_INLINE u_long
-ACE_Hash<TYPE>::operator () (const TYPE &t)
-{
- return t.hash ();
-}
-
-template <class TYPE> ACE_INLINE int
-ACE_Equal_To<TYPE>::operator () (const TYPE &lhs,
- const TYPE &rhs)
-{
- return lhs == rhs;
-}
-
template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE
ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK>::ACE_Hash_Map_Manager_Ex (size_t size,
ACE_Allocator *alloc)
diff --git a/ace/OS.h b/ace/OS.h
index 82cb98d5f5d..c6b56db28f3 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -778,6 +778,12 @@ typedef struct
# define ACE_PLATFORM_A "pSOS"
# define ACE_PLATFORM_EXE_SUFFIX_A ""
+# if defined (ACE_HAS_MOSTLY_UNICODE_APIS)
+# define ASYS_WIDE_STRING(ASCII_STRING) ACE_WString (ASCII_STRING).fast_rep ()
+# else
+# define ASYS_WIDE_STRING(ASCII_STRING) ASCII_STRING
+# endif /* ACE_HAS_MOSTLY_UNICODE_APIS */
+
# if defined (ACE_HAS_UNICODE)
# define ACE_DIRECTORY_SEPARATOR_STR_W L"/"
# define ACE_DIRECTORY_SEPARATOR_CHAR_W L'/'
@@ -6145,7 +6151,7 @@ ace_main_i (int, char *[]); /* forward declaration */ \
ACE_MAIN () /* user's entry point, e.g., "main" w/out argc, argv */ \
{ \
int argc = 1; /* dummy arg count */ \
- char *argv[] = {""}; /* dummy arg list */ \
+ char *argv[] = {"root"}; /* dummy arg list */ \
ACE_Object_Manager ace_object_manager; /* has program lifetime */ \
ace_main_i (argc, argv); /* call user main, ignore result */ \
} \
diff --git a/ace/RB_Tree.cpp b/ace/RB_Tree.cpp
index dd36270cb7f..5b619313e6d 100644
--- a/ace/RB_Tree.cpp
+++ b/ace/RB_Tree.cpp
@@ -56,35 +56,21 @@ ACE_RB_Tree_Node<KEY, T>::~ACE_RB_Tree_Node ()
// Constructor.
-template <class KEY, class T>
-ACE_RB_Tree<KEY, T>::ACE_RB_Tree (
- ACE_Const_Binary_Functor_Base<KEY, KEY> *less_than_functor,
- int free_functor)
- : root_ (0),
- less_than_functor_ (less_than_functor),
- free_functor_ (free_functor)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK>
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree ()
+ : root_ (0)
{
- if (less_than_functor_ == 0)
- {
- less_than_functor_ = new ACE_Less_Than_Functor<KEY, KEY>;
- free_functor_ = 1;
- }
}
// Copy constructor.
-template <class KEY, class T>
-ACE_RB_Tree<KEY, T>::ACE_RB_Tree (const ACE_RB_Tree<KEY, T> &rbt)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK>
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree (const ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> &rbt)
: root_ (0)
{
- // Make a copy of the comparison functor.
- less_than_functor_ = (rbt.less_than_functor_ == 0)
- ? 0 : rbt.less_than_functor_->clone ();
- free_functor_ = 1;
-
// Make a deep copy of the passed tree.
- ACE_RB_Tree_Iterator<KEY, T> iter(rbt);
+ ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK> iter(rbt);
for (iter.first (); iter.is_done () == 0; iter.next ())
{
insert (*(iter.key ()), *(iter.item ()));
@@ -94,15 +80,9 @@ ACE_RB_Tree<KEY, T>::ACE_RB_Tree (const ACE_RB_Tree<KEY, T> &rbt)
// Destructor.
-template <class KEY, class T>
-ACE_RB_Tree<KEY, T>::~ACE_RB_Tree ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK>
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::~ACE_RB_Tree ()
{
- // Free the comparison functor if needed.
- if (free_functor_)
- {
- delete less_than_functor_;
- }
-
// Clear away all nodes in the tree.
clear ();
}
@@ -110,25 +90,14 @@ ACE_RB_Tree<KEY, T>::~ACE_RB_Tree ()
// Assignment operator.
-template <class KEY, class T> void
-ACE_RB_Tree<KEY, T>::operator = (const ACE_RB_Tree<KEY, T> &rbt)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> void
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::operator = (const ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> &rbt)
{
- // Free the comparison functor if needed.
- if (free_functor_)
- {
- delete less_than_functor_;
- }
-
- // Make a copy of the passed tree's comparison functor.
- less_than_functor_ = (rbt.less_than_functor_ == 0)
- ? 0 : rbt.less_than_functor_->clone ();
- free_functor_ = 1;
-
// Clear out the existing tree.
clear ();
// Make a deep copy of the passed tree.
- ACE_RB_Tree_Iterator<KEY, T> iter(rbt);
+ ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK> iter(rbt);
for (iter.first (); iter.is_done () == 0; iter.next ())
{
insert (*(iter.key ()), *(iter.item ()));
@@ -138,27 +107,18 @@ ACE_RB_Tree<KEY, T>::operator = (const ACE_RB_Tree<KEY, T> &rbt)
// Less than comparison function for keys, default
// functor implementation returns 1 if k1 < k2, 0 otherwise.
-template <class KEY, class T> int
-ACE_RB_Tree<KEY, T>::lessthan (const KEY &k1, const KEY &k2)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> int
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::lessthan (const KEY &k1, const KEY &k2)
{
- if (less_than_functor_ == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"),
- ASYS_TEXT ("\nNull comparison functor pointer.\n")),
- 0);
- }
- else
- {
- return less_than_functor_->execute (k1, k2);
- }
+ return this->compare_keys_ (k1, k2);
}
// Returns a pointer to the item corresponding to the
// given key, or 0 if it cannot find the key in the tree.
-template <class KEY, class T> T*
-ACE_RB_Tree<KEY, T>::find (const KEY &k)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> T*
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::find (const KEY &k)
{
// Find the closest matching node, if there is one.
ACE_RB_Tree_Node<KEY, T> *current = find_node (k);
@@ -196,8 +156,8 @@ ACE_RB_Tree<KEY, T>::find (const KEY &k)
// the returned pointer addresses the existing item
// associated with the existing key.
-template <class KEY, class T> T*
-ACE_RB_Tree<KEY, T>::insert (const KEY &k, const T &t)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> T*
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::insert (const KEY &k, const T &t)
{
// Find the closest matching node, if there is one.
ACE_RB_Tree_Node<KEY, T> *current = find_node (k);
@@ -301,8 +261,8 @@ ACE_RB_Tree<KEY, T>::insert (const KEY &k, const T &t)
// and successfully destroyed it, 0 if it did not find the
// item, or -1 if an error occurred.
-template <class KEY, class T> int
-ACE_RB_Tree<KEY, T>::remove (const KEY &k)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> int
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::remove (const KEY &k)
{
// Find a matching node, if there is one.
ACE_RB_Tree_Node<KEY, T> *x, *z;
@@ -375,8 +335,8 @@ ACE_RB_Tree<KEY, T>::remove (const KEY &k)
// Method for right rotation of the tree about a given node.
-template <class KEY, class T> void
-ACE_RB_Tree<KEY, T>::RB_rotate_right (ACE_RB_Tree_Node<KEY, T> * x)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> void
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_rotate_right (ACE_RB_Tree_Node<KEY, T> * x)
{
if (! x)
{
@@ -423,8 +383,8 @@ ACE_RB_Tree<KEY, T>::RB_rotate_right (ACE_RB_Tree_Node<KEY, T> * x)
// Method for left rotation of the tree about a given node.
-template <class KEY, class T> void
-ACE_RB_Tree<KEY, T>::RB_rotate_left (ACE_RB_Tree_Node<KEY, T> * x)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> void
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_rotate_left (ACE_RB_Tree_Node<KEY, T> * x)
{
if (! x)
{
@@ -471,8 +431,8 @@ ACE_RB_Tree<KEY, T>::RB_rotate_left (ACE_RB_Tree_Node<KEY, T> * x)
// Method for restoring Red-Black properties after deletion.
-template <class KEY, class T> void
-ACE_RB_Tree<KEY, T>::RB_delete_fixup (ACE_RB_Tree_Node<KEY, T> * x)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> void
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_delete_fixup (ACE_RB_Tree_Node<KEY, T> * x)
{
while ((x) && (x->parent ()) && (x->color () == ACE_RB_Tree_Node_Base::BLACK))
{
@@ -555,8 +515,8 @@ ACE_RB_Tree<KEY, T>::RB_delete_fixup (ACE_RB_Tree_Node<KEY, T> * x)
// if the tree is not empty and there is no such match,
// or 0 if the tree is empty.
-template <class KEY, class T> ACE_RB_Tree_Node<KEY, T> *
-ACE_RB_Tree<KEY, T>::find_node (const KEY &k)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_RB_Tree_Node<KEY, T> *
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::find_node (const KEY &k)
{
ACE_RB_Tree_Node<KEY, T> *current = root_;
@@ -604,8 +564,8 @@ ACE_RB_Tree<KEY, T>::find_node (const KEY &k)
// Rebalance the tree after insertion of a node.
-template <class KEY, class T> void
-ACE_RB_Tree<KEY, T>::RB_rebalance (ACE_RB_Tree_Node<KEY, T> * x)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> void
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_rebalance (ACE_RB_Tree_Node<KEY, T> * x)
{
ACE_RB_Tree_Node<KEY, T> *y = 0;
@@ -679,8 +639,8 @@ ACE_RB_Tree<KEY, T>::RB_rebalance (ACE_RB_Tree_Node<KEY, T> * x)
// Method to find the successor node of the given node in the tree.
-template <class KEY, class T> ACE_RB_Tree_Node<KEY, T> *
-ACE_RB_Tree<KEY, T>::RB_tree_successor (ACE_RB_Tree_Node<KEY, T> *x) const
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_RB_Tree_Node<KEY, T> *
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_tree_successor (ACE_RB_Tree_Node<KEY, T> *x) const
{
if (x->right ())
{
@@ -700,8 +660,8 @@ ACE_RB_Tree<KEY, T>::RB_tree_successor (ACE_RB_Tree_Node<KEY, T> *x) const
// Method to find the predecessor node of the given node in the tree.
-template <class KEY, class T> ACE_RB_Tree_Node<KEY, T> *
-ACE_RB_Tree<KEY, T>::RB_tree_predecessor (ACE_RB_Tree_Node<KEY, T> *x) const
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_RB_Tree_Node<KEY, T> *
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_tree_predecessor (ACE_RB_Tree_Node<KEY, T> *x) const
{
if (x->left ())
{
@@ -721,8 +681,8 @@ ACE_RB_Tree<KEY, T>::RB_tree_predecessor (ACE_RB_Tree_Node<KEY, T> *x) const
// Method to find the minimum node of the subtree rooted at the given node.
-template <class KEY, class T> ACE_RB_Tree_Node<KEY, T> *
-ACE_RB_Tree<KEY, T>::RB_tree_minimum (ACE_RB_Tree_Node<KEY, T> *x) const
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_RB_Tree_Node<KEY, T> *
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_tree_minimum (ACE_RB_Tree_Node<KEY, T> *x) const
{
while ((x) && (x->left ()))
{
@@ -735,8 +695,8 @@ ACE_RB_Tree<KEY, T>::RB_tree_minimum (ACE_RB_Tree_Node<KEY, T> *x) const
// Method to find the maximum node of the subtree rooted at the given node.
-template <class KEY, class T> ACE_RB_Tree_Node<KEY, T> *
-ACE_RB_Tree<KEY, T>::RB_tree_maximum (ACE_RB_Tree_Node<KEY, T> *x) const
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_RB_Tree_Node<KEY, T> *
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::RB_tree_maximum (ACE_RB_Tree_Node<KEY, T> *x) const
{
while ((x) && (x->right ()))
{
@@ -749,15 +709,15 @@ ACE_RB_Tree<KEY, T>::RB_tree_maximum (ACE_RB_Tree_Node<KEY, T> *x) const
-/////////////////////////////////////////////////
-// template class ACE_RB_Tree_Iterator<KEY, T> //
-/////////////////////////////////////////////////
+//////////////////////////////////////////////////////////
+// template class ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK> //
+//////////////////////////////////////////////////////////
// Constructor.
-template <class KEY, class T>
-ACE_RB_Tree_Iterator<KEY, T>::ACE_RB_Tree_Iterator (const ACE_RB_Tree<KEY, T> &tree)
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK>
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree_Iterator (const ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> &tree)
: tree_ (tree), node_ (0)
{
// Position the iterator at the first node in the tree.
@@ -767,8 +727,8 @@ ACE_RB_Tree_Iterator<KEY, T>::ACE_RB_Tree_Iterator (const ACE_RB_Tree<KEY, T> &t
// Destructor.
-template <class KEY, class T>
-ACE_RB_Tree_Iterator<KEY, T>::~ACE_RB_Tree_Iterator ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK>
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::~ACE_RB_Tree_Iterator ()
{
}
diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h
index b4de225acef..30f56376a2d 100644
--- a/ace/RB_Tree.h
+++ b/ace/RB_Tree.h
@@ -96,7 +96,7 @@ private:
// Pointer to node's right child.
};
-template <class KEY, class T>
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree
{
// = TITLE
@@ -105,26 +105,24 @@ class ACE_RB_Tree
// 1990, MIT, chapter 14.
//
// = Description
- // Optional flag passed to constructor indicates whether or not the
- // passed functor should be deleted by the ACE_RB_Tree's destructor.
+ // If an ACE allocator is passed to the RB_Tree constructor, it is used
+ // for all dynamic allocations done by the tree.
public:
// = Initialization and termination methods.
- ACE_RB_Tree (ACE_Const_Binary_Functor_Base<KEY, KEY> *less_than_functor = 0,
- int free_functor = 0);
+ ACE_RB_Tree ();
// Constructor.
- ACE_RB_Tree (const ACE_RB_Tree<KEY, T> &rbt);
+ ACE_RB_Tree (const ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> &rbt);
// Copy constructor.
virtual ~ACE_RB_Tree (void);
// Destructor.
- void operator= (const ACE_RB_Tree<KEY, T> &rbt);
+ void operator= (const ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> &rbt);
// Assignment operator.
virtual int lessthan (const KEY &k1, const KEY &k2);
- // Less than comparison function for keys. Default implementation returns 1
- // if k1 < k2, and 0 otherwise.
+ // Less than comparison function for keys, using comparison functor.
T* find (const KEY &k);
// Returns a pointer to the item corresponding to the
@@ -196,22 +194,19 @@ public:
ACE_RB_Tree_Node<KEY, T> *root_;
// The root of the tree.
- ACE_Const_Binary_Functor_Base<KEY, KEY> *less_than_functor_;
- // "Less than" functor for comparing nodes in the tree.
+ COMPARE_KEYS compare_keys_;
+ // Comparison functor for comparing nodes in the tree.
- int free_functor_;
- // Flag indicating whether or not to delete functor in destructor
- // and assignment operator.
};
-template <class KEY, class T>
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK>
class ACE_RB_Tree_Iterator
{
// = TITLE
// Implements an iterator for a Red-Black Tree ADT.
public:
// = Initialization and termination methods.
- ACE_RB_Tree_Iterator (const ACE_RB_Tree<KEY, T> &tree);
+ ACE_RB_Tree_Iterator (const ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> &tree);
// Constructor.
~ACE_RB_Tree_Iterator (void);
@@ -244,13 +239,13 @@ private:
// Explicitly prevent assignment and copy construction of iterators.
ACE_UNIMPLEMENTED_FUNC (
- ACE_RB_Tree_Iterator (const ACE_RB_Tree_Iterator<KEY, T> &))
+ ACE_RB_Tree_Iterator (const ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK> &))
ACE_UNIMPLEMENTED_FUNC (
- void operator = (const ACE_RB_Tree_Iterator<KEY, T> &))
+ void operator = (const ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK> &))
// Private members.
- const ACE_RB_Tree<KEY, T> &tree_;
+ const ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> &tree_;
// Reference to the ACE_RB_Tree over which we're iterating.
ACE_RB_Tree_Node <KEY, T> *node_;
diff --git a/ace/RB_Tree.i b/ace/RB_Tree.i
index b423d77d5dd..3ddfee0f079 100644
--- a/ace/RB_Tree.i
+++ b/ace/RB_Tree.i
@@ -98,15 +98,15 @@ ACE_RB_Tree_Node<KEY, T>::right (ACE_RB_Tree_Node<KEY, T> * r)
-////////////////////////////////////////
-// template class ACE_RB_Tree<KEY, T> //
-////////////////////////////////////////
+////////////////////////////////////////////////////////////////
+// template class ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK> //
+////////////////////////////////////////////////////////////////
// Destroys all nodes and sets the root pointer null.
-template <class KEY, class T> ACE_INLINE void
-ACE_RB_Tree<KEY, T>::clear ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE void
+ACE_RB_Tree<KEY, T, COMPARE_KEYS, ACE_LOCK>::clear ()
{
delete root_;
root_ = 0;
@@ -114,15 +114,15 @@ ACE_RB_Tree<KEY, T>::clear ()
-/////////////////////////////////////////////////
-// template class ACE_RB_Tree_Iterator<KEY, T> //
-/////////////////////////////////////////////////
+//////////////////////////////////////////////////////////
+// template class ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK> //
+//////////////////////////////////////////////////////////
// Accessor for key of node under iterator (if any).
-template <class KEY, class T> ACE_INLINE KEY *
-ACE_RB_Tree_Iterator<KEY, T>::key ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE KEY *
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::key ()
{
return node_ ? (&(node_->key ())) : 0;
}
@@ -130,8 +130,8 @@ ACE_RB_Tree_Iterator<KEY, T>::key ()
// Accessor for item of node under iterator (if any).
-template <class KEY, class T> ACE_INLINE T *
-ACE_RB_Tree_Iterator<KEY, T>::item ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE T *
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::item ()
{
return node_ ? (&(node_->item ())) : 0;
}
@@ -139,8 +139,8 @@ ACE_RB_Tree_Iterator<KEY, T>::item ()
// Move to the first item in the tree.
-template <class KEY, class T> ACE_INLINE int
-ACE_RB_Tree_Iterator<KEY, T>::first ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::first ()
{
node_ = tree_.RB_tree_minimum (tree_.root_);
return node_ ? 1 : 0;
@@ -149,8 +149,8 @@ ACE_RB_Tree_Iterator<KEY, T>::first ()
// Move to the last item in the tree.
-template <class KEY, class T> ACE_INLINE int
-ACE_RB_Tree_Iterator<KEY, T>::last ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::last ()
{
node_ = tree_.RB_tree_maximum (tree_.root_);
return node_ ? 1 : 0;
@@ -160,8 +160,8 @@ ACE_RB_Tree_Iterator<KEY, T>::last ()
// Moves to the next item in the tree,
// returns 1 if there is a next item, 0 otherwise.
-template <class KEY, class T> ACE_INLINE int
-ACE_RB_Tree_Iterator<KEY, T>::next ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::next ()
{
node_ = tree_.RB_tree_successor (node_);
return node_ ? 1 : 0;
@@ -171,15 +171,15 @@ ACE_RB_Tree_Iterator<KEY, T>::next ()
// Moves to the previous item in the tree,
// returns 1 if there is a previous item, 0 otherwise.
-template <class KEY, class T> ACE_INLINE int
-ACE_RB_Tree_Iterator<KEY, T>::previous ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::previous ()
{
node_ = tree_.RB_tree_predecessor (node_);
return node_ ? 1 : 0;
}
-template <class KEY, class T> ACE_INLINE int
-ACE_RB_Tree_Iterator<KEY, T>::is_done ()
+template <class KEY, class T, class COMPARE_KEYS, class ACE_LOCK> ACE_INLINE int
+ACE_RB_Tree_Iterator<KEY, T, COMPARE_KEYS, ACE_LOCK>::is_done ()
{
return node_ ? 0 : 1;
}
diff --git a/ace/config-psos-diab.h b/ace/config-psos-diab.h
index 9dc9b81405f..a1e7a871e54 100644
--- a/ace/config-psos-diab.h
+++ b/ace/config-psos-diab.h
@@ -22,6 +22,8 @@
#define ACE_LACKS_FILELOCKS
+#define ACE_LACKS_FSYNC
+
#define ACE_LACKS_INLINE_FUNCTIONS
#define ACE_LACKS_TEMPLATE_AS_TEMPLATE_PARAMETER
@@ -37,6 +39,8 @@
#define ACE_HAS_CPLUSPLUS_HEADERS
+#define ACE_HAS_BROKEN_EXPLICIT_TYPECAST_OPERATOR_INVOCATION
+
#define ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS
#define ACE_HAS_BROKEN_EXPLICIT_DESTRUCTOR
@@ -91,7 +95,7 @@
#define ACE_LACKS_READV
// rename the main entry point
-// #define ACE_MAIN extern "C" void root
+#define ACE_MAIN extern "C" void root
// All this was commented out for the single threaded port
@@ -215,6 +219,8 @@
#define ACE_PSOS_SNARFS_HEADER_INFO
+#define ACE_PSOS_LACKS_ARGC_ARGV
+
#if !defined (ACE_PSOS)
#define ACE_PSOS
#endif /* ACE_PSOS */
diff --git a/include/makeinclude/platform_psos_diab.GNU b/include/makeinclude/platform_psos_diab.GNU
index fa188475bdc..d250c30ad6d 100644
--- a/include/makeinclude/platform_psos_diab.GNU
+++ b/include/makeinclude/platform_psos_diab.GNU
@@ -80,7 +80,7 @@ CC = dcc -tMC68060FS:psos
# describe the target board. The object format is F for ELF, E for COFF,
# or N for GNU/VxWorks. The floating point support is H for hardware
# support, S for software support, or N for no floating point support
-CFLAGS += -D__DIAB -D__DIAB_42p0 -Xkill-opt=0x400 -Xno-old-style -Xlint $(PSOSINCL)
+CFLAGS += -D__DIAB -D__DIAB_42a -Xkill-opt=0x400 -Xno-old-style -Xlint $(PSOSINCL)
# C Compiler Debug Flags (passed iff debug == 1)
# -# prints subprograms with arguments as they are executed
@@ -137,11 +137,11 @@ DCCFLAGS += $(DCFLAGS)
# Dynamic Linker
# DLD = dld
-DLD = dplus -tMC68060FS:psos -Wm$(PSS_BSP)/app.lnk
+DLD = dplus -tMC68060FS:psos -Wm$(PSS_BSP)/ram.lnk
# Static Linker
# LD = dld
-LD = dplus -tMC68060FS:psos -Wm$(PSS_BSP)/app.lnk
+LD = dplus -tMC68060FS:psos -Wm$(PSS_BSP)/ram.lnk
# Static Linker Flags
# -L<path> adds a directory path to the linker search path
diff --git a/tests/Handle_Set_Test.cpp b/tests/Handle_Set_Test.cpp
index b5a88a89c22..45875b5483d 100644
--- a/tests/Handle_Set_Test.cpp
+++ b/tests/Handle_Set_Test.cpp
@@ -98,7 +98,9 @@ test_boundaries (void)
ACE_Handle_Set_Iterator i1 (handle_set);
while ((handle = i1 ()) != ACE_INVALID_HANDLE)
- ACE_ASSERT (!ASYS_TEXT ("this shouldn't get called since the set is empty!\n"));
+ {
+ ACE_ASSERT (ASYS_TEXT ("this shouldn't get called since the set is empty!\n") == 0);
+ }
// Insert the vector of HANDLEs into the set.
diff --git a/tests/Process_Strategy_Test.cpp b/tests/Process_Strategy_Test.cpp
index d4c0ed3b159..77d82b8a8bc 100644
--- a/tests/Process_Strategy_Test.cpp
+++ b/tests/Process_Strategy_Test.cpp
@@ -217,7 +217,7 @@ Options::parse_args (int argc, char *argv[])
-1);
break;
#else
- ACE_ASSERT (!"PROCESS invalid on this platform");
+ ACE_ASSERT ("PROCESS invalid on this platform" == 0);
#endif /* !defined (ACE_LACKS_FORK) */
case Options::THREAD:
#if defined (ACE_HAS_THREADS)
diff --git a/tests/RB_Tree_Test.cpp b/tests/RB_Tree_Test.cpp
index 5bf6f746d47..0e9c34bdf2f 100644
--- a/tests/RB_Tree_Test.cpp
+++ b/tests/RB_Tree_Test.cpp
@@ -10,12 +10,14 @@
//
// = DESCRIPTION
// This is a test to verify and illustrate the use of the ACE_RB_Tree
-// and ACE_RB_Tree_Iterator classes. Two different less than comparison
-// function object types are demonstrated for native key types int (for
-// which the native < operator is sufficient) and char * (for which the
-// native < operator is not sufficient). An RB tree for each of the four
-// possible type parameter combinations over int and char * is constructed
-// and filled in, and the resulting order checked via an iterator.
+// and ACE_RB_Tree_Iterator classes. Two different key and item types are
+// used in order to demonstrate specialization of the ACE_Less_Than
+// comparison function object template: int (for which the native <
+// operator is sufficient), and char * (for which < operator semantics must
+// be replaced by strcmp semantics). An RB tree for each of the four
+// possible type parameter permutations over int and char * is constructed
+// and filled in, and the resulting order is checked via an iterator over
+// each.
//
// = AUTHOR
// Chris Gill <cdgill@cs.wustl.edu>
@@ -52,33 +54,6 @@ static int str_str_index [] = {4, 2, 1, 0, 3, 6, 5, 7}; // LR preorder
// Number of entries placed in each tree.
static int RB_TREE_TEST_ENTRIES = 8;
-class RB_Test_String_Less_Than_Functor :
- public ACE_Const_Binary_Functor_Base<char *, char *>
-{
- // = TITLE
- // Defines a class template that allows us to invoke a binary less than
- // function over two parameterized types without knowing anything about
- // the function and operand objects except their types.
- //
- // = DESCRIPTION
- // This class depends on the definition
- // objects of the paramterized types. A class can invoke such
- // an operation without knowing anything about it, or its implementation.
- //
-public:
-
- virtual int execute (char * const & operand1,
- char * const & operand2)
- {return (ACE_OS::strcmp (operand1, operand2) < 0) ? 1 : 0;}
- // Invokes the function object.
-
- virtual ACE_Const_Binary_Functor_Base<char *, char *> * clone ()
- {return new RB_Test_String_Less_Than_Functor;}
- // Creates another object of the same type.
-};
-
-
-
int
main (int, ASYS_TCHAR *[])
{
@@ -87,14 +62,13 @@ main (int, ASYS_TCHAR *[])
// Local variables used to index arrays.
int i, k;
- // Construct four RB_Trees, using the default comparison semantics for those
- // keyed with int, and using a custom comparison function object for those
- // keyed with char *.
- RB_Test_String_Less_Than_Functor strcmp_functor;
- ACE_RB_Tree<int, int> int_int_tree;
- ACE_RB_Tree<int, char *> int_str_tree;
- ACE_RB_Tree<char *, int> str_int_tree (&strcmp_functor);
- ACE_RB_Tree<char *, char *> str_str_tree (&strcmp_functor);
+ // Construct four RB_Trees. Specialization of the ACE_Less_Than template
+ // for character strings performs strcmp style string comparisons rather
+ // than < operator comparison of the pointers themselves.
+ ACE_RB_Tree<int, int, ACE_Less_Than<int>, ACE_Null_Mutex> int_int_tree;
+ ACE_RB_Tree<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex> int_str_tree;
+ ACE_RB_Tree<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex> str_int_tree;
+ ACE_RB_Tree<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex> str_str_tree;
// Fill in each tree with the key and item from the appropriate arrays,
// using the shuffle indexes to create different insertion orders.
@@ -130,10 +104,10 @@ main (int, ASYS_TCHAR *[])
}
// Construct an iterator for each of the trees.
- ACE_RB_Tree_Iterator<int, int> int_int_iter (int_int_tree);
- ACE_RB_Tree_Iterator<int, char *> int_str_iter (int_str_tree);
- ACE_RB_Tree_Iterator<char *, int> str_int_iter (str_int_tree);
- ACE_RB_Tree_Iterator<char *, char *> str_str_iter (str_str_tree);
+ ACE_RB_Tree_Iterator<int, int, ACE_Less_Than<int>, ACE_Null_Mutex> int_int_iter (int_int_tree);
+ ACE_RB_Tree_Iterator<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex> int_str_iter (int_str_tree);
+ ACE_RB_Tree_Iterator<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex> str_int_iter (str_int_tree);
+ ACE_RB_Tree_Iterator<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex> str_str_iter (str_str_tree);
// Iterate over each of the trees, making sure their entries
// are in the same relative order (i.e., the integers and strings
@@ -229,38 +203,30 @@ main (int, ASYS_TCHAR *[])
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Const_Binary_Functor_Base<char *, char *>;
-template class ACE_Const_Binary_Functor_Base<int, int>;
-template class ACE_Less_Than_Functor<char *, char *>;
-template class ACE_Less_Than_Functor<int, int>;
-template class ACE_RB_Tree<int, int>;
+template class ACE_RB_Tree<int, int, ACE_Less_Than<int>, ACE_Null_Mutex>;
template class ACE_RB_Tree_Node<int, int>;
-template class ACE_RB_Tree_Iterator<int, int>;
-template class ACE_RB_Tree<int, char *>;
+template class ACE_RB_Tree_Iterator<int, int, ACE_Less_Than<int>, ACE_Null_Mutex>;
+template class ACE_RB_Tree<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex>;
template class ACE_RB_Tree_Node<int, char *>;
-template class ACE_RB_Tree_Iterator<int, char *>;
-template class ACE_RB_Tree<char *, int>;
+template class ACE_RB_Tree_Iterator<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex>;
+template class ACE_RB_Tree<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex>;
template class ACE_RB_Tree_Node<char *, int>;
-template class ACE_RB_Tree_Iterator<char *, int>;
-template class ACE_RB_Tree<char *, char *>;
+template class ACE_RB_Tree_Iterator<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex>;
+template class ACE_RB_Tree<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex>;
template class ACE_RB_Tree_Node<char *, char *>;
-template class ACE_RB_Tree_Iterator<char *, char *>;
+template class ACE_RB_Tree_Iterator<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Const_Binary_Functor_Base<char *, char *>
-#pragma instantiate ACE_Const_Binary_Functor_Base<int, int>
-#pragma instantiate ACE_Less_Than_Functor<char *, char *>
-#pragma instantiate ACE_Less_Than_Functor<int, int>
-#pragma instantiate ACE_RB_Tree<int, int>
+#pragma instantiate ACE_RB_Tree<int, int, ACE_Less_Than<int>, ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Node<int, int>
-#pragma instantiate ACE_RB_Tree_Iterator<int, int>
-#pragma instantiate ACE_RB_Tree<int, char *>
+#pragma instantiate ACE_RB_Tree_Iterator<int, int, ACE_Less_Than<int>, ACE_Null_Mutex>
+#pragma instantiate ACE_RB_Tree<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Node<int, char *>
-#pragma instantiate ACE_RB_Tree_Iterator<int, char *>
-#pragma instantiate ACE_RB_Tree<char *, int>
+#pragma instantiate ACE_RB_Tree_Iterator<int, char *, ACE_Less_Than<int>, ACE_Null_Mutex>
+#pragma instantiate ACE_RB_Tree<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Node<char *, int>
-#pragma instantiate ACE_RB_Tree_Iterator<char *, int>
-#pragma instantiate ACE_RB_Tree<char *, char *>
+#pragma instantiate ACE_RB_Tree_Iterator<char *, int, ACE_Less_Than<char *>, ACE_Null_Mutex>
+#pragma instantiate ACE_RB_Tree<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex>
#pragma instantiate ACE_RB_Tree_Node<char *, char *>
-#pragma instantiate ACE_RB_Tree_Iterator<char *, char *>
+#pragma instantiate ACE_RB_Tree_Iterator<char *, char *, ACE_Less_Than<char *>, ACE_Null_Mutex>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/tests/Reactor_Performance_Test.cpp b/tests/Reactor_Performance_Test.cpp
index 00fbf89613e..9cd10445e21 100644
--- a/tests/Reactor_Performance_Test.cpp
+++ b/tests/Reactor_Performance_Test.cpp
@@ -121,7 +121,7 @@ Read_Handler::handle_close (ACE_HANDLE handle,
ACE_UNUSED_ARG (close_mask);
// Reduce count.
- this->waiting_--;
+ waiting_--;
// If no connections are open.
if (waiting_ == 0)
diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp
index 676b9a27600..48b1a446488 100644
--- a/tests/TSS_Test.cpp
+++ b/tests/TSS_Test.cpp
@@ -174,7 +174,9 @@ worker (void *c)
// types when used with ACE_TSS. See DESCRIPTION of template
// class ACE_TSS_Type_Adapter in ace/Synch_T.h for what this
// should look like. Unfortunately, some compilers have trouble
- // with the implicit type conversions.
+ // with the implicit type conversions. Others have problems with
+ // the *explicit* type conversions.
+#if !defined (ACE_HAS_BROKEN_EXPLICIT_TYPECAST_OPERATOR_INVOCATION)
(*u)->operator u_int & () = 37;
if ((*u)->operator u_int () != 37)
{
@@ -185,6 +187,7 @@ worker (void *c)
ASYS_TEXT ("is %u, it should be 37!\n"), (*u)->operator u_int ()));
++errors;
}
+#endif /* !defined (ACE_HAS_BROKEN_EXPLICIT_TYPECAST_OPERATOR_INVOCATION) */
#if !defined (__Lynx__) || defined (ACE_HAS_TSS_EMULATION)
key = ACE_OS::NULL_key;