/* -*- C++ -*- */ // $Id$ // ============================================================================ // // = LIBRARY // ace // // = FILENAME // Functor.i // // = DESCRIPTION // Inlinable method definitions for non-templatized classes // and template specializations implementing the GOF Command Pattern, // and STL-style functors. // // = AUTHOR // Chris Gill // // Based on Command Pattern implementations originally done by // // Carlos O'Ryan and // Douglas C. Schmidt and // Sergio Flores-Gaitan // // and on STL-style functor implementations originally done by // // Irfan Pyarali // // ============================================================================ ////////////////////////////////////////////////////////////// // GOF Command Pattern Classes and Template Specializations // ////////////////////////////////////////////////////////////// // Default constructor. ACE_INLINE ACE_Command_Base::ACE_Command_Base (void) { } // Virtaul destructor. ACE_INLINE ACE_Command_Base::~ACE_Command_Base (void) { } //////////////////////////////////////////////////////////// // STL-style Functor Classes and Template Specializations // //////////////////////////////////////////////////////////// ACE_INLINE u_long ACE_Hash::operator () (char t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (signed char t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (unsigned char t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (short t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (unsigned short t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (int t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (unsigned int t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (long t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (unsigned long t) const { return t; } ACE_INLINE u_long ACE_Hash::operator () (const char *t) const { return ACE::hash_pjw (t); } ACE_INLINE u_long ACE_Hash::operator () (const char *t) const { return ACE::hash_pjw (t); } #if !defined (ACE_HAS_WCHAR_TYPEDEFS_CHAR) ACE_INLINE u_long ACE_Hash::operator () (const wchar_t *t) const { return ACE::hash_pjw (t); } ACE_INLINE u_long ACE_Hash::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::operator () (const ACE_USHORT16 *t) const { return ACE::hash_pjw (t); } ACE_INLINE u_long ACE_Hash::operator () (const ACE_USHORT16 *t) const { return ACE::hash_pjw (t); } #endif /* ! ACE_HAS_WCHAR_TYPEDEFS_USHORT */ ACE_INLINE int ACE_Equal_To::operator () (const char *lhs, const char *rhs) const { return !ACE_OS::strcmp (lhs, rhs); } ACE_INLINE int ACE_Equal_To::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::operator () (const wchar_t *lhs, const wchar_t *rhs) const { return !ACE_OS::strcmp (lhs, rhs); } ACE_INLINE int ACE_Equal_To::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::operator () (const ACE_USHORT16 *lhs, const ACE_USHORT16 *rhs) const { return !ACE_OS::strcmp (lhs, rhs); } ACE_INLINE int ACE_Equal_To::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::operator () (const char *lhs, const char *rhs) const { return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; } ACE_INLINE int ACE_Less_Than::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::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::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::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::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 */