diff options
Diffstat (limited to 'ace')
1187 files changed, 12349 insertions, 11564 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp index d94fabfaf69..af89390c667 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -23,9 +23,9 @@ #include "ace/OS_NS_ctype.h" #include "ace/OS_TLI.h" -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) extern "C" int maxFiles; -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ #if !defined (__ACE_INLINE__) #include "ace/ACE.inl" @@ -41,6 +41,9 @@ ACE_RCSID (ace, "$Id$") +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE { // private: @@ -211,7 +214,7 @@ ACE::select (int width, #if !defined (ACE_WIN32) if (result > 0) readfds.sync ((ACE_HANDLE) width); -#endif /* ACE_WIN64 */ +#endif /* ACE_WIN32 */ return result; } @@ -617,7 +620,7 @@ ACE::recv_n_i (ACE_HANDLE handle, { // Try to transfer as much of the remaining data as possible. n = ACE_OS::recv (handle, - (char *) buf + bytes_transferred, + static_cast <char *> (buf) + bytes_transferred, len - bytes_transferred, flags); // Check EOF. @@ -676,7 +679,7 @@ ACE::recv_n_i (ACE_HANDLE handle, // Since the socket is in non-blocking mode, this call will not // block. n = ACE_OS::recv (handle, - (char *) buf + bytes_transferred, + static_cast <char *> (buf) + bytes_transferred, len - bytes_transferred, flags); @@ -856,7 +859,7 @@ ACE::recv_n_i (ACE_HANDLE handle, { // Try to transfer as much of the remaining data as possible. n = ACE::recv_i (handle, - (char *) buf + bytes_transferred, + static_cast <char *> (buf) + bytes_transferred, len - bytes_transferred); // Check EOF. if (n == 0) @@ -914,7 +917,7 @@ ACE::recv_n_i (ACE_HANDLE handle, // Since the socket is in non-blocking mode, this call will not // block. n = ACE::recv_i (handle, - (char *) buf + bytes_transferred, + static_cast <char *> (buf) + bytes_transferred, len - bytes_transferred); // Check for errors. @@ -1200,7 +1203,7 @@ ACE::recv_n (ACE_HANDLE handle, this_rd_ptr += this_chunk_length; // Increment iovec counter. - iovcnt++; + ++iovcnt; // The buffer is full make a OS call. @@ TODO find a way to // find ACE_IOV_MAX for platforms that do not define it rather @@ -2009,7 +2012,7 @@ ACE::write_n (ACE_HANDLE handle, this_block_ptr += this_chunk_length; // Increment iovec counter. - iovcnt++; + ++iovcnt; // The buffer is full make a OS call. @@ TODO find a way to // find ACE_IOV_MAX for platforms that do not define it rather @@ -2107,7 +2110,7 @@ ACE::send_n (ACE_HANDLE handle, this_block_ptr += this_chunk_length; // Increment iovec counter. - iovcnt++; + ++iovcnt; // The buffer is full make a OS call. @@ TODO find a way to // find ACE_IOV_MAX for platforms that do not define it rather @@ -2401,7 +2404,7 @@ ACE::format_hexdump (const char *buffer, { ACE_OS::sprintf (obuf, ACE_LIB_TEXT (" ")); - obuf++; + ++obuf; } textver[j] = ACE_OS::ace_isprint (c) ? c : '.'; } @@ -2429,7 +2432,7 @@ ACE::format_hexdump (const char *buffer, { ACE_OS::sprintf (obuf, ACE_LIB_TEXT (" ")); - obuf++; + ++obuf; } textver[i] = ACE_OS::ace_isprint (c) ? c : '.'; } @@ -2654,7 +2657,7 @@ ACE::handle_timed_complete (ACE_HANDLE h, need_to_check = 1; known_failure = 1; } -#elif defined (VXWORKS) +#elif defined (ACE_VXWORKS) ACE_UNUSED_ARG (is_tli); // Force the check on VxWorks. The read handle for "h" is not set, @@ -2805,7 +2808,6 @@ ACE::handle_timed_accept (ACE_HANDLE listener, /* NOTREACHED */ } } - ACE_NOTREACHED (return 0); } // Make the current process a UNIX daemon. This is based on Stevens @@ -2936,7 +2938,7 @@ ACE::max_handles (void) #if defined (_SC_OPEN_MAX) return ACE_OS::sysconf (_SC_OPEN_MAX); -#elif defined (VXWORKS) +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) return maxFiles; #elif defined (FD_SETSIZE) return FD_SETSIZE; @@ -3438,18 +3440,6 @@ ACE::strnew (const wchar_t *s) return ACE_OS::strcpy (t, s); } -void -ACE::strdelete (char *s) -{ - delete [] s; -} - -void -ACE::strdelete (wchar_t *s) -{ - delete [] s; -} - inline static bool equal_char(char a, char b, bool case_sensitive) { if (case_sensitive) @@ -3503,3 +3493,6 @@ ACE::wild_match(const char* str, const char* pat, bool case_sensitive) return *p == '\0'; } + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ACE.h b/ace/ACE.h index 12b4934bcf5..581d239c41e 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -35,11 +35,6 @@ #include "ace/Sock_Connect.h" #include "ace/Default_Constants.h" -// Forward declarations. -class ACE_Time_Value; -class ACE_Message_Block; -class ACE_Handle_Set; - #if defined (CYGWIN32) // Include math.h. math.h defines a macro log2 that conflicts with ACE::log2() // which seems to only cause a problem on cygwin. Insuring that math.h is @@ -59,6 +54,13 @@ class ACE_Handle_Set; #endif #define ACE_EXPORT_MACRO ACE_Export +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations. +class ACE_Time_Value; +class ACE_Message_Block; +class ACE_Handle_Set; /** * @namespace ACE @@ -98,7 +100,7 @@ namespace ACE /// Check if error indicates the process being out of handles (file /// descriptors). extern ACE_Export int out_of_handles (int error); - + /// Simple wildcard matching function supporting '*' and '?' /// return true if string s matches pattern. extern ACE_Export bool wild_match(const char* s, const char* pattern, bool case_sensitive = true); @@ -415,7 +417,7 @@ namespace ACE extern ACE_Export char *strnew (const char *s); /// Delete the memory allocated by @c strnew. - extern ACE_Export void strdelete (char *s); + ACE_NAMESPACE_INLINE_FUNCTION void strdelete (char *s); /// Create a fresh new copy of @a str, up to @a n chars long. Uses /// @c ACE_OS::malloc to allocate the new string. @@ -429,7 +431,7 @@ namespace ACE extern ACE_Export wchar_t *strnew (const wchar_t *s); - extern ACE_Export void strdelete (wchar_t *s); + ACE_NAMESPACE_INLINE_FUNCTION void strdelete (wchar_t *s); extern ACE_Export wchar_t *strndup (const wchar_t *str, size_t n); @@ -492,7 +494,10 @@ namespace ACE * if @a avoid_zombies == 0 call @c ACE_OS::fork directly, else * create an orphan process that's inherited by the init process; * init cleans up when the orphan process terminates so we don't - * create zombies. + * create zombies. Returns -1 on failure and either the child PID + * on success if @a avoid_zombies == 0 or 1 on success if @a + * avoid_zombies != 0 (this latter behavior is a known bug that + * needs to be fixed). */ extern ACE_Export pid_t fork ( const ACE_TCHAR *program_name = ACE_LIB_TEXT ("<unknown>"), @@ -816,6 +821,9 @@ namespace ACE } +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/ACE.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/ACE.inl b/ace/ACE.inl index 1462d083e53..a755557fe5c 100644 --- a/ace/ACE.inl +++ b/ace/ACE.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_unistd.h" @@ -6,6 +7,10 @@ #include "ace/os_include/os_ctype.h" #include "ace/OS_NS_sys_socket.h" +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + // Wrappers for methods that have been moved to ACE_OS. ACE_INLINE ssize_t @@ -266,6 +271,20 @@ ACE::handle_exception_ready (ACE_HANDLE handle, } ACE_INLINE void +ACE::strdelete (char *s) +{ + delete [] s; +} + +#if defined (ACE_HAS_WCHAR) +ACE_INLINE void +ACE::strdelete (wchar_t *s) +{ + delete [] s; +} +#endif /* ACE_HAS_WCHAR */ + +ACE_INLINE void ACE::unique_name (const void *object, ACE_TCHAR *name, size_t length) @@ -312,3 +331,6 @@ ACE::hex2byte (ACE_TCHAR c) else return (u_char) (10 + c - ACE_LIB_TEXT ('A')); } + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ACE.pc.in b/ace/ACE.pc.in index b5c4d91f3f1..90b2a9eebd7 100644 --- a/ace/ACE.pc.in +++ b/ace/ACE.pc.in @@ -6,5 +6,5 @@ includedir=@includedir@ Name: ACE Description: ADAPTIVE Communication Environment Version: @VERSION@ -Libs: -L${libdir} -lACE +Libs: -L${libdir} -lACE @LIBS@ Cflags: -I${includedir} diff --git a/ace/ACE_Memory_export.h b/ace/ACE_Memory_export.h deleted file mode 100644 index 20edd951d96..00000000000 --- a/ace/ACE_Memory_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_Memory -// ------------------------------ -#ifndef ACE_MEMORY_EXPORT_H -#define ACE_MEMORY_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_MEMORY_HAS_DLL) -# define ACE_MEMORY_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_MEMORY_HAS_DLL */ - -#if !defined (ACE_MEMORY_HAS_DLL) -# define ACE_MEMORY_HAS_DLL 1 -#endif /* ! ACE_MEMORY_HAS_DLL */ - -#if defined (ACE_MEMORY_HAS_DLL) && (ACE_MEMORY_HAS_DLL == 1) -# if defined (ACE_MEMORY_BUILD_DLL) -# define ACE_Memory_Export ACE_Proper_Export_Flag -# define ACE_MEMORY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_MEMORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_MEMORY_BUILD_DLL */ -# define ACE_Memory_Export ACE_Proper_Import_Flag -# define ACE_MEMORY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_MEMORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_MEMORY_BUILD_DLL */ -#else /* ACE_MEMORY_HAS_DLL == 1 */ -# define ACE_Memory_Export -# define ACE_MEMORY_SINGLETON_DECLARATION(T) -# define ACE_MEMORY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_MEMORY_HAS_DLL == 1 */ - -// Set ACE_MEMORY_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_MEMORY_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_MEMORY_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_MEMORY_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_MEMORY_NTRACE */ - -#if (ACE_MEMORY_NTRACE == 1) -# define ACE_MEMORY_TRACE(X) -#else /* (ACE_MEMORY_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_MEMORY_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_MEMORY_NTRACE == 1) */ - -#endif /* ACE_MEMORY_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_Reactor_export.h b/ace/ACE_Reactor_export.h deleted file mode 100644 index 8ec100011e8..00000000000 --- a/ace/ACE_Reactor_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_Reactor -// ------------------------------ -#ifndef ACE_REACTOR_EXPORT_H -#define ACE_REACTOR_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_REACTOR_HAS_DLL) -# define ACE_REACTOR_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_REACTOR_HAS_DLL */ - -#if !defined (ACE_REACTOR_HAS_DLL) -# define ACE_REACTOR_HAS_DLL 1 -#endif /* ! ACE_REACTOR_HAS_DLL */ - -#if defined (ACE_REACTOR_HAS_DLL) && (ACE_REACTOR_HAS_DLL == 1) -# if defined (ACE_REACTOR_BUILD_DLL) -# define ACE_Reactor_Export ACE_Proper_Export_Flag -# define ACE_REACTOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_REACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_REACTOR_BUILD_DLL */ -# define ACE_Reactor_Export ACE_Proper_Import_Flag -# define ACE_REACTOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_REACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_REACTOR_BUILD_DLL */ -#else /* ACE_REACTOR_HAS_DLL == 1 */ -# define ACE_Reactor_Export -# define ACE_REACTOR_SINGLETON_DECLARATION(T) -# define ACE_REACTOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_REACTOR_HAS_DLL == 1 */ - -// Set ACE_REACTOR_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_REACTOR_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_REACTOR_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_REACTOR_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_REACTOR_NTRACE */ - -#if (ACE_REACTOR_NTRACE == 1) -# define ACE_REACTOR_TRACE(X) -#else /* (ACE_REACTOR_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_REACTOR_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_REACTOR_NTRACE == 1) */ - -#endif /* ACE_REACTOR_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_Sockets_export.h b/ace/ACE_Sockets_export.h deleted file mode 100644 index 1c57c959dc9..00000000000 --- a/ace/ACE_Sockets_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_Sockets -// ------------------------------ -#ifndef ACE_SOCKETS_EXPORT_H -#define ACE_SOCKETS_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_SOCKETS_HAS_DLL) -# define ACE_SOCKETS_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_SOCKETS_HAS_DLL */ - -#if !defined (ACE_SOCKETS_HAS_DLL) -# define ACE_SOCKETS_HAS_DLL 1 -#endif /* ! ACE_SOCKETS_HAS_DLL */ - -#if defined (ACE_SOCKETS_HAS_DLL) && (ACE_SOCKETS_HAS_DLL == 1) -# if defined (ACE_SOCKETS_BUILD_DLL) -# define ACE_Sockets_Export ACE_Proper_Export_Flag -# define ACE_SOCKETS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_SOCKETS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_SOCKETS_BUILD_DLL */ -# define ACE_Sockets_Export ACE_Proper_Import_Flag -# define ACE_SOCKETS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_SOCKETS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_SOCKETS_BUILD_DLL */ -#else /* ACE_SOCKETS_HAS_DLL == 1 */ -# define ACE_Sockets_Export -# define ACE_SOCKETS_SINGLETON_DECLARATION(T) -# define ACE_SOCKETS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_SOCKETS_HAS_DLL == 1 */ - -// Set ACE_SOCKETS_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_SOCKETS_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_SOCKETS_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_SOCKETS_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_SOCKETS_NTRACE */ - -#if (ACE_SOCKETS_NTRACE == 1) -# define ACE_SOCKETS_TRACE(X) -#else /* (ACE_SOCKETS_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_SOCKETS_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_SOCKETS_NTRACE == 1) */ - -#endif /* ACE_SOCKETS_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_Threads_export.h b/ace/ACE_Threads_export.h deleted file mode 100644 index d19193d9127..00000000000 --- a/ace/ACE_Threads_export.h +++ /dev/null @@ -1,58 +0,0 @@ - -// -*- C++ -*- -// $Id$ -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s ACE_Threads -// ------------------------------ -#ifndef ACE_THREADS_EXPORT_H -#define ACE_THREADS_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_THREADS_HAS_DLL) -# define ACE_THREADS_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && ACE_THREADS_HAS_DLL */ - -#if !defined (ACE_THREADS_HAS_DLL) -# define ACE_THREADS_HAS_DLL 1 -#endif /* ! ACE_THREADS_HAS_DLL */ - -#if defined (ACE_THREADS_HAS_DLL) && (ACE_THREADS_HAS_DLL == 1) -# if defined (ACE_THREADS_BUILD_DLL) -# define ACE_Threads_Export ACE_Proper_Export_Flag -# define ACE_THREADS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define ACE_THREADS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* ACE_THREADS_BUILD_DLL */ -# define ACE_Threads_Export ACE_Proper_Import_Flag -# define ACE_THREADS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define ACE_THREADS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* ACE_THREADS_BUILD_DLL */ -#else /* ACE_THREADS_HAS_DLL == 1 */ -# define ACE_Threads_Export -# define ACE_THREADS_SINGLETON_DECLARATION(T) -# define ACE_THREADS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* ACE_THREADS_HAS_DLL == 1 */ - -// Set ACE_THREADS_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (ACE_THREADS_NTRACE) -# if (ACE_NTRACE == 1) -# define ACE_THREADS_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define ACE_THREADS_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !ACE_THREADS_NTRACE */ - -#if (ACE_THREADS_NTRACE == 1) -# define ACE_THREADS_TRACE(X) -#else /* (ACE_THREADS_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define ACE_THREADS_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (ACE_THREADS_NTRACE == 1) */ - -#endif /* ACE_THREADS_EXPORT_H */ - -// End of auto generated file. diff --git a/ace/ACE_crc32.cpp b/ace/ACE_crc32.cpp index 1320ed59085..f9e91c652ce 100644 --- a/ace/ACE_crc32.cpp +++ b/ace/ACE_crc32.cpp @@ -104,6 +104,9 @@ namespace #define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_UINT32 ACE::crc32 (const char *string) { @@ -143,7 +146,7 @@ ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc) for (int i = 0; i < len; ++i) { for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; + *e = (const char *) iov[i].iov_base + iov[i].iov_len; p != e; ++p) COMPUTE (crc, *p); @@ -152,4 +155,7 @@ ACE::crc32 (const iovec *iov, int len, ACE_UINT32 crc) return ~crc; } +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + #undef COMPUTE diff --git a/ace/ACE_crc_ccitt.cpp b/ace/ACE_crc_ccitt.cpp index e81f3419831..f591b53aa10 100644 --- a/ace/ACE_crc_ccitt.cpp +++ b/ace/ACE_crc_ccitt.cpp @@ -71,6 +71,9 @@ namespace #define COMPUTE(var, ch) (var) = (crc_table[(var ^ ch) & 0xFF] ^ (var >> 8)) +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_UINT16 ACE::crc_ccitt (const char *string) { @@ -110,7 +113,7 @@ ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc) for (int i = 0; i < len; ++i) { for (const char *p = (const char *) iov[i].iov_base, - *e = (const char *) iov[i].iov_base + iov[i].iov_len; + *e = (const char *) iov[i].iov_base + iov[i].iov_len; p != e; ++p) COMPUTE (crc, *p); @@ -119,4 +122,7 @@ ACE::crc_ccitt (const iovec *iov, int len, ACE_UINT16 crc) return ~crc; } +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + #undef COMPUTE diff --git a/ace/ACE_export.h b/ace/ACE_export.h index ac0722f3d90..e14f71bad90 100644 --- a/ace/ACE_export.h +++ b/ace/ACE_export.h @@ -52,13 +52,21 @@ #if defined (__ACE_INLINE__) # if defined (_MSC_VER) || defined (__MINGW32__) || defined (CYGWIN32) || \ - (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x560) + (defined (__SUNPRO_CC) && __SUNPRO_CC >= 0x560) || \ + (defined (__HP_aCC) && (__HP_aCC >= 60500)) # define ACE_NAMESPACE_INLINE_FUNCTION inline # else # define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS inline # endif +# define ACE_INLINE_TEMPLATE_FUNCTION inline #else # define ACE_NAMESPACE_INLINE_FUNCTION ACE_NAMESPACE_STORAGE_CLASS +// Microsoft Visual C++ will accept 'extern'; others refuse. +# if defined (_MSC_VER) || defined (__BORLANDC__) +# define ACE_INLINE_TEMPLATE_FUNCTION ACE_Export +# else +# define ACE_INLINE_TEMPLATE_FUNCTION +# endif #endif #endif /* ACE_EXPORT_H */ diff --git a/ace/ARGV.cpp b/ace/ARGV.cpp index 8109c3c215c..97a3cd7ae1a 100644 --- a/ace/ARGV.cpp +++ b/ace/ARGV.cpp @@ -1,4 +1,3 @@ -// ARGV.cpp // $Id$ // Transforms a string BUF into an ARGV-style vector of strings. @@ -9,289 +8,15 @@ #include "ace/ARGV.inl" #endif /* __ACE_INLINE__ */ -#include "ace/Log_Msg.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_Memory.h" +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_RCSID(ace, ARGV, "$Id$") -ACE_ALLOC_HOOK_DEFINE (ACE_ARGV) - -void -ACE_ARGV::dump (void) const -{ -#if defined (ACE_HAS_DUMP) - ACE_TRACE ("ACE_ARGV::dump"); - - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("argc_ = %d"), this->argc_)); - - ACE_ARGV *this_obj = const_cast<ACE_ARGV *> (this); - - for (int i = 0; i < this->argc_; i++) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("\nargv_[%i] = %s"), - i, - this_obj->argv ()[i])); - - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nbuf = %s\n"), this->buf_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\n"))); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* ACE_HAS_DUMP */ -} - -// Creates this->argv_ out of this->buf_. New memory is allocated for -// each element of the array. This is used by the array-to-string -// style constructor and for creating this->argv_ when in iterative -// mode. - -int -ACE_ARGV::string_to_argv (void) -{ - ACE_TRACE ("ACE_ARGV::string_to_argv"); - - return ACE_OS::string_to_argv (this->buf_, - this->argc_, - this->argv_, - this->substitute_env_args_); -} - -int -ACE_ARGV::argv_to_string (ACE_TCHAR **argv, ACE_TCHAR *&buf) -{ - return ACE_OS::argv_to_string (argv, buf); -} - -ACE_ARGV::ACE_ARGV (const ACE_TCHAR buf[], - int substitute_env_args) - : substitute_env_args_ (substitute_env_args), - state_ (TO_PTR_ARRAY), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV::ACE_ARGV ACE_TCHAR[] to ACE_TCHAR *[]"); - - if (buf == 0 || buf[0] == 0) - return; - - // Make an internal copy of the string. - ACE_NEW (this->buf_, - ACE_TCHAR[ACE_OS::strlen (buf) + 1]); - ACE_OS::strcpy (this->buf_, buf); - - // Create this->argv_. - if (this->string_to_argv () == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("string_to_argv"))); -} - -ACE_ARGV::ACE_ARGV (ACE_TCHAR *argv[], - int substitute_env_args) - : substitute_env_args_ (substitute_env_args), - state_ (TO_STRING), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV::ACE_ARGV ACE_TCHAR*[] to ACE_TCHAR[]"); - - if (argv == 0 || argv[0] == 0) - return; - - this->argc_ = ACE_OS::argv_to_string (argv, this->buf_, substitute_env_args); -} - -ACE_ARGV::ACE_ARGV (ACE_TCHAR *first_argv[], - ACE_TCHAR *second_argv[], - int substitute_env_args) - : substitute_env_args_ (substitute_env_args), - state_ (TO_STRING), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV::ACE_ARGV ACE_TCHAR*[] + ACE_TCHAR *[] to ACE_TCHAR[]"); - - int first_argc; - int second_argc; - - ACE_TCHAR *first_buf; - ACE_TCHAR *second_buf; - - // convert the first argv to a string - first_argc = this->argv_to_string (first_argv, first_buf); - - // convert the second argv to a string - second_argc = this->argv_to_string (second_argv, second_buf); - - // Add the number of arguments in both the argvs. - this->argc_ = first_argc + second_argc; - - size_t buf_len = - ACE_OS::strlen (first_buf) + ACE_OS::strlen (second_buf) + 1; - - // Allocate memory to the lenght of the combined argv string. - ACE_NEW (this->buf_, - ACE_TCHAR[buf_len + 1]); - - // copy the first argv string to the buffer - ACE_OS::strcpy (this->buf_, first_buf); - - // concatenate the second argv string to the buffer - ACE_OS::strcat (this->buf_, second_buf); - - // Delete the first and second buffers - - delete [] first_buf; - - delete [] second_buf; -} - - -ACE_ARGV::ACE_ARGV (int substitute_env_args) - : substitute_env_args_ (substitute_env_args), - state_ (ITERATIVE), - argc_ (0), - argv_ (0), - buf_ (0), - length_ (0), - queue_ () -{ - ACE_TRACE ("ACE_ARGV::ACE_ARGV Iterative"); - - // Nothing to do yet -- the user puts in arguments via add () -} - -int -ACE_ARGV::add (const ACE_TCHAR *next_arg) -{ - // Only allow this to work in the "iterative" verion -- the - // ACE_ARGVs created with the one argument constructor. - if (this->state_ != ITERATIVE) - { - errno = EINVAL; - return -1; - } - - // Put the new argument at the end of the queue. - if (this->queue_.enqueue_tail (const_cast <ACE_TCHAR *> (next_arg)) == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("Can't add more to ARGV queue")), - -1); - - this->length_ += ACE_OS::strlen (next_arg); - - this->argc_++; - - // Wipe argv_ and buf_ away so that they will be recreated if the - // user calls argv () or buf (). - if (this->argv_ != 0) - { - for (int i = 0; this->argv_[i] != 0; i++) - ACE_OS::free ((void *) this->argv_[i]); - - delete [] this->argv_; - this->argv_ = 0; - } - - delete [] this->buf_; - this->buf_ = 0; - - return 0; -} - -int -ACE_ARGV::add (ACE_TCHAR *argv[]) -{ - for (int i = 0; argv[i] != 0; i++) - if (this->add (argv[i]) == -1) - return -1; - - return 0; -} - -// Free up argv_ and buf_ - -ACE_ARGV::~ACE_ARGV (void) -{ - ACE_TRACE ("ACE_ARGV::~ACE_ARGV"); - - if (this->argv_ != 0) - for (int i = 0; this->argv_[i] != 0; i++) - ACE_OS::free ((void *) this->argv_[i]); - - delete [] this->argv_; - delete [] this->buf_; -} - -// Create buf_ out of the queue_. This is only used in the -// "iterative" mode. - -int -ACE_ARGV::create_buf_from_queue (void) -{ - ACE_TRACE ("ACE_ARGV::create_buf_from_queue"); - - // If the are no arguments, don't do anything - if (this->argc_ <= 0) - return -1; - - delete [] this->buf_; - - ACE_NEW_RETURN (this->buf_, - ACE_TCHAR[this->length_ + this->argc_], - -1); - - // Get an iterator over the queue - ACE_Unbounded_Queue_Iterator<ACE_TCHAR *> iter (this->queue_); - - ACE_TCHAR **arg; - ACE_TCHAR *ptr = this->buf_; - size_t len; - int more = 0; - - while (!iter.done ()) - { - // Get next argument from the queue. - iter.next (arg); - - more = iter.advance (); - - len = ACE_OS::strlen (*arg); - - // Copy the argument into buf_ - ACE_OS::memcpy ((void *) ptr, - (const void *) (*arg), - len * sizeof (ACE_TCHAR)); - // Move the pointer down. - ptr += len; - - // Put in an argument separating space. - if (more != 0) - *ptr++ = ' '; - } - - // Put in the NUL terminator - *ptr = '\0'; +#if !defined (__ACE_INLINE__) +template class ACE_TARGV<ACE_TCHAR>; +#endif /* __ACE_INLINE__ */ - return 0; -} -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Unbounded_Queue<ACE_TCHAR *>; -template class ACE_Unbounded_Queue_Iterator<ACE_TCHAR *>; -template class ACE_Node<ACE_TCHAR *>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Unbounded_Queue<ACE_TCHAR *> -#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_TCHAR *> -#pragma instantiate ACE_Node<ACE_TCHAR *> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ARGV.h b/ace/ARGV.h index 9cb3ff73474..09c83fcca06 100644 --- a/ace/ARGV.h +++ b/ace/ARGV.h @@ -23,6 +23,9 @@ #include "ace/Unbounded_Queue.h" +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_TARGV * @@ -31,7 +34,7 @@ * variable values for tokens that are environment variable references. */ template < typename CHAR_TYPE = char > -class ACE_TARGV +class ACE_Export ACE_TARGV { public: // = Initialization and termination. @@ -178,7 +181,13 @@ private: typedef ACE_TARGV<ACE_TCHAR> ACE_ARGV; +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) #include "ace/ARGV.inl" +#endif /* __ACE_INLINE__ */ + #include /**/ "ace/post.h" #endif /* ACE_ARGUMENT_VECTOR_H */ diff --git a/ace/ARGV.inl b/ace/ARGV.inl index 168dd3da866..f3342e403e9 100644 --- a/ace/ARGV.inl +++ b/ace/ARGV.inl @@ -7,6 +7,9 @@ #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template < typename CHAR_TYPE > void ACE_TARGV<CHAR_TYPE>::dump (void) const { @@ -340,3 +343,6 @@ ACE_TARGV<CHAR_TYPE>::operator[] (size_t i) return (const CHAR_TYPE *) this->argv ()[i]; } + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Acceptor.cpp b/ace/ATM_Acceptor.cpp index 41273857113..1210917a0c5 100644 --- a/ace/ATM_Acceptor.cpp +++ b/ace/ATM_Acceptor.cpp @@ -14,6 +14,10 @@ ACE_RCSID(ace, ATM_Acceptor, "$Id$") #include "ace/ATM_Acceptor.inl" #endif /* __ACE_INLINE__ */ + +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Put the actual definitions of the ACE_ATM_Request and // ACE_ATM_Request_Queue classes here to hide them from clients... @@ -298,4 +302,8 @@ ACE_ATM_Acceptor::accept (ACE_ATM_Stream &new_sap, #endif /* ACE_HAS_FORE_ATM_XTI */ } +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + + #endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Acceptor.h b/ace/ATM_Acceptor.h index 6305013601f..2f48f07638f 100644 --- a/ace/ATM_Acceptor.h +++ b/ace/ATM_Acceptor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -33,14 +33,21 @@ #if defined (ACE_HAS_FORE_ATM_WS2) || defined (ACE_HAS_LINUX_ATM) #include "ace/SOCK_Acceptor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_SOCK_Acceptor ATM_Acceptor; +ACE_END_VERSIONED_NAMESPACE_DECL #elif defined (ACE_HAS_FORE_ATM_XTI) #include "ace/TLI_Acceptor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_TLI_Acceptor ATM_Acceptor; +ACE_END_VERSIONED_NAMESPACE_DECL #endif // ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. -class ACE_Time_Value +class ACE_Time_Value; /** * @class ACE_ATM_Acceptor @@ -75,8 +82,8 @@ public: // = Passive connection acceptance method. - /// Accept a new data transfer connection. A <timeout> of 0 means - /// block forever, a <timeout> of {0, 0} means poll. <restart> == 1 + /// Accept a new data transfer connection. A @a timeout of 0 means + /// block forever, a @a timeout of {0, 0} means poll. @a restart == 1 /// means "restart if interrupted." int accept (ACE_ATM_Stream &new_sap, ACE_Addr *remote_addr = 0, @@ -103,6 +110,10 @@ private: ATM_Acceptor acceptor_; }; +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + + #if defined (__ACE_INLINE__) #include "ace/ATM_Acceptor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/ATM_Acceptor.inl b/ace/ATM_Acceptor.inl index ba0630dd6d6..b63b68a9621 100644 --- a/ace/ATM_Acceptor.inl +++ b/ace/ATM_Acceptor.inl @@ -1,7 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// ATM_Acceptor.i +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_ATM_Acceptor::dump (void) const @@ -35,3 +37,6 @@ ACE_ATM_Acceptor::close (void) return 0; #endif // ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM } + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Addr.cpp b/ace/ATM_Addr.cpp index 17cb7ef87c6..1c30b7f7a9a 100644 --- a/ace/ATM_Addr.cpp +++ b/ace/ATM_Addr.cpp @@ -17,6 +17,8 @@ ACE_RCSID(ace, ATM_Addr, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Addr) #if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) @@ -321,7 +323,7 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[]) == SOCKET_ERROR) { ACE_OS::printf ("Error: WSALookupServiceBeginW failed! %d\n", ::WSAGetLastError ()); - return -1; + return -1; } dwValue = sizeof (WSAQUERYSETW); @@ -331,7 +333,7 @@ ACE_ATM_Addr::string_to_addr (const ACE_TCHAR sap[]) if (WSAGetLastError () != WSA_E_NO_MORE) { ACE_OS::printf ("Error: WSALookupServiceNextW failed! %d\n", ::WSAGetLastError ()); - return -1; + return -1; } } @@ -398,11 +400,11 @@ ACE_ATM_Addr::addr_to_string (ACE_TCHAR addr[], int i; if (addrlen < ATM_ADDR_SIZE + 1) - return -1; + return -1; for (i = 0; i < ATM_ADDR_SIZE; i++) { buffer[ i * 3 ] = '\0'; - ACE_OS::sprintf (buffer, ACE_LIB_TEXT ("%s%02x."), + ACE_OS::sprintf (buffer, ACE_LIB_TEXT ("%s%02x."), buffer, atm_addr_.satm_number.Addr[ i ]); } @@ -515,4 +517,6 @@ ACE_ATM_Addr::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Addr.h b/ace/ATM_Addr.h index f498d12baf4..c3f112e8c1c 100644 --- a/ace/ATM_Addr.h +++ b/ace/ATM_Addr.h @@ -26,14 +26,21 @@ #include "ace/Addr.h" #if defined (ACE_HAS_FORE_ATM_XTI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ATMSAPAddress ATM_Addr; +ACE_END_VERSIONED_NAMESPACE_DECL #elif defined (ACE_HAS_FORE_ATM_WS2) #define FORE_NAME_SPACE NS_ALL +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef struct sockaddr_atm ATM_Addr; +ACE_END_VERSIONED_NAMESPACE_DECL #elif defined (ACE_HAS_LINUX_ATM) #include /**/ "atm.h" +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + //pbrandao:as Linux has this 2 structs separeted we "link it" here typedef struct _linux_atm_addr { @@ -177,6 +184,10 @@ private: ATM_Addr atm_addr_; }; +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + + #if defined (__ACE_INLINE__) #include "ace/ATM_Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/ATM_Addr.inl b/ace/ATM_Addr.inl index e2cf062a706..8120c6d11d5 100644 --- a/ace/ATM_Addr.inl +++ b/ace/ATM_Addr.inl @@ -2,6 +2,7 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE u_char ACE_ATM_Addr::get_selector (void) const @@ -32,3 +33,5 @@ ACE_ATM_Addr::set_selector (u_char selector) ACE_UNUSED_ARG (selector); #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Connector.cpp b/ace/ATM_Connector.cpp index 07811ffc264..bff8ddad5bd 100644 --- a/ace/ATM_Connector.cpp +++ b/ace/ATM_Connector.cpp @@ -12,6 +12,9 @@ ACE_RCSID(ace, ATM_Connector, "$Id$") #include "ace/ATM_Connector.inl" #endif /* __ACE_INLINE__ */ +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Connector) ACE_ATM_Connector::ACE_ATM_Connector (void) @@ -129,4 +132,7 @@ ACE_ATM_Connector::connect (ACE_ATM_Stream &new_stream, #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ } +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Connector.h b/ace/ATM_Connector.h index 151f3e9978b..8ac6b970439 100644 --- a/ace/ATM_Connector.h +++ b/ace/ATM_Connector.h @@ -28,12 +28,20 @@ #if defined (ACE_WIN32) || defined (ACE_HAS_LINUX_ATM) #include "ace/SOCK_Connector.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_SOCK_Connector ATM_Connector; +ACE_END_VERSIONED_NAMESPACE_DECL #else #include "ace/XTI_ATM_Mcast.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_XTI_ATM_Mcast ATM_Connector; +// Open versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL #endif +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_ATM_Connector * @@ -149,6 +157,9 @@ private: ATM_Connector connector_; }; +// Open versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/ATM_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/ATM_Connector.inl b/ace/ATM_Connector.inl index 50bde9ce55f..f301aa781f5 100644 --- a/ace/ATM_Connector.inl +++ b/ace/ATM_Connector.inl @@ -1,7 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// ATM_Connector.i +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_ATM_Connector::dump (void) const @@ -12,13 +14,13 @@ ACE_ATM_Connector::dump (void) const } ACE_INLINE -ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, - const ACE_ATM_Addr &remote_sap, +ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, + const ACE_ATM_Addr &remote_sap, ACE_ATM_Params params, ACE_ATM_QoS options, ACE_Time_Value *timeout, - const ACE_ATM_Addr &local_sap, - int reuse_addr, + const ACE_ATM_Addr &local_sap, + int reuse_addr, int flags, int perms) { @@ -29,11 +31,11 @@ ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, options, timeout, local_sap, - reuse_addr, + reuse_addr, flags, perms) == ACE_INVALID_HANDLE && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), + ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_ATM_Stream::ACE_ATM_Stream"))); } @@ -41,9 +43,9 @@ ACE_ATM_Connector::ACE_ATM_Connector (ACE_ATM_Stream &new_stream, ACE_INLINE int -ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream, - ACE_ATM_Addr *remote_sap, - ACE_Time_Value *tv) +ACE_ATM_Connector::complete (ACE_ATM_Stream &new_stream, + ACE_ATM_Addr *remote_sap, + ACE_Time_Value *tv) { ACE_TRACE ("ACE_ATM_Connector::complete"); #if defined (ACE_HAS_ATM) @@ -80,18 +82,18 @@ ACE_ATM_Connector::add_leaf (ACE_ATM_Stream ¤t_stream, &cqos, 0, (JL_SENDER_ONLY)); - + ACE_OS::printf( "ATM_Connector::add_leaf: connecting...\n" ); ACE_HANDLE result = ACE_OS::join_leaf(current_stream.get_handle(), - (struct sockaddr *)saddr, + (struct sockaddr *)saddr, addr_len, qos_params); - - if ( result == ACE_INVALID_HANDLE ) - ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n", + + if ( result == ACE_INVALID_HANDLE ) + ACE_OS::printf( "ATM_Connector(add_leaf): connection failed, %d\n", ::WSAGetLastError()); - + return (result != ACE_INVALID_HANDLE); #elif defined (ACE_HAS_LINUX_ATM) ACE_OS::printf("ATM_Connector(add_leaf): not yet implemented in Linux \n"); @@ -116,13 +118,15 @@ int ACE_ATM_Connector::reset_new_handle (ACE_HANDLE handle) { #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) - // Reset the event association + // Reset the event association return ::WSAEventSelect ((SOCKET) handle, 0, - 0); + 0); #else /* !defined ACE_HAS_WINSOCK2 */ ACE_UNUSED_ARG (handle); return 0; #endif /* ACE_WIN32 */ } +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Params.cpp b/ace/ATM_Params.cpp index 1777616858d..cc6ec674ece 100644 --- a/ace/ATM_Params.cpp +++ b/ace/ATM_Params.cpp @@ -2,15 +2,19 @@ #include "ace/ATM_Params.h" -ACE_RCSID(ace, ATM_Params, "$Id$") - #if defined (ACE_HAS_ATM) +ACE_RCSID(ace, ATM_Params, "$Id$") + #if !defined (__ACE_INLINE__) #include "ace/ATM_Params.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_ATM_Params) +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Params.h b/ace/ATM_Params.h index 1056c1bb728..2ae36a6a4a4 100644 --- a/ace/ATM_Params.h +++ b/ace/ATM_Params.h @@ -49,6 +49,8 @@ typedef int Param_Info; typedef int Param_Udata; #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_ATM_Params * @@ -201,6 +203,8 @@ private: int oflag_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/ATM_Params.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/ATM_Params.inl b/ace/ATM_Params.inl index 4006d4d00b5..5d60f6ba920 100644 --- a/ace/ATM_Params.inl +++ b/ace/ATM_Params.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// ATM_Params.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_ATM_Params::dump (void) const @@ -96,7 +97,7 @@ ACE_ATM_Params::set_type (int type) } ACE_INLINE -ACE_Protocol_Info* +ACE_Protocol_Info* ACE_ATM_Params::get_protocol_info( void ) { ACE_TRACE ("ACE_ATM_Params::get_protocol_info"); @@ -104,7 +105,7 @@ ACE_ATM_Params::get_protocol_info( void ) } ACE_INLINE -void +void ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info ) { ACE_TRACE ("ACE_ATM_Params::set_protocol_info"); @@ -112,7 +113,7 @@ ACE_ATM_Params::set_protocol_info( ACE_Protocol_Info *protocol_info ) } ACE_INLINE -ACE_SOCK_GROUP +ACE_SOCK_GROUP ACE_ATM_Params::get_sock_group( void ) { ACE_TRACE ("ACE_ATM_Params::get_sock_group"); @@ -120,7 +121,7 @@ ACE_ATM_Params::get_sock_group( void ) } ACE_INLINE -void +void ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g ) { ACE_TRACE ("ACE_ATM_Params::set_sock_group"); @@ -128,7 +129,7 @@ ACE_ATM_Params::set_sock_group( ACE_SOCK_GROUP g ) } ACE_INLINE -u_long +u_long ACE_ATM_Params::get_flags( void ) { ACE_TRACE ("ACE_ATM_Params::get_flags"); @@ -136,7 +137,7 @@ ACE_ATM_Params::get_flags( void ) } ACE_INLINE -void +void ACE_ATM_Params::set_flags( u_long flags) { ACE_TRACE ("ACE_ATM_Params::set_flags"); @@ -231,3 +232,4 @@ ACE_ATM_Params::set_oflag (int oflag) oflag_ = oflag; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_QoS.cpp b/ace/ATM_QoS.cpp index 6d713cf8579..814834571cf 100644 --- a/ace/ATM_QoS.cpp +++ b/ace/ATM_QoS.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, ATM_QoS, "$Id$") #include "ace/ATM_QoS.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_FORE_ATM_XTI) || defined (ACE_HAS_FORE_ATM_WS2) #define BHLI_MAGIC "FORE_ATM" // This is line rate in cells/s for an OC-3 MM interface. @@ -153,25 +155,25 @@ ACE_ATM_QoS::ACE_ATM_QoS(int rate, + sizeof( ATM_QOS_CLASS_IE ); ACE_OS::memcpy(ie_ptr->IE, &ie_qos, sizeof(ATM_QOS_CLASS_IE)); - // qos_.SendingFlowspec.TokenRate = 0xffffffff; - // qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; - // qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; - // qos_.SendingFlowspec.Latency = 0xffffffff; - // qos_.SendingFlowspec.DelayVariation = 0xffffffff; - // qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; + // qos_.SendingFlowspec.TokenRate = 0xffffffff; + // qos_.SendingFlowspec.TokenBucketSize = 0xffffffff; + // qos_.SendingFlowspec.PeakBandwidth = 0xffffffff; + // qos_.SendingFlowspec.Latency = 0xffffffff; + // qos_.SendingFlowspec.DelayVariation = 0xffffffff; + // qos_.SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; // This will most probably be ignored by the service provider. - // qos_.SendingFlowspec.MaxSduSize = 0xffffffff; - // qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; - - // qos_.ReceivingFlowspec.TokenRate = 0xffffffff; - // qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; - // qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; - // qos_.ReceivingFlowspec.Latency = 0xffffffff; - // qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; - // qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; + // qos_.SendingFlowspec.MaxSduSize = 0xffffffff; + // qos_.SendingFlowspec.MinimumPolicedSize = 0xffffffff; + + // qos_.ReceivingFlowspec.TokenRate = 0xffffffff; + // qos_.ReceivingFlowspec.TokenBucketSize = 0xffffffff; + // qos_.ReceivingFlowspec.PeakBandwidth = 0xffffffff; + // qos_.ReceivingFlowspec.Latency = 0xffffffff; + // qos_.ReceivingFlowspec.DelayVariation = 0xffffffff; + // qos_.ReceivingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; // This will most probably be ignored by the service provider. - // qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; - // qos_.ReceivingFlowspec.MinimumPolicedSize = 0; + // qos_.ReceivingFlowspec.MaxSduSize = 0xffffffff; + // qos_.ReceivingFlowspec.MinimumPolicedSize = 0; ACE_Flow_Spec send_fspec( 0xffffffff, 0xffffffff, @@ -346,7 +348,7 @@ ACE_ATM_QoS::set_cbr_rate (int rate, // Peak bandwidth is in bytes/sec. The rate is specified in cells/sec so // we need to convert from cells/sec to bytes/sec (i.e., multiply by 53). qos_.SendingFlowspec.PeakBandwidth = rate * BYTES_PER_ATM_CELL; - qos_.SendingFlowspec.Latency = -1; // we don't care too much + qos_.SendingFlowspec.Latency = -1; // we don't care too much qos_.SendingFlowspec.DelayVariation = -1; // we don't care too much // no provider-specific data allowed on ATM qos_.ProviderSpecific.buf=0; @@ -478,7 +480,7 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd, // signal the UNI 3.1 Calling Party ID Information Element. t_atm_addr *source_addr; - popt->len = sizeof (struct t_opthdr) + sizeof (t_atm_addr); + popt->len = sizeof (struct t_opthdr) + sizeof (t_atm_addr); popt->level = T_ATM_SIGNALING; popt->name = T_ATM_ORIG_ADDR; popt->status = 0; @@ -530,7 +532,7 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd, struct t_atm_traffic *traffic; // T_ATM_BEARER_CAP: Broadband bearer capability - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_bearer); + popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_bearer); popt->level = T_ATM_SIGNALING; popt->name = T_ATM_BEARER_CAP; popt->status = 0; @@ -546,7 +548,7 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd, } else { - bearer->traffic_type = 0; // UBR + bearer->traffic_type = 0; // UBR bearer->timing_requirements = 0; } bearer->clipping_susceptibility = T_ATM_NULL; @@ -559,7 +561,7 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd, popt = T_OPT_NEXTHDR (buf, info.options, popt); // T_ATM_TRAFFIC: traffic descriptor - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_traffic); + popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_traffic); popt->level = T_ATM_SIGNALING; popt->name = T_ATM_TRAFFIC; popt->status = 0; @@ -576,13 +578,13 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd, traffic->forward.tagging = T_NO; traffic->backward.PCR_high_priority = T_ATM_ABSENT; - traffic->backward.PCR_all_traffic = + traffic->backward.PCR_all_traffic = (ACE_BIT_ENABLED (flags, OPT_FLAGS_PMP)) ? 0 : qos_cells ? qos_cells : LINE_RATE; traffic->backward.SCR_high_priority = T_ATM_ABSENT; - traffic->backward.SCR_all_traffic = T_ATM_ABSENT; + traffic->backward.SCR_all_traffic = T_ATM_ABSENT; traffic->backward.MBS_high_priority = T_ATM_ABSENT; - traffic->backward.MBS_all_traffic = T_ATM_ABSENT; + traffic->backward.MBS_all_traffic = T_ATM_ABSENT; traffic->backward.tagging = T_NO; traffic->best_effort = qos_cells ? T_NO : T_YES; @@ -597,7 +599,7 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd, struct t_atm_qos *qos; // T_ATM_QOS: Quality of Service - popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_qos); + popt->len = sizeof (struct t_opthdr) + sizeof (struct t_atm_qos); popt->level = T_ATM_SIGNALING; popt->name = T_ATM_QOS; popt->status = 0; @@ -623,5 +625,7 @@ ACE_ATM_QoS::construct_options (ACE_HANDLE fd, #endif /* ACE_HAS_FORE_ATM_WS2 */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_QoS.h b/ace/ATM_QoS.h index c29962d80fc..41a4dafab6e 100644 --- a/ace/ATM_QoS.h +++ b/ace/ATM_QoS.h @@ -24,18 +24,28 @@ #if defined (ACE_HAS_ATM) #if defined (ACE_HAS_FORE_ATM_WS2) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // just map to WS2 GQOS struct typedef ACE_QoS ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL #elif defined (ACE_HAS_FORE_ATM_XTI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef struct netbuf ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL #elif defined (ACE_HAS_LINUX_ATM) #include /**/ "atm.h" #include "ace/ATM_Params.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef struct atm_qos ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL #else +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef int ATM_QoS; +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_FORE_ATM_WS2 || ACE_HAS_FORE_ATM_XTI || ACE_HAS_LINUX_ATM */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_ATM_QoS * @@ -94,6 +104,8 @@ private: ATM_QoS qos_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/ATM_QoS.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/ATM_QoS.inl b/ace/ATM_QoS.inl index ac5b7de890f..283baa3f560 100644 --- a/ace/ATM_QoS.inl +++ b/ace/ATM_QoS.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// ATM_QoS.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_ATM_QoS::dump (void) const @@ -24,3 +25,5 @@ ACE_ATM_QoS::get_qos (void) ACE_TRACE ("ACE_ATM_QoS::get_qos"); return qos_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ATM_Stream.cpp b/ace/ATM_Stream.cpp index 898a627c694..c6de5d4b533 100644 --- a/ace/ATM_Stream.cpp +++ b/ace/ATM_Stream.cpp @@ -10,6 +10,8 @@ ACE_RCSID (ace, ATM_Stream, "$Id$") #include "ace/ATM_Stream.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_ATM_Stream) char* @@ -283,4 +285,6 @@ ACE_ATM_Stream::get_vpi_vci (ACE_UINT16 &vpi, #endif /* ACE_HAS_FORE_ATM_XTI || ACE_HAS_FORE_ATM_WS2 || ACE_HAS_LINUX_ATM */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_ATM */ diff --git a/ace/ATM_Stream.h b/ace/ATM_Stream.h index 7741eeab366..e1bb9257c9e 100644 --- a/ace/ATM_Stream.h +++ b/ace/ATM_Stream.h @@ -28,12 +28,18 @@ #if defined (ACE_WIN32) #include "ace/SOCK_Stream.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_SOCK_Stream ATM_Stream; +ACE_END_VERSIONED_NAMESPACE_DECL #else #include "ace/TLI_Stream.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_TLI_Stream ATM_Stream; +ACE_END_VERSIONED_NAMESPACE_DECL #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_ATM_Stream * @@ -90,6 +96,8 @@ private: ATM_Stream stream_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/ATM_Stream.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/ATM_Stream.inl b/ace/ATM_Stream.inl index 9c11fd93b7c..b796af474e7 100644 --- a/ace/ATM_Stream.inl +++ b/ace/ATM_Stream.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// ATM_Stream.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_ATM_Stream::dump (void) const @@ -129,3 +130,4 @@ ACE_ATM_Stream::send_n (const void *buf, #endif /* ACE_HAS_FORE_ATM_XTI */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index bd6435f1a77..8dfb0662c49 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -19,6 +19,8 @@ ACE_RCSID (ace, Acceptor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Acceptor) template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> void @@ -1221,4 +1223,6 @@ ACE_Oneshot_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::operator ACE_PEER_ACCEPT return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_ACCEPTOR_CPP */ diff --git a/ace/Acceptor.h b/ace/Acceptor.h index 138c6766de3..a1ebcd9c055 100644 --- a/ace/Acceptor.h +++ b/ace/Acceptor.h @@ -24,6 +24,7 @@ #include "ace/Strategies_T.h" #include "ace/Synch_Options.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Acceptor @@ -64,16 +65,37 @@ public: int use_select = 1); /** - * Initialize and register {this} with the Reactor and listen for - * connection requests at the designated {local_addr}. {flags} - * indicates how {SVC_HANDLER}'s should be initialized prior to - * being activated. Right now, the only flag that is processed is - * {ACE_NONBLOCK}, which enabled non-blocking I/O on the - * {SVC_HANDLER} when it is opened. If {use_select} is non-zero - * then {select} is used to determine when to break out of the - * {accept} loop. {reuse_addr} is passed down to the - * {PEER_ACCEPTOR}. If it is non-zero this will allow the OS to - * reuse this listen port. + * Open the contained @c PEER_ACCEPTOR object to begin listening, and + * register with the specified reactor for accept events. An + * acceptor can only listen to one port at a time, so make sure to + * @c close() the acceptor before calling @c open() again. + * + * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a + * safeguard against the race condition that can otherwise occur + * between the time when the passive-mode socket handle is "ready" + * and when the actual @c accept() call is made. During this + * interval, the client can shutdown the connection, in which case, + * the @c accept() call can hang. + * + * @param local_addr The address to listen at. + * @param reactor Pointer to the ACE_Reactor instance to register + * this object with. The default is the singleton. + * @param flags Flags to control what mode an accepted socket + * will be put into after it is accepted. The only + * legal value for this argument is @c ACE_NONBLOCK, + * which enables non-blocking mode on the accepted + * peer stream object in @c SVC_HANDLER. The default + * is 0. + * @param use_select Affects behavior when called back by the reactor + * when a connection can be accepted. If non-zero, + * this object will accept all pending connections, + * intead of just the one that triggered the reactor + * callback. Uses ACE_OS::select() internally to + * detect any remaining acceptable connections. + * The default is 1. + * @param reuse_addr Passed to the @c PEER_ACCEPTOR::open() method with + * @p local_addr. Generally used to request that the + * OS allow reuse of the listen port. The default is 1. */ ACE_Acceptor (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor * = ACE_Reactor::instance (), @@ -83,7 +105,9 @@ public: /** * Open the contained @c PEER_ACCEPTOR object to begin listening, and - * register with the specified reactor for accept events. + * register with the specified reactor for accept events. An + * acceptor can only listen to one port at a time, so make sure to + * @c close() the acceptor before calling @c open() again. * * The @c PEER_ACCEPTOR handle is put into non-blocking mode as a * safeguard against the race condition that can otherwise occur @@ -644,6 +668,8 @@ private: int delete_concurrency_strategy_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Acceptor.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Activation_Queue.cpp b/ace/Activation_Queue.cpp index 74aba6c7734..28b91b82bd9 100644 --- a/ace/Activation_Queue.cpp +++ b/ace/Activation_Queue.cpp @@ -13,6 +13,8 @@ ACE_RCSID (ace, Activation_Queue, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Activation_Queue::dump (void) const { @@ -59,7 +61,7 @@ ACE_Activation_Queue::~ACE_Activation_Queue (void) ACE_Method_Request * ACE_Activation_Queue::dequeue (ACE_Time_Value *tv) { - ACE_Message_Block *mb; + ACE_Message_Block *mb = 0; // Dequeue the message. if (this->queue_->dequeue_head (mb, tv) != -1) @@ -79,7 +81,7 @@ int ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, ACE_Time_Value *tv) { - ACE_Message_Block *mb; + ACE_Message_Block *mb = 0; // We pass sizeof (*mr) here so that flow control will work // correctly. Since we also pass <mr> note that no unnecessary @@ -100,7 +102,7 @@ ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, -1); // Enqueue in priority order. - int result = this->queue_->enqueue_prio (mb, tv); + int const result = this->queue_->enqueue_prio (mb, tv); // Free ACE_Message_Block if enqueue_prio failed. if (result == -1) @@ -108,3 +110,5 @@ ACE_Activation_Queue::enqueue (ACE_Method_Request *mr, return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Activation_Queue.h b/ace/Activation_Queue.h index 9a370d2cdf6..26d51c9dcf1 100644 --- a/ace/Activation_Queue.h +++ b/ace/Activation_Queue.h @@ -16,13 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ - +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -34,8 +28,9 @@ /// Define to be compatible with the terminology in the POSA2 book! #define ACE_Activation_List ACE_Activation_Queue -class ACE_Method_Request; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +class ACE_Method_Request; /** * @class ACE_Activation_Queue @@ -52,7 +47,7 @@ class ACE_Method_Request; * * @sa ACE_Method_Request */ -class ACE_Threads_Export ACE_Activation_Queue +class ACE_Export ACE_Activation_Queue { public: // = Initialization and termination methods. @@ -116,7 +111,8 @@ public: * earlier, however, if queue is closed, deactivated, or when * a signal occurs. * - * @retval 0 on success. + * @retval >0 The number of method requests on the queue after adding + * the specified request. * @retval -1 if an error occurs; errno contains further information. If * the specified timeout elapses, errno will be @c EWOULDBLOCK. */ @@ -144,7 +140,14 @@ public: /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; +private: + + // = Prevent copying and assignment. + ACE_Activation_Queue (const ACE_Activation_Queue &); + void operator= (const ACE_Activation_Queue &); + protected: + /// Stores the Method_Requests. ACE_Message_Queue<ACE_SYNCH> *queue_; @@ -152,21 +155,20 @@ protected: int delete_queue_; private: + /// Allocation strategy of the queue. ACE_Allocator *allocator_; /// Allocation strategy of the message blocks. ACE_Allocator *data_block_allocator_; - // = Prevent assignment and initialization. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Activation_Queue &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Activation_Queue (const ACE_Activation_Queue &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Activation_Queue.inl" #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" #endif /* ACE_ACTIVATION_QUEUE_H */ - diff --git a/ace/Activation_Queue.inl b/ace/Activation_Queue.inl index b4b9283bced..466635d859c 100644 --- a/ace/Activation_Queue.inl +++ b/ace/Activation_Queue.inl @@ -1,22 +1,23 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Activation_Queue.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE size_t -ACE_Activation_Queue::method_count (void) const +ACE_Activation_Queue::method_count (void) const { return queue_->message_count (); } -ACE_INLINE int -ACE_Activation_Queue::is_full (void) const +ACE_INLINE int +ACE_Activation_Queue::is_full (void) const { return queue_->is_full (); -} +} -ACE_INLINE int -ACE_Activation_Queue::is_empty (void) const +ACE_INLINE int +ACE_Activation_Queue::is_empty (void) const { return queue_->is_empty (); } @@ -27,8 +28,10 @@ ACE_Activation_Queue::queue (void) const return queue_; } -ACE_INLINE void +ACE_INLINE void ACE_Activation_Queue::queue (ACE_Message_Queue<ACE_SYNCH> *q) { queue_ = q; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Active_Map_Manager.cpp b/ace/Active_Map_Manager.cpp index 47e734d044d..6f4b66191c7 100644 --- a/ace/Active_Map_Manager.cpp +++ b/ace/Active_Map_Manager.cpp @@ -7,4 +7,3 @@ ACE_RCSID(ace, Active_Map_Manager, "$Id$") #if !defined (__ACE_INLINE__) #include "ace/Active_Map_Manager.inl" #endif /* __ACE_INLINE__ */ - diff --git a/ace/Active_Map_Manager.h b/ace/Active_Map_Manager.h index 7764ba11aa1..7e3bb348058 100644 --- a/ace/Active_Map_Manager.h +++ b/ace/Active_Map_Manager.h @@ -23,6 +23,8 @@ #include "ace/Basic_Types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Active_Map_Manager_Key * @@ -101,6 +103,8 @@ private: key_data key_data_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Active_Map_Manager.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Active_Map_Manager.inl b/ace/Active_Map_Manager.inl index 491b25430b7..652cf7c1f71 100644 --- a/ace/Active_Map_Manager.inl +++ b/ace/Active_Map_Manager.inl @@ -4,6 +4,8 @@ #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Active_Map_Manager_Key::ACE_Active_Map_Manager_Key (void) { @@ -89,3 +91,5 @@ ACE_Active_Map_Manager_Key::encode (void *data) const &this->key_data_, sizeof this->key_data_); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Active_Map_Manager_T.cpp b/ace/Active_Map_Manager_T.cpp index b4fbf30cfa5..b8cd14446ac 100644 --- a/ace/Active_Map_Manager_T.cpp +++ b/ace/Active_Map_Manager_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_ACTIVE_MAP_MANAGER_T_C -#define ACE_ACTIVE_MAP_MANAGER_T_C +#ifndef ACE_ACTIVE_MAP_MANAGER_T_CPP +#define ACE_ACTIVE_MAP_MANAGER_T_CPP #include "ace/Active_Map_Manager_T.h" @@ -13,8 +13,10 @@ #include "ace/Active_Map_Manager_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Active_Map_Manager_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Active_Map_Manager) -#endif /* ACE_ACTIVE_MAP_MANAGER_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ACTIVE_MAP_MANAGER_T_CPP */ diff --git a/ace/Active_Map_Manager_T.h b/ace/Active_Map_Manager_T.h index f3e90b3f744..2194f8194de 100644 --- a/ace/Active_Map_Manager_T.h +++ b/ace/Active_Map_Manager_T.h @@ -24,6 +24,8 @@ #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Active_Map_Manager * @@ -191,6 +193,8 @@ private: ACE_UNIMPLEMENTED_FUNC (ACE_Active_Map_Manager (const ACE_Active_Map_Manager<T> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Active_Map_Manager_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Active_Map_Manager_T.inl b/ace/Active_Map_Manager_T.inl index fd9ff0df6c6..124f76c48c4 100644 --- a/ace/Active_Map_Manager_T.inl +++ b/ace/Active_Map_Manager_T.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE int ACE_Active_Map_Manager<T>::bind (ACE_Active_Map_Manager_Key &key, T *&internal_value) @@ -304,3 +307,5 @@ ACE_Active_Map_Manager<T>::rend (void) { return ACE_AMM_BASE::rend (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Addr.cpp b/ace/Addr.cpp index a627d8262c0..6b4e3770f33 100644 --- a/ace/Addr.cpp +++ b/ace/Addr.cpp @@ -15,6 +15,8 @@ ACE_RCSID (ace, #include "ace/Log_Msg.h" #include "ace/os_include/sys/os_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Note: this object requires static construction and destruction. /* static */ const ACE_Addr ACE_Addr::sap_any (AF_ANY, -1); @@ -66,3 +68,5 @@ ACE_Addr::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Addr.h b/ace/Addr.h index 654b1fc4355..53fba544456 100644 --- a/ace/Addr.h +++ b/ace/Addr.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Addr * @@ -91,6 +93,8 @@ protected: int addr_size_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Addr.inl b/ace/Addr.inl index 34457d86612..3780e04b6aa 100644 --- a/ace/Addr.inl +++ b/ace/Addr.inl @@ -4,19 +4,20 @@ // Return the address of the address. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE bool ACE_Addr::operator == (const ACE_Addr &sap) const { return (sap.addr_type_ == this->addr_type_ && - sap.addr_size_ == this->addr_size_ ); + sap.addr_size_ == this->addr_size_ ); } ACE_INLINE bool ACE_Addr::operator != (const ACE_Addr &sap) const { return (sap.addr_type_ != this->addr_type_ || - sap.addr_size_ != this->addr_size_ ); + sap.addr_size_ != this->addr_size_ ); } // Return the size of the address. @@ -56,3 +57,5 @@ ACE_Addr::hash (void) const { return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp index e24baecc6eb..f29f2522ca7 100644 --- a/ace/Arg_Shifter.cpp +++ b/ace/Arg_Shifter.cpp @@ -1,9 +1,14 @@ #include "ace/Arg_Shifter.h" -#include "ace/OS_NS_string.h" -#include "ace/OS_NS_strings.h" -#include "ace/OS_Errno.h" -#include "ace/OS_Memory.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Arg_Shifter.inl" +#endif /* __ACE_INLINE__ */ + ACE_RCSID (ace, Arg_Shifter, "$Id$") + +#if !defined (__ACE_INLINE__) +template class ACE_TArg_Shifter< ACE_TCHAR >; +#endif /* __ACE_INLINE__ */ diff --git a/ace/Arg_Shifter.h b/ace/Arg_Shifter.h index dbae5593674..b63a9d8d82d 100644 --- a/ace/Arg_Shifter.h +++ b/ace/Arg_Shifter.h @@ -1,4 +1,4 @@ -// This may look like C, but it's really -*- C++ -*- +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Arg_Shifter * @@ -202,7 +204,12 @@ private: typedef ACE_TArg_Shifter< ACE_TCHAR > ACE_Arg_Shifter; +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) #include "ace/Arg_Shifter.inl" +#endif /* __ACE_INLINE__ */ + #include /**/ "ace/post.h" diff --git a/ace/Arg_Shifter.inl b/ace/Arg_Shifter.inl index 42e882556c8..eb11e4c42b4 100644 --- a/ace/Arg_Shifter.inl +++ b/ace/Arg_Shifter.inl @@ -1,3 +1,4 @@ +// -*- C++ -*- #include "ace/Arg_Shifter.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" @@ -8,6 +9,8 @@ ACE_RCSID (ace, Arg_Shifter, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template < typename CHAR_TYPE > ACE_TArg_Shifter<CHAR_TYPE>::ACE_TArg_Shifter (int& argc, const CHAR_TYPE** argv, @@ -219,3 +222,5 @@ ACE_TArg_Shifter<CHAR_TYPE>::num_ignored_args (void) const { return this->front_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Argv_Type_Converter.cpp b/ace/Argv_Type_Converter.cpp index 044f734d7d9..78d2788c331 100644 --- a/ace/Argv_Type_Converter.cpp +++ b/ace/Argv_Type_Converter.cpp @@ -13,6 +13,8 @@ ACE_RCSID (ace, #include "ace/OS_NS_string.h" #include "ace/OS_Errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Argv_Type_Converter::ACE_Argv_Type_Converter (int &argc, wchar_t** argv) : saved_argc_ (argc) , char_argv_ (0) @@ -193,3 +195,5 @@ ACE_Argv_Type_Converter::cleanup (void) this->wchar_passed_ = false; this->char_passed_ = false; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Argv_Type_Converter.h b/ace/Argv_Type_Converter.h index 7cc09f4974b..381448af6ab 100644 --- a/ace/Argv_Type_Converter.h +++ b/ace/Argv_Type_Converter.h @@ -22,6 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Argv_Type_Converter @@ -103,6 +104,8 @@ private: bool char_passed_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Argv_Type_Converter.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Argv_Type_Converter.inl b/ace/Argv_Type_Converter.inl index fcb0c1d6263..54b9ed2dfc1 100644 --- a/ace/Argv_Type_Converter.inl +++ b/ace/Argv_Type_Converter.inl @@ -2,6 +2,7 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_TCHAR** ACE_Argv_Type_Converter::get_TCHAR_argv (void) @@ -43,3 +44,5 @@ ACE_Argv_Type_Converter::get_argc (void) { return this->saved_argc_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Array.h b/ace/Array.h index be28d342eef..c3159cd7a89 100644 --- a/ace/Array.h +++ b/ace/Array.h @@ -6,7 +6,9 @@ * * $Id$ * - * NOTE: this file has been deprecated and will soon go away. You + * @deprecated + * + * @note This file has been deprecated and will soon go away. You * should directly include "Containers_T.h" instead. * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> diff --git a/ace/Array_Base.cpp b/ace/Array_Base.cpp index a054d900045..ece933009d6 100644 --- a/ace/Array_Base.cpp +++ b/ace/Array_Base.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_ARRAY_BASE_C -#define ACE_ARRAY_BASE_C +#ifndef ACE_ARRAY_BASE_CPP +#define ACE_ARRAY_BASE_CPP #include "ace/Array_Base.h" @@ -14,20 +14,11 @@ #endif /* __ACE_INLINE__ */ #include "ace/Malloc_Base.h" - -#if defined (_MSC_VER) && _MSC_VER == 1200 && !defined (ACE_HAS_WINCE) -# include <new> /* For placement new() operator. */ -#endif /* _MSC_VER == 1200 */ - #include "ace/os_include/os_errno.h" -ACE_RCSID (ace, - Array_Base, - "$Id$") - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Dynamically initialize an array. - template <class T> ACE_Array_Base<T>::ACE_Array_Base (size_t size, ACE_Allocator *alloc) @@ -210,4 +201,6 @@ ACE_Array_Iterator<T>::next (T *&item) } } -#endif /* ACE_ARRAY_BASE_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ARRAY_BASE_CPP */ diff --git a/ace/Array_Base.h b/ace/Array_Base.h index 7b785e404b7..dd02278dc90 100644 --- a/ace/Array_Base.h +++ b/ace/Array_Base.h @@ -22,6 +22,8 @@ #include "ace/Global_Macros.h" #include "ace/Malloc_Base.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration. template <class T> class ACE_Array_Iterator; @@ -117,7 +119,7 @@ public: */ int max_size (size_t new_size); -private: +protected: /// Returns 1 if <slot> is within range, i.e., 0 >= <slot> < /// <cur_size_>, else returns 0. int in_range (size_t slot) const; @@ -190,6 +192,8 @@ private: ACE_Array_Base<T> &array_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Array_Base.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Array_Base.inl b/ace/Array_Base.inl index f5698deb9eb..3afc27e69b8 100644 --- a/ace/Array_Base.inl +++ b/ace/Array_Base.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ // Clean up the array (e.g., delete dynamically allocated memory). +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE ACE_Array_Base<T>::~ACE_Array_Base (void) { @@ -84,3 +87,5 @@ ACE_Array_Iterator<T>::done (void) const return this->current_ >= array_.size (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Array_Map.cpp b/ace/Array_Map.cpp index 01fbf4cdcae..3db24968a63 100644 --- a/ace/Array_Map.cpp +++ b/ace/Array_Map.cpp @@ -11,6 +11,7 @@ #include <algorithm> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL #ifndef ACE_LACKS_MEMBER_TEMPLATES template<typename Key, typename Value, class EqualTo> @@ -80,12 +81,7 @@ ACE_Array_Map<Key, Value, EqualTo>::swap ( } template<typename Key, typename Value, class EqualTo> -#if defined (_MSC_VER) && (_MSC_VER <= 1200) -// MSVC++ 6 doesn't like the typename qualification. -std::pair<ACE_Array_Map<Key, Value, EqualTo>::iterator, bool> -#else std::pair<typename ACE_Array_Map<Key, Value, EqualTo>::iterator, bool> -#endif /* _MSC_VER <= 1200 */ ACE_Array_Map<Key, Value, EqualTo>::insert ( typename ACE_Array_Map<Key, Value, EqualTo>::value_type const & x) { @@ -281,4 +277,6 @@ operator< (ACE_Array_Map<Key, Value, EqualTo> const & lhs, rhs.begin (), rhs.end ()); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_ARRAY_MAP_CPP */ diff --git a/ace/Array_Map.h b/ace/Array_Map.h index 5952397aa2e..3425e917d4c 100644 --- a/ace/Array_Map.h +++ b/ace/Array_Map.h @@ -32,6 +32,7 @@ #include <iterator> #include <functional> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Array_Map @@ -101,17 +102,15 @@ public: typedef ptrdiff_t difference_type; typedef size_t size_type; -#if ((defined (_MSC_VER) && (_MSC_VER <= 1200)) || \ - (defined (_MSC_VER) && !defined (_CPPLIB_VER))) - // MSVC++ 6 doesn't define a standard's compliant reverse_iterator, - // also the latest Platform SDK's don't do this. - // +#if ((defined (_MSC_VER) && !defined (_CPPLIB_VER))) + // the latest Platform SDK's doesn't define a standard's compliant + // reverse_iterator, // It seems when there is no _CPPLIB_VER defined, then we can assume // also that the SDK is old. typedef std::reverse_iterator<iterator, value_type> reverse_iterator; typedef std::reverse_iterator<const_iterator, value_type const> const_reverse_iterator; -#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x570 \ +#elif defined (__SUNPRO_CC) && __SUNPRO_CC <= 0x580 \ && defined (_RWSTD_NO_CLASS_PARTIAL_SPEC) typedef std::reverse_iterator<iterator, std::input_iterator_tag, @@ -128,7 +127,7 @@ public: #else typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; -#endif /* _MSC_VER <= 1200 */ +#endif /* _MSC_VER */ /// Default Constructor. /** @@ -300,6 +299,8 @@ bool operator< (ACE_Array_Map<Key, Value, EqualTo> const & lhs, // -------------------------------------------------------------- +ACE_END_VERSIONED_NAMESPACE_DECL + #ifdef __ACE_INLINE__ # include "ace/Array_Map.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Array_Map.inl b/ace/Array_Map.inl index 3c423390241..85cb1554c2f 100644 --- a/ace/Array_Map.inl +++ b/ace/Array_Map.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<typename Key, typename Value, class EqualTo> ACE_INLINE ACE_Array_Map<Key, Value, EqualTo>::ACE_Array_Map ( @@ -118,3 +120,5 @@ ACE_Array_Map<Key, Value, EqualTo>::operator[] ( iterator i = (this->insert (value_type (k, data_type ()))).first; return (*i).second; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Asynch_Acceptor.cpp b/ace/Asynch_Acceptor.cpp index 6bf4ab5c313..374658afefe 100644 --- a/ace/Asynch_Acceptor.cpp +++ b/ace/Asynch_Acceptor.cpp @@ -24,6 +24,8 @@ ACE_RCSID(ace, Asynch_Acceptor, "$Id$") #include "ace/SOCK_Stream.h" #include "ace/Sock_Connect.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class HANDLER> ACE_Asynch_Acceptor<HANDLER>::ACE_Asynch_Acceptor (void) : listen_handle_ (ACE_INVALID_HANDLE), @@ -172,7 +174,7 @@ ACE_Asynch_Acceptor<HANDLER>::open (const ACE_INET_Addr &address, return 0; } -template <class HANDLER> void +template <class HANDLER> int ACE_Asynch_Acceptor<HANDLER>::set_handle (ACE_HANDLE listen_handle) { ACE_TRACE ("ACE_Asynch_Acceptor<>::set_handle"); @@ -185,9 +187,11 @@ ACE_Asynch_Acceptor<HANDLER>::set_handle (ACE_HANDLE listen_handle) this->listen_handle_, 0, this->proactor ()) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Asynch_Accept::open"))); + ACE_ERROR_RETURN ((LM_ERROR, + ACE_LIB_TEXT ("%p\n"), + ACE_LIB_TEXT ("ACE_Asynch_Accept::open")), + -1); + return 0; } template <class HANDLER> ACE_HANDLE @@ -367,14 +371,13 @@ ACE_Asynch_Acceptor<HANDLER>::cancel (void) // ERROR_OPERATION_ABORTED. All completion notifications for the I/O // operations will occur normally. #if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) \ - && ( defined (_MSC_VER) \ - || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x530))) + && ( defined (_MSC_VER) || (defined (__BORLANDC__))) return (int) ::CancelIo (this->listen_handle_); #else // Supported now return this->asynch_accept_.cancel(); -#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) && ((defined (_MSC_VER)) || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x530))) */ +#endif /* (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) && ((defined (_MSC_VER)) || (defined (__BORLANDC__))) */ } template <class HANDLER> void @@ -518,5 +521,7 @@ ACE_Asynch_Acceptor<HANDLER>::should_reissue_accept (void) return this->reissue_accept_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ #endif /* ACE_ASYNCH_ACCEPTOR_C */ diff --git a/ace/Asynch_Acceptor.h b/ace/Asynch_Acceptor.h index 27efe871c0f..e8cb490794d 100644 --- a/ace/Asynch_Acceptor.h +++ b/ace/Asynch_Acceptor.h @@ -26,6 +26,8 @@ #include "ace/Default_Constants.h" #include "ace/Asynch_IO.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations class ACE_Message_Block; class ACE_INET_Addr; @@ -70,7 +72,7 @@ public: * associated @c ACE_Service_Handler::addresses() method * after any call to @c validate_new_connection() and prior * to the @c open() hook method call. - * @param backlog Optional, defaulting to @c ACE_DEFAULT_BACKLOG (which + * @param backlog Optional, defaulting to @c ACE_DEFAULT_ASYNCH_BACKLOG (which * can be adjusted in your platform's @c config.h file). * Specifies the listening backlog for the listening socket. * @param reuse_addr Optional, indicates whether the @c SO_REUSEADDR @@ -107,7 +109,7 @@ public: virtual int open (const ACE_INET_Addr &address, size_t bytes_to_read = 0, int pass_addresses = 0, - int backlog = ACE_DEFAULT_BACKLOG, + int backlog = ACE_DEFAULT_ASYNCH_BACKLOG, int reuse_addr = 1, ACE_Proactor *proactor = 0, int validate_new_connection = 0, @@ -123,7 +125,7 @@ public: * closed and the all outstanding asynchronous operations have * either completed or have been canceled on the old listen handle. */ - virtual void set_handle (ACE_HANDLE handle); + virtual int set_handle (ACE_HANDLE handle); /// This initiates a new asynchronous accept operation. /** @@ -279,6 +281,8 @@ private: int addr_family_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Asynch_Acceptor.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Asynch_Connector.cpp b/ace/Asynch_Connector.cpp index 1fbbcc512e7..65b23f9a60c 100644 --- a/ace/Asynch_Connector.cpp +++ b/ace/Asynch_Connector.cpp @@ -1,8 +1,7 @@ -/* -*- C++ -*- */ // $Id$ -#ifndef ACE_ASYNCH_CONNECTOR_C -#define ACE_ASYNCH_CONNECTOR_C +#ifndef ACE_ASYNCH_CONNECTOR_CPP +#define ACE_ASYNCH_CONNECTOR_CPP #include "ace/Asynch_Connector.h" @@ -10,8 +9,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Asynch_Connector, "$Id$") - #if (defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS)) && !defined(ACE_HAS_WINCE) // This only works on platforms that support async I/O. @@ -22,6 +19,8 @@ ACE_RCSID(ace, Asynch_Connector, "$Id$") #include "ace/Message_Block.h" #include "ace/INET_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class HANDLER> ACE_Asynch_Connector<HANDLER>::ACE_Asynch_Connector (void) : pass_addresses_ (0), @@ -291,5 +290,7 @@ ACE_Asynch_Connector<HANDLER>::validate_new_connection (int new_value) this->validate_new_connection_ = new_value; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#endif /* ACE_ASYNCH_CONNECTOR_C */ +#endif /* ACE_ASYNCH_CONNECTOR_CPP */ diff --git a/ace/Asynch_Connector.h b/ace/Asynch_Connector.h index d7bf516cecf..06e9bb41382 100644 --- a/ace/Asynch_Connector.h +++ b/ace/Asynch_Connector.h @@ -26,6 +26,8 @@ #include "ace/Asynch_IO.h" #include "ace/INET_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations class ACE_Message_Block; @@ -155,6 +157,8 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Asynch_Connector.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Asynch_IO.cpp b/ace/Asynch_IO.cpp index 58ddd94bd54..cfcaf28aa2c 100644 --- a/ace/Asynch_IO.cpp +++ b/ace/Asynch_IO.cpp @@ -12,6 +12,8 @@ ACE_RCSID(ace, Asynch_IO, "$Id$") #include "ace/INET_Addr.h" #include "ace/Asynch_IO_Impl.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + size_t ACE_Asynch_Result::bytes_transferred (void) const { @@ -1330,8 +1332,4 @@ ACE_Asynch_Write_Dgram::Result::~Result (void) #endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Refcounted_Auto_Ptr<ACE_Handler::Proxy, ACE_SYNCH_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Refcounted_Auto_Ptr<ACE_Handler::Proxy, ACE_SYNCH_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Asynch_IO.h b/ace/Asynch_IO.h index b1822e82c3c..e4733562440 100644 --- a/ace/Asynch_IO.h +++ b/ace/Asynch_IO.h @@ -47,6 +47,8 @@ #include "ace/os_include/sys/os_socket.h" #include "ace/os_include/sys/os_types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_WIN32) && ! defined (ACE_HAS_WINCE) \ && ! defined (ACE_HAS_PHARLAP) typedef TRANSMIT_FILE_BUFFERS ACE_TRANSMIT_FILE_BUFFERS; @@ -299,9 +301,17 @@ public: /** * Initializes the factory with information which will be used with - * each asynchronous call. If ({handle} == ACE_INVALID_HANDLE), - * {ACE_Handler::handle} will be called on the {handler} to get the - * correct handle. + * each asynchronous call. + * + * @arg handler The ACE_Handler that will be called to handle completions + * for operations initiated using this factory. + * @arg handle The handle that future read operations will use. + * If handle == @c ACE_INVALID_HANDLE, + * ACE_Handler::handle() will be called on @ handler + * to get the correct handle. + * + * @retval 0 for success. + * @retval -1 for failure; consult @c errno for further information. */ int open (ACE_Handler &handler, ACE_HANDLE handle = ACE_INVALID_HANDLE, @@ -452,7 +462,7 @@ public: int priority = 0, int signal_number = ACE_SIGRTMIN); -#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) +#if (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) /** * Same as above but with gather support, through chaining of composite * message blocks using the continuation field. @@ -462,10 +472,10 @@ public: const void *act = 0, int priority = 0, int signal_number = ACE_SIGRTMIN); -#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ +#endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) */ /// Return the underlying implementation class. - // (this should be protected...) + /// @todo (this should be protected...) virtual ACE_Asynch_Operation_Impl *implementation (void) const; protected: @@ -583,7 +593,7 @@ public: /** * Same as above but with scatter support, through chaining of composite * message blocks using the continuation field. - * NOTE: In win32 Each data block payload must be at least the size of a system + * @note In win32 Each data block payload must be at least the size of a system * memory page and must be aligned on a system memory page size boundary */ int readv (ACE_Message_Block &message_block, @@ -717,7 +727,7 @@ public: /** * Same as above but with gather support, through chaining of composite * message blocks using the continuation field. - * NOTE: In win32 Each data block payload must be at least the size of a system + * @note In win32 Each data block payload must be at least the size of a system * memory page and must be aligned on a system memory page size boundary */ int writev (ACE_Message_Block &message_block, @@ -1661,6 +1671,8 @@ public: virtual void act (const void *); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS*/ #include /**/ "ace/post.h" #endif /* ACE_ASYNCH_IO_H */ diff --git a/ace/Asynch_IO_Impl.cpp b/ace/Asynch_IO_Impl.cpp index 8b52d7eab9a..8dba289d6ec 100644 --- a/ace/Asynch_IO_Impl.cpp +++ b/ace/Asynch_IO_Impl.cpp @@ -10,6 +10,8 @@ #include "ace/Asynch_IO_Impl.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Asynch_Result_Impl::~ACE_Asynch_Result_Impl (void) { } @@ -110,7 +112,6 @@ ACE_Asynch_Write_Dgram_Result_Impl::ACE_Asynch_Write_Dgram_Result_Impl (void) { } - - +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_WIN32 || ACE_HAS_WINCE */ diff --git a/ace/Asynch_IO_Impl.h b/ace/Asynch_IO_Impl.h index a6feb00fbf7..7dc5f283126 100644 --- a/ace/Asynch_IO_Impl.h +++ b/ace/Asynch_IO_Impl.h @@ -36,6 +36,8 @@ #include "ace/Asynch_IO.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration. class ACE_Proactor_Impl; @@ -305,7 +307,7 @@ public: /** * Same as above but with scatter support, through chaining of composite * message blocks using the continuation field. - * NOTE: In win32 Each data block payload must be at least the size of a system + * @note In win32 Each data block payload must be at least the size of a system * memory page and must be aligned on a system memory page size boundary */ virtual int readv (ACE_Message_Block &message_block, @@ -317,10 +319,6 @@ public: int signal_number) = 0; #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - // We don;t need to redefine the following function again because it - // has already been defined in ACE_Asynch_Read_Stream_Impl. But we - // still need it here to supress a overwriting pure virtual function - // warning in KAI compiler. /// This starts off an asynchronous read. Upto <bytes_to_read> will /// be read and stored in the <message_block>. virtual int read (ACE_Message_Block &message_block, @@ -394,7 +392,7 @@ public: /** * Same as above but with gather support, through chaining of composite * message blocks using the continuation field. - * NOTE: In win32 Each data block payload must be at least the size of a system + * @note In win32 Each data block payload must be at least the size of a system * memory page and must be aligned on a system memory page size boundary */ virtual int writev (ACE_Message_Block &message_block, @@ -406,13 +404,8 @@ public: int signal_number) = 0; #endif /* (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) */ - - // We don;t need to redefine the following function again because it - // has already been defined in ACE_Asynch_Write_Stream_Impl. But we - // still need it here to supress a overwriting pure virtual function - // warning in KAI compiler. - /// This starts off an asynchronous write. Upto <bytes_to_write> - /// will be written from the <message_block>. + /// This starts off an asynchronous write. Upto @a bytes_to_write + /// will be written from the @a message_block. virtual int write (ACE_Message_Block &message_block, size_t bytes_to_write, const void *act, @@ -470,12 +463,12 @@ public: /** * This starts off an asynchronous accept. The asynchronous accept * call also allows any initial data to be returned to the - * <handler>. Upto <bytes_to_read> will be read and stored in the - * <message_block>. The <accept_handle> will be used for the - * <accept> call. If (<accept_handle> == INVALID_HANDLE), a new + * <handler>. Upto @a bytes_to_read will be read and stored in the + * <message_block>. The @a accept_handle will be used for the + * <accept> call. If (@a accept_handle == INVALID_HANDLE), a new * handle will be created. * - * <message_block> must be specified. This is because the address of + * @a message_block must be specified. This is because the address of * the new connection is placed at the end of this buffer. */ virtual int accept (ACE_Message_Block &message_block, @@ -812,6 +805,8 @@ protected: ACE_Asynch_Write_Dgram_Result_Impl (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Asynch_IO_Impl.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Asynch_IO_Impl.inl b/ace/Asynch_IO_Impl.inl index 3d61fae7942..495a768a972 100644 --- a/ace/Asynch_IO_Impl.inl +++ b/ace/Asynch_IO_Impl.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Asynch_Result_Impl::ACE_Asynch_Result_Impl (void) { @@ -98,3 +102,5 @@ ACE_Asynch_Transmit_File_Result_Impl::ACE_Asynch_Transmit_File_Result_Impl (void : ACE_Asynch_Result_Impl () { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Asynch_Pseudo_Task.cpp b/ace/Asynch_Pseudo_Task.cpp index ce936471e52..b3e25ef0298 100644 --- a/ace/Asynch_Pseudo_Task.cpp +++ b/ace/Asynch_Pseudo_Task.cpp @@ -7,6 +7,8 @@ ACE_RCSID(ace, Asynch_Pseudo_Task, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Asynch_Pseudo_Task::ACE_Asynch_Pseudo_Task() : select_reactor_ (), // should be initialized before reactor_ reactor_ (&select_reactor_, 0) // don't delete implementation @@ -18,7 +20,7 @@ ACE_Asynch_Pseudo_Task::~ACE_Asynch_Pseudo_Task() this->stop(); } -int +int ACE_Asynch_Pseudo_Task::start (void) { if (this->reactor_.initialized () == 0) @@ -30,10 +32,10 @@ ACE_Asynch_Pseudo_Task::start (void) return this->activate () == -1 ? -1 : 0; // If started, return 0 } -int +int ACE_Asynch_Pseudo_Task::stop (void) { - if (this->thr_count () == 0) // already stopped + if (this->thr_count () == 0) // already stopped return 0; if (this->reactor_.end_reactor_event_loop () == -1) @@ -47,7 +49,7 @@ ACE_Asynch_Pseudo_Task::stop (void) int ACE_Asynch_Pseudo_Task::svc (void) { -#if !defined (ACE_WIN32) +#if !defined (ACE_WIN32) sigset_t RT_signals; @@ -92,7 +94,7 @@ ACE_Asynch_Pseudo_Task::register_io_handler (ACE_HANDLE handle, ACE_LIB_TEXT ("register_io_handler (suspended)"))); this->reactor_.remove_handler (handle, ACE_Event_Handler::ALL_EVENTS_MASK - | ACE_Event_Handler::DONT_CALL); + | ACE_Event_Handler::DONT_CALL); return -1; } @@ -126,3 +128,5 @@ ACE_Asynch_Pseudo_Task::resume_io_handler (ACE_HANDLE handle) { return this->reactor_.resume_handler (handle); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Asynch_Pseudo_Task.h b/ace/Asynch_Pseudo_Task.h index a20570737b5..7fc68e16b70 100644 --- a/ace/Asynch_Pseudo_Task.h +++ b/ace/Asynch_Pseudo_Task.h @@ -25,6 +25,8 @@ #include "ace/Select_Reactor.h" #include "ace/Task.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /* * Specialization hook to replace the Reactor with the * concrete Reactor implementation, e.g., select_st, @@ -63,6 +65,8 @@ protected: ACE_Reactor reactor_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_ASYNCH_PSEUDO_TASK_H */ diff --git a/ace/Atomic_Op.cpp b/ace/Atomic_Op.cpp index eee9f742d2c..8737981a794 100644 --- a/ace/Atomic_Op.cpp +++ b/ace/Atomic_Op.cpp @@ -179,7 +179,8 @@ multi_cpu_exchange_add (volatile long *value, long rhs) } // end namespace - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::increment_fn_) (volatile long *) = 0; long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::decrement_fn_) (volatile long *) = 0; long (*ACE_Atomic_Op<ACE_Thread_Mutex, long>::exchange_fn_) (volatile long *, long) = 0; @@ -246,4 +247,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ diff --git a/ace/Atomic_Op.h b/ace/Atomic_Op.h index 968ed3d49b5..991625cd32f 100644 --- a/ace/Atomic_Op.h +++ b/ace/Atomic_Op.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -44,6 +44,9 @@ #endif /* ACE_HAS_THREADS */ #if defined (ACE_HAS_BUILTIN_ATOMIC_OP) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Atomic_Op<ACE_Thread_Mutex, long> * @@ -61,7 +64,7 @@ public: ACE_Atomic_Op (void); /// Initialize <value_> to c. - ACE_Atomic_Op (long c); + ACE_Atomic_Op (const long &c); /// Manage copying... ACE_Atomic_Op (const ACE_Atomic_Op<ACE_Thread_Mutex, long> &c); @@ -125,10 +128,13 @@ public: static void init_functions (void); private: + // This function cannot be supported by this template specialization. // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex // template instead. - ACE_UNIMPLEMENTED_FUNC (ACE_Thread_Mutex &mutex (void)) + ACE_Thread_Mutex &mutex (void); + +private: /// Current object decorated by the atomic op. volatile long value_; @@ -157,7 +163,7 @@ public: ACE_Atomic_Op (void); /// Initialize <value_> to c. - ACE_Atomic_Op (unsigned long c); + ACE_Atomic_Op (const unsigned long &c); /// Manage copying... ACE_Atomic_Op (const ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long> &c); @@ -221,10 +227,13 @@ public: static void init_functions (void); private: + // This function cannot be supported by this template specialization. // If you need access to an underlying lock, use the ACE_Atomic_Op_Ex // template instead. - ACE_UNIMPLEMENTED_FUNC (ACE_Thread_Mutex &mutex (void)) + ACE_Thread_Mutex &mutex (void); + +private: /// Current object decorated by the atomic op. volatile unsigned long value_; @@ -236,6 +245,8 @@ private: static long (*exchange_add_fn_) (volatile long *, long); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ #if defined (__ACE_INLINE__) diff --git a/ace/Atomic_Op.inl b/ace/Atomic_Op.inl index 7c481b206ad..007f653bbfa 100644 --- a/ace/Atomic_Op.inl +++ b/ace/Atomic_Op.inl @@ -5,6 +5,8 @@ #if defined (ACE_HAS_BUILTIN_ATOMIC_OP) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (void) : value_ (0) @@ -12,7 +14,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (void) } ACE_INLINE -ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (long c) +ACE_Atomic_Op<ACE_Thread_Mutex, long>::ACE_Atomic_Op (const long &c) : value_ (c) { } @@ -157,7 +159,7 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (void) } ACE_INLINE -ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (unsigned long c) +ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::ACE_Atomic_Op (const unsigned long &c) : value_ (c) { } @@ -294,4 +296,6 @@ ACE_Atomic_Op<ACE_Thread_Mutex, unsigned long>::value_i (void) return this->value_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_BUILTIN_ATOMIC_OP */ diff --git a/ace/Atomic_Op_T.cpp b/ace/Atomic_Op_T.cpp index cfa7b1b316e..d31e49e081a 100644 --- a/ace/Atomic_Op_T.cpp +++ b/ace/Atomic_Op_T.cpp @@ -1,5 +1,5 @@ -#ifndef ACE_ATOMIC_OP_T_C -#define ACE_ATOMIC_OP_T_C +#ifndef ACE_ATOMIC_OP_T_CPP +#define ACE_ATOMIC_OP_T_CPP #include "ace/Atomic_Op_T.h" #include "ace/Log_Msg.h" @@ -12,6 +12,7 @@ #include "ace/Atomic_Op_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op_Ex) ACE_ALLOC_HOOK_DEFINE(ACE_Atomic_Op) @@ -71,4 +72,6 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op (const TYPE &c) // ACE_TRACE ("ACE_Atomic_Op<ACE_LOCK, TYPE>::ACE_Atomic_Op"); } -#endif /* ACE_ATOMIC_OP_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_ATOMIC_OP_T_CPP */ diff --git a/ace/Atomic_Op_T.h b/ace/Atomic_Op_T.h index b87c1db1d4c..89703186356 100644 --- a/ace/Atomic_Op_T.h +++ b/ace/Atomic_Op_T.h @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Atomic_Op_Ex * @@ -110,7 +112,7 @@ public: * Returns a reference to the underlying <ACE_LOCK>. This makes it * possible to acquire the lock explicitly, which can be useful in * some cases if you instantiate the <ACE_Atomic_Op_Ex> with an - * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>. NOTE: the right + * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>. @note the right * name would be lock_, but HP/C++ will choke on that! */ ACE_LOCK &mutex (void); @@ -234,6 +236,7 @@ private: ACE_Atomic_Op_Ex <ACE_LOCK, TYPE> impl_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Atomic_Op_T.inl" diff --git a/ace/Atomic_Op_T.inl b/ace/Atomic_Op_T.inl index 4a236220741..41b7ccd2af0 100644 --- a/ace/Atomic_Op_T.inl +++ b/ace/Atomic_Op_T.inl @@ -4,6 +4,8 @@ #include "ace/Guard_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // // ACE_Atomic_Op_Ex inline functions // @@ -277,3 +279,5 @@ ACE_Atomic_Op<ACE_LOCK, TYPE>::value_i (void) { return this->impl_.value_i (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Event.cpp b/ace/Auto_Event.cpp index 67444d3c886..456ac2a4890 100644 --- a/ace/Auto_Event.cpp +++ b/ace/Auto_Event.cpp @@ -6,8 +6,11 @@ #include "ace/Auto_Event.inl" #endif /* __ACE_INLINE__ */ +ACE_RCSID (ace, + Auto_Event, + "$Id$") -ACE_RCSID(ace, Auto_Event, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Auto_Event::ACE_Auto_Event (int initial_state, int type, @@ -40,3 +43,5 @@ ACE_Auto_Event::dump (void) const ACE_Event::dump (); #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Event.h b/ace/Auto_Event.h index 50e6aedf88c..db1a834e9c0 100644 --- a/ace/Auto_Event.h +++ b/ace/Auto_Event.h @@ -24,6 +24,8 @@ #include "ace/Event.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Auto_Event * @@ -37,13 +39,13 @@ class ACE_Export ACE_Auto_Event : public ACE_Event { public: - /// constructor which will create auto event + /// Constructor which will create auto event ACE_Auto_Event (int initial_state = 0, int type = USYNC_THREAD, const char *name = 0, void *arg = 0); - /// constructor which will create auto event (wchar_t version) + /// Constructor which will create auto event (wchar_t version) ACE_Auto_Event (int initial_state, int type, const wchar_t *name, @@ -59,6 +61,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Auto_Event.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Auto_Event.inl b/ace/Auto_Event.inl index e8858bfa4a6..80048c29b99 100644 --- a/ace/Auto_Event.inl +++ b/ace/Auto_Event.inl @@ -1,7 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Auto_Event::~ACE_Auto_Event (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Functor.cpp b/ace/Auto_Functor.cpp index af1ff0142ce..91dbad1952b 100644 --- a/ace/Auto_Functor.cpp +++ b/ace/Auto_Functor.cpp @@ -1,3 +1,5 @@ +// $Id$ + #ifndef ACE_AUTO_FUNCTOR_CPP #define ACE_AUTO_FUNCTOR_CPP @@ -7,7 +9,7 @@ # include "ace/Auto_Functor.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Auto_Functor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template<typename X, typename Functor> ACE_Utils::Auto_Functor<X,Functor>::~Auto_Functor() @@ -35,4 +37,6 @@ ACE_Utils::Auto_Functor<X,Functor>::reset(X * p, Functor f) f_ = f; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /*ACE_AUTO_FUNCTOR_CPP*/ diff --git a/ace/Auto_Functor.h b/ace/Auto_Functor.h index 8a5f9f2ed71..b9bcf8342b1 100644 --- a/ace/Auto_Functor.h +++ b/ace/Auto_Functor.h @@ -20,6 +20,8 @@ #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_Utils { /** @@ -127,7 +129,9 @@ private: Functor f_; }; -} // namespace TAO +} // namespace ACE_Utils + +ACE_END_VERSIONED_NAMESPACE_DECL #if defined(__ACE_INLINE__) # include "ace/Auto_Functor.inl" diff --git a/ace/Auto_Functor.inl b/ace/Auto_Functor.inl index 6364894bc86..31c2dc25f97 100644 --- a/ace/Auto_Functor.inl +++ b/ace/Auto_Functor.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<typename X, typename Functor> ACE_INLINE ACE_Utils::Auto_Functor_Ref<X,Functor>:: Auto_Functor_Ref(X * p, Functor f) @@ -141,3 +145,5 @@ ACE_Utils::Auto_Functor<X,Functor>::operator ACE_Utils::Auto_Functor_Ref<X,Funct } #endif /* ACE_LACKS_MEMBER_TEMPLATES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_IncDec_T.cpp b/ace/Auto_IncDec_T.cpp index c4e689e3ab2..cf33efd7d6e 100644 --- a/ace/Auto_IncDec_T.cpp +++ b/ace/Auto_IncDec_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_AUTO_INCDEC_T_C -#define ACE_AUTO_INCDEC_T_C +#ifndef ACE_AUTO_INCDEC_T_CPP +#define ACE_AUTO_INCDEC_T_CPP #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -10,12 +10,12 @@ #include "ace/Auto_IncDec_T.h" #include "ace/Log_Msg.h" -ACE_RCSID(ace, Auto_IncDec_T, "Auto_IncDec_T.cpp, by Edan Ayal") - #if !defined (__ACE_INLINE__) #include "ace/Auto_IncDec_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Auto_IncDec) template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> void @@ -29,4 +29,6 @@ ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::dump (void) const #endif /* ACE_HAS_DUMP */ } -#endif /* ACE_AUTO_INCDEC_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_AUTO_INCDEC_T_CPP */ diff --git a/ace/Auto_IncDec_T.h b/ace/Auto_IncDec_T.h index a9092c7c122..2aeefe27247 100644 --- a/ace/Auto_IncDec_T.h +++ b/ace/Auto_IncDec_T.h @@ -24,6 +24,8 @@ #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Auto_IncDec * @@ -62,9 +64,10 @@ private: ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Auto_IncDec_T.inl" -// On non-Win32 platforms, this code will be inlined #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) diff --git a/ace/Auto_IncDec_T.inl b/ace/Auto_IncDec_T.inl index 96658ed76c5..51daac0e84d 100644 --- a/ace/Auto_IncDec_T.inl +++ b/ace/Auto_IncDec_T.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Implicitly and automatically increment the counter. template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> ACE_INLINE @@ -19,3 +22,4 @@ ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE>::~ACE_Auto_IncDec (void) --this->counter_; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Auto_Ptr.cpp b/ace/Auto_Ptr.cpp index 9c2827504c9..081744ce316 100644 --- a/ace/Auto_Ptr.cpp +++ b/ace/Auto_Ptr.cpp @@ -1,8 +1,7 @@ -// Auto_Ptr.cpp // $Id$ -#if !defined (ACE_AUTO_PTR_C) -#define ACE_AUTO_PTR_C +#ifndef ACE_AUTO_PTR_CPP +#define ACE_AUTO_PTR_CPP #include "ace/Auto_Ptr.h" @@ -12,19 +11,11 @@ ACE_RCSID(ace, Auto_Ptr, "$Id$") -ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Ptr) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Ptr) ACE_ALLOC_HOOK_DEFINE(ACE_Auto_Basic_Array_Ptr) -#if defined (__MINGW32__) -# if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ - (ACE_HAS_STANDARD_CPP_LIBRARY != 0) -# if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template alloc; -# elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate alloc -# endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -# endif /* ACE_HAS_STANDARD_CPP_LIBRARY != 0 */ -#endif /* __MINGW32__ */ - -#endif /* ACE_AUTO_PTR_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_AUTO_PTR_CPP */ diff --git a/ace/Auto_Ptr.h b/ace/Auto_Ptr.h index 1f0d93062dc..5fe2908937f 100644 --- a/ace/Auto_Ptr.h +++ b/ace/Auto_Ptr.h @@ -32,6 +32,9 @@ # pragma warning(disable: 4284) #endif /* _MSC_VER */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Auto_Basic_Ptr * @@ -65,6 +68,8 @@ protected: X *p_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if !defined (ACE_LACKS_AUTO_PTR) && \ defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ (ACE_HAS_STANDARD_CPP_LIBRARY != 0) @@ -93,6 +98,7 @@ public: #endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @brief Implements the draft C++ standard auto_ptr abstraction. @@ -163,17 +169,24 @@ public: X *operator-> () const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + // Some platforms have an older version of auto_ptr // support, which lacks reset, and cannot be disabled // easily. Portability to these platforms requires // use of the following ACE_AUTO_PTR_RESET macro. +// +// Note that this macro correctly handles the case where NEWPTR may be +// a call to operator new(), e.g. "new foo", by making sure it is only +// evaluated once. # if defined (ACE_AUTO_PTR_LACKS_RESET) # define ACE_AUTO_PTR_RESET(AUTOPTR,NEWPTR,TYPE) \ do { \ - if (NEWPTR != AUTOPTR.get ()) \ + TYPE * tmp_ptr = NEWPTR; \ + if (tmp_ptr != AUTOPTR.get ()) \ { \ - AUTOPTR.release (); \ - AUTOPTR = auto_ptr<TYPE> (NEWPTR); \ + delete AUTOPTR.release (); \ + AUTOPTR = auto_ptr<TYPE> (tmp_ptr); \ } \ } while (0) # else /* ! ACE_AUTO_PTR_LACKS_RESET */ diff --git a/ace/Auto_Ptr.inl b/ace/Auto_Ptr.inl index ce4d53a490c..57adb236261 100644 --- a/ace/Auto_Ptr.inl +++ b/ace/Auto_Ptr.inl @@ -1,10 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Auto_Ptr.i - #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class X> ACE_INLINE void ACE_Auto_Basic_Ptr<X>::dump (void) const { @@ -167,3 +168,4 @@ ACE_Auto_Array_Ptr<X>::operator->() const return this->get (); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Barrier.cpp b/ace/Barrier.cpp index 6637f1ec638..739e249cd76 100644 --- a/ace/Barrier.cpp +++ b/ace/Barrier.cpp @@ -9,12 +9,17 @@ #endif /* __ACE_INLINE__ */ #include "ace/Guard_T.h" +#include "ace/OS_NS_errno.h" #if defined (ACE_HAS_DUMP) # include "ace/Log_Msg.h" #endif /* ACE_HAS_DUMP */ -ACE_RCSID(ace, Barrier, "$Id$") +ACE_RCSID (ace, + Barrier, + "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Sub_Barrier) @@ -69,7 +74,7 @@ ACE_Barrier::ACE_Barrier (unsigned int count, sub_barrier_1_ (count, lock_, name, arg), sub_barrier_2_ (count, lock_, name, arg) { -// ACE_TRACE ("ACE_Barrier::ACE_Barrier"); + ACE_TRACE ("ACE_Barrier::ACE_Barrier"); this->sub_barrier_[0] = &this->sub_barrier_1_; this->sub_barrier_[1] = &this->sub_barrier_2_; } @@ -77,7 +82,7 @@ ACE_Barrier::ACE_Barrier (unsigned int count, int ACE_Barrier::wait (void) { -// ACE_TRACE ("ACE_Barrier::wait"); + ACE_TRACE ("ACE_Barrier::wait"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); ACE_Sub_Barrier *sbp = @@ -85,14 +90,18 @@ ACE_Barrier::wait (void) // Check for shutdown... if (sbp == 0) - return -1; + { + errno = ESHUTDOWN; + return -1; + } + + int retval = 0; if (sbp->running_threads_ == 1) { // We're the last running thread, so swap generations and tell // all the threads waiting on the barrier to continue on their // way. - sbp->running_threads_ = this->count_; // Swap generations. this->current_generation_ = 1 - this->current_generation_; @@ -105,8 +114,43 @@ ACE_Barrier::wait (void) // Block until all the other threads wait(). while (sbp->running_threads_ != this->count_) sbp->barrier_finished_.wait (); + + // We're awake and the count has completed. See if it completed + // because all threads hit the barrier, or because the barrier + // was shut down. + if (this->sub_barrier_[this->current_generation_] == 0) + { + errno = ESHUTDOWN; + retval = -1; + } + } + + return retval; +} + +int +ACE_Barrier::shutdown (void) +{ + ACE_TRACE ("ACE_Barrier::shutdown"); + ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + + ACE_Sub_Barrier *sbp = + this->sub_barrier_[this->current_generation_]; + + // Check for shutdown... + if (sbp == 0) + { + errno = ESHUTDOWN; + return -1; } + // Flag the shutdown + this->sub_barrier_[0] = 0; + this->sub_barrier_[1] = 0; + // Tell all the threads waiting on the barrier to continue on their way. + sbp->running_threads_ = this->count_; + sbp->barrier_finished_.broadcast (); + return 0; } @@ -148,4 +192,6 @@ ACE_Process_Barrier::dump (void) const } #endif /* 0 */ +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/Barrier.h b/ace/Barrier.h index 1bc2514c1de..7939aed1d24 100644 --- a/ace/Barrier.h +++ b/ace/Barrier.h @@ -16,31 +16,27 @@ #define ACE_BARRIER_H #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/OS_NS_errno.h" +#include "ace/config-all.h" // ACE platform supports some form of threading. #if !defined (ACE_HAS_THREADS) -#include "ace/config-all.h" +#include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Barrier * * @brief This is a no-op to make ACE "syntactically consistent." */ -class ACE_Threads_Export ACE_Barrier +class ACE_Export ACE_Barrier { public: ACE_Barrier (unsigned int, const ACE_TCHAR * = 0, void * = 0) {} @@ -49,11 +45,15 @@ public: void dump (void) const {} }; +ACE_END_VERSIONED_NAMESPACE_DECL + #else /* ACE_HAS_THREADS */ #include "ace/Condition_Thread_Mutex.h" -struct ACE_Threads_Export ACE_Sub_Barrier +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +struct ACE_Export ACE_Sub_Barrier { // = Initialization. ACE_Sub_Barrier (unsigned int count, @@ -93,7 +93,7 @@ struct ACE_Threads_Export ACE_Sub_Barrier * SunOpsis Vol. 4, No. 1 by Richard Marejka * (Richard.Marejka@canada.sun.com). */ -class ACE_Threads_Export ACE_Barrier +class ACE_Export ACE_Barrier { public: /// Initialize the barrier to synchronize @a count threads. @@ -106,8 +106,20 @@ public: /// Block the caller until all @c count threads have called @c wait and /// then allow all the caller threads to continue in parallel. + /// + /// @retval 0 after successfully waiting for all threads to wait. -1 if + /// an error occurs or the barrier is shut down (@sa shutdown ()). int wait (void); + /// Shut the barrier down, aborting the wait of all waiting threads. + /// Any threads waiting on the barrier when it is shut down will return with + /// value -1, errno ESHUTDOWN. + /// + /// @retval 0 for success, -1 if already shut down. + /// + /// @since ACE beta 5.4.9. + int shutdown (void); + /// Dump the state of an object. void dump (void) const; @@ -152,7 +164,7 @@ private: * This class is just a simple wrapper for ACE_Barrier that * selects the USYNC_PROCESS variant for the locks. */ -class ACE_Threads_Export ACE_Process_Barrier : public ACE_Barrier +class ACE_Export ACE_Process_Barrier : public ACE_Barrier { public: /// Create a Process_Barrier, passing in the optional <name>. @@ -174,7 +186,7 @@ public: * This class is just a simple wrapper for ACE_Barrier that * selects the USYNC_THREAD variant for the locks. */ -class ACE_Threads_Export ACE_Thread_Barrier : public ACE_Barrier +class ACE_Export ACE_Thread_Barrier : public ACE_Barrier { public: /// Create a Thread_Barrier, passing in the optional @a name. @@ -190,6 +202,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Barrier.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Barrier.inl b/ace/Barrier.inl index bb7a483b3e3..9ab5c9fb111 100644 --- a/ace/Barrier.inl +++ b/ace/Barrier.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Sub_Barrier::~ACE_Sub_Barrier (void) { @@ -15,3 +18,5 @@ ACE_INLINE ACE_Thread_Barrier::~ACE_Thread_Barrier (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Base_Thread_Adapter.cpp b/ace/Base_Thread_Adapter.cpp index 5aa59b6a113..23e3556fd9a 100644 --- a/ace/Base_Thread_Adapter.cpp +++ b/ace/Base_Thread_Adapter.cpp @@ -2,7 +2,9 @@ #include "ace/Base_Thread_Adapter.h" -ACE_RCSID(ace, Base_Thread_Adapter, "$Id$") +ACE_RCSID (ace, + Base_Thread_Adapter, + "$Id$") #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/Base_Thread_Adapter.inl" @@ -12,6 +14,8 @@ ACE_RCSID(ace, Base_Thread_Adapter, "$Id$") # include "ace/OS_NS_Thread.h" #endif /* ACE_HAS_TSS_EMULATION */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::init_log_msg_hook_ = 0; ACE_INHERIT_LOG_MSG_HOOK ACE_Base_Thread_Adapter::inherit_log_msg_hook_ = 0; ACE_CLOSE_LOG_MSG_HOOK ACE_Base_Thread_Adapter::close_log_msg_hook_ = 0; @@ -83,14 +87,16 @@ ACE_Base_Thread_Adapter::thr_desc_log_msg (void) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + // Run the thread entry point for the <ACE_Thread_Adapter>. This must // be an extern "C" to make certain compilers happy... #if defined (ACE_PSOS) extern "C" void -ace_thread_adapter (unsigned long args) +ACE_THREAD_ADAPTER_NAME (unsigned long args) { - ACE_OS_TRACE ("ace_thread_adapter"); + ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME"); #if defined (ACE_HAS_TSS_EMULATION) // As early as we can in the execution of the new thread, allocate @@ -100,7 +106,7 @@ ace_thread_adapter (unsigned long args) ACE_TSS_Emulation::tss_open (ts_storage); #endif /* ACE_HAS_TSS_EMULATION */ - ACE_Base_Thread_Adapter *thread_args = + ACE_Base_Thread_Adapter * const thread_args = static_cast<ACE_Base_Thread_Adapter *> (args); // Invoke the user-supplied function with the args. @@ -108,9 +114,9 @@ ace_thread_adapter (unsigned long args) } #else /* ! defined (ACE_PSOS) */ extern "C" ACE_THR_FUNC_RETURN -ace_thread_adapter (void *args) +ACE_THREAD_ADAPTER_NAME (void *args) { - ACE_OS_TRACE ("ace_thread_adapter"); + ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME"); #if defined (ACE_HAS_TSS_EMULATION) // As early as we can in the execution of the new thread, allocate @@ -120,7 +126,7 @@ ace_thread_adapter (void *args) ACE_TSS_Emulation::tss_open (ts_storage); #endif /* ACE_HAS_TSS_EMULATION */ - ACE_Base_Thread_Adapter *thread_args = + ACE_Base_Thread_Adapter * const thread_args = static_cast<ACE_Base_Thread_Adapter *> (args); #ifdef ACE_USES_GPROF diff --git a/ace/Base_Thread_Adapter.h b/ace/Base_Thread_Adapter.h index cd82e2b45ac..b4425f32896 100644 --- a/ace/Base_Thread_Adapter.h +++ b/ace/Base_Thread_Adapter.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + //============================================================================= /** * @file Base_Thread_Adapter.h @@ -25,14 +27,21 @@ #include "os_include/sys/os_time.h" #endif // ACE_USES_GPROF +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# define ACE_THREAD_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_thread_adapter) +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + // Run the thread entry point for the ACE_Thread_Adapter. This must // be an extern "C" to make certain compilers happy... + #if defined (ACE_PSOS) -extern "C" void ace_thread_adapter (unsigned long args); +extern "C" void ACE_THREAD_ADAPTER_NAME (unsigned long args); #else /* ! defined (ACE_PSOS) */ -extern "C" ACE_Export ACE_THR_FUNC_RETURN ace_thread_adapter (void *args); +extern "C" ACE_Export ACE_THR_FUNC_RETURN ACE_THREAD_ADAPTER_NAME (void *args); #endif /* ACE_PSOS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_OS_Thread_Descriptor * @@ -108,7 +117,7 @@ protected: /// Constructor. ACE_Base_Thread_Adapter (ACE_THR_FUNC user_func, void *arg, - ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ace_thread_adapter, + ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, ACE_OS_Thread_Descriptor *td = 0 # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) , ACE_SEH_EXCEPT_HANDLER selector = 0 @@ -163,11 +172,10 @@ protected: struct itimerval itimer_; #endif // ACE_USES_GPROF - /// Friend declaration to avoid compiler warning: only defines a private - /// destructor and has no friends. - friend class ACE_Thread_Adapter_Has_Private_Destructor; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/Base_Thread_Adapter.inl b/ace/Base_Thread_Adapter.inl index 814c50e610d..7fa3959034b 100644 --- a/ace/Base_Thread_Adapter.inl +++ b/ace/Base_Thread_Adapter.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE long ACE_OS_Thread_Descriptor::flags (void) const { @@ -32,6 +36,7 @@ ACE_Base_Thread_Adapter::entry_point (void) { return this->entry_point_; } + #ifdef ACE_USES_GPROF ACE_INLINE itimerval* ACE_Base_Thread_Adapter::timerval (void) @@ -39,3 +44,5 @@ ACE_Base_Thread_Adapter::timerval (void) return &(this->itimer_); } #endif // ACE_USES_GPROF + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Based_Pointer_Repository.cpp b/ace/Based_Pointer_Repository.cpp index 2973da69ee8..74ea8994c6d 100644 --- a/ace/Based_Pointer_Repository.cpp +++ b/ace/Based_Pointer_Repository.cpp @@ -7,6 +7,8 @@ #include "ace/Synch_Traits.h" #include "ace/RW_Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Based_Pointer_Repository_Rep * @@ -111,21 +113,9 @@ ACE_Based_Pointer_Repository::unbind (void *addr) return 0; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton <ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>; -template class ACE_Map_Entry<void *, size_t>; -template class ACE_Map_Manager<void *, size_t, ACE_Null_Mutex>; -template class ACE_Map_Iterator<void *, size_t, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<void *, size_t, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<void *, size_t, ACE_Null_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton <ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX> -#pragma instantiate ACE_Map_Entry<void *, size_t> -#pragma instantiate ACE_Map_Manager<void *, size_t, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<void *, size_t, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<void *, size_t, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<void *, size_t, ACE_Null_Mutex> -#elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) template ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX> * ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX>::singleton_; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Based_Pointer_Repository.h b/ace/Based_Pointer_Repository.h index 586bfcf79be..5d0b1b8fe41 100644 --- a/ace/Based_Pointer_Repository.h +++ b/ace/Based_Pointer_Repository.h @@ -16,21 +16,19 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -# define ACE_MEMORY_SINGLETON_DECLARE ACE_SINGLETON_DECLARE -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Singleton.h" #include "ace/Synch_Traits.h" #include "ace/os_include/os_stddef.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl., using the "Cheshire Cat" technique. class ACE_Based_Pointer_Repository_Rep; @@ -40,10 +38,10 @@ class ACE_Based_Pointer_Repository_Rep; * @brief Maps pointers to the base address of the region to which each * pointer belongs. */ -class ACE_Memory_Export ACE_Based_Pointer_Repository +class ACE_Export ACE_Based_Pointer_Repository { public: - // = Use <ACE_Null_Mutex> to allow locking while iterating. + // = Use ACE_Null_Mutex to allow locking while iterating. // = Initialization and termination methods. ACE_Based_Pointer_Repository (void); @@ -51,9 +49,9 @@ public: // = Search structure methods. /** - * Return the appropriate <base_addr> region that contains <addr>. - * Returns 1 on success and 0 if the <addr> isn't contained in any - * <base_addr> region. + * Return the appropriate @a base_addr region that contains @a addr. + * Returns 1 on success and 0 if the @a addr isn't contained in any + * @a base_addr region. */ int find (void *addr, void *&base_addr); @@ -77,17 +75,16 @@ private: // ---------------------------------- -#include "ace/Singleton.h" - /// Declare a process wide singleton -ACE_MEMORY_SINGLETON_DECLARE (ACE_Singleton, - ACE_Based_Pointer_Repository, - ACE_SYNCH_RW_MUTEX) +ACE_SINGLETON_DECLARE (ACE_Singleton, + ACE_Based_Pointer_Repository, + ACE_SYNCH_RW_MUTEX) /// Provide a Singleton access point to the based pointer repository. typedef ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX> ACE_BASED_POINTER_REPOSITORY; +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/ace/Based_Pointer_T.cpp b/ace/Based_Pointer_T.cpp index c648d28834f..2155bc3a734 100644 --- a/ace/Based_Pointer_T.cpp +++ b/ace/Based_Pointer_T.cpp @@ -13,6 +13,8 @@ #include "ace/Based_Pointer_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class CONCRETE> ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (void) { @@ -114,4 +116,6 @@ ACE_Based_Pointer<CONCRETE>::ACE_Based_Pointer (const ACE_Based_Pointer<CONCRETE ACE_ASSERT (0); // not implemented. } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_BASED_POINTER_T_CPP */ diff --git a/ace/Based_Pointer_T.h b/ace/Based_Pointer_T.h index 91ebfc778cd..1d778639211 100644 --- a/ace/Based_Pointer_T.h +++ b/ace/Based_Pointer_T.h @@ -27,6 +27,8 @@ #pragma warning(disable: 4284) #endif /* _MSC_VER */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Based_Pointer_Basic * @@ -158,15 +160,15 @@ class ACE_Based_Pointer : public ACE_Based_Pointer_Basic<CONCRETE> { public: // = Initialization method. - /// Constructor. See constructor for <ACE_Based_Pointer_Basic> for + /// Constructor. See constructor for ACE_Based_Pointer_Basic for /// details. ACE_Based_Pointer (void); /// Initialize this object using the <initial> pointer. See - /// constructor for <ACE_Based_Pointer_Basic> for details. + /// constructor for ACE_Based_Pointer_Basic for details. ACE_Based_Pointer (CONCRETE *initial); - /// Initialize this object with known <base_addr>. <dummy> is + /// Initialize this object with known @a base_addr. @a dummy is /// a dummy value used to resolve overload ambiguity and it /// otherwise ignored. ACE_Based_Pointer (const void *base_addr, int dummy); @@ -184,6 +186,8 @@ public: CONCRETE *operator-> (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Based_Pointer_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Based_Pointer_T.inl b/ace/Based_Pointer_T.inl index b45e14073e3..4d6b86e0c41 100644 --- a/ace/Based_Pointer_T.inl +++ b/ace/Based_Pointer_T.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #define ACE_COMPUTE_BASED_POINTER(P) (((char *) (P) - (P)->base_offset_) + (P)->target_) #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class CONCRETE> ACE_INLINE CONCRETE * ACE_Based_Pointer<CONCRETE>::operator->(void) { @@ -132,3 +135,5 @@ ACE_Based_Pointer<CONCRETE>::operator= (const ACE_Based_Pointer<CONCRETE> &rhs) ACE_TRACE ("ACE_Based_Pointer<CONCRETE>::operator="); *this = rhs.addr (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Basic_Stats.cpp b/ace/Basic_Stats.cpp index ed0be542095..e727d1c8224 100644 --- a/ace/Basic_Stats.cpp +++ b/ace/Basic_Stats.cpp @@ -7,7 +7,11 @@ #include "ace/Basic_Stats.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Basic_Stats, "$Id$") +ACE_RCSID(ace, + Basic_Stats, + "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs) @@ -28,7 +32,7 @@ ACE_Basic_Stats::accumulate (const ACE_Basic_Stats &rhs) if (this->min_ > rhs.min_) { this->min_ = rhs.min_; - this->min_at_ = rhs.min_at_; + this->min_at_ = rhs.min_at_; } if (this->max_ < rhs.max_) { @@ -96,3 +100,5 @@ ACE_Basic_Stats::dump_results (const wchar_t *msg, #endif /* ACE_NLOGGING */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Basic_Stats.h b/ace/Basic_Stats.h index ffbd7ce1df6..f0c8a0f3b38 100644 --- a/ace/Basic_Stats.h +++ b/ace/Basic_Stats.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /// Collect basic stats about a series of samples /** * Compute the average and standard deviation (aka jitter) for an @@ -78,6 +80,8 @@ public: ACE_UINT64 sum_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Basic_Stats.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Basic_Stats.inl b/ace/Basic_Stats.inl index b2fd80d121a..bbdce099907 100644 --- a/ace/Basic_Stats.inl +++ b/ace/Basic_Stats.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Basic_Stats::ACE_Basic_Stats (void) : samples_count_ (0) @@ -45,3 +49,5 @@ ACE_Basic_Stats::sample (ACE_UINT64 value) this->sum_ += value; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Basic_Types.cpp b/ace/Basic_Types.cpp index b31658212a0..53544d079eb 100644 --- a/ace/Basic_Types.cpp +++ b/ace/Basic_Types.cpp @@ -19,6 +19,8 @@ ACE_RCSID (ace, # include "ace/streams.h" # endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_U_LongLong::output (FILE *file) const { @@ -131,8 +133,7 @@ operator<< (ostream& os, const ACE_U_LongLong& ll) } # endif +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_LACKS_LONGLONG_T */ -// Explicit template instantiation file -#include "ace/Template_Instantiations.cpp" diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index cf08f81b4a0..c3ee616356e 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -32,7 +32,7 @@ * - ACE_INT32 * - ACE_UINT32 * - ACE_UINT64 - * (Note: ACE_INT64 is partly defined, there is no ACE_LongLong for + * (@note ACE_INT64 is partly defined, there is no ACE_LongLong for * platforms that don't have a native 8-byte integer type.) * * Byte-order (endian-ness) determination: @@ -151,97 +151,99 @@ # endif /* !defined (ACE_SIZEOF_LONG_LONG) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // The sizes of the commonly implemented types are now known. Set up // typedefs for whatever we can. Some of these are needed for certain // cases of ACE_UINT64, so do them before the 64-bit stuff. #if defined (ACE_INT8_TYPE) - typedef ACE_INT8_TYPE ACE_INT8; + typedef ACE_INT8_TYPE ACE_INT8; #elif defined (ACE_HAS_INT8_T) - typedef int8_t ACE_INT8; + typedef int8_t ACE_INT8; #elif !defined (ACE_LACKS_SIGNED_CHAR) - typedef signed char ACE_INT8; + typedef signed char ACE_INT8; #else - typedef char ACE_INT8; + typedef char ACE_INT8; #endif /* defined (ACE_INT8_TYPE) */ #if defined (ACE_UINT8_TYPE) - typedef ACE_UINT8_TYPE ACE_UINT8; + typedef ACE_UINT8_TYPE ACE_UINT8; #elif defined (ACE_HAS_UINT8_T) - typedef uint8_t ACE_UINT8; + typedef uint8_t ACE_UINT8; #else - typedef unsigned char ACE_UINT8; + typedef unsigned char ACE_UINT8; #endif /* defined (ACE_UINT8_TYPE) */ #if defined (ACE_INT16_TYPE) - typedef ACE_INT16_TYPE ACE_INT16; + typedef ACE_INT16_TYPE ACE_INT16; #elif defined (ACE_HAS_INT16_T) - typedef int16_t ACE_INT16; + typedef int16_t ACE_INT16; #elif ACE_SIZEOF_SHORT == 2 - typedef short ACE_INT16; + typedef short ACE_INT16; #elif ACE_SIZEOF_INT == 2 - typedef int ACE_INT16; + typedef int ACE_INT16; #else # error Have to add to the ACE_INT16 type setting #endif /* defined (ACE_INT16_TYPE) */ #if defined (ACE_UINT16_TYPE) - typedef ACE_UINT16_TYPE ACE_UINT16; + typedef ACE_UINT16_TYPE ACE_UINT16; #elif defined (ACE_HAS_UINT16_T) - typedef uint16_t ACE_UINT16; + typedef uint16_t ACE_UINT16; #elif ACE_SIZEOF_SHORT == 2 - typedef unsigned short ACE_UINT16; + typedef unsigned short ACE_UINT16; #elif ACE_SIZEOF_INT == 2 - typedef unsigned int ACE_UINT16; + typedef unsigned int ACE_UINT16; #else # error Have to add to the ACE_UINT16 type setting #endif /* defined (ACE_UINT16_TYPE) */ #if defined (ACE_INT32_TYPE) - typedef ACE_INT32_TYPE ACE_INT32; + typedef ACE_INT32_TYPE ACE_INT32; #elif defined (ACE_HAS_INT32_T) - typedef int32_t ACE_INT32; + typedef int32_t ACE_INT32; #elif ACE_SIZEOF_INT == 4 - typedef int ACE_INT32; + typedef int ACE_INT32; #elif ACE_SIZEOF_LONG == 4 - typedef long ACE_INT32; + typedef long ACE_INT32; #else # error Have to add to the ACE_INT32 type setting #endif /* defined (ACE_INT32_TYPE) */ #if defined (ACE_UINT32_TYPE) - typedef ACE_UINT32_TYPE ACE_UINT32; + typedef ACE_UINT32_TYPE ACE_UINT32; #elif defined (ACE_HAS_UINT32_T) - typedef uint32_t ACE_UINT32; + typedef uint32_t ACE_UINT32; #elif ACE_SIZEOF_INT == 4 - typedef unsigned int ACE_UINT32; + typedef unsigned int ACE_UINT32; #elif ACE_SIZEOF_LONG == 4 - typedef unsigned long ACE_UINT32; + typedef unsigned long ACE_UINT32; #else # error Have to add to the ACE_UINT32 type setting #endif /* defined (ACE_UINT32_TYPE) */ #if defined (ACE_INT64_TYPE) - typedef ACE_INT64_TYPE ACE_INT64; + typedef ACE_INT64_TYPE ACE_INT64; #elif defined (ACE_HAS_INT64_T) - typedef int64_t ACE_INT64; + typedef int64_t ACE_INT64; #elif ACE_SIZEOF_LONG == 8 - typedef long ACE_INT64; + typedef long ACE_INT64; #elif !defined (ACE_LACKS_LONGLONG_T) && ACE_SIZEOF_LONG_LONG == 8 - typedef long long ACE_INT64; + typedef long long ACE_INT64; #endif /* defined (ACE_INT64_TYPE) */ #if !(defined (ACE_LACKS_LONGLONG_T) || defined (ACE_LACKS_UNSIGNEDLONGLONG_T)) /* See matching #if around ACE_U_LongLong class declaration below */ # if defined (ACE_UINT64_TYPE) - typedef ACE_UINT64_TYPE ACE_UINT64; + typedef ACE_UINT64_TYPE ACE_UINT64; # elif defined (ACE_HAS_UINT64_T) - typedef uint64_t ACE_UINT64; + typedef uint64_t ACE_UINT64; # elif ACE_SIZEOF_LONG == 8 - typedef unsigned long ACE_UINT64; + typedef unsigned long ACE_UINT64; # elif ACE_SIZEOF_LONG_LONG == 8 - typedef unsigned long long ACE_UINT64; + typedef unsigned long long ACE_UINT64; # endif /* defined (ACE_UINT64_TYPE) */ #endif /* !(ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T) */ @@ -259,14 +261,11 @@ typedef unsigned char ACE_Byte; // Type for doing arithmetic on pointers ... as elsewhere, we assume // that unsigned versions of a type are the same size as the signed // version of the same type. -// NOTE! ptr_arith_t is an ACE-defined type and should not be used. -// It has been superseded by the standard type ptrdiff_t. This definition -// is simply a placeholder til all ptr_arith_t usage can be expunged from -// ACE and TAO. # if defined (ACE_HAS_WINCE) && (_WIN32_WCE < 400) -typedef unsigned long ptrdiff_t; // evc3, PocketPC don't defined ptrdiff_t +typedef unsigned long ptrdiff_t; // evc3, PocketPC don't defined ptrdiff_t # endif -typedef ptrdiff_t ptr_arith_t; + +ACE_END_VERSIONED_NAMESPACE_DECL // Byte-order (endian-ness) determination. # if defined (BYTE_ORDER) @@ -358,6 +357,8 @@ typedef ptrdiff_t ptr_arith_t; // Forward declaration for streams # include "ace/iosfwd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_U_LongLong * @@ -507,7 +508,7 @@ typedef ptrdiff_t ptr_arith_t; double for_alignment_; }; - // NOTE: the following four accessors are inlined here in + // @note the following four accessors are inlined here in // order to minimize the extent of the data_ struct. It's // only used here; the .i and .cpp files use the accessors. @@ -523,7 +524,7 @@ typedef ptrdiff_t ptr_arith_t; /// Internal utility function to hide access through struct. ACE_UINT32 &l_ () { return data_.lo_; } - // NOTE: the above four accessors are inlined here in + // @note the above four accessors are inlined here in // order to minimize the extent of the data_ struct. It's // only used here; the .i and .cpp files use the accessors. @@ -549,6 +550,8 @@ typedef ptrdiff_t ptr_arith_t; ostream &operator<< (ostream &, const ACE_U_LongLong &); #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +ACE_END_VERSIONED_NAMESPACE_DECL + # endif /* ACE_LACKS_LONGLONG_T */ // Conversions from ACE_UINT64 to ACE_UINT32. ACE_CU64_TO_CU32 should diff --git a/ace/Basic_Types.inl b/ace/Basic_Types.inl index 20d01562575..15f9a9a1ab6 100644 --- a/ace/Basic_Types.inl +++ b/ace/Basic_Types.inl @@ -4,6 +4,8 @@ # if !defined (ACE_LACKS_LONGLONG_T) && defined (ACE_LACKS_UNSIGNEDLONGLONG_T) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Implementation for ACE_U_LongLong when we have signed long long // but no unsigned long long. @@ -134,7 +136,7 @@ ACE_U_LongLong::operator>= (const ACE_U_LongLong &n) const { if (data_ == n.data_) return true; - return data_ > n.data_; + return data_ > n.data_; } ACE_INLINE bool @@ -419,8 +421,12 @@ ACE_U_LongLong::operator/ (const int n) const } #endif +ACE_END_VERSIONED_NAMESPACE_DECL + #elif defined (ACE_LACKS_LONGLONG_T) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_U_LongLong::ACE_U_LongLong (const ACE_UINT32 lo, const ACE_UINT32 hi) { @@ -943,4 +949,6 @@ ACE_U_LongLong::operator/ (const int n) const } #endif /* ACE_SIZEOF_INT != 4 */ +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_LONGLONG_T || ACE_LACKS_UNSIGNEDLONGLONG_T */ diff --git a/ace/Bound_Ptr.h b/ace/Bound_Ptr.h index 833ab3fe84e..c80fe91dc65 100644 --- a/ace/Bound_Ptr.h +++ b/ace/Bound_Ptr.h @@ -23,6 +23,8 @@ #include "ace/Auto_Ptr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Bound_Ptr_Counter * @@ -333,6 +335,8 @@ private: X *ptr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include "ace/Bound_Ptr.inl" #include /**/ "ace/post.h" diff --git a/ace/Bound_Ptr.inl b/ace/Bound_Ptr.inl index f95b7c94f59..7f6797156f9 100644 --- a/ace/Bound_Ptr.inl +++ b/ace/Bound_Ptr.inl @@ -8,6 +8,8 @@ # include "ace/Log_Msg.h" #endif /* ACE_NEW_THROWS_EXCEPTIONS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class ACE_LOCK> inline ACE_Bound_Ptr_Counter<ACE_LOCK> * ACE_Bound_Ptr_Counter<ACE_LOCK>::internal_create (int init_obj_ref_count) { @@ -482,3 +484,5 @@ ACE_Weak_Bound_Ptr<X, ACE_LOCK>::remove_ref () } return new_obj_ref_count; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Base.cpp b/ace/CDR_Base.cpp index 7f3c7d5c05f..e4382bff196 100644 --- a/ace/CDR_Base.cpp +++ b/ace/CDR_Base.cpp @@ -12,6 +12,8 @@ ACE_RCSID (ace, CDR_Base, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // // See comments in CDR_Base.inl about optimization cases for swap_XX_array. // @@ -21,7 +23,7 @@ ACE_CDR::swap_2_array (const char* orig, char* target, size_t n) { // ACE_ASSERT(n > 0); The caller checks that n > 0 - // We pretend that AMD64/GNU G++ systems have a Pentium CPU to + // We pretend that AMD64/GNU G++ systems have a Pentium CPU to // take advantage of the inline assembly implementation. // Later, we try to read in 32 or 64 bit chunks, @@ -287,7 +289,7 @@ ACE_CDR::swap_4_array (const char* orig, char* target, size_t n) register unsigned long b = * reinterpret_cast<const long*> (orig + 8); -#if defined(__amd64__) && defined(__GNUC__) +#if defined(__amd64__) && defined(__GNUC__) asm ("bswapq %1" : "=r" (a) : "0" (a)); asm ("bswapq %1" : "=r" (b) : "0" (b)); asm ("rol $32, %1" : "=r" (a) : "0" (a)); @@ -482,8 +484,12 @@ ACE_CDR::swap_16_array (const char* orig, char* target, size_t n) void ACE_CDR::mb_align (ACE_Message_Block *mb) { +#if !defined (ACE_CDR_IGNORE_ALIGNMENT) char *start = ACE_ptr_align_binary (mb->base (), ACE_CDR::MAX_ALIGNMENT); +#else + char *start = mb->base (); +#endif /* ACE_CDR_IGNORE_ALIGNMENT */ mb->rd_ptr (start); mb->wr_ptr (start); } @@ -542,17 +548,19 @@ ACE_CDR::consolidate (ACE_Message_Block *dst, + ACE_CDR::MAX_ALIGNMENT); dst->size (newsize); +#if !defined (ACE_CDR_IGNORE_ALIGNMENT) // We must copy the contents of <src> into the new buffer, but // respecting the alignment. ptrdiff_t srcalign = ptrdiff_t(src->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; ptrdiff_t dstalign = ptrdiff_t(dst->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; - int offset = srcalign - dstalign; + ptrdiff_t offset = srcalign - dstalign; if (offset < 0) offset += ACE_CDR::MAX_ALIGNMENT; - dst->rd_ptr (offset); + dst->rd_ptr (static_cast<size_t> (offset)); dst->wr_ptr (dst->rd_ptr ()); +#endif /* ACE_CDR_IGNORE_ALIGNMENT */ for (const ACE_Message_Block* i = src; i != 0; @@ -614,3 +622,5 @@ ACE_CDR::Float::operator!= (const ACE_CDR::Float & /* rhs */) const return false; } #endif /* _UNICOS */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h index 6b163161f6f..1caa81333ad 100644 --- a/ace/CDR_Base.h +++ b/ace/CDR_Base.h @@ -38,13 +38,9 @@ #include "ace/Basic_Types.h" #include "ace/Default_Constants.h" +#include "ace/If_Then_Else.h" -#if !defined (_MSC_VER) || (_MSC_VER >= 1310) - // MSVC++ 6 can't handle partial template specializations so fall - // back on an unsigned char typedef. -# include "ace/If_Then_Else.h" -#endif /* !_MSC_VER || _MSC_VER >= 1310 */ - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Message_Block; @@ -172,20 +168,14 @@ public: * avoid complaints from all compilers is to define them all. */ //@{ -# if (defined (_MSC_VER) && (_MSC_VER < 1310)) - // MSVC++ 6 can't handle partial template specializations so fall - // back on an unsigned char typedef. - typedef unsigned char Boolean; -# else typedef ACE::If_Then_Else<(sizeof (bool) == 1), bool, unsigned char>::result_type Boolean; -# endif /* _MSC_VER <= 1310 */ # if !defined (ACE_CDR_WCHAR_OVERRIDE) || defined(ACE_USES_WCHAR) # undef ACE_CDR_WCHAR_OVERRIDE # define ACE_CDR_WCHAR_OVERRIDE wchar_t -# endif +# endif typedef unsigned char Octet; typedef char Char; @@ -309,6 +299,8 @@ public: #endif /* ACE_CDR_GIOP_MINOR_VERSION */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/CDR_Base.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/CDR_Base.inl b/ace/CDR_Base.inl index 6d6222ff40d..84e14344cc5 100644 --- a/ace/CDR_Base.inl +++ b/ace/CDR_Base.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // // The ACE_CDR::swap_X and ACE_CDR::swap_X_array routines are broken // in 4 cases for optimization: @@ -97,7 +99,7 @@ ACE_CDR::swap_4 (const char* orig, char* target) ACE_INLINE void ACE_CDR::swap_8 (const char* orig, char* target) { -#if defined(__amd64__) && defined(__GNUG__) +#if defined(__amd64__) && defined(__GNUG__) register unsigned long x = * reinterpret_cast<const unsigned long*> (orig); asm ("bswapq %1" : "=r" (x) : "0" (x)); @@ -196,4 +198,6 @@ ACE_CDR::next_size (size_t minsize) return newsize; } +ACE_END_VERSIONED_NAMESPACE_DECL + // **************************************************************** diff --git a/ace/CDR_Size.cpp b/ace/CDR_Size.cpp index e63d22c53be..3f2829cc909 100644 --- a/ace/CDR_Size.cpp +++ b/ace/CDR_Size.cpp @@ -9,6 +9,8 @@ ACE_RCSID (ace, CDR_Size, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_CDR::Boolean ACE_SizeCDR::write_wchar (ACE_CDR::WChar x) { @@ -241,3 +243,5 @@ operator<< (ACE_SizeCDR &ss, const ACE_CString &x) ss.write_string (x); return ss.good_bit (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Size.h b/ace/CDR_Size.h index b52b04486c7..f2bf59ce98c 100644 --- a/ace/CDR_Size.h +++ b/ace/CDR_Size.h @@ -36,6 +36,8 @@ #include "ace/SStringfwd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SizeCDR * @@ -87,7 +89,7 @@ public: const ACE_CDR::WChar *x); //@} - /// Note: the portion written starts at <x> and ends + /// @note the portion written starts at <x> and ends /// at <x + length>. /// The length is *NOT* stored into the CDR stream. //@{ @name Array write operations @@ -172,16 +174,19 @@ protected: ACE_CDR::Octet minor_version_; }; - // @@ This operator should not be inlined since they force SString.h // to be included in this header. extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, const ACE_CString &x); +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/CDR_Size.inl" #else /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Not used by CORBA or TAO extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, ACE_CDR::Char x); @@ -226,8 +231,11 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, extern ACE_Export ACE_CDR::Boolean operator<< (ACE_SizeCDR &ss, const ACE_CDR::WChar* x); +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* __ACE_INLINE__ */ + #include /**/ "ace/post.h" #endif /* ACE_CDR_SIZE_H */ diff --git a/ace/CDR_Size.inl b/ace/CDR_Size.inl index 7697b9abdf7..4c835067ce8 100644 --- a/ace/CDR_Size.inl +++ b/ace/CDR_Size.inl @@ -4,6 +4,7 @@ #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SizeCDR::ACE_SizeCDR (ACE_CDR::Octet major_version, @@ -415,3 +416,5 @@ operator<< (ACE_SizeCDR &ss, ACE_OutputCDR::from_wstring x) (ACE_CDR::Boolean) (ss.good_bit () && (!x.bound_ || len <= x.bound_)); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Stream.cpp b/ace/CDR_Stream.cpp index 12a57ee11e3..2ca41fe93ed 100644 --- a/ace/CDR_Stream.cpp +++ b/ace/CDR_Stream.cpp @@ -9,9 +9,10 @@ ACE_RCSID (ace, CDR_Stream, "$Id$") - // **************************************************************** +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_OutputCDR::wchar_maxbytes_ = sizeof (ACE_CDR::WChar); ACE_OutputCDR::ACE_OutputCDR (size_t size, @@ -33,7 +34,9 @@ ACE_OutputCDR::ACE_OutputCDR (size_t size, ACE_Time_Value::max_time, data_block_allocator, message_block_allocator), +#if !defined (ACE_LACKS_CDR_ALIGNMENT) current_alignment_ (0), +#endif /* ACE_LACKS_CDR_ALIGNMENT */ current_is_writable_ (true), do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), good_bit_ (true), @@ -67,7 +70,9 @@ ACE_OutputCDR::ACE_OutputCDR (char *data, size_t size, ACE_Time_Value::max_time, data_block_allocator, message_block_allocator), +#if !defined (ACE_LACKS_CDR_ALIGNMENT) current_alignment_ (0), +#endif /* ACE_LACKS_CDR_ALIGNMENT */ current_is_writable_ (true), do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), good_bit_ (true), @@ -88,7 +93,9 @@ ACE_OutputCDR::ACE_OutputCDR (ACE_Message_Block *data, ACE_CDR::Octet major_version, ACE_CDR::Octet minor_version) : start_ (data->data_block ()->duplicate ()), +#if !defined (ACE_LACKS_CDR_ALIGNMENT) current_alignment_ (0), +#endif /* ACE_LACKS_CDR_ALIGNMENT */ current_is_writable_ (true), do_byte_swap_ (byte_order != ACE_CDR_BYTE_ORDER), good_bit_ (true), @@ -129,8 +136,12 @@ ACE_OutputCDR::grow_and_adjust (size_t size, size_t cursize = this->current_->size (); if (this->current_->cont () != 0) cursize = this->current_->cont ()->size (); + size_t minsize = size; + +#if !defined (ACE_LACKS_CDR_ALIGNMENT) + minsize += ACE_CDR::MAX_ALIGNMENT; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ - size_t minsize = size + ACE_CDR::MAX_ALIGNMENT; // Make sure that there is enough room for <minsize> bytes, but // also make it bigger than whatever our current size is. if (minsize < cursize) @@ -139,7 +150,7 @@ ACE_OutputCDR::grow_and_adjust (size_t size, const size_t newsize = ACE_CDR::next_size (minsize); this->good_bit_ = false; - ACE_Message_Block* tmp; + ACE_Message_Block* tmp = 0; ACE_NEW_RETURN (tmp, ACE_Message_Block (newsize, ACE_Message_Block::MB_DATA, @@ -154,17 +165,19 @@ ACE_OutputCDR::grow_and_adjust (size_t size, -1); this->good_bit_ = true; +#if !defined (ACE_LACKS_CDR_ALIGNMENT) // The new block must start with the same alignment as the // previous block finished. ptrdiff_t tmpalign = ptrdiff_t(tmp->rd_ptr ()) % ACE_CDR::MAX_ALIGNMENT; ptrdiff_t curalign = ptrdiff_t(this->current_alignment_) % ACE_CDR::MAX_ALIGNMENT; - int offset = curalign - tmpalign; + ptrdiff_t offset = curalign - tmpalign; if (offset < 0) offset += ACE_CDR::MAX_ALIGNMENT; - tmp->rd_ptr (offset); + tmp->rd_ptr (static_cast<size_t> (offset)); tmp->wr_ptr (tmp->rd_ptr ()); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ // grow the chain and set the current block. tmp->cont (this->current_->cont ()); @@ -187,7 +200,7 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) return (this->good_bit_ = false); } if (static_cast<ACE_CDR::Short> (major_version_) == 1 - && static_cast<ACE_CDR::Short> (minor_version_) == 2) + && static_cast<ACE_CDR::Short> (minor_version_) == 2) { ACE_CDR::Octet len = static_cast<ACE_CDR::Octet> (ACE_OutputCDR::wchar_maxbytes_); @@ -196,24 +209,24 @@ ACE_OutputCDR::write_wchar (ACE_CDR::WChar x) if (ACE_OutputCDR::wchar_maxbytes_ == sizeof(ACE_CDR::WChar)) return this->write_octet_array ( - reinterpret_cast<const ACE_CDR::Octet*> (&x), - static_cast<ACE_CDR::ULong> (len)); + reinterpret_cast<const ACE_CDR::Octet*> (&x), + static_cast<ACE_CDR::ULong> (len)); else if (ACE_OutputCDR::wchar_maxbytes_ == 2) { ACE_CDR::Short sx = static_cast<ACE_CDR::Short> (x); return this->write_octet_array ( - reinterpret_cast<const ACE_CDR::Octet*> (&sx), - static_cast<ACE_CDR::ULong> (len)); + reinterpret_cast<const ACE_CDR::Octet*> (&sx), + static_cast<ACE_CDR::ULong> (len)); } else { ACE_CDR::Octet ox = static_cast<ACE_CDR::Octet> (x); return this->write_octet_array ( - reinterpret_cast<const ACE_CDR::Octet*> (&ox), - static_cast<ACE_CDR::ULong> (len)); + reinterpret_cast<const ACE_CDR::Octet*> (&ox), + static_cast<ACE_CDR::ULong> (len)); } } } @@ -310,7 +323,7 @@ ACE_OutputCDR::write_wstring (ACE_CDR::ULong len, } else if (this->write_ulong (1)) return this->write_wchar (0); - return (this->good_bit_ = false); + return (this->good_bit_ = false); } ACE_CDR::Boolean @@ -347,7 +360,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) continue; } - ACE_Message_Block* cont; + ACE_Message_Block* cont = 0; this->good_bit_ = false; ACE_NEW_RETURN (cont, ACE_Message_Block (i->data_block ()->duplicate ()), @@ -364,8 +377,10 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) this->current_->cont (cont); this->current_ = cont; this->current_is_writable_ = false; +#if !defined (ACE_LACKS_CDR_ALIGNMENT) this->current_alignment_ = (this->current_alignment_ + cont->length ()) % ACE_CDR::MAX_ALIGNMENT; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ } else { @@ -379,7 +394,7 @@ ACE_OutputCDR::write_octet_array_mb (const ACE_Message_Block* mb) ACE_CDR::Boolean ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x) { - char *buf; + char *buf = 0; if (this->adjust (1, buf) == 0) { *reinterpret_cast<ACE_CDR::Octet*> (buf) = *x; @@ -392,7 +407,7 @@ ACE_OutputCDR::write_1 (const ACE_CDR::Octet *x) ACE_CDR::Boolean ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x) { - char *buf; + char *buf = 0; if (this->adjust (ACE_CDR::SHORT_SIZE, buf) == 0) { #if !defined (ACE_ENABLE_SWAP_ON_WRITE) @@ -418,7 +433,7 @@ ACE_OutputCDR::write_2 (const ACE_CDR::UShort *x) ACE_CDR::Boolean ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x) { - char *buf; + char *buf = 0; if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) { #if !defined (ACE_ENABLE_SWAP_ON_WRITE) @@ -444,7 +459,7 @@ ACE_OutputCDR::write_4 (const ACE_CDR::ULong *x) ACE_CDR::Boolean ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x) { - char *buf; + char *buf = 0; if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) { @@ -484,7 +499,7 @@ ACE_OutputCDR::write_8 (const ACE_CDR::ULongLong *x) ACE_CDR::Boolean ACE_OutputCDR::write_16 (const ACE_CDR::LongDouble *x) { - char* buf; + char* buf = 0; if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, ACE_CDR::LONGDOUBLE_ALIGN, buf) == 0) @@ -515,7 +530,7 @@ ACE_OutputCDR::write_wchar_array_i (const ACE_CDR::WChar *x, { if (length == 0) return true; - char* buf; + char* buf = 0; const size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? ACE_CDR::SHORT_ALIGN : ACE_CDR::OCTET_ALIGN; @@ -557,7 +572,7 @@ ACE_OutputCDR::write_array (const void *x, { if (length == 0) return true; - char *buf; + char *buf = 0; if (this->adjust (size * length, align, buf) == 0) { #if !defined (ACE_ENABLE_SWAP_ON_WRITE) @@ -723,10 +738,14 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, wchar_translator_ (rhs.wchar_translator_) { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) // Align the base pointer assuming that the incoming stream is also // aligned the way we are aligned char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), ACE_CDR::MAX_ALIGNMENT); +#else + char *incoming_start = rhs.start_.base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ const size_t newpos = (rhs.start_.rd_ptr() - incoming_start) + offset; @@ -753,10 +772,14 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs, wchar_translator_ (rhs.wchar_translator_) { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) // Align the base pointer assuming that the incoming stream is also // aligned the way we are aligned char *incoming_start = ACE_ptr_align_binary (rhs.start_.base (), ACE_CDR::MAX_ALIGNMENT); +#else + char *incoming_start = rhs.start_.base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ const size_t newpos = rhs.start_.rd_ptr() - incoming_start; @@ -787,8 +810,12 @@ ACE_InputCDR::ACE_InputCDR (const ACE_InputCDR& rhs) char_translator_ (rhs.char_translator_), wchar_translator_ (rhs.wchar_translator_) { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) char *buf = ACE_ptr_align_binary (rhs.start_.base (), ACE_CDR::MAX_ALIGNMENT); +#else + char *buf = rhs.start_.base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ size_t rd_offset = rhs.start_.rd_ptr () - buf; size_t wr_offset = rhs.start_.wr_ptr () - buf; @@ -1025,7 +1052,7 @@ ACE_InputCDR::read_string (ACE_CDR::Char *&x) ACE_CDR::Boolean ACE_InputCDR::read_string (ACE_CString &x) { - ACE_CDR::Char *data; + ACE_CDR::Char *data = 0; if (this->read_string (data)) { x = data; @@ -1121,7 +1148,7 @@ ACE_InputCDR::read_array (void* x, { if (length == 0) return true; - char* buf; + char* buf = 0; if (this->adjust (size * length, align, buf) == 0) { @@ -1165,7 +1192,7 @@ ACE_InputCDR::read_wchar_array_i (ACE_CDR::WChar* x, { if (length == 0) return true; - char* buf; + char* buf = 0; const size_t align = (ACE_OutputCDR::wchar_maxbytes_ == 2) ? ACE_CDR::SHORT_ALIGN : ACE_CDR::OCTET_ALIGN; @@ -1260,7 +1287,7 @@ ACE_InputCDR::read_2 (ACE_CDR::UShort *x) ACE_CDR::Boolean ACE_InputCDR::read_4 (ACE_CDR::ULong *x) { - char *buf; + char *buf = 0; if (this->adjust (ACE_CDR::LONG_SIZE, buf) == 0) { #if !defined (ACE_DISABLE_SWAP_ON_READ) @@ -1280,7 +1307,7 @@ ACE_InputCDR::read_4 (ACE_CDR::ULong *x) ACE_CDR::Boolean ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x) { - char *buf; + char *buf = 0; if (this->adjust (ACE_CDR::LONGLONG_SIZE, buf) == 0) { @@ -1331,7 +1358,7 @@ ACE_InputCDR::read_8 (ACE_CDR::ULongLong *x) ACE_CDR::Boolean ACE_InputCDR::read_16 (ACE_CDR::LongDouble *x) { - char *buf; + char *buf = 0; if (this->adjust (ACE_CDR::LONGDOUBLE_SIZE, ACE_CDR::LONGDOUBLE_ALIGN, buf) == 0) @@ -1641,3 +1668,5 @@ operator>> (ACE_InputCDR &is, ACE_CString &x) is.read_string (x); return is.good_bit (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CDR_Stream.h b/ace/CDR_Stream.h index 4a7c93b43fe..3c245ab945b 100644 --- a/ace/CDR_Stream.h +++ b/ace/CDR_Stream.h @@ -19,6 +19,16 @@ * Those assumptions are pretty good these days, with Crays beign * the only known exception. * + * Optimizations + * ------------- + * ACE_LACKS_CDR_ALIGNMENT + * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu> + * + * CDR stream ignores alignment when marshaling data. Use this option + * only when ACE_DISABLE_SWAP_ON_READ can be enabled. This option requires + * ACE CDR engine to do both marshaling and demarshaling. + * + * * @author TAO version by Aniruddha Gokhale <gokhale@cs.wustl.edu> * @author Carlos O'Ryan <coryan@cs.wustl.edu> * @author ACE version by Jeff Parsons <parsons@cs.wustl.edu> @@ -52,6 +62,8 @@ #endif /* ! ACE_LITTLE_ENDIAN */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Char_Codeset_Translator; class ACE_WChar_Codeset_Translator; @@ -217,7 +229,7 @@ public: const ACE_CDR::WChar *x); //@} - /// Note: the portion written starts at <x> and ends + /// @note the portion written starts at <x> and ends /// at <x + length>. /// The length is *NOT* stored into the CDR stream. //@{ @name Array write operations @@ -289,7 +301,7 @@ public: /** * Return the start of the message block chain for this CDR stream. - * NOTE: The complete CDR stream is represented by a chain of + * @note The complete CDR stream is represented by a chain of * message blocks. */ const ACE_Message_Block *begin (void) const; @@ -301,14 +313,14 @@ public: const ACE_Message_Block *current (void) const; /** - * Access the underlying buffer (read only). NOTE: This + * Access the underlying buffer (read only). @note This * method only returns a pointer to the first block in the * chain. */ const char *buffer (void) const; /** - * Return the start and size of the internal buffer.NOTE: This + * Return the start and size of the internal buffer.@note This * method only returns information about the first block in the * chain. */ @@ -431,6 +443,7 @@ private: /// The current block in the chain were we are writing. ACE_Message_Block *current_; +#if !defined (ACE_LACKS_CDR_IALIGNMENT) /** * The current alignment as measured from the start of the buffer. * Usually this coincides with the alignment of the buffer in @@ -440,6 +453,7 @@ private: * the stolen message block. */ size_t current_alignment_; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ /** * Is the current block writable. When we steal a buffer from the @@ -487,20 +501,6 @@ protected: static int wchar_maxbytes_; }; -/** -* @class OutputCDR_Auto_Reset -* -* @brief This class will call the reset() method on an -* output CDR when it goes out of scope. -*/ -class OutputCDR_Auto_Reset { -public: - OutputCDR_Auto_Reset (ACE_OutputCDR& cdr); - ~OutputCDR_Auto_Reset (void); -private: - ACE_OutputCDR& cdr_; -}; - // **************************************************************** @@ -1174,10 +1174,14 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, ACE_CString &x); +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/CDR_Stream.inl" #else /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Not used by CORBA or TAO extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, ACE_CDR::Char x); @@ -1264,6 +1268,8 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is, ACE_CDR::WChar*& x); +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" diff --git a/ace/CDR_Stream.inl b/ace/CDR_Stream.inl index 6d68e938d15..cbcb6638bf1 100644 --- a/ace/CDR_Stream.inl +++ b/ace/CDR_Stream.inl @@ -7,6 +7,8 @@ // **************************************************************** +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // implementing the special types ACE_INLINE ACE_OutputCDR::from_boolean::from_boolean (ACE_CDR::Boolean b) @@ -153,7 +155,10 @@ ACE_OutputCDR::reset (void) this->current_ = &this->start_; this->current_is_writable_ = true; ACE_CDR::mb_align (&this->start_); + +#if !defined (ACE_LACKS_CDR_ALIGNMENT) this->current_alignment_ = 0; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ // It is tempting not to remove the memory, but we need to do so to // release any potential user buffers chained in the continuation @@ -165,7 +170,6 @@ ACE_OutputCDR::reset (void) ACE_Message_Block::release (cont); this->start_.cont (0); } - } // Encode the CDR stream. @@ -173,7 +177,8 @@ ACE_OutputCDR::reset (void) ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_octet (ACE_CDR::Octet x) { - return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (&x)); + const void *temp = &x; + return this->write_1 (reinterpret_cast<const ACE_CDR::Octet *> (temp)); } ACE_INLINE ACE_CDR::Boolean @@ -186,62 +191,74 @@ ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_char (ACE_CDR::Char x) { if (this->char_translator_ == 0) - return this->write_1 (reinterpret_cast<const ACE_CDR::Octet*> (&x)); + { + const void *temp = &x; + return this->write_1 (reinterpret_cast<const ACE_CDR::Octet*> (temp)); + } return this->char_translator_->write_char (*this, x); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_short (ACE_CDR::Short x) { - return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (&x)); + const void *temp = &x; + return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ushort (ACE_CDR::UShort x) { - return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (&x)); + const void *temp = &x; + return this->write_2 (reinterpret_cast<const ACE_CDR::UShort*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_long (ACE_CDR::Long x) { - return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (&x)); + const void *temp = &x; + return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ulong (ACE_CDR::ULong x) { - return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (&x)); + const void *temp = &x; + return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_longlong (const ACE_CDR::LongLong &x) { - return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (&x)); + const void *temp = &x; + return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_ulonglong (const ACE_CDR::ULongLong &x) { - return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (&x)); + const void *temp = &x; + return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_float (ACE_CDR::Float x) { - return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (&x)); + const void *temp = &x; + return this->write_4 (reinterpret_cast<const ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_double (const ACE_CDR::Double &x) { - return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (&x)); + const void *temp = &x; + return this->write_8 (reinterpret_cast<const ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_longdouble (const ACE_CDR::LongDouble &x) { - return this->write_16 (reinterpret_cast<const ACE_CDR::LongDouble*> (&x)); + const void *temp = &x; + return this->write_16 (reinterpret_cast<const ACE_CDR::LongDouble*> (temp)); } ACE_INLINE ACE_CDR::Boolean @@ -416,17 +433,24 @@ ACE_OutputCDR::adjust (size_t size, if (!this->current_is_writable_) return this->grow_and_adjust (size, align, buf); +#if !defined (ACE_LACKS_CDR_ALIGNMENT) const size_t offset = ACE_align_binary (this->current_alignment_, align) - this->current_alignment_; buf = this->current_->wr_ptr () + offset; +#else + buf = this->current_->wr_ptr (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + char *end = buf + size; if (end <= this->current_->end () && end >= buf) { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) this->current_alignment_ += offset + size; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ this->current_->wr_ptr (end); return 0; } @@ -518,14 +542,26 @@ ACE_OutputCDR::reset_byte_order (int byte_order) ACE_INLINE size_t ACE_OutputCDR::current_alignment (void) const { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) return this->current_alignment_; +#else + // Default value set to 0 + return 0; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ } ACE_INLINE int ACE_OutputCDR::align_write_ptr (size_t alignment) { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) char *dummy; return this->adjust (0, alignment, dummy); +#else + ACE_UNUSED_ARG (alignment); + // A return value of -1 from this function is used + // to indicate failure, returning 0 + return 0; +#endif /* ACE_LACKS_CDR_ALIGNMENT */ } ACE_INLINE ACE_Char_Codeset_Translator * @@ -578,7 +614,10 @@ ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_char (ACE_CDR::Char &x) { if (this->char_translator_ == 0) - return this->read_1 (reinterpret_cast<ACE_CDR::Octet*> (&x)); + { + void *temp = &x; + return this->read_1 (reinterpret_cast<ACE_CDR::Octet*> (temp)); + } return this->char_translator_->read_char (*this, x); } @@ -586,58 +625,67 @@ ACE_InputCDR::read_char (ACE_CDR::Char &x) ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_short (ACE_CDR::Short &x) { - return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (&x)); + void *temp = &x; + return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_ushort (ACE_CDR::UShort &x) { - return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (&x)); + void *temp = &x; + return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_long (ACE_CDR::Long &x) { - return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (&x)); + void *temp = &x; + return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_ulong (ACE_CDR::ULong &x) { - return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (&x)); + void *temp = &x; + return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_longlong (ACE_CDR::LongLong &x) { - return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (&x)); + void *temp = &x; + return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_ulonglong (ACE_CDR::ULongLong &x) { - return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (&x)); + void *temp = &x; + return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_float (ACE_CDR::Float &x) { - return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (&x)); + void *temp = &x; + return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_double (ACE_CDR::Double &x) { - return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (&x)); + void *temp = &x; + return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::read_longdouble (ACE_CDR::LongDouble &x) { - return this->read_16 (reinterpret_cast<ACE_CDR::LongDouble*> (&x)); + void *temp = &x; + return this->read_16 (reinterpret_cast<ACE_CDR::LongDouble*> (temp)); } ACE_INLINE size_t @@ -874,7 +922,8 @@ ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_char (void) { ACE_CDR::Char x; - return this->read_1 (reinterpret_cast<ACE_CDR::Octet*> (&x)); + void *temp = &x; + return this->read_1 (reinterpret_cast<ACE_CDR::Octet*> (temp)); } ACE_INLINE ACE_CDR::Boolean @@ -896,42 +945,48 @@ ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_short (void) { ACE_CDR::Short x; - return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (&x)); + void *temp = &x; + return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_ushort (void) { ACE_CDR::UShort x; - return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (&x)); + void *temp = &x; + return this->read_2 (reinterpret_cast<ACE_CDR::UShort*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_long (void) { ACE_CDR::Long x; - return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (&x)); + void *temp = &x; + return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_ulong (void) { ACE_CDR::ULong x; - return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (&x)); + void *temp = &x; + return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_longlong (void) { ACE_CDR::LongLong x; - return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (&x)); + void *temp = &x; + return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_ulonglong (void) { ACE_CDR::ULongLong x; - return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (&x)); + void *temp = &x; + return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean @@ -940,21 +995,24 @@ ACE_InputCDR::skip_float (void) // Changing this removes the warning for GHS and it // stops the compiler from getting an internal error. ACE_CDR::ULong value; - return this->read_4 (&value); + void *temp = &value; + return this->read_4 (reinterpret_cast<ACE_CDR::ULong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_double (void) { double x; - return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (&x)); + void *temp = &x; + return this->read_8 (reinterpret_cast<ACE_CDR::ULongLong*> (temp)); } ACE_INLINE ACE_CDR::Boolean ACE_InputCDR::skip_longdouble (void) { ACE_CDR::LongDouble x; - return this->read_16 (reinterpret_cast<ACE_CDR::LongDouble*> (&x)); + void *temp = &x; + return this->read_16 (reinterpret_cast<ACE_CDR::LongDouble*> (temp)); } ACE_INLINE char* @@ -986,7 +1044,12 @@ ACE_InputCDR::adjust (size_t size, size_t align, char*& buf) { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) buf = ACE_ptr_align_binary (this->rd_ptr (), align); +#else + buf = this->rd_ptr (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + char *end = buf + size; if (end <= this->wr_ptr ()) { @@ -996,6 +1059,9 @@ ACE_InputCDR::adjust (size_t size, this->good_bit_ = false; return -1; +#if defined (ACE_LACKS_CDR_ALIGNMENT) + ACE_UNUSED_ARG (align); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ } ACE_INLINE int @@ -1436,8 +1502,12 @@ ACE_InputCDR::byte_order (void) const ACE_INLINE int ACE_InputCDR::align_read_ptr (size_t alignment) { +#if !defined (ACE_LACKS_CDR_ALIGNMENT) char *buf = ACE_ptr_align_binary (this->rd_ptr (), alignment); +#else + char *buf = this->rd_ptr (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ if (buf <= this->wr_ptr ()) { @@ -1670,14 +1740,4 @@ ACE_WChar_Codeset_Translator::minor_version (ACE_OutputCDR& output) return output.minor_version_; } -ACE_INLINE -OutputCDR_Auto_Reset::OutputCDR_Auto_Reset (ACE_OutputCDR& cdr) - : cdr_ (cdr) -{ -} - -ACE_INLINE -OutputCDR_Auto_Reset::~OutputCDR_Auto_Reset (void) -{ - cdr_.reset (); -} +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/CE_Screen_Output.cpp b/ace/CE_Screen_Output.cpp index f4d69659532..8a477b97a85 100644 --- a/ace/CE_Screen_Output.cpp +++ b/ace/CE_Screen_Output.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/CE_Screen_Output.h" @@ -6,6 +5,8 @@ #include "ace/Log_Msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_CE_Screen_Output::ACE_CE_Screen_Output(HWND hEdit) : handler_(hEdit) , pFile_(0) @@ -152,4 +153,6 @@ ACE_CE_Screen_Output& ACE_CE_Screen_Output::operator << (FILE* pFile) return *this; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif // ACE_HAS_WINCE diff --git a/ace/CE_Screen_Output.h b/ace/CE_Screen_Output.h index 5252b810fb1..48e9d54cb13 100644 --- a/ace/CE_Screen_Output.h +++ b/ace/CE_Screen_Output.h @@ -24,8 +24,13 @@ #include "ace/Log_Msg_Callback.h" #include "ace/Log_Record.h" -const ACE_TCHAR endl[] = ACE_LIB_TEXT("\r\n"); -const ACE_TCHAR tab[] = ACE_LIB_TEXT("\t"); +namespace +{ + const ACE_TCHAR endl[] = ACE_LIB_TEXT("\r\n"); + const ACE_TCHAR tab[] = ACE_LIB_TEXT("\t"); +} + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_CE_Screen_Output @@ -87,7 +92,7 @@ public: private: - ACE_CE_Screen_Output(ACE_CE_Screen_Output&); + ACE_CE_Screen_Output (ACE_CE_Screen_Output&); private: @@ -98,5 +103,7 @@ private: FILE* pFile_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif // ACE_HAS_WINCE #endif // ACE_CE_SCREEN_OUTPUT_H diff --git a/ace/Cache_Map_Manager_T.cpp b/ace/Cache_Map_Manager_T.cpp index f2e6c88a273..effa6f7d208 100644 --- a/ace/Cache_Map_Manager_T.cpp +++ b/ace/Cache_Map_Manager_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_CACHE_MAP_MANAGER_T_C -#define ACE_CACHE_MAP_MANAGER_T_C +#ifndef ACE_CACHE_MAP_MANAGER_T_CPP +#define ACE_CACHE_MAP_MANAGER_T_CPP #include "ace/Cache_Map_Manager_T.h" @@ -16,7 +16,7 @@ #include "ace/Cache_Map_Manager_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Cache_Map_Manager_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Manager) @@ -24,8 +24,8 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Iterator) ACE_ALLOC_HOOK_DEFINE(ACE_Cache_Map_Reverse_Iterator) -#define ACE_T1 class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES -#define ACE_T2 KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES +#define ACE_T1 class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES +#define ACE_T2 KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES template <ACE_T1> ACE_Cache_Map_Manager<ACE_T2>::ACE_Cache_Map_Manager (CACHING_STRATEGY &caching_s, @@ -415,4 +415,6 @@ ACE_Cache_Map_Iterator<KEY, VALUE, IMPLEMENTATION, CACHING_STRATEGY, ATTRIBUTES> { } -#endif /* ACE_CACHE_MAP_MANAGER_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CACHE_MAP_MANAGER_T_CPP */ diff --git a/ace/Cache_Map_Manager_T.h b/ace/Cache_Map_Manager_T.h index cd981a8d702..ad014e696e2 100644 --- a/ace/Cache_Map_Manager_T.h +++ b/ace/Cache_Map_Manager_T.h @@ -25,6 +25,8 @@ #include "ace/Global_Macros.h" #include "ace/Pair_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration. class ACE_Allocator; @@ -55,7 +57,7 @@ class ACE_Cache_Map_Reverse_Iterator; * isn't efficient. Locking has to be provided by the * application. */ -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> class ACE_Cache_Map_Manager { public: @@ -63,7 +65,7 @@ public: // = Traits. typedef KEY key_type; typedef VALUE mapped_type; - typedef MAP map_type; + typedef CMAP_TYPE map_type; typedef CACHING_STRATEGY caching_strategy_type; typedef ITERATOR_IMPL ITERATOR_IMPLEMENTATION; @@ -111,7 +113,7 @@ public: int close (void); /** - * Associate <key> with <value>. If <key> is already in the MAP + * Associate <key> with <value>. If <key> is already in the CMAP_TYPE * then the ENTRY is not changed. Returns 0 if a new entry is bound * successfully, returns 1 if an attempt is made to bind an existing * entry, and returns -1 if failures occur. @@ -121,7 +123,7 @@ public: /** * Lookup entry<key,value> in the cache. If it is not found, returns -1. - * If the <key> is located in the MAP object, the CACHING_STRATEGY is + * If the <key> is located in the CMAP_TYPE object, the CACHING_STRATEGY is * notified of it via notify_find (int result, ATTRIBUTES &attribute). * If notify_find also returns 0 (success), then this function returns * 0 (success) and sets the cached value in <value>. @@ -131,7 +133,7 @@ public: /** * Lookup entry<key,value> in the cache. If it is not found, returns -1. - * If the <key> is located in the MAP object, the CACHING_STRATEGY is + * If the <key> is located in the CMAP_TYPE object, the CACHING_STRATEGY is * notified of it via notify_find (int result, ATTRIBUTES &attribute). * If notify_find also returns 0 (success), then this function returns * 0 (success). @@ -212,7 +214,7 @@ public: REVERSE_ITERATOR rend (void); /// The map managed by the Cache_Map_Manager. - MAP &map (void); + CMAP_TYPE &map (void); /// The caching strategy used on the cache. CACHING_STRATEGY &caching_strategy (void); @@ -220,7 +222,7 @@ public: protected: /// The underlying map which needs to be cached. - MAP map_; + CMAP_TYPE map_; /// The strategy to be followed for caching entries in the map. CACHING_STRATEGY &caching_strategy_; @@ -228,8 +230,8 @@ protected: private: // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Cache_Map_Manager (const ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> &)) }; @@ -384,6 +386,8 @@ protected: REVERSE_IMPLEMENTATION reverse_iterator_implementation_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Cache_Map_Manager_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Cache_Map_Manager_T.inl b/ace/Cache_Map_Manager_T.inl index ca559696665..ba30c528dd6 100644 --- a/ace/Cache_Map_Manager_T.inl +++ b/ace/Cache_Map_Manager_T.inl @@ -2,56 +2,58 @@ // //$Id$ -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE int -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::purge (void) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE int +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::purge (void) { return this->caching_strategy ().caching_utility ().clear_cache (this->map_, this->caching_strategy ().purge_percent ()); } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE size_t -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::current_size (void) const +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE size_t +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::current_size (void) const { return this->map_.current_size (); } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE size_t -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::total_size (void) const +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE size_t +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::total_size (void) const { return this->map_.total_size (); } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE MAP & -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::map (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE CMAP_TYPE & +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::map (void) { return this->map_; } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE CACHING_STRATEGY & -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::caching_strategy (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE CACHING_STRATEGY & +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::caching_strategy (void) { return this->caching_strategy_; } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::begin (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::begin (void) { return ITERATOR (this->map_.begin ()); } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::end (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Iterator<KEY, VALUE, ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::end (void) { return ITERATOR (this->map_.end ()); } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rbegin (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rbegin (void) { return REVERSE_ITERATOR (this->map_.rbegin ()); } -template <class KEY, class VALUE, class MAP, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> -ACE_Cache_Map_Manager<KEY, VALUE, MAP, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rend (void) +template <class KEY, class VALUE, class CMAP_TYPE, class ITERATOR_IMPL, class REVERSE_ITERATOR_IMPL, class CACHING_STRATEGY, class ATTRIBUTES> ACE_INLINE ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES> +ACE_Cache_Map_Manager<KEY, VALUE, CMAP_TYPE, ITERATOR_IMPL, REVERSE_ITERATOR_IMPL, CACHING_STRATEGY, ATTRIBUTES>::rend (void) { return REVERSE_ITERATOR (this->map_.rend ()); } @@ -240,3 +242,4 @@ ACE_Cache_Map_Reverse_Iterator<KEY, VALUE, REVERSE_IMPLEMENTATION, CACHING_STRAT return this->reverse_iterator_implementation_; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cached_Connect_Strategy_T.cpp b/ace/Cached_Connect_Strategy_T.cpp index f44f3209987..706142c640d 100644 --- a/ace/Cached_Connect_Strategy_T.cpp +++ b/ace/Cached_Connect_Strategy_T.cpp @@ -1,7 +1,7 @@ //$Id$ -#ifndef CACHED_CONNECT_STRATEGY_T_C -#define CACHED_CONNECT_STRATEGY_T_C +#ifndef ACE_CACHED_CONNECT_STRATEGY_T_CPP +#define ACE_CACHED_CONNECT_STRATEGY_T_CPP #include "ace/Cached_Connect_Strategy_T.h" @@ -16,11 +16,11 @@ #include "ace/WFMO_Reactor.h" #include "ace/Pair_T.h" -ACE_RCSID(ace, Cached_Connect_Strategy_T, "$Id$") - #define ACE_T1 class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX #define ACE_T2 SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <ACE_T1> ACE_Cached_Connect_Strategy_Ex<ACE_T2>::ACE_Cached_Connect_Strategy_Ex (CACHING_STRATEGY &caching_s, @@ -275,7 +275,7 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cached_connect (SVC_HANDLER *&sh, // for the <Connector> to notify the cache of the completion of // connect(). - if (errno == EWOULDBLOCK) + if (errno == EWOULDBLOCK || errno == ETIMEDOUT) errno = ENOTSUP; else if (ACE::out_of_handles (errno) || errno == EADDRINUSE) { @@ -296,7 +296,7 @@ ACE_Cached_Connect_Strategy_Ex<ACE_T2>::cached_connect (SVC_HANDLER *&sh, flags, perms) == -1) { - if (errno == EWOULDBLOCK) + if (errno == EWOULDBLOCK || errno == ETIMEDOUT) errno = ENOTSUP; return -1; } @@ -726,7 +726,9 @@ ACE_Bounded_Cached_Connect_Strategy<ACE_T2>::find_or_create_svc_handler_i ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Cached_Connect_Strategy) +ACE_END_VERSIONED_NAMESPACE_DECL + #undef ACE_T1 #undef ACE_T2 -#endif /* CACHED_CONNECT_STRATEGY_T_C */ +#endif /* ACE_CACHED_CONNECT_STRATEGY_T_CPP */ diff --git a/ace/Cached_Connect_Strategy_T.h b/ace/Cached_Connect_Strategy_T.h index 8c051a240d2..f04392846cb 100644 --- a/ace/Cached_Connect_Strategy_T.h +++ b/ace/Cached_Connect_Strategy_T.h @@ -30,6 +30,8 @@ // For linkers which cant grok long names... #define ACE_Cached_Connect_Strategy_Ex ACCSE +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Cached_Connect_Strategy_Ex * @@ -246,6 +248,7 @@ protected: size_t max_size_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Cached_Connect_Strategy_T.cpp" diff --git a/ace/Caching_Strategies_T.cpp b/ace/Caching_Strategies_T.cpp index 7adf976162f..db2f9067ec9 100644 --- a/ace/Caching_Strategies_T.cpp +++ b/ace/Caching_Strategies_T.cpp @@ -1,7 +1,7 @@ //$Id$ -#ifndef CACHING_STRATEGIES_T_C -#define CACHING_STRATEGIES_T_C +#ifndef ACE_CACHING_STRATEGIES_T_CPP +#define ACECACHING_STRATEGIES_T_CPP #include "ace/Caching_Strategies_T.h" #include "ace/Log_Msg.h" @@ -14,7 +14,7 @@ #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Caching_Strategies_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template<class ATTRIBUTES, class CACHING_UTILITY> ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::~ACE_Caching_Strategy (void) @@ -54,4 +54,6 @@ ACE_ALLOC_HOOK_DEFINE(ACE_LFU_Caching_Strategy) ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Caching_Strategy) ACE_ALLOC_HOOK_DEFINE(ACE_Null_Caching_Strategy) -#endif /* CACHING_STRATEGIES_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CACHING_STRATEGIES_T_CPP */ diff --git a/ace/Caching_Strategies_T.h b/ace/Caching_Strategies_T.h index cbf1157a96e..74f7ff2b1fe 100644 --- a/ace/Caching_Strategies_T.h +++ b/ace/Caching_Strategies_T.h @@ -29,6 +29,8 @@ // For linkers that cant grok long names. #define ACE_Caching_Strategy ACS +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Caching_Strategy * @@ -531,6 +533,8 @@ private: CACHING_UTILITY caching_utility_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Caching_Strategies_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Caching_Strategies_T.inl b/ace/Caching_Strategies_T.inl index 12e82be947b..cbe5f9c35ff 100644 --- a/ace/Caching_Strategies_T.inl +++ b/ace/Caching_Strategies_T.inl @@ -1,10 +1,13 @@ -/* -*-C++-*- */ +// -*-C++-*- +// //$Id$ ////////////////////////////////////////////////////////////////////////////////// #include "ace/OS_Memory.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> ACE_INLINE ACE_Caching_Strategy_Adapter<ATTRIBUTES, CACHING_UTILITY, IMPLEMENTATION>::ACE_Caching_Strategy_Adapter (IMPLEMENTATION *implementation, int delete_implementation) @@ -457,4 +460,6 @@ ACE_Null_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY>::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL + ////////////////////////////////////////////////////////////////////////////////// diff --git a/ace/Caching_Utility_T.cpp b/ace/Caching_Utility_T.cpp index 767adb3c07d..c8b7a48e807 100644 --- a/ace/Caching_Utility_T.cpp +++ b/ace/Caching_Utility_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef CACHING_UTILITY_T_C -#define CACHING_UTILITY_T_C +#ifndef ACE_CACHING_UTILITY_T_CPP +#define ACE_CACHING_UTILITY_T_CPP #include "ace/Caching_Utility_T.h" @@ -11,13 +11,12 @@ #include "ace/Min_Max.h" #include "ace/OS_Memory.h" -// #include "ace/Strategies.h" #include "ace/Recyclable.h" -ACE_RCSID(ace, Caching_Utility_T, "$Id$") - ////////////////////////////////////////////////////////////////////////////// +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class KEY, class VALUE, class CONTAINER, class ITERATOR, class ATTRIBUTES> ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::ACE_Pair_Caching_Utility (ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER> *cleanup_strategy, int delete_cleanup_strategy) @@ -57,7 +56,7 @@ ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cac // Calculate the no of entries to remove from the cache depending // upon the <purge_percent>. - size_t entries_to_remove + size_t const entries_to_remove = ACE_MAX (static_cast<size_t> (1), static_cast<size_t> (static_cast<double> (purge_percent) / 100 * current_map_size)); @@ -157,7 +156,7 @@ ACE_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUT // Calculate the no of entries to remove from the cache depending // upon the <purge_percent>. - size_t entries_to_remove + size_t const entries_to_remove = ACE_MAX (static_cast<size_t> (1), static_cast<size_t> (static_cast<double> (purge_percent) / 100 * current_map_size)); @@ -267,7 +266,8 @@ ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATO return 0; // Get the number of entries in the container which can be considered for purging. - size_t available_entries = container.current_size () - this->marked_as_closed_entries_; + size_t const available_entries = + container.current_size () - this->marked_as_closed_entries_; // Also whether the number of entries in the cache zero. // Oops! then there is no way out but exiting. @@ -281,8 +281,7 @@ ACE_Refcounted_Recyclable_Handler_Caching_Utility<KEY, VALUE, CONTAINER, ITERATO static_cast<size_t> (static_cast<double> (purge_percent) / 100 * available_entries)); - if (entries_to_remove >= available_entries || - entries_to_remove == 0) + if (entries_to_remove >= available_entries || entries_to_remove == 0) entries_to_remove = available_entries - 1; KEY *key_to_remove = 0; @@ -495,4 +494,6 @@ ACE_Null_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::minimum ( ACE_UNUSED_ARG (value_to_remove); } -#endif /* CACHING_UTILITY_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CACHING_UTILITY_T_CPP */ diff --git a/ace/Caching_Utility_T.h b/ace/Caching_Utility_T.h index 03b95ce3cd1..0112e3f2b7d 100644 --- a/ace/Caching_Utility_T.h +++ b/ace/Caching_Utility_T.h @@ -27,6 +27,8 @@ // For linkers that cant grok long names. #define ACE_Pair_Caching_Utility APUTIL +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Pair_Caching_Utility * @@ -34,7 +36,7 @@ * * This class defines the methods commonly used by the different * caching strategies. For instance: <clear_cache> method which - * decides and purges the entry from the container. Note: This + * decides and purges the entry from the container. @note This * class helps in the caching_strategies using a container * containing entries of <KEY, ACE_Pair<VALUE, attributes>> * kind. The attributes helps in deciding the entries to be @@ -90,7 +92,7 @@ protected: * * This class defines the methods commonly used by the different * caching strategies. For instance: <clear_cache> method which - * decides and purges the entry from the container. Note: This + * decides and purges the entry from the container. @note This * class helps in the caching_strategies using a container * containing entries of <KEY, Svc_Handler> kind. The attributes * helps in deciding the entries to be purged. The @@ -149,7 +151,7 @@ private: * * This class defines the methods commonly used by the different * caching strategies. For instance: clear_cache () method which - * decides and purges the entry from the container. Note: This + * decides and purges the entry from the container. @note This * class helps in the caching_strategies using a container * containing entries of <Refcounted_KEY, * Recyclable_Connection_Handler> kind. The attributes helps in @@ -215,7 +217,7 @@ private: * * This class defines the methods commonly used by the different * caching strategies. For instance: <clear_cache> method which - * decides and purges the entry from the container. Note: This + * decides and purges the entry from the container. @note This * class helps in the caching_strategies using a container * containing entries of <KEY, HANDLER> kind where the HANDLER * contains the caching attributes which help in deciding the @@ -278,7 +280,7 @@ private: * * This class defines the methods commonly used by the different * caching strategies. For instance: <clear_cache> method which - * decides and purges the entry from the container. Note: This + * decides and purges the entry from the container. @note This * class is be used with the Null_Caching_Strategy. The * Cleanup_Strategy is the callback class to which the entries to * be cleaned up will be delegated. @@ -301,7 +303,7 @@ public: /** * Purge entries from the <container>. The Cleanup_Strategy will do * the actual job of cleanup once the entries to be cleaned up are - * decided. Note: Here it is a no-op. + * decided. @note Here it is a no-op. */ int clear_cache (CONTAINER &container, double purge_percent); @@ -312,7 +314,7 @@ protected: * Find the entry with minimum caching attributes. This is handler * specific since this utility is to be used very specifically for * handler who have caching_attributes for server side acched - * connection management.Note: Here it is a no-op. + * connection management.@note Here it is a no-op. */ void minimum (CONTAINER &container, KEY *&key_to_remove, @@ -330,6 +332,8 @@ private: ACE_UNIMPLEMENTED_FUNC (ACE_Null_Caching_Utility (const ACE_Null_Caching_Utility<KEY,VALUE,CONTAINER,ITERATOR,ATTRIBUTES> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Caching_Utility_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Capabilities.cpp b/ace/Capabilities.cpp index 2af1ef65954..24a650ef1ff 100644 --- a/ace/Capabilities.cpp +++ b/ace/Capabilities.cpp @@ -16,6 +16,7 @@ ACE_RCSID (ace, #define ACE_ESC ((ACE_TCHAR)0x1b) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_CapEntry::~ACE_CapEntry (void) { @@ -38,29 +39,29 @@ ACE_Capabilities::parse (const ACE_TCHAR *buf, ACE_TString &cap) { if (*buf == ACE_LIB_TEXT ('\\')) { - buf++; + ++buf; if (*buf == ACE_LIB_TEXT ('E') || *buf == ACE_LIB_TEXT ('e')) { cap += ACE_ESC; - buf++; + ++buf; continue; } else if (*buf == ACE_LIB_TEXT ('r')) { cap += ACE_LIB_TEXT ('\r'); - buf++; + ++buf; continue; } else if (*buf == ACE_LIB_TEXT ('n')) { cap += ACE_LIB_TEXT ('\n'); - buf++; + ++buf; continue; } else if (*buf == ACE_LIB_TEXT ('t')) { cap += ACE_LIB_TEXT ('\t'); - buf++; + ++buf; continue; } else if (*buf == ACE_LIB_TEXT ('\\')) @@ -102,11 +103,11 @@ ACE_Capabilities::parse (const ACE_TCHAR *buf, int &cap) void ACE_Capabilities::resetcaps (void) { - for (MAP::ITERATOR iter (this->caps_); + for (CAPABILITIES_MAP::ITERATOR iter (this->caps_); !iter.done (); iter.advance ()) { - MAP::ENTRY *entry = 0; + CAPABILITIES_MAP::ENTRY *entry = 0; iter.next (entry); delete entry->int_id_; } @@ -202,7 +203,7 @@ ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line) { // Skip blanks or irrelevant characters while (*line && isspace(*line)) - line++; + ++line; // End of line reached if (*line == ACE_LIB_TEXT ('\0')) @@ -219,7 +220,7 @@ ACE_Capabilities::is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line) // Skip puntuaction char if neccesary. if (*line == ACE_LIB_TEXT ('|') || *line == ACE_LIB_TEXT (',')) - line++; + ++line; else { ACE_DEBUG ((LM_DEBUG, @@ -292,7 +293,7 @@ static int is_empty (const ACE_TCHAR *line) { while (*line && isspace (*line)) - line++; + ++line; return *line == ACE_LIB_TEXT ('\0') || *line == ACE_LIB_TEXT ('#'); } @@ -301,7 +302,7 @@ static int is_line (const ACE_TCHAR *line) { while (*line && isspace (*line)) - line++; + ++line; return *line != ACE_LIB_TEXT ('\0'); } @@ -321,7 +322,7 @@ ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name) int done; ACE_TString line; - while (!(done = (this->getline (fp, line) == -1)) + while (0 == (done = (this->getline (fp, line) == -1)) && is_empty (line.c_str ())) continue; @@ -330,7 +331,7 @@ ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name) ACE_TString newline; ACE_TString description; - while (!(done = (this->getline (fp, newline) == -1))) + while (0 == (done = (this->getline (fp, newline) == -1))) if (is_line (newline.c_str ())) description += newline; else @@ -351,16 +352,4 @@ ACE_Capabilities::getent (const ACE_TCHAR *fname, const ACE_TCHAR *name) return -1; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<ACE_TString,ACE_CapEntry*>; -template class ACE_Hash_Map_Manager_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<ACE_TString,ACE_CapEntry*> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_TString,ACE_CapEntry*,ACE_Hash<ACE_TString>,ACE_Equal_To<ACE_TString>,ACE_Null_Mutex> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Capabilities.h b/ace/Capabilities.h index 902dc31a540..a970722e803 100644 --- a/ace/Capabilities.h +++ b/ace/Capabilities.h @@ -27,6 +27,8 @@ #include "ace/SString.h" #include "ace/Functor_String.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_CapEntry * @@ -133,7 +135,7 @@ class ACE_Export ACE_Capabilities { public: - typedef ACE_Hash_Map_Manager_Ex<ACE_TString, ACE_CapEntry *, ACE_Hash<ACE_TString>, ACE_Equal_To<ACE_TString>, ACE_Null_Mutex> MAP; + typedef ACE_Hash_Map_Manager_Ex<ACE_TString, ACE_CapEntry *, ACE_Hash<ACE_TString>, ACE_Equal_To<ACE_TString>, ACE_Null_Mutex> CAPABILITIES_MAP; /// The Constructor ACE_Capabilities (void); @@ -180,7 +182,7 @@ protected: private: /// This is the set of ACE_CapEntry. - MAP caps_; + CAPABILITIES_MAP caps_; }; @@ -189,7 +191,7 @@ int is_empty (const ACE_TCHAR *line) { while (*line && isspace (*line)) - line++; + ++line; return *line == ACE_LIB_TEXT ('\0') || *line == ACE_LIB_TEXT ('#'); } @@ -198,12 +200,14 @@ int is_line (const ACE_TCHAR *line) { while (*line && isspace (*line)) - line++; + ++line; return *line != ACE_LIB_TEXT ('\0'); } #endif /* ACE_IS_SPLITTING */ +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Capabilities.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Capabilities.inl b/ace/Capabilities.inl index ca168c0491a..053e0ecf7b6 100644 --- a/ace/Capabilities.inl +++ b/ace/Capabilities.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_CapEntry::ACE_CapEntry (int captype) : captype_ (captype) @@ -46,3 +48,5 @@ ACE_BoolCapEntry::getval (void) const { return val_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cleanup.cpp b/ace/Cleanup.cpp index 9e51dd6cf70..a2b67825e72 100644 --- a/ace/Cleanup.cpp +++ b/ace/Cleanup.cpp @@ -1,9 +1,10 @@ -// -*- C++ -*- // $Id$ #include "ace/Cleanup.h" -ACE_RCSID(ace, Cleanup, "$Id$") +ACE_RCSID (ace, + Cleanup, + "$Id$") #if !defined (ACE_HAS_INLINED_OSCALLS) # include "ace/Cleanup.inl" @@ -11,6 +12,8 @@ ACE_RCSID(ace, Cleanup, "$Id$") #include "ace/OS_Memory.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Cleanup::cleanup (void *) { @@ -25,7 +28,7 @@ ACE_Cleanup::~ACE_Cleanup (void) /*****************************************************************************/ extern "C" void -ace_cleanup_destroyer (ACE_Cleanup *object, void *param) +ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *object, void *param) { object->cleanup (param); } @@ -98,7 +101,7 @@ ACE_Cleanup_Info_Node::~ACE_Cleanup_Info_Node (void) ACE_Cleanup_Info_Node * ACE_Cleanup_Info_Node::insert (const ACE_Cleanup_Info &new_info) { - ACE_Cleanup_Info_Node *new_node; + ACE_Cleanup_Info_Node *new_node = 0; ACE_NEW_RETURN (new_node, ACE_Cleanup_Info_Node (new_info, this), @@ -133,7 +136,7 @@ ACE_OS_Exit_Info::at_exit_i (void *object, // Return -1 and sets errno if unable to allocate storage. Enqueue // at the head and dequeue from the head to get LIFO ordering. - ACE_Cleanup_Info_Node *new_node; + ACE_Cleanup_Info_Node *new_node = 0; if ((new_node = registered_objects_->insert (new_info)) == 0) return -1; @@ -163,7 +166,7 @@ ACE_OS_Exit_Info::find (void *object) } void -ACE_OS_Exit_Info::call_hooks () +ACE_OS_Exit_Info::call_hooks (void) { // Call all registered cleanup hooks, in reverse order of // registration. @@ -172,10 +175,12 @@ ACE_OS_Exit_Info::call_hooks () iter = iter->next_) { ACE_Cleanup_Info &info = iter->cleanup_info_; - if (info.cleanup_hook_ == reinterpret_cast<ACE_CLEANUP_FUNC> (ace_cleanup_destroyer)) + if (info.cleanup_hook_ == reinterpret_cast<ACE_CLEANUP_FUNC> ( + ACE_CLEANUP_DESTROYER_NAME)) // The object is an ACE_Cleanup. - ace_cleanup_destroyer (reinterpret_cast<ACE_Cleanup *> (info.object_), - info.param_); + ACE_CLEANUP_DESTROYER_NAME ( + reinterpret_cast<ACE_Cleanup *> (info.object_), + info.param_); else if (info.object_ == &ace_exit_hook_marker) // The hook is an ACE_EXIT_HOOK. (* reinterpret_cast<ACE_EXIT_HOOK> (info.cleanup_hook_)) (); @@ -183,3 +188,5 @@ ACE_OS_Exit_Info::call_hooks () (*info.cleanup_hook_) (info.object_, info.param_); } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cleanup.h b/ace/Cleanup.h index 4cf7629ac4a..37e46b7e7cb 100644 --- a/ace/Cleanup.h +++ b/ace/Cleanup.h @@ -26,6 +26,15 @@ # endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/ACE_export.h" + +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# include "ace/Global_Macros.h" +# define ACE_CLEANUP_DESTROYER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_cleanup_destroyer) +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Cleanup * @@ -46,7 +55,7 @@ public: // Adapter for cleanup, used by ACE_Object_Manager. extern "C" ACE_Export -void ace_cleanup_destroyer (ACE_Cleanup *, void *param = 0); +void ACE_CLEANUP_DESTROYER_NAME (ACE_Cleanup *, void *param = 0); /** * @class ACE_Cleanup_Info @@ -113,6 +122,8 @@ private: ACE_Cleanup_Info_Node *registered_objects_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/Cleanup.inl b/ace/Cleanup.inl index 841c715bf1a..02d3c223f8d 100644 --- a/ace/Cleanup.inl +++ b/ace/Cleanup.inl @@ -1,7 +1,12 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Cleanup::ACE_Cleanup (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Cleanup_Strategies_T.cpp b/ace/Cleanup_Strategies_T.cpp index 5b9425ee5da..10804ba21ca 100644 --- a/ace/Cleanup_Strategies_T.cpp +++ b/ace/Cleanup_Strategies_T.cpp @@ -1,7 +1,7 @@ //$Id$ -#ifndef CLEANUP_STRATEGIES_T_C -#define CLEANUP_STRATEGIES_T_C +#ifndef ACE_CLEANUP_STRATEGIES_T_CPP +#define ACE_CLEANUP_STRATEGIES_T_CPP #include "ace/Cleanup_Strategies_T.h" @@ -9,6 +9,8 @@ #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + //////////////////////////////////////////////////////////////////////////// template <class KEY, class VALUE, class CONTAINER> @@ -19,19 +21,18 @@ ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::~ACE_Cleanup_Strategy (void) template <class KEY, class VALUE, class CONTAINER> int ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, KEY *key, - VALUE *value) + VALUE *) { - ACE_UNUSED_ARG (value); - return container.unbind (*key); } //////////////////////////////////////////////////////////////////////////// template <class KEY, class VALUE, class CONTAINER> int -ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, - KEY *key, - VALUE *) +ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup ( + CONTAINER &container, + KEY *key, + VALUE *) { VALUE value; @@ -48,9 +49,12 @@ ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAIN ///////////////////////////////////////////////////////////////////////////// template <class KEY, class VALUE, class CONTAINER> int -ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &, - KEY *, - VALUE *value) +ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<KEY, + VALUE, + CONTAINER>::cleanup ( + CONTAINER &, + KEY *, + VALUE *value) { return value->first ()->handle_close_i (); } @@ -58,9 +62,10 @@ ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::clean //////////////////////////////////////////////////////////////////////////// template <class KEY, class VALUE, class CONTAINER> int -ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, - KEY *key, - VALUE *value) +ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup ( + CONTAINER &container, + KEY *key, + VALUE *value) { // Remove the item from cache only if the handler isnt in use. if ((*value)->active () == 0) @@ -78,15 +83,13 @@ ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &contain //////////////////////////////////////////////////////////////////////////// template <class KEY, class VALUE, class CONTAINER> int -ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, - KEY *key, - VALUE *value) +ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &, + KEY *, + VALUE *) { - ACE_UNUSED_ARG (container); - ACE_UNUSED_ARG (key); - ACE_UNUSED_ARG (value); - return 0; } -#endif /* CLEANUP_STRATEGIES_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_CLEANUP_STRATEGIES_T_CPP */ diff --git a/ace/Cleanup_Strategies_T.h b/ace/Cleanup_Strategies_T.h index 989b6a2c629..d31a812d70c 100644 --- a/ace/Cleanup_Strategies_T.h +++ b/ace/Cleanup_Strategies_T.h @@ -24,6 +24,8 @@ // For linkers that cant grok long names. #define ACE_Cleanup_Strategy ACLE +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Cleanup_Strategy * @@ -57,7 +59,7 @@ public: * * The entry to be cleaned up is removed from the container. * Here, since we are dealing with svc_handlers specifically, we - * perform a couple of extra operations. Note: To be used when + * perform a couple of extra operations. @note To be used when * the handler is recyclable. */ template <class KEY, class VALUE, class CONTAINER> @@ -104,7 +106,7 @@ public: * * The entry to be cleaned up is removed from the container. * Here, since we are dealing with svc_handlers specifically, we - * perform a couple of extra operations. Note: This cleanup strategy + * perform a couple of extra operations. @note This cleanup strategy * should be used in the case when the handler has the caching * attributes. */ @@ -139,6 +141,8 @@ public: virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Cleanup_Strategies_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Codecs.cpp b/ace/Codecs.cpp index 8e717cb4533..d28cda908d1 100644 --- a/ace/Codecs.cpp +++ b/ace/Codecs.cpp @@ -7,14 +7,28 @@ ACE_RCSID (ace, Codecs, "$Id$") -const ACE_Byte ACE_Base64::alphabet_[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +namespace +{ + // Just in case ... +#undef alphabet +#undef pad +#undef max_columns + + // Symbols which form the Base64 alphabet (Defined as per RFC 2045) + ACE_Byte const alphabet[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -const ACE_Byte ACE_Base64::pad_ = '='; + // The padding character used in the encoding + ACE_Byte const pad = '='; -int ACE_Base64::init_ = 0; + // Number of columns per line of encoded output (Can have a maximum + // value of 76). + int const max_columns = 72; +} -int ACE_Base64::max_columns_ = 72; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +bool ACE_Base64::init_ = false; ACE_Byte ACE_Base64::decoder_[256]; @@ -34,7 +48,7 @@ ACE_Base64::encode (const ACE_Byte* input, ACE_Byte* result = 0; size_t length = ((input_len + 2) / 3) * 4; - size_t num_lines = length / ACE_Base64::max_columns_ + 1; + size_t num_lines = length / max_columns + 1; length += num_lines + 1; ACE_NEW_RETURN (result, ACE_Byte[length], 0); @@ -50,12 +64,12 @@ ACE_Base64::encode (const ACE_Byte* input, if (char_count == 3) { - result[pos++] = ACE_Base64::alphabet_[bits >> 18]; - result[pos++] = ACE_Base64::alphabet_[(bits >> 12) & 0x3f]; - result[pos++] = ACE_Base64::alphabet_[(bits >> 6) & 0x3f]; - result[pos++] = ACE_Base64::alphabet_[bits & 0x3f]; + result[pos++] = alphabet[bits >> 18]; + result[pos++] = alphabet[(bits >> 12) & 0x3f]; + result[pos++] = alphabet[(bits >> 6) & 0x3f]; + result[pos++] = alphabet[bits & 0x3f]; cols += 4; - if (cols == ACE_Base64::max_columns_) { + if (cols == max_columns) { result[pos++] = '\n'; cols = 0; } @@ -71,17 +85,17 @@ ACE_Base64::encode (const ACE_Byte* input, if (char_count != 0) { bits <<= (16 - (8 * char_count)); - result[pos++] = ACE_Base64::alphabet_[bits >> 18]; - result[pos++] = ACE_Base64::alphabet_[(bits >> 12) & 0x3f]; + result[pos++] = alphabet[bits >> 18]; + result[pos++] = alphabet[(bits >> 12) & 0x3f]; if (char_count == 1) { - result[pos++] = pad_; - result[pos++] = pad_; + result[pos++] = pad; + result[pos++] = pad; } else { - result[pos++] = ACE_Base64::alphabet_[(bits >> 6) & 0x3f]; - result[pos++] = pad_; + result[pos++] = alphabet[(bits >> 6) & 0x3f]; + result[pos++] = pad; } if (cols > 0) result[pos++] = '\n'; @@ -99,7 +113,7 @@ ACE_Base64::length (const ACE_Byte* input) ACE_Byte* ptr = const_cast<ACE_Byte*> (input); while (*ptr != 0 && - (member_[*(ptr)] == 1 || *ptr == pad_ + (member_[*(ptr)] == 1 || *ptr == pad || ACE_OS::ace_isspace (*ptr))) ptr++; size_t len = ptr - input; @@ -122,7 +136,7 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len) ACE_Byte* ptr = const_cast<ACE_Byte*> (input); while (*ptr != 0 && - (member_[*(ptr)] == 1 || *ptr == pad_ + (member_[*(ptr)] == 1 || *ptr == pad || ACE_OS::ace_isspace (*ptr))) ptr++; size_t input_len = ptr - input; @@ -134,7 +148,7 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len) size_t i = 0; for (; i < input_len; ++i) { - if (input[i] == pad_) + if (input[i] == pad) break; if (!ACE_Base64::member_[input[i]]) continue; @@ -143,9 +157,9 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len) if (char_count == 4) { - result[pos++] = bits >> 16; - result[pos++] = (bits >> 8) & 0xff; - result[pos++] = bits & 0xff; + result[pos++] = static_cast<ACE_Byte> (bits >> 16); + result[pos++] = static_cast<ACE_Byte> ((bits >> 8) & 0xff); + result[pos++] = static_cast<ACE_Byte> (bits & 0xff); bits = 0; char_count = 0; } @@ -176,11 +190,11 @@ ACE_Base64::decode (const ACE_Byte* input, size_t* output_len) errors++; break; case 2: - result[pos++] = bits >> 10; + result[pos++] = static_cast<ACE_Byte> (bits >> 10); break; case 3: - result[pos++] = bits >> 16; - result[pos++] = (bits >> 8) & 0xff; + result[pos++] = static_cast<ACE_Byte> (bits >> 16); + result[pos++] = static_cast<ACE_Byte> ((bits >> 8) & 0xff); break; } } @@ -200,12 +214,14 @@ ACE_Base64::init () { if (!ACE_Base64::init_) { - for (ACE_Byte i = 0; i < sizeof (ACE_Base64::alphabet_); ++i) + for (ACE_Byte i = 0; i < sizeof (alphabet); ++i) { - ACE_Base64::decoder_[ACE_Base64::alphabet_[i]] = i; - ACE_Base64::member_[ACE_Base64::alphabet_[i]] = 1; + ACE_Base64::decoder_[alphabet[i]] = i; + ACE_Base64::member_ [alphabet[i]] = 1; } - ACE_Base64::init_ = 1; + ACE_Base64::init_ = true; } return; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Codecs.h b/ace/Codecs.h index 899092b29aa..3159a312c95 100644 --- a/ace/Codecs.h +++ b/ace/Codecs.h @@ -1,5 +1,6 @@ // -*- C++ -*- +//============================================================================= /** * @file Codecs.h * @@ -13,18 +14,25 @@ * One: Format of Internet Message Bodies. * */ +//============================================================================= #ifndef ACE_CODECS_H #define ACE_CODECS_H + #include /**/ "ace/pre.h" -#include "ace/Basic_Types.h" -#include "ace/Global_Macros.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Basic_Types.h" +#include "ace/Global_Macros.h" + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Base64 * @@ -37,7 +45,6 @@ */ class ACE_Export ACE_Base64 { - friend class ace_dewarn_gplusplus; public: //@{ @@ -77,17 +84,21 @@ public: //@} +protected: + + // Prevent default construction. + ACE_Base64 (void) {} + private: - /// Initialize the tables for encoding/decoding. - static void init(); + // Preventing copying and assignment. + ACE_Base64 (ACE_Base64 const &); + ACE_Base64 & operator= (ACE_Base64 const &); - // Prevent construction in any form - ACE_UNIMPLEMENTED_FUNC (ACE_Base64 ()) - ACE_UNIMPLEMENTED_FUNC (ACE_Base64 (const ACE_Base64&)) + /// Initialize the tables for encoding/decoding. + static void init (void); - /// Symbols which form the Base64 alphabet (Defined as per RFC 2045) - static const ACE_Byte alphabet_[]; +private: /// Alphabet used for decoding i.e decoder_[alphabet_[i = 0..63]] = i static ACE_Byte decoder_[]; @@ -96,16 +107,13 @@ private: /// member_[alphabet_[0..63]] = 1 static ACE_Byte member_[]; - /// The padding character used in the encoding - static const ACE_Byte pad_; - /// Boolean to denote whether initialization is complete - static int init_; - - /// Number of columns per line of encoded output (Can have a max value of 76) - static int max_columns_; + static bool init_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" + #endif /* ACE_CODECS_H */ diff --git a/ace/Codeset_IBM1047.cpp b/ace/Codeset_IBM1047.cpp index aeda9a3c43e..469c15089c4 100644 --- a/ace/Codeset_IBM1047.cpp +++ b/ace/Codeset_IBM1047.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ // ============================================================================ @@ -22,10 +21,57 @@ #if defined(ACE_MVS) -ACE_RCSID(ace, Codeset_IBM1047, "$Id$") +ACE_RCSID (ace, + Codeset_IBM1047, + "$Id$") // **************************************************************** +namespace +{ + char const to_IBM1047[] = + { + "\x00\x01\x02\x03\x37\x2D\x2E\x2F\x16\x05\x25\x0B\x0C\x0D\x0E\x0F" // 00-0F + "\x10\x11\x12\x13\x3C\x3D\x32\x26\x18\x19\x3F\x27\x22\x1D\x35\x1F" // 10-1F + "\x40\x5A\x7F\x7B\x5B\x6C\x50\x7D\x4D\x5D\x5C\x4E\x6B\x60\x4B\x61" // 20-2F + "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\x7A\x5E\x4C\x7E\x6E\x6F" // 30-3F + "\x7C\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xD1\xD2\xD3\xD4\xD5\xD6" // 40-4F + "\xD7\xD8\xD9\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xAD\xE0\xBD\x5F\x6D" // 50-5F + "\x79\x81\x82\x83\x84\x85\x86\x87\x88\x89\x91\x92\x93\x94\x95\x96" // 60-6F + "\x97\x98\x99\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xC0\x4F\xD0\xA1\x07" // 70-7F + "\x43\x20\x21\x1C\x23\xEB\x24\x9B\x71\x28\x38\x49\x90\xBA\xEC\xDF" // 80-8F + "\x45\x29\x2A\x9D\x72\x2B\x8A\x9A\x67\x56\x64\x4A\x53\x68\x59\x46" // 90-9F + "\xEA\xDA\x2C\xDE\x8B\x55\x41\xFE\x58\x51\x52\x48\x69\xDB\x8E\x8D" // A0-AF + "\x73\x74\x75\xFA\x15\xB0\xB1\xB3\xB4\xB5\x6A\xB7\xB8\xB9\xCC\xBC" // B0-BF + "\xAB\x3E\x3B\x0A\xBF\x8F\x3A\x14\xA0\x17\xCB\xCA\x1A\x1B\x9C\x04" // C0-CF + "\x34\xEF\x1E\x06\x08\x09\x77\x70\xBE\xBB\xAC\x54\x63\x65\x66\x62" // D0-DF + "\x30\x42\x47\x57\xEE\x33\xB6\xE1\xCD\xED\x36\x44\xCE\xCF\x31\xAA" // E0-EF + "\xFC\x9E\xAE\x8C\xDD\xDC\x39\xFB\x80\xAF\xFD\x78\x76\xB2\x9F\xFF" // F0-FF +}; + + char const from_IBM1047[] = + { + "\x00\x01\x02\x03\xCF\x09\xD3\x7F\xD4\xD5\xC3\x0B\x0C\x0D\x0E\x0F" // 00-0F + "\x10\x11\x12\x13\xC7\xB4\x08\xC9\x18\x19\xCC\xCD\x83\x1D\xD2\x1F" // 10-1F + "\x81\x82\x1C\x84\x86\x0A\x17\x1B\x89\x91\x92\x95\xA2\x05\x06\x07" // 20-2F + "\x20\xEE\x16\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xC1\x1A" // 30-3F + "\x20\xA6\xE1\x80\xEB\x90\x9F\xE2\xAB\x8B\x9B\x2E\x3C\x28\x2B\x7C" // 40-4F + "\x26\xA9\xAA\x9C\xDB\xA5\x99\xE3\xA8\x9E\x21\x24\x2A\x29\x3B\x5E" // 50-5F + "\x2D\x2F\xDF\xDC\x9A\xDD\xDE\x98\x9D\xAC\xBA\x2C\x25\x5F\x3E\x3F" // 60-6F + "\xD7\x88\x94\xB0\xB1\xB2\xFC\xD6\xFB\x60\x3A\x23\x40\x27\x3D\x22" // 70-7F + "\xF8\x61\x62\x63\x64\x65\x66\x67\x68\x69\x96\xA4\xF3\xAF\xAE\xC5" // 80-8F + "\x8C\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x97\x87\xCE\x93\xF1\xFE" // 90-9F + "\xC8\x7E\x73\x74\x75\x76\x77\x78\x79\x7A\xEF\xC0\xDA\x5B\xF2\xF9" // A0-AF + "\xB5\xB6\xFD\xB7\xB8\xB9\xE6\xBB\xBC\xBD\x8D\xD9\xBF\x5D\xD8\xC4" // B0-BF + "\x7B\x41\x42\x43\x44\x45\x46\x47\x48\x49\xCB\xCA\xBE\xE8\xEC\xED" // C0-CF + "\x7D\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\xA1\xAD\xF5\xF4\xA3\x8F" // D0-DF + "\x5C\xE7\x53\x54\x55\x56\x57\x58\x59\x5A\xA0\x85\x8E\xE9\xE4\xD1" // E0-EF + "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\xB3\xF7\xF0\xFA\xA7\xFF" // F0-FF + }; +} + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_IBM1047_ISO8859::ACE_IBM1047_ISO8859 (void) { } @@ -52,7 +98,7 @@ ACE_IBM1047_ISO8859::read_char (ACE_InputCDR &in, { if (this->read_1 (in, reinterpret_cast<ACE_CDR::Octet*> (&x))) { - x = ACE_to_IBM1047[x]; + x = to_IBM1047[x]; return 1; } return 0; @@ -94,7 +140,7 @@ ACE_IBM1047_ISO8859::read_char_array (ACE_InputCDR& in, len)) { for (ACE_CDR::ULong i = 0; i != len; ++i) - x[i] = ACE_to_IBM1047[x[i]]; + x[i] = to_IBM1047[x[i]]; return 1; } @@ -108,7 +154,7 @@ ACE_IBM1047_ISO8859::write_char (ACE_OutputCDR& out, { return this->write_1 (out, - reinterpret_cast<const ACE_CDR::Octet*> (&ACE_from_IBM1047[x])); + reinterpret_cast<const ACE_CDR::Octet*> (&from_IBM1047[x])); } ACE_CDR::Boolean @@ -132,7 +178,7 @@ ACE_IBM1047_ISO8859::write_char_array (ACE_OutputCDR& out, ACE_OS::memcpy (buf, x, len); for (ACE_CDR::ULong i = 0; i != len; ++i) - buf[i] = ACE_from_IBM1047[buf[i]]; + buf[i] = from_IBM1047[buf[i]]; return 1; } @@ -170,7 +216,7 @@ ACE_ISO8859_IBM1047::read_char (ACE_InputCDR& in, { if (this->read_1 (in, reinterpret_cast<ACE_CDR::Octet*> (&x))) { - x = ACE_from_IBM1047[x]; + x = from_IBM1047[x]; return 1; } return 0; @@ -212,7 +258,7 @@ ACE_ISO8859_IBM1047::read_char_array (ACE_InputCDR &in, len)) { for (ACE_CDR::ULong i = 0; i != len; ++i) - x[i] = ACE_from_IBM1047[x[i]]; + x[i] = from_IBM1047[x[i]]; return 1; } @@ -226,7 +272,7 @@ ACE_ISO8859_IBM1047::write_char (ACE_OutputCDR &out, { return this->write_1 (out, - reinterpret_cast<const ACE_CDR::Octet *> (&ACE_to_IBM1047[x])); + reinterpret_cast<const ACE_CDR::Octet *> (&to_IBM1047[x])); } ACE_CDR::Boolean @@ -252,7 +298,7 @@ ACE_ISO8859_IBM1047::write_char_array (ACE_OutputCDR &out, ACE_OS::memcpy (buf, x, len); for (ACE_CDR::ULong i = 0; i != len; ++i) - buf[i] = ACE_to_IBM1047[buf[i]]; + buf[i] = to_IBM1047[buf[i]]; return 1; } @@ -261,49 +307,11 @@ ACE_ISO8859_IBM1047::write_char_array (ACE_OutputCDR &out, return 0; } -// **************************************************************** - -char ACE_to_IBM1047[257] = -{ - "\x00\x01\x02\x03\x37\x2D\x2E\x2F\x16\x05\x25\x0B\x0C\x0D\x0E\x0F" // 00-0F - "\x10\x11\x12\x13\x3C\x3D\x32\x26\x18\x19\x3F\x27\x22\x1D\x35\x1F" // 10-1F - "\x40\x5A\x7F\x7B\x5B\x6C\x50\x7D\x4D\x5D\x5C\x4E\x6B\x60\x4B\x61" // 20-2F - "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\x7A\x5E\x4C\x7E\x6E\x6F" // 30-3F - "\x7C\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xD1\xD2\xD3\xD4\xD5\xD6" // 40-4F - "\xD7\xD8\xD9\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xAD\xE0\xBD\x5F\x6D" // 50-5F - "\x79\x81\x82\x83\x84\x85\x86\x87\x88\x89\x91\x92\x93\x94\x95\x96" // 60-6F - "\x97\x98\x99\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xC0\x4F\xD0\xA1\x07" // 70-7F - "\x43\x20\x21\x1C\x23\xEB\x24\x9B\x71\x28\x38\x49\x90\xBA\xEC\xDF" // 80-8F - "\x45\x29\x2A\x9D\x72\x2B\x8A\x9A\x67\x56\x64\x4A\x53\x68\x59\x46" // 90-9F - "\xEA\xDA\x2C\xDE\x8B\x55\x41\xFE\x58\x51\x52\x48\x69\xDB\x8E\x8D" // A0-AF - "\x73\x74\x75\xFA\x15\xB0\xB1\xB3\xB4\xB5\x6A\xB7\xB8\xB9\xCC\xBC" // B0-BF - "\xAB\x3E\x3B\x0A\xBF\x8F\x3A\x14\xA0\x17\xCB\xCA\x1A\x1B\x9C\x04" // C0-CF - "\x34\xEF\x1E\x06\x08\x09\x77\x70\xBE\xBB\xAC\x54\x63\x65\x66\x62" // D0-DF - "\x30\x42\x47\x57\xEE\x33\xB6\xE1\xCD\xED\x36\x44\xCE\xCF\x31\xAA" // E0-EF - "\xFC\x9E\xAE\x8C\xDD\xDC\x39\xFB\x80\xAF\xFD\x78\x76\xB2\x9F\xFF" // F0-FF -}; +ACE_END_VERSIONED_NAMESPACE_DECL -char ACE_from_IBM1047[257] = -{ - "\x00\x01\x02\x03\xCF\x09\xD3\x7F\xD4\xD5\xC3\x0B\x0C\x0D\x0E\x0F" // 00-0F - "\x10\x11\x12\x13\xC7\xB4\x08\xC9\x18\x19\xCC\xCD\x83\x1D\xD2\x1F" // 10-1F - "\x81\x82\x1C\x84\x86\x0A\x17\x1B\x89\x91\x92\x95\xA2\x05\x06\x07" // 20-2F - "\x20\xEE\x16\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xC1\x1A" // 30-3F - "\x20\xA6\xE1\x80\xEB\x90\x9F\xE2\xAB\x8B\x9B\x2E\x3C\x28\x2B\x7C" // 40-4F - "\x26\xA9\xAA\x9C\xDB\xA5\x99\xE3\xA8\x9E\x21\x24\x2A\x29\x3B\x5E" // 50-5F - "\x2D\x2F\xDF\xDC\x9A\xDD\xDE\x98\x9D\xAC\xBA\x2C\x25\x5F\x3E\x3F" // 60-6F - "\xD7\x88\x94\xB0\xB1\xB2\xFC\xD6\xFB\x60\x3A\x23\x40\x27\x3D\x22" // 70-7F - "\xF8\x61\x62\x63\x64\x65\x66\x67\x68\x69\x96\xA4\xF3\xAF\xAE\xC5" // 80-8F - "\x8C\x6A\x6B\x6C\x6D\x6E\x6F\x70\x71\x72\x97\x87\xCE\x93\xF1\xFE" // 90-9F - "\xC8\x7E\x73\x74\x75\x76\x77\x78\x79\x7A\xEF\xC0\xDA\x5B\xF2\xF9" // A0-AF - "\xB5\xB6\xFD\xB7\xB8\xB9\xE6\xBB\xBC\xBD\x8D\xD9\xBF\x5D\xD8\xC4" // B0-BF - "\x7B\x41\x42\x43\x44\x45\x46\x47\x48\x49\xCB\xCA\xBE\xE8\xEC\xED" // C0-CF - "\x7D\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\xA1\xAD\xF5\xF4\xA3\x8F" // D0-DF - "\x5C\xE7\x53\x54\x55\x56\x57\x58\x59\x5A\xA0\x85\x8E\xE9\xE4\xD1" // E0-EF - "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\xB3\xF7\xF0\xFA\xA7\xFF" // F0-FF -}; +// **************************************************************** #elif defined (__HP_aCC) // Make aC++ stop complaining about an empty translation unit -static int shut_up_aCC = 0; +static int const shut_up_aCC = 0; #endif /* ACE_MVS */ diff --git a/ace/Codeset_IBM1047.h b/ace/Codeset_IBM1047.h index ca788435be6..9f9231a41a9 100644 --- a/ace/Codeset_IBM1047.h +++ b/ace/Codeset_IBM1047.h @@ -29,8 +29,7 @@ #include "ace/CDR_Stream.h" -extern ACE_Export char ACE_to_IBM1047[257]; -extern ACE_Export char ACE_from_IBM1047[257]; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // **************************************************************** @@ -120,7 +119,10 @@ public: virtual ACE_CDR::ULong tcs (); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_MVS */ #include /**/ "ace/post.h" + #endif /* ACE_CODESET_IMB1047_H */ diff --git a/ace/Codeset_Registry.cpp b/ace/Codeset_Registry.cpp index 6cdb913bce4..5d3c6abb59b 100644 --- a/ace/Codeset_Registry.cpp +++ b/ace/Codeset_Registry.cpp @@ -21,8 +21,11 @@ #include "ace/Codeset_Registry.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Codeset_Registry, "$Id$") +ACE_RCSID (ace, + Codeset_Registry, + "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL int ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale, @@ -30,7 +33,7 @@ ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale, ACE_CDR::UShort *num_sets, ACE_CDR::UShort **char_sets) { - registry_entry* element = 0; + registry_entry const * element = 0; for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) if (ACE_OS::strcmp(registry_db_[i].loc_name_,locale.c_str()) == 0) element = ®istry_db_[i]; @@ -42,8 +45,8 @@ ACE_Codeset_Registry::locale_to_registry_i (const ACE_CString &locale, if (char_sets != 0) { ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); - ACE_OS::memcpy (element->char_sets_, - *char_sets, + ACE_OS::memcpy (*char_sets, + element->char_sets_, element->num_sets_ * sizeof (ACE_CDR::UShort)); } return 1; @@ -55,7 +58,7 @@ ACE_Codeset_Registry::registry_to_locale_i (ACE_CDR::ULong codeset_id, ACE_CDR::UShort *num_sets, ACE_CDR::UShort **char_sets) { - registry_entry* element = 0; + registry_entry const * element = 0; for (size_t i = 0; element == 0 && i < num_registry_entries_; i++) if (codeset_id == registry_db_[i].codeset_id_) element = ®istry_db_[i]; @@ -67,8 +70,8 @@ ACE_Codeset_Registry::registry_to_locale_i (ACE_CDR::ULong codeset_id, if (char_sets != 0) { ACE_NEW_RETURN (*char_sets,ACE_CDR::UShort[element->num_sets_],0); - ACE_OS::memcpy (element->char_sets_, - *char_sets, + ACE_OS::memcpy (*char_sets, + element->char_sets_, element->num_sets_ * sizeof (ACE_CDR::UShort)); } return 1; @@ -78,8 +81,8 @@ int ACE_Codeset_Registry::is_compatible_i (ACE_CDR::ULong codeset_id, ACE_CDR::ULong other) { - registry_entry* lhs = 0; - registry_entry* rhs = 0; + registry_entry const * lhs = 0; + registry_entry const * rhs = 0; for (size_t i = 0; (lhs == 0 || rhs == 0) && i < num_registry_entries_; i++) { if (codeset_id == registry_db_[i].codeset_id_) @@ -106,3 +109,5 @@ ACE_Codeset_Registry::get_max_bytes_i (ACE_CDR::ULong codeset_id) return registry_db_[i].max_bytes_; return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Codeset_Registry.h b/ace/Codeset_Registry.h index 5ed68e35d0b..eb8d013d4af 100644 --- a/ace/Codeset_Registry.h +++ b/ace/Codeset_Registry.h @@ -37,31 +37,33 @@ #include /**/ <dce/rpc.h> #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Codeset_Registry { public: - // based on a locale string, find the registry value and optional codeset - // collection. This wraps the dce_cs_loc_to_rgy function, or emulates it. + /// Based on a locale string, find the registry value and optional codeset + /// collection. This wraps the dce_cs_loc_to_rgy function, or emulates it. static int locale_to_registry (const ACE_CString &locale, ACE_CDR::ULong &codeset_id, ACE_CDR::UShort * = 0, ACE_CDR::UShort ** = 0); - // based on a registry value, find the locale string and optional codeset - // collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. + /// Based on a registry value, find the locale string and optional codeset + /// collection. This wraps the dce_cs_rgy_to_loc function, or emulates it. static int registry_to_locale (ACE_CDR::ULong codeset_id, ACE_CString &locale, ACE_CDR::UShort * = 0, ACE_CDR::UShort ** = 0); - // tell if two codesets are compatible. This wraps the - //rpc_cs_char_set_compat_check function. + /// Tell if two codesets are compatible. This wraps the + /// rpc_cs_char_set_compat_check function. static int is_compatible (ACE_CDR::ULong codeset_id, ACE_CDR::ULong other); - // return the max number of bytes required to represent a single character. - // This wraps the rpc_rgy_get_max_bytes function. + /// Return the max number of bytes required to represent a single character. + /// This wraps the rpc_rgy_get_max_bytes function. static ACE_CDR::Short get_max_bytes (ACE_CDR::ULong codeset_id); enum {max_charsets_ = 5}; @@ -76,8 +78,8 @@ protected: } registry_entry; private: - static size_t num_registry_entries_; - static registry_entry registry_db_[]; + static size_t const num_registry_entries_; + static registry_entry const registry_db_[]; static int locale_to_registry_i (const ACE_CString &locale, ACE_CDR::ULong &codeset_id, @@ -92,6 +94,8 @@ private: static ACE_CDR::Short get_max_bytes_i (ACE_CDR::ULong codeset_id); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Codeset_Registry.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Codeset_Registry.inl b/ace/Codeset_Registry.inl index 47aaf7280ca..d24e07cc83b 100644 --- a/ace/Codeset_Registry.inl +++ b/ace/Codeset_Registry.inl @@ -14,6 +14,8 @@ */ //============================================================================= +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Codeset_Registry::locale_to_registry(const ACE_CString &locale, @@ -65,8 +67,8 @@ ACE_Codeset_Registry::registry_to_locale(ACE_CDR::ULong codeset_id, #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ } -// tell if two codesets are compatible. This wraps the -//rpc_cs_char_set_compat_check function. +// Tell if two codesets are compatible. This wraps the +// rpc_cs_char_set_compat_check function. ACE_INLINE int ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id, @@ -81,7 +83,7 @@ ACE_Codeset_Registry::is_compatible (ACE_CDR::ULong codeset_id, #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ } -// return the max number of bytes required to represent a single character. +// Return the max number of bytes required to represent a single character. // This wraps the rpc_rgy_get_max_bytes function. ACE_INLINE ACE_CDR::Short @@ -96,3 +98,5 @@ ACE_Codeset_Registry::get_max_bytes (ACE_CDR::ULong codeset_id) return ACE_Codeset_Registry::get_max_bytes_i (codeset_id); #endif /* ACE_HAS_DCE_CODESET_REGISTRY */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Codeset_Registry_db.cpp b/ace/Codeset_Registry_db.cpp index 7386ba39e5e..cd6e29760af 100644 --- a/ace/Codeset_Registry_db.cpp +++ b/ace/Codeset_Registry_db.cpp @@ -12,7 +12,9 @@ #include "ace/Codeset_Registry.h" -ACE_Codeset_Registry::registry_entry +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Codeset_Registry::registry_entry const ACE_Codeset_Registry::registry_db_[] = { {"ISO 8859-1:1987; Latin Alphabet No. 1","ASCII",0x00010001,1,{0x0011},1}, @@ -21,4 +23,6 @@ ACE_Codeset_Registry::registry_db_[] = {"ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form","Unicode",0x00010109,1,{0x1000},2} }; -size_t ACE_Codeset_Registry::num_registry_entries_ = 4; +size_t const ACE_Codeset_Registry::num_registry_entries_ = 4; + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Condition_Recursive_Thread_Mutex.cpp b/ace/Condition_Recursive_Thread_Mutex.cpp index fa364a6a03e..06301818247 100644 --- a/ace/Condition_Recursive_Thread_Mutex.cpp +++ b/ace/Condition_Recursive_Thread_Mutex.cpp @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + /** * @file Condition_Recursive_Thread_Mutex.cpp * @@ -17,6 +18,8 @@ # include "ace/Log_Msg.h" #endif /* ACE_HAS_DUMP */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_Condition<ACE_Recursive_Thread_Mutex>::remove (void) { @@ -121,4 +124,6 @@ ACE_Condition_Recursive_Thread_Mutex::ACE_Condition_Recursive_Thread_Mutex ( { } -#endif /* ACD_HAS_THREADS */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_HAS_THREADS */ diff --git a/ace/Condition_Recursive_Thread_Mutex.h b/ace/Condition_Recursive_Thread_Mutex.h index 21a24557fc5..0c4607a5c2e 100644 --- a/ace/Condition_Recursive_Thread_Mutex.h +++ b/ace/Condition_Recursive_Thread_Mutex.h @@ -27,8 +27,9 @@ #else /* ACE_HAS_THREADS */ #include "ace/Recursive_Thread_Mutex.h" -template <class ACE_LOCK> -class ACE_Condition; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class ACE_LOCK> class ACE_Condition; /** * @class ACE_Condition<ACE_Recursive_Thread_Mutex> @@ -86,15 +87,19 @@ public: void dump (void) const; private: + + // = Prevent assignment and copying. + void operator= (const ACE_Condition<ACE_Recursive_Thread_Mutex> &); + ACE_Condition (const ACE_Condition<ACE_Recursive_Thread_Mutex> &); + +private: + /// A normal (i.e., non-recursive) condition variable. ACE_cond_t cond_; /// Reference to the recursive mutex. ACE_Recursive_Thread_Mutex &mutex_; - // = Prevent assignment and initialization. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Condition<ACE_Recursive_Thread_Mutex> &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Condition (const ACE_Condition<ACE_Recursive_Thread_Mutex> &)) }; class ACE_Export ACE_Condition_Recursive_Thread_Mutex @@ -105,6 +110,8 @@ public: ACE_Condition_Recursive_Thread_Mutex (ACE_Recursive_Thread_Mutex &m); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_HAS_THREADS */ #include /**/ "ace/post.h" diff --git a/ace/Condition_T.cpp b/ace/Condition_T.cpp index 456482d91ef..c2d4375486e 100644 --- a/ace/Condition_T.cpp +++ b/ace/Condition_T.cpp @@ -1,23 +1,24 @@ // $Id$ -#ifndef ACE_CONDITION_T_C -#define ACE_CONDITION_T_C +#ifndef ACE_CONDITION_T_CPP +#define ACE_CONDITION_T_CPP #include "ace/Condition_T.h" -#include "ace/Log_Msg.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Condition_T, "$Id$") - #if defined (ACE_HAS_THREADS) +#include "ace/Log_Msg.h" + #if !defined (__ACE_INLINE__) #include "ace/Condition_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Condition) template <class MUTEX> void @@ -190,6 +191,9 @@ ACE_Condition<MUTEX>::wait (const ACE_Time_Value *abstime) // ACE_TRACE ("ACE_Condition<MUTEX>::wait"); return this->wait (this->mutex_, abstime); } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ -#endif /* ACE_CONDITION_T_C */ +#endif /* ACE_CONDITION_T_CPP */ diff --git a/ace/Condition_T.h b/ace/Condition_T.h index 6d85c4b3519..e5ec5fcaab7 100644 --- a/ace/Condition_T.h +++ b/ace/Condition_T.h @@ -14,6 +14,7 @@ #ifndef ACE_CONDITION_T_H #define ACE_CONDITION_T_H + #include /**/ "ace/pre.h" #include "ace/OS_NS_Thread.h" @@ -25,6 +26,8 @@ #if defined (ACE_HAS_THREADS) /* ACE platform supports some form of threading. */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -156,6 +159,8 @@ public: // Declare the dynamic allocation hooks. }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Condition_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Condition_T.inl b/ace/Condition_T.inl index cb927320208..b787569a764 100644 --- a/ace/Condition_T.inl +++ b/ace/Condition_T.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class MUTEX> ACE_INLINE int ACE_Condition<MUTEX>::remove (void) { @@ -79,3 +82,5 @@ ACE_Condition<MUTEX>::broadcast (void) #endif /* CHORUS */ return ACE_OS::cond_broadcast (&this->cond_); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Condition_Thread_Mutex.cpp b/ace/Condition_Thread_Mutex.cpp index a04e2b30847..7907b717f73 100644 --- a/ace/Condition_Thread_Mutex.cpp +++ b/ace/Condition_Thread_Mutex.cpp @@ -21,6 +21,8 @@ ACE_RCSID(ace, Condition_Thread_Mutex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Condition_Thread_Mutex) void @@ -133,4 +135,6 @@ ACE_Condition_Thread_Mutex::broadcast (void) return ACE_OS::cond_broadcast (&this->cond_); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/Condition_Thread_Mutex.h b/ace/Condition_Thread_Mutex.h index 7b30fba8079..01a465e8f33 100644 --- a/ace/Condition_Thread_Mutex.h +++ b/ace/Condition_Thread_Mutex.h @@ -29,6 +29,8 @@ #include "ace/Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; class ACE_Export ACE_Condition_Attributes @@ -176,6 +178,8 @@ public: }; #endif /* 0 */ +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Condition_Thread_Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Condition_Thread_Mutex.inl b/ace/Condition_Thread_Mutex.inl index ff15f94ad04..3e12c9c911a 100644 --- a/ace/Condition_Thread_Mutex.inl +++ b/ace/Condition_Thread_Mutex.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Condition_Attributes::ACE_Condition_Attributes (int type) { @@ -67,3 +70,5 @@ ACE_Process_Condition<MUTEX>::ACE_Process_Condition (MUTEX &m, // ACE_TRACE ("ACE_Process_Condition<MUTEX>::ACE_Process_Condition"); } #endif /* 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp index 468f1b9e9dc..6cfec441cf6 100644 --- a/ace/Configuration.cpp +++ b/ace/Configuration.cpp @@ -12,76 +12,7 @@ # include "ace/OS_NS_unistd.h" #endif /* ACE_LACKS_ACCESS */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -#if defined (ACE_HAS_THREADS) -// ACE_SYNCH_MUTEX should not be used in the template instantiations -// because the resulting template instantiation for the -// single-threaded case already exists in ACE. -template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex> >; -template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex>; -template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex, ACE_Control_Block>; -#endif /* ACE_HAS_THREADS */ -template class ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId>; -template class ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId>; -template class ACE_Hash_Map_Entry<ACE_Configuration_ExtId, int>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_Configuration_ExtId, int, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex>; - - -// Added to fix problems in SunOS CC5.0 -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Value_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Value_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_Configuration_ExtId,int,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Section_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex>; -template class ACE_Equal_To<ACE_Configuration_ExtId>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Section_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_Configuration_ExtId,int,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex>; -template class ACE_Hash<ACE_Configuration_ExtId>; - -template class ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId, int, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex>; - -template class ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId>; -template class ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId>; -template class ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, int>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#if defined (ACE_HAS_THREADS) -// ACE_SYNCH_MUTEX should not be used in the template instantiations -// because the resulting template instantiation for the -// single-threaded case already exists in ACE. -#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex> > -#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex> -#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Thread_Mutex, ACE_Control_Block> -#endif /* ACE_HAS_THREADS */ -#pragma instantiate ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId> -#pragma instantiate ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId> -#pragma instantiate ACE_Hash_Map_Entry<ACE_Configuration_ExtId, int> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_Configuration_ExtId, int, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex> - -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Value_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Value_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_Configuration_ExtId,int,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Section_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex> -#pragma instantiate ACE_Equal_To<ACE_Configuration_ExtId> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_Configuration_ExtId,ACE_Configuration_Section_IntId,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_Configuration_ExtId,int,ACE_Hash<ACE_Configuration_ExtId>,ACE_Equal_To<ACE_Configuration_ExtId>,ACE_Null_Mutex> -#pragma instantiate ACE_Hash<ACE_Configuration_ExtId> - -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_Configuration_ExtId, int, ACE_Hash<ACE_Configuration_ExtId>, ACE_Equal_To<ACE_Configuration_ExtId>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, ACE_Configuration_Section_IntId> -#pragma instantiate ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId> -#pragma instantiate ACE_Hash_Map_With_Allocator<ACE_Configuration_ExtId, int> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Section_Key_Internal::ACE_Section_Key_Internal (void) : ref_count_ (0) @@ -1781,7 +1712,7 @@ ACE_Configuration_Heap::remove_section (const ACE_Configuration_Section_Key& key VALUE_HASH::ITERATOR value_iter = value_hash_map->begin (); while (!value_iter.done ()) { - VALUE_HASH::ENTRY* value_entry; + VALUE_HASH::ENTRY* value_entry = 0; if (!value_iter.next (value_entry)) return 1; @@ -1841,7 +1772,7 @@ ACE_Configuration_Heap::enumerate_values (const ACE_Configuration_Section_Key& k } // Get the next entry - ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId>* entry; + ACE_Hash_Map_Entry<ACE_Configuration_ExtId, ACE_Configuration_Value_IntId>* entry = 0; if (!pKey->value_iter_->next (entry)) return 1; @@ -1884,7 +1815,7 @@ ACE_Configuration_Heap::enumerate_sections (const ACE_Configuration_Section_Key& } // Get the next entry - ACE_Hash_Map_Entry<ACE_Configuration_ExtId, int>* entry; + ACE_Hash_Map_Entry<ACE_Configuration_ExtId, int>* entry = 0; if (!pKey->section_iter_->next (entry)) return 1; @@ -2257,3 +2188,5 @@ ACE_Configuration_Heap::remove_value (const ACE_Configuration_Section_Key& key, return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Configuration.h b/ace/Configuration.h index 96ba0153409..b1ca0f6a9d9 100644 --- a/ace/Configuration.h +++ b/ace/Configuration.h @@ -53,6 +53,8 @@ #define ACE_DEFAULT_CONFIG_SECTION_SIZE 16 #endif /* ACE_DEFAULT_CONFIG_SECTION_SIZE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Section_Key_Internal * @@ -698,8 +700,8 @@ public: ACE_Configuration_Section_IntId (void); /// Named ctor - explicit ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, - SUBSECTION_MAP* section_hash_map); + ACE_Configuration_Section_IntId (VALUE_MAP* value_hash_map, + SUBSECTION_MAP* section_hash_map); /// Copy ctor ACE_Configuration_Section_IntId (const ACE_Configuration_Section_IntId& rhs); @@ -775,7 +777,7 @@ protected: * representation of a configuraiton database. A persistent heap * may be used to store configurations persistently * - * Note: Before using this class you must call one of the open methods. + * @note Before using this class you must call one of the open methods. * * @todo * - Need to investigate what happens if memory mapped file gets mapped to @@ -884,5 +886,7 @@ private: size_t default_map_size_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_CONFIGURATION_H */ diff --git a/ace/Configuration_Import_Export.cpp b/ace/Configuration_Import_Export.cpp index da1ea7d660e..76ad0f051d9 100644 --- a/ace/Configuration_Import_Export.cpp +++ b/ace/Configuration_Import_Export.cpp @@ -5,6 +5,8 @@ #include "ace/OS_NS_ctype.h" #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Config_ImpExp_Base::ACE_Config_ImpExp_Base (ACE_Configuration& config) : config_ (config) { @@ -121,7 +123,7 @@ ACE_Registry_ImpExp::import_config (const ACE_TCHAR* filename) { // number type ACE_TCHAR* endptr = 0; - u_int value = ACE_OS::strtoul (end + 6, &endptr, 16); + unsigned long value = ACE_OS::strtoul (end + 6, &endptr, 16); if (config_.set_integer_value (section, name, value)) { ACE_OS::fclose (in); @@ -644,3 +646,5 @@ ACE_Ini_ImpExp::squish (ACE_TCHAR *src) return cp; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Configuration_Import_Export.h b/ace/Configuration_Import_Export.h index d2ac9eeb566..41dc401e0c7 100644 --- a/ace/Configuration_Import_Export.h +++ b/ace/Configuration_Import_Export.h @@ -32,6 +32,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Config_ImpExp_Base * @@ -207,5 +209,7 @@ private: ACE_Ini_ImpExp& operator= (const ACE_Ini_ImpExp&); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_CONFIGURATION_IMPORT_EXPORT_H */ diff --git a/ace/Connection_Recycling_Strategy.cpp b/ace/Connection_Recycling_Strategy.cpp index 351dde2ea52..c5bc6910d21 100644 --- a/ace/Connection_Recycling_Strategy.cpp +++ b/ace/Connection_Recycling_Strategy.cpp @@ -4,10 +4,10 @@ ACE_RCSID(ace, Connection_Recycling_Strategy, "$Id$") -ACE_Connection_Recycling_Strategy::ACE_Connection_Recycling_Strategy (void) -{ -} +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Connection_Recycling_Strategy::~ACE_Connection_Recycling_Strategy (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Connection_Recycling_Strategy.h b/ace/Connection_Recycling_Strategy.h index bbe4f7b48ce..786835ef6b7 100644 --- a/ace/Connection_Recycling_Strategy.h +++ b/ace/Connection_Recycling_Strategy.h @@ -19,15 +19,13 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Connection_Recycling_Strategy * * @brief Defines the interface for a connection recycler. */ - class ACE_Export ACE_Connection_Recycling_Strategy { public: @@ -56,12 +54,10 @@ public: virtual int cleanup_hint (const void *recycling_act, void **act_holder = 0) = 0; -protected: - /// Default ctor. - ACE_Connection_Recycling_Strategy (void); }; - +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" + #endif /*ACE_CONNECTION_RECYCLING_STRATEGY*/ diff --git a/ace/Connector.cpp b/ace/Connector.cpp index c4a40988e59..f588b605462 100644 --- a/ace/Connector.cpp +++ b/ace/Connector.cpp @@ -1,10 +1,10 @@ -// Connector.cpp // $Id$ -#ifndef ACE_CONNECTOR_C -#define ACE_CONNECTOR_C +#ifndef ACE_CONNECTOR_CPP +#define ACE_CONNECTOR_CPP #include "ace/Connector.h" +#include "ace/ACE.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_string.h" #include "ace/os_include/os_fcntl.h" /* Has ACE_NONBLOCK */ @@ -13,7 +13,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Connector, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Connector) @@ -66,46 +66,6 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::dump (void) const #endif /* ACE_HAS_DUMP */ } -template <class SVC_HANDLER> SVC_HANDLER * -ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::close (void) -{ - // @@ TODO: This method should be removed after a couple of betas. - SVC_HANDLER *svc_handler = 0; - - // Make sure that we haven't already initialized the Svc_Handler. - if (this->svc_handler_) - { - // Exclusive access to the Reactor. - ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), 0); - - // Double check. - if (this->svc_handler_) - { - // Remember the Svc_Handler. - svc_handler = this->svc_handler_; - - // Remove from Reactor. - this->reactor ()->remove_handler - (this->svc_handler_->get_handle (), - ACE_Event_Handler::ALL_EVENTS_MASK); - - // Cancel timer. - this->reactor ()->cancel_timer - (this->timer_id (), 0, 0); - - // Remove this handle from the set of non-blocking handles - // in the Connector. - this->connector_.non_blocking_handles ().clr_bit - (this->svc_handler_->get_handle ()); - - // We are done. Don't initialize the Svc_Handler again. - this->svc_handler_ = 0; - } - } - - return svc_handler; -} - template <class SVC_HANDLER> bool ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::close (SVC_HANDLER *&sh) { @@ -126,14 +86,12 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::close (SVC_HANDLER *&sh) // Remember the Svc_Handler. sh = this->svc_handler_; - + ACE_HANDLE h = sh->get_handle (); this->svc_handler_ = 0; - // Remove from Reactor. - if (this->reactor ()->remove_handler ( - sh->get_handle (), - ACE_Event_Handler::ALL_EVENTS_MASK) == -1) - return false; + // Remove this handle from the set of non-blocking handles + // in the Connector. + this->connector_.non_blocking_handles ().remove (h); // Cancel timer. if (this->reactor ()->cancel_timer (this->timer_id (), @@ -141,10 +99,11 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::close (SVC_HANDLER *&sh) 0) == -1) return false; - // Remove this handle from the set of non-blocking handles - // in the Connector. - this->connector_.non_blocking_handles ().clr_bit - (sh->get_handle ()); + // Remove from Reactor. + if (this->reactor ()->remove_handler ( + h, + ACE_Event_Handler::ALL_EVENTS_MASK) == -1) + return false; } return true; @@ -159,21 +118,18 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_timeout // This method is called if a connection times out before completing. ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_timeout"); - SVC_HANDLER *svc_handler = - this->close (); - - if (svc_handler == 0) - return 0; + SVC_HANDLER *svc_handler = 0; + int retval = this->close (svc_handler) ? 0 : -1; // Forward to the SVC_HANDLER the <arg> that was passed in as a // magic cookie during ACE_Connector::connect(). This gives the // SVC_HANDLER an opportunity to take corrective action (e.g., wait // a few milliseconds and try to reconnect again. - if (svc_handler->handle_timeout (tv, arg) == -1) + if (svc_handler != 0 && svc_handler->handle_timeout (tv, arg) == -1) svc_handler->handle_close (svc_handler->get_handle (), ACE_Event_Handler::TIMER_MASK); - return 0; + return retval; } @@ -184,16 +140,14 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_input (ACE_HANDLE) // establishment. ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_input"); - SVC_HANDLER *svc_handler = - this->close (); - - if (svc_handler == 0) - return 0; + SVC_HANDLER *svc_handler = 0; + int retval = this->close (svc_handler) ? 0 : -1; // Close Svc_Handler. - svc_handler->close (0); + if (svc_handler != 0) + svc_handler->close (0); - return 0; + return retval; } template <class SVC_HANDLER> int @@ -202,16 +156,15 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_output (ACE_HANDLE handle) // Called when a connection is establishment asynchronous. ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_output"); - SVC_HANDLER *svc_handler = - this->close (); - - if (svc_handler == 0) - return 0; + // Grab the connector ref before smashing ourselves in close(). + ACE_Connector_Base<SVC_HANDLER> &connector = this->connector_; + SVC_HANDLER *svc_handler = 0; + int retval = this->close (svc_handler) ? 0 : -1; - this->connector_.initialize_svc_handler (handle, - svc_handler); + if (svc_handler != 0) + connector.initialize_svc_handler (handle, svc_handler); - return 0; + return retval; } template <class SVC_HANDLER> int @@ -220,7 +173,6 @@ ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_exception (ACE_HANDLE h) // On Win32, the except mask must also be set for asynchronous // connects. ACE_TRACE ("ACE_NonBlocking_Connect_Handler<SVC_HANDLER>::handle_exception"); - return this->handle_output (h); } @@ -417,7 +369,7 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::connect_i if (this->make_svc_handler (sh) == -1) return -1; - ACE_Time_Value *timeout; + ACE_Time_Value *timeout = 0; int use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR]; if (use_reactor) @@ -529,6 +481,7 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::cancel (SVC_HANDLER *sh) if (handler == 0) return -1; + // find_handler() increments handler's refcount; ensure we decrement it. ACE_Event_Handler_var safe_handler (handler); NBCH *nbch = @@ -583,25 +536,24 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::nonblocking_connect goto reactor_registration_failure; // Add handle to non-blocking handle set. - this->non_blocking_handles ().set_bit (handle); + this->non_blocking_handles ().insert (handle); // If we're starting connection under timer control then we need to // schedule a timeout with the ACE_Reactor. tv = const_cast<ACE_Time_Value *> (synch_options.time_value ()); - if (tv == 0) - return 0; - - timer_id = - this->reactor ()->schedule_timer (nbch, - synch_options.arg (), - *tv); - if (timer_id == -1) - goto timer_registration_failure; - - // Remember timer id. - nbch->timer_id (timer_id); + if (tv != 0) + { + timer_id = + this->reactor ()->schedule_timer (nbch, + synch_options.arg (), + *tv); + if (timer_id == -1) + goto timer_registration_failure; + + // Remember timer id. + nbch->timer_id (timer_id); + } - // Everything was successful. return 0; // Undo previous actions using the ol' "goto label and fallthru" @@ -612,7 +564,7 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::nonblocking_connect this->reactor ()->remove_handler (handle, mask); // Remove handle from the set of non-blocking handles. - this->non_blocking_handles ().clr_bit (handle); + this->non_blocking_handles ().remove (handle); /* FALLTHRU */ @@ -681,7 +633,7 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::reactor (void) const return this->reactor_; } -template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ACE_Handle_Set & +template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> ACE_Unbounded_Set<ACE_HANDLE> & ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::non_blocking_handles (void) { return this->non_blocking_handles_; @@ -691,7 +643,7 @@ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1> int ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::close (void) { // If there are no non-blocking handle pending, return immediately. - if (this->non_blocking_handles ().num_set () == 0) + if (this->non_blocking_handles ().size () == 0) return 0; // Exclusive access to the Reactor. @@ -700,28 +652,41 @@ ACE_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::close (void) // Go through all the non-blocking handles. It is necessary to // create a new iterator each time because we remove from the handle // set when we cancel the Svc_Handler. + ACE_HANDLE *handle = 0; while (1) { - ACE_Handle_Set_Iterator iterator (this->non_blocking_handles ()); - ACE_HANDLE handle = iterator (); - - if (handle == ACE_INVALID_HANDLE) + ACE_Unbounded_Set_Iterator<ACE_HANDLE> + iterator (this->non_blocking_handles ()); + if (!iterator.next (handle)) break; ACE_Event_Handler *handler = - this->reactor ()->find_handler (handle); - - ACE_ASSERT (handler != 0); + this->reactor ()->find_handler (*handle); + if (handler == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("%t: Connector::close h %d, no handler\n"), + *handle)); + // Remove handle from the set of non-blocking handles. + this->non_blocking_handles ().remove (*handle); + continue; + } + // find_handler() incremented handler's refcount; ensure it's decremented ACE_Event_Handler_var safe_handler (handler); - - NBCH *nbch = - dynamic_cast<NBCH *> (handler); - - ACE_ASSERT (nbch != 0); - - SVC_HANDLER *svc_handler = - nbch->svc_handler (); + NBCH *nbch = dynamic_cast<NBCH *> (handler); + if (nbch == 0) + { + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("%t: Connector::close h %d handler %@ ") + ACE_LIB_TEXT ("not a legit handler\n"), + *handle, + handler)); + // Remove handle from the set of non-blocking handles. + this->non_blocking_handles ().remove (*handle); + continue; + } + SVC_HANDLER *svc_handler = nbch->svc_handler (); // Cancel the non-blocking connection. this->cancel (svc_handler); @@ -994,4 +959,6 @@ ACE_Strategy_Connector<SVC_HANDLER, ACE_PEER_CONNECTOR_2>::concurrency_strategy return this->concurrency_strategy_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_CONNECTOR_C */ diff --git a/ace/Connector.h b/ace/Connector.h index c82593dcb69..516fc8a775d 100644 --- a/ace/Connector.h +++ b/ace/Connector.h @@ -23,7 +23,9 @@ #include "ace/Strategies_T.h" #include "ace/Synch_Options.h" -#include "ace/Handle_Set.h" +#include "ace/Unbounded_Set.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Connector_Base @@ -47,7 +49,7 @@ public: /// Return the handle set representing the non-blocking connects in /// progress. - virtual ACE_Handle_Set &non_blocking_handles (void) = 0; + virtual ACE_Unbounded_Set<ACE_HANDLE> &non_blocking_handles (void) = 0; }; /** @@ -65,17 +67,13 @@ public: SVC_HANDLER *, long timer_id); - /// Close up and return underlying SVC_HANDLER *. - /** @deprecated: This should be deprecated sooner or later. The next - * method should be used. - */ - SVC_HANDLER *close (void); - /// Close up and return underlying SVC_HANDLER through @c sh. /** * If the return value is true the close was performed succesfully, - * and if the return value is false, the close was not - * successfull. The @c sh does not have any connection to the return + * implying that this object was removed from the reactor and thereby + * (by means of reference counting decremented to 0) deleted. + * If the return value is false, the close was not successful. + * The @c sh does not have any connection to the return * value. The argument will return a valid svc_handler object if a * valid one exists within the object. Returning a valid svc_handler * pointer also invalidates the svc_handler contained in this @@ -174,7 +172,7 @@ public: /** * Initialize a connector. @a flags indicates how <SVC_HANDLER>'s * should be initialized prior to being activated. Right now, the - * only flag that is processed is <ACE_NONBLOCK>, which enabled + * only flag that is processed is ACE_NONBLOCK, which enabled * non-blocking I/O on the <SVC_HANDLER> when it is opened. */ ACE_Connector (ACE_Reactor *r = ACE_Reactor::instance (), @@ -183,7 +181,7 @@ public: /** * Initialize a connector. @a flags indicates how <SVC_HANDLER>'s * should be initialized prior to being activated. Right now, the - * only flag that is processed is <ACE_NONBLOCK>, which enabled + * only flag that is processed is ACE_NONBLOCK, which enabled * non-blocking I/O on the <SVC_HANDLER> when it is opened. */ virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), @@ -199,7 +197,7 @@ public: * using <synch_options>. If the caller wants to designate the * selected <local_addr> they can (and can also insist that the * <local_addr> be reused by passing a value <reuse_addr> == - * 1). <flags> and <perms> can be used to pass any flags that are + * 1). @a flags and <perms> can be used to pass any flags that are * needed to perform specific operations such as opening a file * within connect with certain permissions. If the connection fails * the <close> hook on the <svc_handler> will be called @@ -347,7 +345,7 @@ protected: /// Return the handle set representing the non-blocking connects in /// progress. - ACE_Handle_Set &non_blocking_handles (void); + ACE_Unbounded_Set<ACE_HANDLE> &non_blocking_handles (void); // = Dynamic linking hooks. /// Default version does no work and returns -1. Must be overloaded @@ -376,7 +374,7 @@ private: /** * Flags that indicate how <SVC_HANDLER>'s should be initialized * prior to being activated. Right now, the only flag that is - * processed is <ACE_NONBLOCK>, which enabled non-blocking I/O on + * processed is ACE_NONBLOCK, which enabled non-blocking I/O on * the <SVC_HANDLER> when it is opened. */ int flags_; @@ -385,7 +383,7 @@ private: ACE_Reactor *reactor_; /// Handle set representing the non-blocking connects in progress. - ACE_Handle_Set non_blocking_handles_; + ACE_Unbounded_Set<ACE_HANDLE> non_blocking_handles_; }; @@ -430,9 +428,9 @@ public: SUPER; /** - * Initialize a connector. <flags> indicates how <SVC_HANDLER>'s + * Initialize a connector. @a flags indicates how <SVC_HANDLER>'s * should be initialized prior to being activated. Right now, the - * only flag that is processed is <ACE_NONBLOCK>, which enabled + * only flag that is processed is ACE_NONBLOCK, which enabled * non-blocking I/O on the <SVC_HANDLER> when it is opened. */ ACE_Strategy_Connector (ACE_Reactor *r = ACE_Reactor::instance (), @@ -442,9 +440,9 @@ public: int flags = 0); /** - * Initialize a connector. <flags> indicates how <SVC_HANDLER>'s + * Initialize a connector. @a flags indicates how <SVC_HANDLER>'s * should be initialized prior to being activated. Right now, the - * only flag that is processed is <ACE_NONBLOCK>, which enabled + * only flag that is processed is ACE_NONBLOCK, which enabled * non-blocking I/O on the <SVC_HANDLER> when it is opened. * Default strategies would be created and used. */ @@ -452,9 +450,9 @@ public: int flags); /** - * Initialize a connector. <flags> indicates how <SVC_HANDLER>'s + * Initialize a connector. @a flags indicates how <SVC_HANDLER>'s * should be initialized prior to being activated. Right now, the - * only flag that is processed is <ACE_NONBLOCK>, which enabled + * only flag that is processed is ACE_NONBLOCK, which enabled * non-blocking I/O on the <SVC_HANDLER> when it is opened. */ virtual int open (ACE_Reactor *r = ACE_Reactor::instance (), @@ -560,6 +558,8 @@ protected: int delete_concurrency_strategy_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Connector.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Container_Instantiations.cpp b/ace/Container_Instantiations.cpp index 9b45dacf6e4..031a262808d 100644 --- a/ace/Container_Instantiations.cpp +++ b/ace/Container_Instantiations.cpp @@ -1,6 +1,9 @@ // $Id$ #include "ace/CDR_Base.h" #include "ace/Unbounded_Queue.h" +#include "ace/Unbounded_Set.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Instantiations of templates with basic data types that can be used // across ACE+TAO. @@ -9,11 +12,17 @@ template class ACE_Node<ACE_INT32>; template class ACE_Unbounded_Queue<ACE_INT32>; template class ACE_Unbounded_Queue_Iterator<ACE_INT32>; +template class ACE_Unbounded_Set<ACE_HANDLE>; +template class ACE_Unbounded_Set_Iterator<ACE_HANDLE>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Node<ACE_INT32>; -#pragma instantiate ACE_Unbounded_Queue<ACE_INT32>; -#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_INT32>; +#pragma instantiate ACE_Node<ACE_INT32> +#pragma instantiate ACE_Unbounded_Queue<ACE_INT32> +#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_INT32> +#pragma instantiate ACE_Unbounded_Set<ACE_HANDLE> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_HANDLE> #endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION*/ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Containers.cpp b/ace/Containers.cpp index 63faaef39bd..2904225a3c9 100644 --- a/ace/Containers.cpp +++ b/ace/Containers.cpp @@ -10,15 +10,3 @@ ACE_RCSID (ace, #include "ace/Containers.inl" #endif /* __ACE_INLINE__ */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Double_Linked_List<ACE_DLList_Node>; -template class ACE_Double_Linked_List_Iterator_Base<ACE_DLList_Node>; -template class ACE_Double_Linked_List_Iterator<ACE_DLList_Node>; -template class ACE_Double_Linked_List_Reverse_Iterator<ACE_DLList_Node>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Double_Linked_List<ACE_DLList_Node> -#pragma instantiate ACE_Double_Linked_List_Iterator_Base<ACE_DLList_Node> -#pragma instantiate ACE_Double_Linked_List_Iterator<ACE_DLList_Node> -#pragma instantiate ACE_Double_Linked_List_Reverse_Iterator<ACE_DLList_Node> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - diff --git a/ace/Containers.h b/ace/Containers.h index b5356ecdf3e..f8e4cda2d02 100644 --- a/ace/Containers.h +++ b/ace/Containers.h @@ -21,15 +21,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -template <class T> -class ACE_Double_Linked_List; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL -template <class T> -class ACE_Double_Linked_List_Iterator_Base; -template <class T> -class ACE_Double_Linked_List_Iterator; -template <class T> -class ACE_Double_Linked_List_Reverse_Iterator; +template <class T> class ACE_Double_Linked_List; +template <class T> class ACE_Double_Linked_List_Iterator_Base; +template <class T> class ACE_Double_Linked_List_Iterator; +template <class T> class ACE_Double_Linked_List_Reverse_Iterator; /** * @class ACE_DLList_Node @@ -48,7 +45,6 @@ public: ACE_DLList_Node (void *&i, ACE_DLList_Node *n = 0, ACE_DLList_Node *p = 0); - ~ACE_DLList_Node (void); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -62,6 +58,8 @@ protected: ACE_DLList_Node (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Containers.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Containers.inl b/ace/Containers.inl index 1312f2a47a6..ebc0b96bf7e 100644 --- a/ace/Containers.inl +++ b/ace/Containers.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_DLList_Node::ACE_DLList_Node (void) : item_ (0), @@ -19,7 +22,4 @@ ACE_DLList_Node::ACE_DLList_Node (void *&i, { } -ACE_INLINE -ACE_DLList_Node::~ACE_DLList_Node (void) -{ -} +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Containers_T.cpp b/ace/Containers_T.cpp index 1b7ecfca264..80d9ca7f206 100644 --- a/ace/Containers_T.cpp +++ b/ace/Containers_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_CONTAINERS_T_C -#define ACE_CONTAINERS_T_C +#ifndef ACE_CONTAINERS_T_CPP +#define ACE_CONTAINERS_T_CPP #include "ace/Log_Msg.h" #include "ace/Malloc_Base.h" @@ -17,9 +17,7 @@ #include "ace/Containers_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (ace, - Containers_T, - "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Stack) @@ -1934,5 +1932,6 @@ ACE_Array<T>::operator== (const ACE_Array<T> &s) const // **************************************************************** +ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_CONTAINERS_T_C */ +#endif /* ACE_CONTAINERS_T_CPP */ diff --git a/ace/Containers_T.h b/ace/Containers_T.h index fdbf7d6bec1..e34a0bf781e 100644 --- a/ace/Containers_T.h +++ b/ace/Containers_T.h @@ -36,6 +36,8 @@ // Backwards compatibility, please include "ace/Unbounded_Queue.h" directly. #include "ace/Unbounded_Queue.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Allocator; @@ -602,8 +604,9 @@ protected: // = Iteration methods. /** * Move to the first element of the list. Returns 0 if the list is - * empty, else 1. Note: the head of the ACE_DLList is actually a - * null entry, so the first element is actually the 2n'd entry + * empty, else 1. + * @note the head of the ACE_DLList is actually a null entry, so the + * first element is actually the 2n'd entry */ int go_head (void); @@ -1061,7 +1064,6 @@ public: /// Delegates to ACE_Double_Linked_List. int remove (ACE_DLList_Node *n); - // = Initialization and termination methods. /// Delegates to ACE_Double_Linked_List. @@ -1230,23 +1232,23 @@ public: protected: // = Initialization method. ACE_Fixed_Set_Iterator_Base (ACE_Fixed_Set<T, ACE_SIZE> &s); - + /// Set we are iterating over. ACE_Fixed_Set<T, ACE_SIZE> &s_; /// How far we've advanced over the set. ssize_t next_; - + /// The number of non free items that the iterator had pointed at. size_t iterated_items_; - + /// Dump the state of an object. void dump_i (void) const; - + /// Pass back the {next_item} that hasn't been seen in the Set. /// Returns 0 when all items have been seen, else 1. int next_i (T *&next_item); -}; +}; /** * @class ACE_Fixed_Set_Iterator @@ -1271,12 +1273,12 @@ public: /// Dump the state of an object. void dump (void) const; - + /// Remove the item where the itearetor is located at. /// Returns 1 if it removes a item, else 0. /// Pass back the removed {item}. int remove (T *&item); - + /// STL-like iterator dereference operator: returns a reference /// to the node underneath the iterator. T & operator* (void); @@ -1307,7 +1309,7 @@ public: /// Dump the state of an object. void dump (void) const; - + /// STL-like iterator dereference operator: returns a reference /// to the node underneath the iterator. const T & operator* (void) const ; @@ -2005,6 +2007,8 @@ public: bool operator!= (const ACE_Array<T> &s) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Containers_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Containers_T.inl b/ace/Containers_T.inl index 885345ba9a8..425d6e167e8 100644 --- a/ace/Containers_T.inl +++ b/ace/Containers_T.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE int ACE_Bounded_Stack<T>::is_empty (void) const { @@ -347,7 +350,7 @@ ACE_DLList<T>::remove (ACE_DLList_Node *n) } template <class T> ACE_INLINE -ACE_DLList<T>::ACE_DLList (ACE_Allocator *alloc ) +ACE_DLList<T>::ACE_DLList (ACE_Allocator *alloc) : ACE_DLList_Base (alloc) { } @@ -472,3 +475,5 @@ ACE_DLList_Reverse_Iterator<T>::dump (void) const ACE_Double_Linked_List_Reverse_Iterator <ACE_DLList_Node>::dump (); #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Copy_Disabled.cpp b/ace/Copy_Disabled.cpp index 4d2ffb94db7..d2fb124a182 100644 --- a/ace/Copy_Disabled.cpp +++ b/ace/Copy_Disabled.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file Copy_Disabled.cpp * @@ -15,7 +14,10 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Copy_Disabled::ACE_Copy_Disabled (void) { } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Copy_Disabled.h b/ace/Copy_Disabled.h index 583bc683062..512b96c9dcf 100644 --- a/ace/Copy_Disabled.h +++ b/ace/Copy_Disabled.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Copy_Disabled * @@ -47,6 +49,7 @@ class ACE_Export ACE_Copy_Disabled { public: + /// Default constructor ACE_Copy_Disabled (void); @@ -55,6 +58,8 @@ private: ACE_Copy_Disabled &operator= (const ACE_Copy_Disabled &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_COPY_DISABLED_H */ diff --git a/ace/Countdown_Time.cpp b/ace/Countdown_Time.cpp index b8556633cb1..fb03f0465e0 100644 --- a/ace/Countdown_Time.cpp +++ b/ace/Countdown_Time.cpp @@ -5,6 +5,8 @@ ACE_RCSID (ace, Countdown_Time, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time) : max_wait_time_ (max_wait_time), stopped_ (0) @@ -60,3 +62,5 @@ ACE_Countdown_Time::update (void) { return this->stop () == 0 && this->start (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Countdown_Time.h b/ace/Countdown_Time.h index 374f8d00140..248e2d19951 100644 --- a/ace/Countdown_Time.h +++ b/ace/Countdown_Time.h @@ -23,6 +23,8 @@ #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Countdown_Time * @@ -71,6 +73,8 @@ private: ACE_Countdown_Time &operator= (const ACE_Countdown_Time &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_COUNTDOWN_TIME_H */ diff --git a/ace/DEV.cpp b/ace/DEV.cpp index 932d7644ad5..1ae27fc558e 100644 --- a/ace/DEV.cpp +++ b/ace/DEV.cpp @@ -1,7 +1,5 @@ -// DEV.cpp // $Id$ - #include "ace/DEV.h" #include "ace/OS_NS_unistd.h" @@ -12,6 +10,8 @@ ACE_RCSID(ace, DEV, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_DEV) void @@ -39,3 +39,5 @@ ACE_DEV::close (void) this->set_handle (ACE_INVALID_HANDLE); return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV.h b/ace/DEV.h index 69a92aaad1b..8b0c585ddf7 100644 --- a/ace/DEV.h +++ b/ace/DEV.h @@ -36,6 +36,8 @@ #define ACE_DEV_STREAM ACE_DEV_IO, ACE_DEV_Addr #endif /* ACE_TEMPLATE_TYPEDEFS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_DEV * @@ -66,6 +68,8 @@ protected: ACE_DEV (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/DEV.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/DEV.inl b/ace/DEV.inl index 91246710423..e00f4fc705e 100644 --- a/ace/DEV.inl +++ b/ace/DEV.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_DEV::disable (int signum) const { @@ -11,3 +14,5 @@ ACE_DEV::disable (int signum) const return ACE_IO_SAP::disable (signum) ; #endif /* ACE_WIN32 */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Addr.cpp b/ace/DEV_Addr.cpp index 16b7536e0b0..f7e5503b1eb 100644 --- a/ace/DEV_Addr.cpp +++ b/ace/DEV_Addr.cpp @@ -1,4 +1,3 @@ -// DEV_Addr.cpp // $Id$ #include "ace/DEV_Addr.h" @@ -13,6 +12,8 @@ ACE_RCSID (ace, DEV_Addr, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Addr) // Transform the current address into string format. @@ -56,7 +57,7 @@ ACE_DEV_Addr::ACE_DEV_Addr (void) ACE_TRACE ("ACE_DEV_Addr::ACE_DEV_Addr"); (void) ACE_OS::memset ((void *) &this->devname_, - 0, sizeof this->devname_); + 0, sizeof this->devname_); } int @@ -104,3 +105,4 @@ ACE_DEV_Addr::operator= (const ACE_DEV_Addr &sa) return *this; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Addr.h b/ace/DEV_Addr.h index eba31734c2b..0646260c8f9 100644 --- a/ace/DEV_Addr.h +++ b/ace/DEV_Addr.h @@ -23,6 +23,8 @@ #include "ace/os_include/os_dirent.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_DEV_Addr * @@ -77,6 +79,8 @@ private: ACE_TCHAR devname_[DEVNAME_LENGTH]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/DEV_Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/DEV_Addr.inl b/ace/DEV_Addr.inl index 059c81111a8..820b961d1d0 100644 --- a/ace/DEV_Addr.inl +++ b/ace/DEV_Addr.inl @@ -6,6 +6,8 @@ #include "ace/Global_Macros.h" #include "ace/os_include/sys/os_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE void ACE_DEV_Addr::set (const ACE_TCHAR *devname) { @@ -33,7 +35,7 @@ ACE_DEV_Addr::operator != (const ACE_DEV_Addr &sap) const { ACE_TRACE ("ACE_DEV_Addr::operator !="); - return !((*this) == sap); // This is lazy, of course... ;-). + return !((*this) == sap); // This is lazy, of course... ;-). } // Return the path name used for the rendezvous point. @@ -45,3 +47,5 @@ ACE_DEV_Addr::get_path_name (void) const return this->devname_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Connector.cpp b/ace/DEV_Connector.cpp index 5c577754481..a1fef807057 100644 --- a/ace/DEV_Connector.cpp +++ b/ace/DEV_Connector.cpp @@ -1,4 +1,3 @@ -// DEV_Connector.cpp // $Id$ #include "ace/DEV_Connector.h" @@ -15,6 +14,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_DEV_Connector) void @@ -48,3 +49,5 @@ ACE_DEV_Connector::connect (ACE_DEV_IO &new_io, new_io.addr_ = remote_sap; // class copy. return handle == ACE_INVALID_HANDLE ? -1 : 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_Connector.h b/ace/DEV_Connector.h index 858cd5d0369..2d57f836b24 100644 --- a/ace/DEV_Connector.h +++ b/ace/DEV_Connector.h @@ -22,6 +22,9 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_DEV_Connector * @@ -97,6 +100,8 @@ public: typedef ACE_DEV_IO PEER_STREAM; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/DEV_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/DEV_Connector.inl b/ace/DEV_Connector.inl index 798639197b4..13ceeba1d75 100644 --- a/ace/DEV_Connector.inl +++ b/ace/DEV_Connector.inl @@ -1,23 +1,26 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Creates a Local ACE_DEV. ACE_INLINE ACE_DEV_Connector::ACE_DEV_Connector (ACE_DEV_IO &new_io, - const ACE_DEV_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) + const ACE_DEV_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms) { ACE_TRACE ("ACE_DEV_Connector::ACE_DEV_Connector"); if (this->connect (new_io, remote_sap, timeout, local_sap, - reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE + reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("address %s, %p\n"), - remote_sap.get_path_name (), ACE_LIB_TEXT ("ACE_DEV_IO"))); + remote_sap.get_path_name (), ACE_LIB_TEXT ("ACE_DEV_IO"))); } ACE_INLINE int @@ -28,3 +31,4 @@ ACE_DEV_Connector::reset_new_handle (ACE_HANDLE handle) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_IO.cpp b/ace/DEV_IO.cpp index fb025287df0..f5367d1d5cd 100644 --- a/ace/DEV_IO.cpp +++ b/ace/DEV_IO.cpp @@ -1,4 +1,3 @@ -// DEV_IO.cpp // $Id$ #include "ace/DEV_IO.h" @@ -10,6 +9,9 @@ ACE_RCSID(ace, DEV_IO, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_DEV_IO) // Return the local endpoint address. @@ -125,3 +127,5 @@ ACE_DEV_IO::recv (size_t n, ...) const va_end (argp); return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DEV_IO.h b/ace/DEV_IO.h index 69e584a401b..fd2a0e2c5b8 100644 --- a/ace/DEV_IO.h +++ b/ace/DEV_IO.h @@ -28,6 +28,8 @@ #include "ace/os_include/os_stdio.h" #include "ace/os_include/sys/os_uio.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -173,6 +175,8 @@ private: ACE_DEV_Addr addr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/DEV_IO.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/DEV_IO.inl b/ace/DEV_IO.inl index 3724c7cc492..cb9392e2bf3 100644 --- a/ace/DEV_IO.inl +++ b/ace/DEV_IO.inl @@ -1,8 +1,7 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// DEV_IO.i - #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_unistd.h" #include "ace/OS_Memory.h" @@ -12,6 +11,8 @@ // Send exactly N bytes from BUF to this device. Keeping trying until // this many bytes are sent. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ssize_t ACE_DEV_IO::send_n (const void *buf, size_t n) const { @@ -23,7 +24,7 @@ ACE_DEV_IO::send_n (const void *buf, size_t n) const // this many bytes are received. ACE_INLINE ssize_t -ACE_DEV_IO::recv_n (void *buf, +ACE_DEV_IO::recv_n (void *buf, size_t n, const ACE_Time_Value *timeout, size_t *bytes_transferred) const @@ -121,3 +122,5 @@ ACE_DEV_IO::send (const ACE_Str_Buf *cntl, const ACE_Str_Buf *data, int flags) c return ACE_OS::putmsg (this->get_handle (), (strbuf *) cntl, (strbuf *) data, flags); } #endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DLL.cpp b/ace/DLL.cpp index 7a8df6573a7..00363d51bbf 100644 --- a/ace/DLL.cpp +++ b/ace/DLL.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, DLL, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Default constructor. Also, by default, the object will be closed // before it is destroyed. @@ -134,7 +136,7 @@ ACE_DLL::open_i (const ACE_TCHAR *dll_filename, if (!this->dll_name_) this->dll_name_ = ACE::strnew (dll_filename); - + this->open_mode_ = open_mode; this->close_handle_on_destruction_ = close_handle_on_destruction; @@ -238,3 +240,5 @@ ACE_DLL::set_handle (ACE_SHLIB_HANDLE handle, return this->open_i (temp, 1, close_handle_on_destruction, handle); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DLL.h b/ace/DLL.h index 3554b558542..022521ae6a7 100644 --- a/ace/DLL.h +++ b/ace/DLL.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #include "ace/Global_Macros.h" #include "ace/os_include/os_dlfcn.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_DLL_Handle; /** @@ -32,7 +34,7 @@ class ACE_DLL_Handle; * @brief Provides an abstract interface for handling various DLL * operations. * - * This class is an wrapper over the various methods for utilizing + * This class is a wrapper over the various methods for utilizing * a dynamically linked library (DLL), which is called a shared * library on some platforms. Operations open(), close(), and * symbol() have been implemented to help opening/closing and @@ -43,18 +45,36 @@ class ACE_Export ACE_DLL public: // = Initialization and termination methods. - /// Default constructor. By default, the close() operation on the - /// object will be invoked before it is destroyed. + /** + * Default constructor. By default, the close() operation on the + * object will be invoked before it is destroyed. + * @param close_handle_on_destruction Indicates whether or not the + * close() method will be called to close an open DLL when this + * object is destroyed. By default, close() will be called. + * Set this parameter to 0 for situations where the DLL's lifetime + * is controlled in a scope other than that of this ACE_DLL object. + * For example, termination by ACE_DLL_Manager via ACE::fini(). + */ explicit ACE_DLL (int close_handle_on_destruction = 1); /** - * This constructor opens and dynamically links @a dll_name. The - * default mode is <RTLD_LAZY>, which loads identifier symbols but - * not the symbols for functions, which are loaded dynamically - * on-demand. Other supported modes include: <RTLD_NOW>, which - * performs all necessary relocations when @a dll_name is first - * loaded and <RTLD_GLOBAL>, which makes symbols available for - * relocation processing of any other DLLs. + * This constructor performs the actions of open() during construction. + * @param dll_name The name or path of the DLL to load. + * @param open_mode Flags to alter the actions taken when loading the DLL. + * The possible values are: + * @li @c RTLD_LAZY (this the default): loads identifier symbols but + * not the symbols for functions, which are loaded dynamically + * on-demand. + * @li @c RTLD_NOW: performs all necessary relocations when + * @a dll_name is first loaded + * @li RTLD_GLOBAL: makes symbols available for relocation + * processing of any other DLLs. + * @param close_handle_on_destruction Indicates whether or not the + * close() method will be called to close an open DLL when this + * object is destroyed. By default, close() will be called. + * Set this parameter to 0 for situations where the DLL's lifetime + * is controlled in a scope other than that of this ACE_DLL object. + * For example, termination by ACE_DLL_Manager via ACE::fini(). */ explicit ACE_DLL (const ACE_TCHAR *dll_name, int open_mode = ACE_DEFAULT_SHLIB_MODE, @@ -64,16 +84,23 @@ public: ACE_DLL (const ACE_DLL &); /** - * This method opens and dynamically links @a dll_name. The default - * mode is <RTLD_LAZY>, which loads identifier symbols but not the - * symbols for functions, which are loaded dynamically on-demand. - * Other supported modes include: <RTLD_NOW>, which performs all - * necessary relocations when @a dll_name>is first loaded and - * <RTLD_GLOBAL>, which makes symbols available for relocation - * processing of any other DLLs. - * @param dll_name The name of the dll. - * @param open_mode How the dll is opened. - * @param close_handle_on_destruction Close the handle when object is destroyed. + * This method opens and dynamically links a specified DLL. + * @param dll_name The name or path of the DLL to load. + * @param open_mode Flags to alter the actions taken when loading the DLL. + * The possible values are: + * @li @c RTLD_LAZY (this the default): loads identifier symbols but + * not the symbols for functions, which are loaded dynamically + * on-demand. + * @li @c RTLD_NOW: performs all necessary relocations when + * @a dll_name is first loaded + * @li RTLD_GLOBAL: makes symbols available for relocation + * processing of any other DLLs. + * @param close_handle_on_destruction Indicates whether or not the + * close() method will be called to close an open DLL when this + * object is destroyed. By default, close() will be called. + * Set this parameter to 0 for situations where the DLL's lifetime + * is controlled in a scope other than that of this ACE_DLL object. + * For example, termination by ACE_DLL_Manager via ACE::fini(). * @retval -1 On failure * @retval 0 On success. */ @@ -86,16 +113,21 @@ public: /** * Called when the DLL object is destroyed -- invokes close() if the - * <close_handle_on_destruction> flag is set in the constructor or open() - * method. + * @a close_handle_on_destruction flag was set to non-zero in the + * constructor or open() method. */ ~ACE_DLL (void); - /// If @a symbol_name is in the symbol table of the DLL a pointer to - /// the @a symbol_name is returned. Otherwise, returns 0. Setting - /// ignore_errors = 1 allows you to probe a dll without generating - /// error messages in the log. Handy for determining the capabilities - /// of a library. + /** + * Look up a named symbol in the DLL. DLL must be successfully opened + * before calling symbol(). + * @param symbol_name The symbol name to look up. + * @param ignore_errors If set to 1, allows you to probe a dll without + * generating error messages in the log. Handy for determining + * the capabilities of a library. + * @return Returns the value of @a symbol_name if it is a valid symbol + * in the DLL. Otherwise, returns 0. + */ void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); /// Returns a pointer to a string explaining that an error occured. You @@ -113,7 +145,7 @@ public: /// Set the handle for the DLL object. By default, the close() //operation on / the object will be invoked before it is destroyed. - int set_handle (ACE_SHLIB_HANDLE handle, + int set_handle (ACE_SHLIB_HANDLE handle, int close_handle_on_destruction = 1); private: @@ -124,6 +156,11 @@ private: ACE_SHLIB_HANDLE handle = 0); + // Disallow assignment since we don't handle it. + void operator= (const ACE_DLL &); + +private: + /// Open mode. int open_mode_; @@ -141,9 +178,9 @@ private: /// Flag to record if the last operation had an error. int error_; - // = Disallow copying and assignment since we don't handle these. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_DLL &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_DLL_H */ diff --git a/ace/DLL_Manager.cpp b/ace/DLL_Manager.cpp index cbbb10545fe..783b524c5a2 100644 --- a/ace/DLL_Manager.cpp +++ b/ace/DLL_Manager.cpp @@ -14,11 +14,14 @@ #include "ace/OS_NS_dlfcn.h" #include "ace/OS_NS_string.h" -ACE_RCSID (ace, DLL_Manager, - "DLL_Manager.cpp,v 4.23 2003/11/05 23:30:46 shuston Exp") +ACE_RCSID (ace, + DLL_Manager, + "DLL_Manager.cpp,v 4.23 2003/11/05 23:30:46 shuston Exp") /******************************************************************/ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + sig_atomic_t ACE_DLL_Handle::open_called_ = 0; ACE_DLL_Handle::ACE_DLL_Handle (void) @@ -684,22 +687,4 @@ ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload) return 0; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Array_Base<ACE_TString>; -template class ACE_Array_Iterator<ACE_TString>; -template class auto_ptr<ACE_TString>; -# if defined (ACE_LACKS_AUTO_PTR) \ - || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \ - && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)) -template class ACE_Auto_Basic_Ptr<ACE_TString>; -# endif /* ACE_LACKS_AUTO_PTR */ -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -# pragma instantiate ACE_Array_Base<ACE_TString> -# pragma instantiate ACE_Array_Iterator<ACE_TString> -# pragma instantiate auto_ptr<ACE_TString> -# if defined (ACE_LACKS_AUTO_PTR) \ - || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \ - && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)) -# pragma instantiate ACE_Auto_Basic_Ptr<ACE_TString> -# endif /* ACE_LACKS_AUTO_PTR */ -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/DLL_Manager.h b/ace/DLL_Manager.h index 856fbe4e861..2bde7161251 100644 --- a/ace/DLL_Manager.h +++ b/ace/DLL_Manager.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -32,6 +32,9 @@ #define ACE_DEFAULT_DLL_MANAGER_SIZE 1024 + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_DLL_Handle * @@ -48,12 +51,12 @@ * extracting symbol information from a DLL, respectively. * * Most of this class came from the original ACE_DLL class. - * ACE_DLL is now just an interface that passed all it's calls - * either directly or via ACE_DLL_Manager to this class for - * execution. + * ACE_DLL is now just an interface that passed all it's calls + * either directly or via ACE_DLL_Manager to this class for + * execution. * */ -class ACE_Export ACE_DLL_Handle +class ACE_DLL_Handle { public: @@ -67,41 +70,42 @@ public: const ACE_TCHAR *dll_name () const; /** - * This method opens and dynamically links <dll_name>. The default + * This method opens and dynamically links @a dll_name. The default * mode is <RTLD_LAZY>, which loads identifier symbols but not the * symbols for functions, which are loaded dynamically on-demand. * Other supported modes include: <RTLD_NOW>, which performs all - * necessary relocations when <dll_name> is first loaded and + * necessary relocations when @a dll_name is first loaded and * <RTLD_GLOBAL>, which makes symbols available for relocation * processing of any other DLLs. Returns -1 on failure and 0 on * success. */ - int open (const ACE_TCHAR *dll_name, + int open (const ACE_TCHAR *dll_name, int open_mode, ACE_SHLIB_HANDLE handle); /// Call to close the DLL object. If unload = 0, it only decrements - /// the refcount, but if unload = 1, then it will actually unload + /// the refcount, but if unload = 1, then it will actually unload /// the library when the refcount == 0; int close (int unload = 0); /// Return the current refcount. sig_atomic_t refcount (void) const; - /// If <symbol_name> is in the symbol table of the DLL a pointer to - /// the <symbol_name> is returned. Otherwise, returns 0. Set the + /// If @a symbol_name is in the symbol table of the DLL a pointer to + /// the @a symbol_name is returned. Otherwise, returns 0. Set the /// ignore_errors flag to supress logging errors if symbol_name isn't /// found. This is nice if you just want to probe a dll to see what's /// available, since missing functions in that case aren't really errors. void *symbol (const ACE_TCHAR *symbol_name, int ignore_errors = 0); /** - * Return the handle to the caller. If <become_owner> is non-0 then + * Return the handle to the caller. If @a become_owner is non-0 then * caller assumes ownership of the handle so we decrement the retcount. */ ACE_SHLIB_HANDLE get_handle (int become_owner = 0); - + private: + /// Returns a pointer to a string explaining why <symbol> or <open> /// failed. This is used internal to print out the error to the log, /// but since this object is shared, we can't store or return the error @@ -114,6 +118,12 @@ private: void get_dll_names (const ACE_TCHAR *dll_name, ACE_Array<ACE_TString> &try_names); + // Disallow copying and assignment since we don't handle them. + ACE_DLL_Handle (const ACE_DLL_Handle &); + void operator= (const ACE_DLL_Handle &); + +private: + // Keep track of how many ACE_DLL objects have a reference to this // dll. sig_atomic_t refcount_; @@ -134,11 +144,6 @@ private: /// Synchronization variable for the MT_SAFE Repository ACE_Thread_Mutex lock_; #endif /* ACE_MT_SAFE */ - - // = Disallow copying and assignment since we don't handle these. - ACE_UNIMPLEMENTED_FUNC (ACE_DLL_Handle (const ACE_DLL_Handle &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_DLL_Handle &)) - }; class ACE_Framework_Repository; @@ -146,10 +151,10 @@ class ACE_Framework_Repository; /** * @class ACE_DLL_Manager * - * @brief This class is a singleton and serves as a factory and - * repository for instances of ACE_DLL_Handle. + * @brief This class is a singleton and serves as a factory and + * repository for instances of ACE_DLL_Handle. * - * This class is a singleton whose lifetime is managed by the + * This class is a singleton whose lifetime is managed by the * ACE_Framework_Repository. Although it is normally meant to be * used directly only by ACE_DLL, applications can call the unload_policy() * methods in order get/set the the dll unload policy. Unload policies include @@ -157,30 +162,28 @@ class ACE_Framework_Repository; * by using the ACE_DLL_UNLOAD_POLICY macro found in config-all.h. If a dll * choses to set an unload policy, it will be used when the per-dll policy * (the default) is in effect. If the per-dll policy is in effect and a dll - * has not chosen to set a policy, the current per-process policy will be - * used. + * has not chosen to set a policy, the current per-process policy will be + * used. * * The following policy macros are provided in config-all.h: * - * ACE_DLL_UNLOAD_POLICY_PER_PROCESS - Per-process policy that unloads dlls + * ACE_DLL_UNLOAD_POLICY_PER_PROCESS - Per-process policy that unloads dlls * eagerly. - * - * ACE_DLL_UNLOAD_POLICY_PER_DLL - Apply policy on a per-dll basis. If the - * dll doesn't use one of the macros below, the current per-process policy + * + * ACE_DLL_UNLOAD_POLICY_PER_DLL - Apply policy on a per-dll basis. If the + * dll doesn't use one of the macros below, the current per-process policy * will be used. * - * ACE_DLL_UNLOAD_POLICY_LAZY - Don't unload dll when refcount reaches + * ACE_DLL_UNLOAD_POLICY_LAZY - Don't unload dll when refcount reaches * zero, i.e., wait for either an explicit unload request or program exit. * - * ACE_DLL_UNLOAD_POLICY_DEFAULT - Default policy allows dlls to control + * ACE_DLL_UNLOAD_POLICY_DEFAULT - Default policy allows dlls to control * their own destinies, but will unload those that don't make a choice eagerly. * */ class ACE_Export ACE_DLL_Manager { public: - // This if to silence the compiler warnings, even though ACE_Framework_Repository - // always uses the instance method. friend class ACE_Framework_Repository; enum @@ -191,10 +194,10 @@ public: /// Return a unique instance static ACE_DLL_Manager *instance (int size = ACE_DLL_Manager::DEFAULT_SIZE); - /// Factory for ACE_DLL_Handle objects. If one already exits, + /// Factory for ACE_DLL_Handle objects. If one already exits, /// its refcount is incremented. - ACE_DLL_Handle *open_dll (const ACE_TCHAR *dll_name, - int openmode, + ACE_DLL_Handle *open_dll (const ACE_TCHAR *dll_name, + int openmode, ACE_SHLIB_HANDLE handle); /// Close the underlying dll. Decrements the refcount. @@ -203,12 +206,19 @@ public: /// Returns the current per-process UNLOAD_POLICY. u_long unload_policy (void) const; - /// Set the per-process UNLOAD_POLICY. If the policy is changed from + /// Set the per-process UNLOAD_POLICY. If the policy is changed from /// LAZY to EAGER, then it will also unload any dlls with zero /// refcounts. void unload_policy (u_long unload_policy); protected: + + /// Default constructor. + ACE_DLL_Manager (int size = ACE_DLL_Manager::DEFAULT_SIZE); + + /// Destructor. + ~ACE_DLL_Manager (void); + // Allocate handle_vector_. int open (int size); @@ -222,15 +232,16 @@ protected: int unload_dll (ACE_DLL_Handle *dll_handle, int force_unload = 0); private: - /// Default constructor. - ACE_DLL_Manager (int size = ACE_DLL_Manager::DEFAULT_SIZE); - - /// Destructor. - ~ACE_DLL_Manager (void); /// Close the singleton instance. static void close_singleton (void); + // Disallow copying and assignment since we don't handle these. + ACE_DLL_Manager (const ACE_DLL_Manager &); + void operator= (const ACE_DLL_Manager &); + +private: + /// Vector containing all loaded handle objects. ACE_DLL_Handle **handle_vector_; @@ -243,7 +254,7 @@ private: /// Unload strategy. u_long unload_policy_; - /// Pointer to a process-wide <ACE_DLL_Manager>. + /// Pointer to a process-wide <ACE_DLL_Manager>. static ACE_DLL_Manager *instance_; #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) @@ -251,10 +262,9 @@ private: ACE_Thread_Mutex lock_; #endif /* ACE_MT_SAFE */ - // = Disallow copying and assignment since we don't handle these. - ACE_UNIMPLEMENTED_FUNC (ACE_DLL_Manager (const ACE_DLL_Manager &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_DLL_Manager &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_DLL_MANAGER_H */ diff --git a/ace/Date_Time.h b/ace/Date_Time.h index d11af119f9d..7efd047cafd 100644 --- a/ace/Date_Time.h +++ b/ace/Date_Time.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -113,6 +115,8 @@ private: long wday_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Date_Time.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Date_Time.inl b/ace/Date_Time.inl index 4dbc8ecc657..dfb0d239bc3 100644 --- a/ace/Date_Time.inl +++ b/ace/Date_Time.inl @@ -1,13 +1,14 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Date_Time.i - #include "ace/Global_Macros.h" #include "ace/Time_Value.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_time.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE void ACE_Date_Time::update (const ACE_Time_Value& timevalue) { @@ -214,3 +215,5 @@ ACE_Date_Time::weekday (long wday) ACE_TRACE ("ACE_Date_Time::weekday"); wday_ = wday; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Default_Constants.h b/ace/Default_Constants.h index 85820e5d603..05419382e97 100644 --- a/ace/Default_Constants.h +++ b/ace/Default_Constants.h @@ -75,6 +75,10 @@ # define ACE_DEFAULT_BACKLOG 5 # endif /* ACE_DEFAULT_BACKLOG */ +# if !defined (ACE_DEFAULT_ASYNCH_BACKLOG) +# define ACE_DEFAULT_ASYNCH_BACKLOG 5 +# endif /* ACE_DEFAULT_ASYNCH_BACKLOG */ + # if !defined (ACE_DEFAULT_THREADS) # define ACE_DEFAULT_THREADS 1 # endif /* ACE_DEFAULT_THREADS */ @@ -452,7 +456,7 @@ # define ACE_MAX_DEFAULT_PORT 65535 #endif /* ACE_MAX_DEFAULT_PORT */ -// Default number of <ACE_Event_Handler>s supported by +// Default number of ACE_Event_Handlers supported by // <ACE_Timer_Heap>. # if !defined (ACE_DEFAULT_TIMERS) # define ACE_DEFAULT_TIMERS _POSIX_TIMER_MAX diff --git a/ace/Dev_Poll_Reactor.cpp b/ace/Dev_Poll_Reactor.cpp index 803dd2f4e32..e5a783d938c 100644 --- a/ace/Dev_Poll_Reactor.cpp +++ b/ace/Dev_Poll_Reactor.cpp @@ -40,6 +40,8 @@ ACE_RCSID (ace, #include "ace/os_include/os_poll.h" #include "ace/OS_NS_sys_mman.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Dev_Poll_Reactor_Notify::ACE_Dev_Poll_Reactor_Notify (void) : dp_reactor_ (0) , notification_pipe_ () @@ -93,6 +95,9 @@ ACE_Dev_Poll_Reactor_Notify::open (ACE_Reactor_Impl *r, if (free_queue_.enqueue_head (temp + i) == -1) return -1; + if (ACE::set_flags (this->notification_pipe_.write_handle (), + ACE_NONBLOCK) == -1) + return -1; #endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ // Set the read handle into non-blocking mode since we need to @@ -428,7 +433,7 @@ ACE_Dev_Poll_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) default: // Should we bail out if we get an invalid mask? ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("invalid mask = %d\n"), + ACE_LIB_TEXT ("dispatch_notify invalid mask = %d\n"), buffer.mask_)); } if (result == -1) @@ -666,9 +671,11 @@ ACE_Dev_Poll_Reactor_Handler_Repository::find (ACE_HANDLE handle, if (this->handle_in_range (handle)) { eh = this->handlers_[handle].event_handler; - - if (eh != 0 && index_p != 0) - *index_p = handle; + if (eh != 0) + { + if (index_p != 0) + *index_p = handle; + } else errno = ENOENT; } @@ -692,18 +699,22 @@ ACE_Dev_Poll_Reactor_Handler_Repository::bind ( this->handlers_[handle].event_handler = event_handler; this->handlers_[handle].mask = mask; + event_handler->add_reference (); return 0; } int -ACE_Dev_Poll_Reactor_Handler_Repository::unbind (ACE_HANDLE handle) +ACE_Dev_Poll_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, + bool decr_refcnt) { ACE_TRACE ("ACE_Dev_Poll_Reactor_Handler_Repository::unbind"); if (this->find (handle) == 0) return -1; + if (decr_refcnt) + this->handlers_[handle].event_handler->remove_reference (); this->handlers_[handle].event_handler = 0; this->handlers_[handle].mask = ACE_Event_Handler::NULL_MASK; this->handlers_[handle].suspended = 0; @@ -906,10 +917,11 @@ ACE_Dev_Poll_Reactor::open (size_t size, else if (this->notify_handler_->open (this, 0, disable_notify_pipe) == -1 - || this->register_handler_i ( - this->notify_handler_->notify_handle (), - this->notify_handler_, - ACE_Event_Handler::READ_MASK) == -1) + || (disable_notify_pipe == 0 + && this->register_handler_i ( + this->notify_handler_->notify_handle (), + this->notify_handler_, + ACE_Event_Handler::READ_MASK)) == -1) result = -1; this->size_ = size; @@ -1095,14 +1107,11 @@ ACE_Dev_Poll_Reactor::work_pending_i (ACE_Time_Value * max_wait_time) this->size_, static_cast<int> (timeout)); - // all detected events are put in this->events_: - this->start_pevents_ = this->events_; - - // If nfds == 0 then end_pevents_ == start_pevents_ meaning that there is - // no work pending. If nfds > 0 then there is work pending. - // Otherwise an error occurred. - if (nfds > -1) - this->end_pevents_ = this->start_pevents_ + nfds; + if (nfds > 0) + { + this->start_pevents_ = this->events_; + this->end_pevents_ = this->start_pevents_ + nfds; + } #else @@ -1174,6 +1183,8 @@ ACE_Dev_Poll_Reactor::handle_events_i (ACE_Time_Value *max_wait_time, do { result = this->work_pending_i (max_wait_time); + if (result == -1) + ACE_ERROR((LM_ERROR, "%t: %p\n", "work_pending_i")); } while (result == -1 && this->restart_ != 0 && errno == EINTR); @@ -1341,9 +1352,6 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) short &revents = pfds->revents; #endif /* ACE_HAS_EVENT_POLL */ - if (revents == 0) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) disp h %d events 0x%x\n"), - handle, (int)revents)); // Figure out what to do first in order to make it easier to manage // the bit twiddling and possible pfds increment before releasing // the token for dispatch. @@ -1394,51 +1402,52 @@ ACE_Dev_Poll_Reactor::dispatch_io_event (Token_Guard &guard) */ ACE_Event_Handler *eh = this->handler_rep_.find (handle); - { - // Modify the reference count in an exception-safe way. - // Note that eh could be the notify handler. It's not strictly - // necessary to manage its refcount, but since we don't enable - // the counting policy, it won't do much. Management of the - // notified handlers themselves is done in the notify handler. - ACE_Dev_Poll_Handler_Guard eh_guard (eh); - - // Release the reactor token before upcall. - guard.release_token (); - - // Dispatch the detected event - if (disp_out) - { - const int status = - this->upcall (eh, &ACE_Event_Handler::handle_output, handle); - - if (status < 0) - // Note that the token is reacquired in remove_handler(). - this->remove_handler (handle, ACE_Event_Handler::WRITE_MASK); - return 1; - } - - if (disp_exc) - { - const int status = - this->upcall (eh, &ACE_Event_Handler::handle_exception, handle); - - if (status < 0) - // Note that the token is reacquired in remove_handler(). - this->remove_handler (handle, ACE_Event_Handler::EXCEPT_MASK); - return 1; - } - - if (disp_in) - { - const int status = - this->upcall (eh, &ACE_Event_Handler::handle_input, handle); - - if (status < 0) - // Note that the token is reacquired in remove_handler(). - this->remove_handler (handle, ACE_Event_Handler::READ_MASK); - return 1; - } - } // The reactor token is reacquired upon leaving this scope. + if (eh) + { + // Modify the reference count in an exception-safe way. + // Note that eh could be the notify handler. It's not strictly + // necessary to manage its refcount, but since we don't enable + // the counting policy, it won't do much. Management of the + // notified handlers themselves is done in the notify handler. + ACE_Dev_Poll_Handler_Guard eh_guard (eh); + + // Release the reactor token before upcall. + guard.release_token (); + + // Dispatch the detected event + if (disp_out) + { + const int status = + this->upcall (eh, &ACE_Event_Handler::handle_output, handle); + + if (status < 0) + // Note that the token is reacquired in remove_handler(). + this->remove_handler (handle, ACE_Event_Handler::WRITE_MASK); + return 1; + } + + if (disp_exc) + { + const int status = + this->upcall (eh, &ACE_Event_Handler::handle_exception, handle); + + if (status < 0) + // Note that the token is reacquired in remove_handler(). + this->remove_handler (handle, ACE_Event_Handler::EXCEPT_MASK); + return 1; + } + + if (disp_in) + { + const int status = + this->upcall (eh, &ACE_Event_Handler::handle_input, handle); + + if (status < 0) + // Note that the token is reacquired in remove_handler(). + this->remove_handler (handle, ACE_Event_Handler::READ_MASK); + return 1; + } + } // The reactor token is reacquired upon leaving this scope. } return 0; @@ -1524,7 +1533,6 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, if (this->handler_rep_.find (handle) == 0) { - ACE_DEBUG ((LM_DEBUG, "Need to add handle %d\n", handle)); // Handler not present in the repository. Bind it. if (this->handler_rep_.bind (handle, event_handler, mask) != 0) return -1; @@ -1532,7 +1540,7 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, #if defined (ACE_HAS_EVENT_POLL) struct epoll_event epev; - + ACE_OS::memset (&epev, 0, sizeof (epev)); static const int op = EPOLL_CTL_ADD; epev.events = this->reactor_mask_to_poll_event (mask); @@ -1552,13 +1560,8 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, // Handler is already present in the repository, so register it // again, possibly for different event. Add new mask to the // current one. - ACE_DEBUG ((LM_DEBUG, "Adding mask 0x%x for handle %d\n", mask, handle)); if (this->mask_ops_i (handle, mask, ACE_Reactor::ADD_MASK) == -1) - { - ACE_ERROR ((LM_ERROR, "%p\n", "mask_ops_i")); - (void) this->handler_rep_.unbind (handle); - return -1; - } + ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "mask_ops_i"), -1); } #ifndef ACE_HAS_EVENT_POLL @@ -1573,7 +1576,6 @@ ACE_Dev_Poll_Reactor::register_handler_i (ACE_HANDLE handle, if (ACE_OS::write (this->poll_fd_, &pfd, sizeof (pfd)) != sizeof (pfd)) { (void) this->handler_rep_.unbind (handle); - return -1; } #endif /*ACE_HAS_EVENT_POLL*/ @@ -1696,27 +1698,22 @@ ACE_Dev_Poll_Reactor::remove_handler_i (ACE_HANDLE handle, ACE_Event_Handler *eh = this->handler_rep_.find (handle); - if (eh == 0 - || this->mask_ops_i (handle, mask, ACE_Reactor::CLR_MASK) == -1) + if (eh == 0 || + this->mask_ops_i (handle, mask, ACE_Reactor::CLR_MASK) == -1) return -1; - // If there are no longer any outstanding events on the given handle - // then remove it from the handler repository. - if (this->handler_rep_.mask (handle) == ACE_Event_Handler::NULL_MASK - && this->handler_rep_.unbind (handle) != 0) - return -1; + // Check for ref counting now - handle_close() may delete eh. + int requires_reference_counting = + eh->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED; if (ACE_BIT_DISABLED (mask, ACE_Event_Handler::DONT_CALL)) - { - // Release the lock during the "close" upcall. - ACE_Reverse_Lock<ACE_Dev_Poll_Reactor_Token> reverse_lock (this->token_); - ACE_GUARD_RETURN (ACE_Reverse_Lock<ACE_Dev_Poll_Reactor_Token>, - reverse_guard, - reverse_lock, - -1); + (void) eh->handle_close (handle, mask); - (void) eh->handle_close (handle, mask); - } + // If there are no longer any outstanding events on the given handle + // then remove it from the handler repository. + if (this->handler_rep_.mask (handle) == ACE_Event_Handler::NULL_MASK) + this->handler_rep_.unbind (handle, requires_reference_counting); // Note the fact that we've changed the state of the wait_set, // i.e. the "interest set," which is used by the dispatching loop to @@ -1870,7 +1867,7 @@ ACE_Dev_Poll_Reactor::suspend_handler_i (ACE_HANDLE handle) #if defined (ACE_HAS_EVENT_POLL) struct epoll_event epev; - + ACE_OS::memset (&epev, 0, sizeof (epev)); static const int op = EPOLL_CTL_DEL; epev.events = 0; @@ -1980,7 +1977,7 @@ ACE_Dev_Poll_Reactor::resume_handler_i (ACE_HANDLE handle) #if defined (ACE_HAS_EVENT_POLL) struct epoll_event epev; - + ACE_OS::memset (&epev, 0, sizeof (epev)); static const int op = EPOLL_CTL_ADD; epev.events = this->reactor_mask_to_poll_event (mask); @@ -2178,7 +2175,10 @@ ACE_Dev_Poll_Reactor::find_handler (ACE_HANDLE handle) { ACE_MT (ACE_READ_GUARD_RETURN (ACE_Dev_Poll_Reactor_Token, mon, this->token_, 0)); - return this->handler_rep_.find (handle); + ACE_Event_Handler *event_handler = this->handler_rep_.find (handle); + if (event_handler) + event_handler->add_reference (); + return event_handler; } int @@ -2422,7 +2422,7 @@ ACE_Dev_Poll_Reactor::mask_ops_i (ACE_HANDLE handle, #elif defined (ACE_HAS_EVENT_POLL) struct epoll_event epev; - + ACE_OS::memset (&epev, 0, sizeof (epev)); int op; // ACE_Event_Handler::NULL_MASK ??? @@ -2597,7 +2597,10 @@ ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly (ACE_Time_Value *max_wait) if (errno == ETIME) return 0; else - return -1; + { + ACE_ERROR ((LM_ERROR, "%t: %p\n", "token acquire_read")); + return -1; + } } // We got the token and so let us mark ourselves as owner @@ -2641,18 +2644,6 @@ ACE_Dev_Poll_Reactor::Token_Guard::acquire (ACE_Time_Value *max_wait) return result; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Dev_Poll_Reactor_Token; -template class ACE_Lock_Adapter<ACE_Dev_Poll_Reactor_Token>; -template class ACE_Reverse_Lock<ACE_Dev_Poll_Reactor_Token>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Dev_Poll_Reactor_Token -#pragma instantiate ACE_Lock_Adapter<ACE_Dev_Poll_Reactor_Token> -#pragma instantiate ACE_Reverse_Lock<ACE_Dev_Poll_Reactor_Token> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ diff --git a/ace/Dev_Poll_Reactor.h b/ace/Dev_Poll_Reactor.h index 38ca44218f3..78b0949b7d3 100644 --- a/ace/Dev_Poll_Reactor.h +++ b/ace/Dev_Poll_Reactor.h @@ -19,12 +19,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_REACTOR_BUILD_DLL -# include "ace/ACE_Reactor_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Reactor_Export ACE_Export -#endif /* ACE_REACTOR_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -62,14 +57,17 @@ # include "ace/Unbounded_Queue.h" #endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -// Forward declarations -class ACE_Sig_Handler; -class ACE_Dev_Poll_Reactor; - #if defined (ACE_HAS_DEV_POLL) struct pollfd; +#elif defined (ACE_HAS_EVENT_POLL) +struct epoll_event; #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward declarations +class ACE_Sig_Handler; +class ACE_Dev_Poll_Reactor; /** * @class ACE_Dev_Poll_Event_Tuple @@ -381,8 +379,9 @@ public: ACE_Event_Handler *handler, ACE_Reactor_Mask mask); - /// Remove the binding of @c ACE_HANDLE in accordance with the <mask>. - int unbind (ACE_HANDLE handle); + /// Remove the binding for @c ACE_HANDLE; optionally decrement the associated + /// handler's reference count. + int unbind (ACE_HANDLE handle, bool decr_refcnt = true); /// Remove all the (@c ACE_HANDLE, @c ACE_Event_Handler) tuples. int unbind_all (void); @@ -472,7 +471,7 @@ typedef ACE_Noop_Token ACE_DEV_POLL_TOKEN; #endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ typedef ACE_Reactor_Token_T<ACE_DEV_POLL_TOKEN> ACE_Dev_Poll_Reactor_Token; -class ACE_Reactor_Export ACE_Dev_Poll_Reactor : public ACE_Reactor_Impl +class ACE_Export ACE_Dev_Poll_Reactor : public ACE_Reactor_Impl { public: @@ -843,7 +842,7 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. Returns the number of notifications + * ACE_Event_Handler object. Returns the number of notifications * purged. Returns -1 on error. */ virtual int purge_pending_notifications (ACE_Event_Handler * = 0, @@ -1179,14 +1178,14 @@ protected: /// Constructor that will grab the token for us Token_Guard (ACE_Dev_Poll_Reactor_Token &token); - /// Destructor. This will release the token if it hasnt been + /// Destructor. This will release the token if it hasn't been /// released till this point ~Token_Guard (void); /// Release the token .. void release_token (void); - /// Returns whether the thread that created this object ownes the + /// Returns whether the thread that created this object owns the /// token or not. int is_owner (void); @@ -1203,18 +1202,20 @@ protected: int acquire (ACE_Time_Value *max_wait = 0); private: + + Token_Guard (void); + + private: + /// The Reactor token. ACE_Dev_Poll_Reactor_Token &token_; /// Flag that indicate whether the thread that created this object /// owns the token or not. A value of 0 indicates that this class - /// hasnt got the token (and hence the thread) and a value of 1 + /// hasn't got the token (and hence the thread) and a value of 1 /// vice-versa. int owner_; - private: - - ACE_UNIMPLEMENTED_FUNC (Token_Guard (void)) }; }; @@ -1267,6 +1268,7 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) # include "ace/Dev_Poll_Reactor.inl" diff --git a/ace/Dev_Poll_Reactor.inl b/ace/Dev_Poll_Reactor.inl index 0d99c764c01..b7034e07333 100644 --- a/ace/Dev_Poll_Reactor.inl +++ b/ace/Dev_Poll_Reactor.inl @@ -4,6 +4,8 @@ #include "ace/Log_Msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Dev_Poll_Event_Tuple::ACE_Dev_Poll_Event_Tuple (void) : event_handler (0), @@ -222,3 +224,5 @@ ACE_Dev_Poll_Reactor::Token_Guard::is_owner (void) { return this->owner_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dirent.h b/ace/Dirent.h index 5cda1c442fb..c31f8cc20cb 100644 --- a/ace/Dirent.h +++ b/ace/Dirent.h @@ -25,6 +25,8 @@ #include "ace/OS_NS_dirent.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Dirent * @@ -68,15 +70,15 @@ public: * update the st_atime field of the directory each time the * directory is actually read. */ - dirent *read (void); + ACE_DIRENT *read (void); /** * Has the equivalent functionality as <readdir> except that an * <entry> and <result> buffer must be supplied by the caller to * store the result. */ - int read (struct dirent *entry, - struct dirent **result); + int read (struct ACE_DIRENT *entry, + struct ACE_DIRENT **result); // = Manipulators. /// Returns the current location associated with the directory @@ -110,6 +112,8 @@ private: ACE_DIR *dirp_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Dirent.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Dirent.inl b/ace/Dirent.inl index c75c79fd320..0a8f0b9e6e4 100644 --- a/ace/Dirent.inl +++ b/ace/Dirent.inl @@ -1,15 +1,18 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Log_Msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int -ACE_Dirent::open (const ACE_TCHAR *dirname) +ACE_Dirent::open (const ACE_TCHAR *dirname) { // If the directory stream is already open, close it to prevent // possible resource leaks. - if (this->dirp_ != 0) + if (this->dirp_ != 0) { ACE_OS::closedir (this->dirp_); this->dirp_ = 0; @@ -23,38 +26,38 @@ ACE_Dirent::open (const ACE_TCHAR *dirname) return 0; } -ACE_INLINE +ACE_INLINE ACE_Dirent::ACE_Dirent (void) : dirp_ (0) { } -ACE_INLINE -ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname) +ACE_INLINE +ACE_Dirent::ACE_Dirent (const ACE_TCHAR *dirname) : dirp_ (0) { if (this->open (dirname) == -1) ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), + ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Dirent::ACE_Dirent"))); } -ACE_INLINE +ACE_INLINE ACE_Dirent::~ACE_Dirent (void) { if (this->dirp_ != 0) ACE_OS::closedir (this->dirp_); } -ACE_INLINE dirent * +ACE_INLINE ACE_DIRENT * ACE_Dirent::read (void) { return this->dirp_ ? ACE_OS::readdir (this->dirp_) : 0; } ACE_INLINE int -ACE_Dirent::read (struct dirent *entry, - struct dirent **result) +ACE_Dirent::read (struct ACE_DIRENT *entry, + struct ACE_DIRENT **result) { return this->dirp_ ? ACE_OS::readdir_r (this->dirp_, entry, result) @@ -64,7 +67,7 @@ ACE_Dirent::read (struct dirent *entry, ACE_INLINE void ACE_Dirent::close (void) { - if (this->dirp_ != 0) + if (this->dirp_ != 0) { ACE_OS::closedir (this->dirp_); @@ -93,3 +96,4 @@ ACE_Dirent::tell (void) return this->dirp_ ? ACE_OS::telldir (this->dirp_) : 0; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dirent_Selector.cpp b/ace/Dirent_Selector.cpp index c4690ee88e4..0788c8d891b 100644 --- a/ace/Dirent_Selector.cpp +++ b/ace/Dirent_Selector.cpp @@ -13,6 +13,8 @@ ACE_RCSID (ace, Dirent_Selector, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Construction/Destruction ACE_Dirent_Selector::ACE_Dirent_Selector (void) @@ -29,9 +31,9 @@ ACE_Dirent_Selector::~ACE_Dirent_Selector (void) int ACE_Dirent_Selector::open (const ACE_TCHAR *dir, - int (*sel)(const dirent *d), - int (*cmp) (const dirent **d1, - const dirent **d2)) + int (*sel)(const ACE_DIRENT *d), + int (*cmp) (const ACE_DIRENT **d1, + const ACE_DIRENT **d2)) { n_ = ACE_OS::scandir (dir, &this->namelist_, sel, cmp); return n_; @@ -54,3 +56,5 @@ ACE_Dirent_Selector::close (void) this->namelist_ = 0; return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dirent_Selector.h b/ace/Dirent_Selector.h index 8985e4a930a..89b2eead630 100644 --- a/ace/Dirent_Selector.h +++ b/ace/Dirent_Selector.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #include "ace/os_include/os_dirent.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Dirent_Selector * @@ -43,7 +45,7 @@ public: int length (void) const; /// Return the entry at @a index. - dirent *operator[] (const int index) const; + ACE_DIRENT *operator[] (const int index) const; /// Free up resources. int close (void); @@ -51,17 +53,19 @@ public: /// Open the directory @a dir and populate the <namelist_> array with /// directory entries that match the @a selector and @a comparator. int open (const ACE_TCHAR *dir, - int (*selector)(const dirent *d) = 0, - int (*comparator)(const dirent **d1, const dirent **d2) = 0); + int (*selector)(const ACE_DIRENT *d) = 0, + int (*comparator)(const ACE_DIRENT **d1, const ACE_DIRENT **d2) = 0); protected: /// Ptr to the namelist array. - dirent **namelist_; + ACE_DIRENT **namelist_; - /// # of entries in the array. + /// Number of entries in the array. int n_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Dirent_Selector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Dirent_Selector.inl b/ace/Dirent_Selector.inl index 894971076ed..7c42f46b9be 100644 --- a/ace/Dirent_Selector.inl +++ b/ace/Dirent_Selector.inl @@ -1,14 +1,19 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Dirent_Selector::length (void) const { return n_; } -ACE_INLINE dirent * +ACE_INLINE ACE_DIRENT * ACE_Dirent_Selector::operator[] (const int n) const { return this->namelist_[n]; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dump.cpp b/ace/Dump.cpp index 380be07f857..b601496f3b6 100644 --- a/ace/Dump.cpp +++ b/ace/Dump.cpp @@ -8,6 +8,8 @@ ACE_RCSID(ace, Dump, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Implementations (very simple for now...) ACE_Dumpable::~ACE_Dumpable (void) @@ -135,3 +137,5 @@ ACE_ODB::remove_object (const void *this_ptr) } ACE_ODB *ACE_ODB::instance_ = 0; + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dump.h b/ace/Dump.h index aff3faab9a9..7c792f0db66 100644 --- a/ace/Dump.h +++ b/ace/Dump.h @@ -58,6 +58,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Dumpable * @@ -161,6 +163,8 @@ private: int current_size_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + // Include the templates classes at this point. #include "ace/Dump_T.h" diff --git a/ace/Dump_T.cpp b/ace/Dump_T.cpp index fe83085ee1a..3c789497eee 100644 --- a/ace/Dump_T.cpp +++ b/ace/Dump_T.cpp @@ -1,8 +1,9 @@ // Dump_T.cpp +// // $Id$ -#ifndef ACE_DUMP_T_C -#define ACE_DUMP_T_C +#ifndef ACE_DUMP_T_CPP +#define ACE_DUMP_T_CPP #include "ace/Dump_T.h" #include "ace/Global_Macros.h" @@ -12,7 +13,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Dump_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class Concrete> ACE_Dumpable_Adapter<Concrete>::~ACE_Dumpable_Adapter (void) @@ -42,4 +43,6 @@ ACE_Dumpable_Adapter<Concrete>::dump (void) const #endif /* ACE_HAS_DUMP */ } -#endif /* ACE_DUMP_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_DUMP_T_CPP */ diff --git a/ace/Dump_T.h b/ace/Dump_T.h index 7595526a562..561569765a4 100644 --- a/ace/Dump_T.h +++ b/ace/Dump_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Dumpable_Adapter * @@ -53,6 +55,8 @@ private: const Concrete *this_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + // Some useful macros for conditionally compiling this feature... #if defined (ACE_NDEBUG) #define ACE_REGISTER_OBJECT(CLASS) diff --git a/ace/Dynamic.cpp b/ace/Dynamic.cpp index fbab1172542..adeae242579 100644 --- a/ace/Dynamic.cpp +++ b/ace/Dynamic.cpp @@ -1,4 +1,3 @@ -// Dynamic.cpp // $Id$ #include "ace/Dynamic.h" @@ -13,8 +12,10 @@ ACE_RCSID(ace, Dynamic, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Dynamic::ACE_Dynamic (void) - : is_dynamic_ (0) + : is_dynamic_ (false) { ACE_TRACE ("ACE_Dynamic::ACE_Dynamic"); } @@ -25,21 +26,9 @@ ACE_Dynamic::instance (void) return ACE_TSS_Singleton<ACE_Dynamic, ACE_SYNCH_NULL_MUTEX>::instance (); } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex>; -# if (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) - template class ACE_TSS<ACE_Dynamic>; -# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex> - -# if (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) - #pragma instantiate ACE_TSS<ACE_Dynamic> -# endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ - -#elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) template ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex> * ACE_TSS_Singleton<ACE_Dynamic, ACE_Null_Mutex>::singleton_; +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic.h b/ace/Dynamic.h index d6c3ab9466b..3c9f9aced43 100644 --- a/ace/Dynamic.h +++ b/ace/Dynamic.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Dynamic * @@ -46,8 +48,8 @@ public: */ void set (void); - /// 1 if we were allocated dynamically, else 0. - int is_dynamic (void); + /// @c true if we were allocated dynamically, else @c false. + bool is_dynamic (void); /// Resets state flag. void reset (void); @@ -60,9 +62,11 @@ private: * method is usually called in operator new and then checked and * reset in the constructor. */ - int is_dynamic_; + bool is_dynamic_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Dynamic.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Dynamic.inl b/ace/Dynamic.inl index 9d1595441d6..3f506bc51f4 100644 --- a/ace/Dynamic.inl +++ b/ace/Dynamic.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Dynamic.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Dynamic::~ACE_Dynamic (void) @@ -13,11 +14,11 @@ ACE_INLINE void ACE_Dynamic::set (void) { // ACE_TRACE ("ACE_Dynamic::set"); - this->is_dynamic_ = 1; + this->is_dynamic_ = true; } -ACE_INLINE int -ACE_Dynamic::is_dynamic () +ACE_INLINE bool +ACE_Dynamic::is_dynamic (void) { // ACE_TRACE ("ACE_Dynamic::is_dynamic"); return this->is_dynamic_; @@ -27,5 +28,7 @@ ACE_INLINE void ACE_Dynamic::reset (void) { // ACE_TRACE ("ACE_Dynamic::reset"); - this->is_dynamic_ = 0; + this->is_dynamic_ = false; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service.cpp b/ace/Dynamic_Service.cpp index 9178889675c..dd0d8d0c679 100644 --- a/ace/Dynamic_Service.cpp +++ b/ace/Dynamic_Service.cpp @@ -1,8 +1,7 @@ -// Dynamic_Service.cpp // $Id$ -#ifndef ACE_DYNAMIC_SERVICE_C -#define ACE_DYNAMIC_SERVICE_C +#ifndef ACE_DYNAMIC_SERVICE_CPP +#define ACE_DYNAMIC_SERVICE_CPP #include "ace/Dynamic_Service.h" @@ -16,14 +15,16 @@ #include "ace/Dynamic_Service.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TYPE> TYPE * ACE_Dynamic_Service<TYPE>::instance (const ACE_TCHAR *name) { - ACE_Service_Object *svc_obj = + ACE_Service_Object * svc_obj = static_cast<ACE_Service_Object *> (ACE_Dynamic_Service_Base::instance (name)); return dynamic_cast<TYPE *> (svc_obj); } -ACE_RCSID(ace, Dynamic_Service, "$Id$") +ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_DYNAMIC_SERVICE_C */ +#endif /* ACE_DYNAMIC_SERVICE_CPP */ diff --git a/ace/Dynamic_Service.h b/ace/Dynamic_Service.h index 2b678fb70f1..88ac4115c12 100644 --- a/ace/Dynamic_Service.h +++ b/ace/Dynamic_Service.h @@ -24,6 +24,8 @@ #include "ace/Dynamic_Service_Base.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Service_Object; /** @@ -46,6 +48,8 @@ public: static TYPE* instance (const wchar_t *name); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Dynamic_Service.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Dynamic_Service.inl b/ace/Dynamic_Service.inl index 3387ca51abb..108ddd32a09 100644 --- a/ace/Dynamic_Service.inl +++ b/ace/Dynamic_Service.inl @@ -1,8 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TYPE> ACE_INLINE TYPE * ACE_Dynamic_Service<TYPE>::instance (const ACE_ANTI_TCHAR *name) { return instance (ACE_TEXT_TO_TCHAR_IN (name)); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service_Base.cpp b/ace/Dynamic_Service_Base.cpp index 4f62b6de092..bec17fb079f 100644 --- a/ace/Dynamic_Service_Base.cpp +++ b/ace/Dynamic_Service_Base.cpp @@ -9,6 +9,7 @@ ACE_RCSID (ace, Dynamic_Service_Base, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Dynamic_Service_Base::dump (void) const @@ -39,6 +40,8 @@ ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name) if (type == 0) return 0; - void *obj = type->object (); + void * const obj = type->object (); return obj; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Dynamic_Service_Base.h b/ace/Dynamic_Service_Base.h index 2b80085f0e7..17b7c5dda2f 100644 --- a/ace/Dynamic_Service_Base.h +++ b/ace/Dynamic_Service_Base.h @@ -22,6 +22,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Dynamic_Service_Base @@ -42,5 +43,7 @@ protected: static void* instance (const ACE_TCHAR *name); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_DYNAMIC_SERVICE_BASE_H */ diff --git a/ace/Env_Value_T.cpp b/ace/Env_Value_T.cpp index dcab4e0522c..788bf125fc5 100644 --- a/ace/Env_Value_T.cpp +++ b/ace/Env_Value_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#if !defined (ACE_ENV_VALUE_T_C) -#define ACE_ENV_VALUE_T_C +#ifndef ACE_ENV_VALUE_T_CPP +#define ACE_ENV_VALUE_T_CPP #include "ace/Env_Value_T.h" @@ -9,6 +9,4 @@ #include "ace/Env_Value_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Env_Value_T, "$Id$") - -#endif /* ACE_ENV_VALUE_T_C */ +#endif /* ACE_ENV_VALUE_T_CPP */ diff --git a/ace/Env_Value_T.h b/ace/Env_Value_T.h index a88cca9d7e6..0a01705dfbb 100644 --- a/ace/Env_Value_T.h +++ b/ace/Env_Value_T.h @@ -27,6 +27,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Env_Value * @@ -77,6 +79,8 @@ private: /// Function to convert a string @a s into type @c T. template <class T> void ACE_Convert (const ACE_TCHAR *s, T &t); +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Env_Value_T.inl" #endif /* __ACE_INLINE__ */ @@ -85,73 +89,75 @@ template <class T> void ACE_Convert (const ACE_TCHAR *s, T &t); #include "ace/Env_Value_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL -// Default calls a CTOR on type T of the form 'T::T(const char*)', but -// users can feel free to create their own specialized conversion -// functions if necessary, as shown below. Note that for 'char*' the -// default is used because a simple cast will be performed and no -// conversion will be necessary. - -template <class T> inline void -ACE_Convert (const ACE_TCHAR *s, T &t) -{ - t = T (s); -} - -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, ACE_TCHAR *&v) { v = (ACE_TCHAR *) s; } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, const ACE_TCHAR *&v) { v = (const ACE_TCHAR *) s; } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, short &si) { si = static_cast<short> (ACE_OS::strtol (s, 0, 10)); } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, u_short &us) { us = static_cast <u_short> (ACE_OS::strtol (s, 0, 10)); } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, u_int &i) { i = static_cast<u_int> (ACE_OS::strtol (s, 0, 10)); } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, long &l) { l = ACE_OS::strtol (s, 0, 10); } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, int &i) { i = static_cast<int> (ACE_OS::strtol (s, 0, 10)); } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, u_long &ul) { ul = ACE_OS::strtoul (s, 0, 10); } -inline void +template <> inline void ACE_Convert (const ACE_TCHAR *s, double &d) { d = ACE_OS::strtod (s, 0); } +// Default calls a CTOR on type T of the form 'T::T(const char*)', but +// users can feel free to create their own specialized conversion +// functions if necessary, as shown above. Note that for 'char*' the +// default is used because a simple cast will be performed and no +// conversion will be necessary. +template <class T> inline void +ACE_Convert (const ACE_TCHAR *s, T &t) +{ + t = T (s); +} + +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) #pragma implementation ("Env_Value_T.cpp") #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ diff --git a/ace/Env_Value_T.inl b/ace/Env_Value_T.inl index 6df7d7a8ce4..1af0296cf91 100644 --- a/ace/Env_Value_T.inl +++ b/ace/Env_Value_T.inl @@ -1,5 +1,8 @@ +// -*- C++ -*- // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE ACE_Env_Value<T>::operator T (void) { @@ -25,8 +28,8 @@ template <class T> ACE_INLINE void ACE_Env_Value<T>::open (const ACE_TCHAR *varname, const T &defval) { - varname_ = varname; - value_ = defval; + this->varname_ = varname; + this->value_ = defval; this->fetch_value (); } @@ -41,10 +44,12 @@ ACE_Env_Value<T>::fetch_value (void) template <class T> ACE_INLINE const ACE_TCHAR* ACE_Env_Value<T>::varname (void) const { - return varname_; + return this->varname_; } template <class T> ACE_INLINE ACE_Env_Value<T>::~ACE_Env_Value (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event.cpp b/ace/Event.cpp index fde6f78840c..bc21465d27a 100644 --- a/ace/Event.cpp +++ b/ace/Event.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, Event, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Event::ACE_Event (int manual_reset, int initial_state, int type, @@ -85,3 +87,5 @@ ACE_Event::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event.h b/ace/Event.h index 1a0070c2970..c4457a7dd9c 100644 --- a/ace/Event.h +++ b/ace/Event.h @@ -24,6 +24,8 @@ #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Event * @@ -130,6 +132,8 @@ private: const ACE_Event &operator= (const ACE_Event &rhs); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Event.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Event.inl b/ace/Event.inl index fdb9b491650..188d7c202cf 100644 --- a/ace/Event.inl +++ b/ace/Event.inl @@ -1,6 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_event_t ACE_Event::handle (void) const { @@ -13,3 +15,4 @@ ACE_Event::handle (ACE_event_t new_handle) this->handle_ = new_handle; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event_Handler.cpp b/ace/Event_Handler.cpp index 5ea84a6c9a3..c0daee5bdba 100644 --- a/ace/Event_Handler.cpp +++ b/ace/Event_Handler.cpp @@ -6,6 +6,8 @@ #include "ace/OS_Errno.h" #include "ace/Reactor.h" #include "ace/Thread_Manager.h" +/* Need to see if ACE_HAS_BUILTIN_ATOMIC_OP defined */ +#include "ace/Atomic_Op.h" #if !defined (__ACE_INLINE__) #include "ace/Event_Handler.inl" @@ -13,15 +15,17 @@ ACE_RCSID(ace, Event_Handler, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Implement conceptually abstract virtual functions in the base class // so derived classes don't have to implement unused ones. ACE_Event_Handler::ACE_Event_Handler (ACE_Reactor *r, int p) - : reference_count_ (1) - , priority_ (p) - , reactor_ (r) - , reference_counting_policy_ (Reference_Counting_Policy::DISABLED) + : reference_count_ (1), + priority_ (p), + reactor_ (r), + reference_counting_policy_ (Reference_Counting_Policy::DISABLED) { // ACE_TRACE ("ACE_Event_Handler::ACE_Event_Handler"); } @@ -244,23 +248,21 @@ ACE_Event_Handler::reference_counting_policy (void) return this->reference_counting_policy_; } -#if !defined (ACE_HAS_WINCE) +//#if !defined (ACE_HAS_WINCE) ACE_THR_FUNC_RETURN ACE_Event_Handler::read_adapter (void *args) { ACE_Event_Handler *this_ptr = static_cast<ACE_Event_Handler *> (args); + ACE_Reactor *r = this_ptr->reactor (); - ACE_HANDLE handle = this_ptr->get_handle (); - if (handle == ACE_INVALID_HANDLE) - handle = ACE_STDIN; - - while (this_ptr->handle_input (handle) != -1) + while (this_ptr->handle_input (ACE_STDIN) != -1) continue; - this_ptr->handle_close (handle, - ACE_Event_Handler::READ_MASK); - this_ptr->reactor ()->notify (); + this_ptr->handle_close (ACE_STDIN, ACE_Event_Handler::READ_MASK); + // It's possible for handle_close() to "delete this" so we need to + // cache the reactor pointer and use it here. + r->notify (); return 0; } @@ -304,7 +306,7 @@ ACE_Event_Handler::remove_stdin_handler (ACE_Reactor *reactor, #endif /* ACE_WIN32 */ } -#endif /* ACE_HAS_WINCE */ +//#endif /* ACE_HAS_WINCE */ ACE_Event_Handler_var::ACE_Event_Handler_var (void) : ptr_ (0) @@ -404,3 +406,5 @@ ACE_Notification_Buffer::ACE_Notification_Buffer (ACE_Event_Handler *eh, { ACE_TRACE ("ACE_Notification_Buffer::ACE_Notification_Buffer"); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event_Handler.h b/ace/Event_Handler.h index c0aea234a72..b6b066cb379 100644 --- a/ace/Event_Handler.h +++ b/ace/Event_Handler.h @@ -24,6 +24,8 @@ #include "ace/Atomic_Op.h" #include "ace/Synch_Traits.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration. class ACE_Message_Block; class ACE_Reactor; @@ -123,7 +125,7 @@ public: virtual int handle_exit (ACE_Process *); /// Called when a <handle_*()> method returns -1 or when the - /// <remove_handler> method is called on an <ACE_Reactor>. The + /// <remove_handler> method is called on an ACE_Reactor. The /// <close_mask> indicates which event has triggered the /// <handle_close> method callback on a particular <handle>. virtual int handle_close (ACE_HANDLE handle, @@ -143,16 +145,18 @@ public: /// The application takes responsibility of resuming the handler ACE_APPLICATION_RESUMES_HANDLER }; - /* Called to figure out whether the handler needs to resumed by the + /** + * Called to figure out whether the handler needs to resumed by the * reactor or the application can take care of it. The default * value of 0 would be returned which would allow the reactor to * take care of resumption of the handler. The application can * return a value more than zero and decide to resume the handler * themseleves. + * + * @note This method is only useful for the ACE_TP_Reactor. Sad + * that we have to have this method in a class that is supposed to + * be used across different components in ACE. */ - // @@ NOTE: This method is only useful for the ACE_TP_Reactor. Sad - // that we have to have this method in a class that is supposed to - // be used across different componets in ACE. virtual int resume_handler (void); virtual int handle_qos (ACE_HANDLE = ACE_INVALID_HANDLE); @@ -168,14 +172,14 @@ public: /// Get only the reactor's timer related interface. virtual ACE_Reactor_Timer_Interface *reactor_timer_interface (void) const; -#if !defined (ACE_HAS_WINCE) + //#if !defined (ACE_HAS_WINCE) /** * Used to read from non-socket ACE_HANDLEs in our own thread to * work around Win32 limitations that don't allow us to <select> on * non-sockets (such as ACE_STDIN). This is commonly used in * situations where the Reactor is used to demultiplex read events * on ACE_STDIN on UNIX. Note that <event_handler> must be a - * subclass of <ACE_Event_Handler>. If the <get_handle> method of + * subclass of ACE_Event_Handler. If the <get_handle> method of * this event handler returns <ACE_INVALID_HANDLE> we default to * reading from ACE_STDIN. */ @@ -194,7 +198,7 @@ public: /// Performs the inverse of the <register_stdin_handler> method. static int remove_stdin_handler (ACE_Reactor *reactor, ACE_Thread_Manager *thr_mgr); -#endif /* ACE_HAS_WINCE */ + //#endif /* ACE_HAS_WINCE */ /// Reference count type. typedef long Reference_Count; @@ -376,6 +380,8 @@ public: ACE_Reactor_Mask mask_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Event_Handler.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Event_Handler.inl b/ace/Event_Handler.inl index d07de45a072..75f2cd12aa5 100644 --- a/ace/Event_Handler.inl +++ b/ace/Event_Handler.inl @@ -1,8 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Notification_Buffer::~ACE_Notification_Buffer (void) { } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Event_Handler_T.cpp b/ace/Event_Handler_T.cpp index cbe9676a58e..51a03f62310 100644 --- a/ace/Event_Handler_T.cpp +++ b/ace/Event_Handler_T.cpp @@ -17,6 +17,7 @@ #include "ace/Event_Handler_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Event_Handler_T) @@ -117,6 +118,8 @@ ACE_Event_Handler_T<T>::handle_signal (int signum, siginfo_t *s, ucontext_t *u) return this->sig_handler_ == 0 ? 0 : (this->op_handler_->*sig_handler_) (signum, s, u); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ #endif /* ACE_EVENT_HANDLER_T_CPP */ diff --git a/ace/Event_Handler_T.h b/ace/Event_Handler_T.h index 1352a65d486..71c97bcf4a8 100644 --- a/ace/Event_Handler_T.h +++ b/ace/Event_Handler_T.h @@ -22,6 +22,8 @@ #if defined (ACE_HAS_TEMPLATE_TYPEDEFS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Event_Handler_T * @@ -170,6 +172,8 @@ protected: GET_HANDLE get_handle_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Event_Handler_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Event_Handler_T.inl b/ace/Event_Handler_T.inl index f5d85f862b5..5d2e31ab81e 100644 --- a/ace/Event_Handler_T.inl +++ b/ace/Event_Handler_T.inl @@ -2,9 +2,9 @@ // // $Id$ - #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template<class T> ACE_INLINE void ACE_Event_Handler_T<T>::op_handler (T *op) @@ -131,3 +131,5 @@ ACE_Event_Handler_T<T>::sig_handler (ACE_TYPENAME ACE_Event_Handler_T<T>::SIG_HA ACE_TRACE ("ACE_Event_Handler_T<T>::sig_handler"); this->sig_handler_ = h; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO.cpp b/ace/FIFO.cpp index 89c6019e449..3f2a4c5115b 100644 --- a/ace/FIFO.cpp +++ b/ace/FIFO.cpp @@ -1,4 +1,3 @@ -// FIFO.cpp // $Id$ #include "ace/FIFO.h" @@ -15,6 +14,8 @@ ACE_RCSID(ace, FIFO, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FIFO) void @@ -30,7 +31,7 @@ ACE_FIFO::dump (void) const } int -ACE_FIFO::open (const ACE_TCHAR *r, int flags, int perms, +ACE_FIFO::open (const ACE_TCHAR *r, int flags, mode_t perms, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO::open"); @@ -52,8 +53,8 @@ ACE_FIFO::open (const ACE_TCHAR *r, int flags, int perms, } ACE_FIFO::ACE_FIFO (const ACE_TCHAR *fifo_name, - int flags, - int perms, + int flags, + mode_t perms, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO::ACE_FIFO"); @@ -79,3 +80,5 @@ ACE_FIFO::close (void) } return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO.h b/ace/FIFO.h index 1b88db74a1d..066e3e98035 100644 --- a/ace/FIFO.h +++ b/ace/FIFO.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //========================================================================== /** @@ -24,6 +24,8 @@ #include "ace/IPC_SAP.h" #include "ace/os_include/os_limits.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_FIFO * @@ -39,7 +41,7 @@ class ACE_Export ACE_FIFO : public ACE_IPC_SAP public: /// Open up the named pipe on the <rendezvous> in accordance with the /// flags. - int open (const ACE_TCHAR *rendezvous, int flags, int perms, + int open (const ACE_TCHAR *rendezvous, int flags, mode_t perms, LPSECURITY_ATTRIBUTES sa = 0); /// Close down the ACE_FIFO without removing the rendezvous point. @@ -65,7 +67,7 @@ protected: /// Open up the named pipe on the <rendezvous> in accordance with the /// flags. - ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, int perms, + ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, mode_t perms, LPSECURITY_ATTRIBUTES sa = 0); private: @@ -73,6 +75,8 @@ private: ACE_TCHAR rendezvous_[MAXPATHLEN + 1]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FIFO.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FIFO.inl b/ace/FIFO.inl index 0c91ceaca3f..149ed11318b 100644 --- a/ace/FIFO.inl +++ b/ace/FIFO.inl @@ -1,10 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// FIFO.i - #include "ace/OS_NS_unistd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_FIFO::get_local_addr (const ACE_TCHAR *&r) const { @@ -17,6 +18,8 @@ ACE_INLINE int ACE_FIFO::remove (void) { ACE_TRACE ("ACE_FIFO::remove"); - int result = this->close (); + int const result = this->close (); return ACE_OS::unlink (this->rendezvous_) == -1 || result == -1 ? -1 : 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv.cpp b/ace/FIFO_Recv.cpp index 4aa92e29acd..50a39067bb0 100644 --- a/ace/FIFO_Recv.cpp +++ b/ace/FIFO_Recv.cpp @@ -1,4 +1,3 @@ -// FIFO_Recv.cpp // $Id$ #include "ace/FIFO_Recv.h" @@ -11,6 +10,8 @@ ACE_RCSID(ace, FIFO_Recv, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv) void @@ -43,9 +44,9 @@ ACE_FIFO_Recv::close (void) int ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name, - int flags, - int perms, - int persistent, + int flags, + mode_t perms, + int persistent, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Recv::open"); @@ -55,7 +56,7 @@ ACE_FIFO_Recv::open (const ACE_TCHAR *fifo_name, else if (this->disable (ACE_NONBLOCK) == -1) return -1; else if (persistent - && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE) + && (this->aux_handle_ = ACE_OS::open (fifo_name, O_WRONLY, 0, sa)) == ACE_INVALID_HANDLE) return -1; else return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0; @@ -68,18 +69,20 @@ ACE_FIFO_Recv::ACE_FIFO_Recv (void) } ACE_FIFO_Recv::ACE_FIFO_Recv (const ACE_TCHAR *fifo_name, - int flags, - int perms, - int persistent, + int flags, + mode_t perms, + int persistent, LPSECURITY_ATTRIBUTES sa) : aux_handle_ (ACE_INVALID_HANDLE) { ACE_TRACE ("ACE_FIFO_Recv::ACE_FIFO_Recv"); if (this->ACE_FIFO_Recv::open (fifo_name, - flags, - perms, - persistent, + flags, + perms, + persistent, sa) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Recv"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv.h b/ace/FIFO_Recv.h index ea1b391edb9..fc4ec2222f3 100644 --- a/ace/FIFO_Recv.h +++ b/ace/FIFO_Recv.h @@ -25,6 +25,8 @@ #include "ace/os_include/os_fcntl.h" #include "ace/Default_Constants.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_FIFO_Recv * @@ -41,14 +43,14 @@ public: /// Open up a bytestream named pipe for reading. ACE_FIFO_Recv (const ACE_TCHAR *rendezvous, int flags = O_CREAT | O_RDONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, int persistent = 1, LPSECURITY_ATTRIBUTES sa = 0); /// Open up a bytestream named pipe for reading. int open (const ACE_TCHAR *rendezvous, int flags = O_CREAT | O_RDONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, int persistent = 1, LPSECURITY_ATTRIBUTES sa = 0); @@ -72,6 +74,8 @@ private: ACE_HANDLE aux_handle_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FIFO_Recv.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FIFO_Recv.inl b/ace/FIFO_Recv.inl index 5817a486624..b5cf96cb56d 100644 --- a/ace/FIFO_Recv.inl +++ b/ace/FIFO_Recv.inl @@ -1,11 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// FIFO_Recv.i - #include "ace/ACE.h" #include "ace/OS_NS_unistd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ssize_t ACE_FIFO_Recv::recv (void *buf, size_t len) { @@ -19,3 +20,5 @@ ACE_FIFO_Recv::recv_n (void *buf, size_t n) ACE_TRACE ("ACE_FIFO_Recv::recv_n"); return ACE::recv_n (this->get_handle (), buf, n); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv_Msg.cpp b/ace/FIFO_Recv_Msg.cpp index de6055f5707..7aa5b1d6721 100644 --- a/ace/FIFO_Recv_Msg.cpp +++ b/ace/FIFO_Recv_Msg.cpp @@ -1,4 +1,3 @@ -// FIFO_Recv_Msg.cpp // $Id$ #include "ace/FIFO_Recv_Msg.h" @@ -11,6 +10,8 @@ ACE_RCSID(ace, FIFO_Recv_Msg, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Recv_Msg) void @@ -28,17 +29,17 @@ ACE_FIFO_Recv_Msg::dump (void) const int ACE_FIFO_Recv_Msg::open (const ACE_TCHAR *fifo_name, - int flags, - int perms, - int persistent, + int flags, + mode_t perms, + int persistent, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Recv_Msg::open"); return ACE_FIFO_Recv::open (fifo_name, - flags, - perms, - persistent, + flags, + perms, + persistent, sa); } @@ -48,17 +49,19 @@ ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (void) } ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg (const ACE_TCHAR *fifo_name, - int flags, - int perms, - int persistent, + int flags, + mode_t perms, + int persistent, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Recv_Msg::ACE_FIFO_Recv_Msg"); if (this->ACE_FIFO_Recv_Msg::open (fifo_name, - flags, - perms, - persistent, + flags, + perms, + persistent, sa) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Recv_Msg"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Recv_Msg.h b/ace/FIFO_Recv_Msg.h index cc35bc22423..b1c7afe3eb3 100644 --- a/ace/FIFO_Recv_Msg.h +++ b/ace/FIFO_Recv_Msg.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decls class ACE_Str_Buf; @@ -50,14 +52,14 @@ public: /// Open up a record-oriented named pipe for reading. ACE_FIFO_Recv_Msg (const ACE_TCHAR *rendezvous, int flags = O_CREAT | O_RDONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, int persistent = 1, LPSECURITY_ATTRIBUTES sa = 0); /// Open up a record-oriented named pipe for reading. int open (const ACE_TCHAR *rendezvous, int flags = O_CREAT | O_RDONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, int persistent = 1, LPSECURITY_ATTRIBUTES sa = 0); @@ -126,6 +128,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FIFO_Recv_Msg.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FIFO_Recv_Msg.inl b/ace/FIFO_Recv_Msg.inl index c5a81e02a62..bab21a7e20e 100644 --- a/ace/FIFO_Recv_Msg.inl +++ b/ace/FIFO_Recv_Msg.inl @@ -2,8 +2,6 @@ // // $Id$ -// FIFO_Recv_Msg.i - #include "ace/Min_Max.h" #include "ace/OS_NS_stropts.h" @@ -11,6 +9,8 @@ #include "ace/OS_NS_unistd.h" #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ssize_t ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) { @@ -26,8 +26,8 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf &recv_msg) return recv_msg.len; #else /* Do the ol' 2-read trick... */ if (ACE_OS::read (this->get_handle (), - (char *) &recv_msg.len, - sizeof recv_msg.len) != sizeof recv_msg.len) + (char *) &recv_msg.len, + sizeof recv_msg.len) != sizeof recv_msg.len) return -1; else { @@ -77,8 +77,8 @@ ACE_FIFO_Recv_Msg::recv (void *buf, size_t max_len) #if defined (ACE_HAS_STREAM_PIPES) ACE_INLINE ssize_t ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags) + ACE_Str_Buf *cntl, + int *flags) { ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); if (ACE_OS::getmsg (this->get_handle (), @@ -92,9 +92,9 @@ ACE_FIFO_Recv_Msg::recv (ACE_Str_Buf *data, ACE_INLINE ssize_t ACE_FIFO_Recv_Msg::recv (int *band, - ACE_Str_Buf *data, - ACE_Str_Buf *cntl, - int *flags) + ACE_Str_Buf *data, + ACE_Str_Buf *cntl, + int *flags) { ACE_TRACE ("ACE_FIFO_Recv_Msg::recv"); if (ACE_OS::getpmsg (this->get_handle (), @@ -107,3 +107,5 @@ ACE_FIFO_Recv_Msg::recv (int *band, return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); } #endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send.cpp b/ace/FIFO_Send.cpp index 9e347ef67ee..c29871430ed 100644 --- a/ace/FIFO_Send.cpp +++ b/ace/FIFO_Send.cpp @@ -1,4 +1,3 @@ -// FIFO_Send.cpp // $Id$ #include "ace/FIFO_Send.h" @@ -10,6 +9,8 @@ ACE_RCSID(ace, FIFO_Send, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send) void @@ -29,7 +30,7 @@ ACE_FIFO_Send::ACE_FIFO_Send (void) int ACE_FIFO_Send::open (const ACE_TCHAR *rendezvous_name, int flags, - int perms, + mode_t perms, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Send::open"); @@ -41,7 +42,7 @@ ACE_FIFO_Send::open (const ACE_TCHAR *rendezvous_name, ACE_FIFO_Send::ACE_FIFO_Send (const ACE_TCHAR *fifo_name, int flags, - int perms, + mode_t perms, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Send::ACE_FIFO_Send"); @@ -53,3 +54,5 @@ ACE_FIFO_Send::ACE_FIFO_Send (const ACE_TCHAR *fifo_name, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Send::ACE_FIFO_Send"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send.h b/ace/FIFO_Send.h index 125f1a42e15..45e02c87c38 100644 --- a/ace/FIFO_Send.h +++ b/ace/FIFO_Send.h @@ -25,6 +25,8 @@ #include "ace/os_include/os_fcntl.h" #include "ace/Default_Constants.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_FIFO_Send * @@ -40,13 +42,13 @@ public: /// Open up a bytestream named pipe for writing. ACE_FIFO_Send (const ACE_TCHAR *rendezvous, int flags = O_WRONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, LPSECURITY_ATTRIBUTES sa = 0); /// Open up a bytestream named pipe for writing. int open (const ACE_TCHAR *rendezvous, int flags = O_WRONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, LPSECURITY_ATTRIBUTES sa = 0); /// Send <buf> of up to <len> bytes. @@ -62,6 +64,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FIFO_Send.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FIFO_Send.inl b/ace/FIFO_Send.inl index eb503d9b831..12491058e2c 100644 --- a/ace/FIFO_Send.inl +++ b/ace/FIFO_Send.inl @@ -1,11 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// FIFO_Send.i - #include "ace/ACE.h" #include "ace/OS_NS_unistd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ssize_t ACE_FIFO_Send::send (const void *buf, size_t len) { @@ -19,3 +20,5 @@ ACE_FIFO_Send::send_n (const void *buf, size_t n) ACE_TRACE ("ACE_FIFO_Send::send_n"); return ACE::send_n (this->get_handle (), buf, n); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send_Msg.cpp b/ace/FIFO_Send_Msg.cpp index 1575f7ae98c..f39c5d865e9 100644 --- a/ace/FIFO_Send_Msg.cpp +++ b/ace/FIFO_Send_Msg.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, FIFO_Send_Msg, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FIFO_Send_Msg) void @@ -57,8 +59,8 @@ ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (void) int ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name, - int flags, - int perms, + int flags, + mode_t perms, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Send_Msg::open"); @@ -66,11 +68,13 @@ ACE_FIFO_Send_Msg::open (const ACE_TCHAR *fifo_name, } ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg (const ACE_TCHAR *fifo_name, - int flags, - int perms, + int flags, + mode_t perms, LPSECURITY_ATTRIBUTES sa) { ACE_TRACE ("ACE_FIFO_Send_Msg::ACE_FIFO_Send_Msg"); if (this->ACE_FIFO_Send_Msg::open (fifo_name, flags, perms, sa) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_FIFO_Send_Msg"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FIFO_Send_Msg.h b/ace/FIFO_Send_Msg.h index b7f0e104177..8272ec6c819 100644 --- a/ace/FIFO_Send_Msg.h +++ b/ace/FIFO_Send_Msg.h @@ -25,6 +25,8 @@ # include "ace/OS_NS_stropts.h" #endif /* ACE_HAS_STREAM_PIPES */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward Decls class ACE_Str_Buf; @@ -44,13 +46,13 @@ public: /// Open up a record-oriented named pipe for writing. ACE_FIFO_Send_Msg (const ACE_TCHAR *rendezvous, int flags = O_WRONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, LPSECURITY_ATTRIBUTES sa = 0); /// Open up a record-oriented named pipe for writing. int open (const ACE_TCHAR *rendezvous, int flags = O_WRONLY, - int perms = ACE_DEFAULT_FILE_PERMS, + mode_t perms = ACE_DEFAULT_FILE_PERMS, LPSECURITY_ATTRIBUTES sa = 0); /// Send <buf> of up to <len> bytes. @@ -79,6 +81,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FIFO_Send_Msg.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FIFO_Send_Msg.inl b/ace/FIFO_Send_Msg.inl index 34bb88aabc3..74392656597 100644 --- a/ace/FIFO_Send_Msg.inl +++ b/ace/FIFO_Send_Msg.inl @@ -4,6 +4,8 @@ #include "ace/OS_NS_stropts.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ssize_t ACE_FIFO_Send_Msg::send (const void *buf, size_t len) { @@ -16,8 +18,8 @@ ACE_FIFO_Send_Msg::send (const void *buf, size_t len) #if defined (ACE_HAS_STREAM_PIPES) ACE_INLINE ssize_t ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl, - int flags) + const ACE_Str_Buf *cntl, + int flags) { ACE_TRACE ("ACE_FIFO_Send_Msg::send"); if (ACE_OS::putmsg (this->get_handle (), @@ -31,9 +33,9 @@ ACE_FIFO_Send_Msg::send (const ACE_Str_Buf *data, ACE_INLINE ssize_t ACE_FIFO_Send_Msg::send (int band, - const ACE_Str_Buf *data, - const ACE_Str_Buf *cntl, - int flags) + const ACE_Str_Buf *data, + const ACE_Str_Buf *cntl, + int flags) { ACE_TRACE ("ACE_FIFO_Send_Msg::send"); @@ -47,3 +49,5 @@ ACE_FIFO_Send_Msg::send (int band, return (cntl == 0 ? 0 : cntl->len) + (data == 0 ? 0 : data->len); } #endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE.cpp b/ace/FILE.cpp index de7c294cc6e..d2578b42a04 100644 --- a/ace/FILE.cpp +++ b/ace/FILE.cpp @@ -15,6 +15,8 @@ ACE_RCSID(ace, FILE, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FILE) void @@ -145,3 +147,5 @@ ACE_FILE::unlink (void) return ACE_OS::unlink (this->addr_.get_path_name ()); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE.h b/ace/FILE.h index 9291e24dd61..ba791f46428 100644 --- a/ace/FILE.h +++ b/ace/FILE.h @@ -35,6 +35,8 @@ #define ACE_FILE_STREAM ACE_FILE_IO, ACE_FILE_Addr #endif /* ACE_TEMPLATE_TYPEDEFS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_FILE_Info * @@ -127,6 +129,8 @@ protected: ACE_FILE_Addr addr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FILE.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FILE.inl b/ace/FILE.inl index 934f5d7aa98..fdd65029d3a 100644 --- a/ace/FILE.inl +++ b/ace/FILE.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_FILE::disable (int signum) const { @@ -12,3 +15,4 @@ ACE_FILE::disable (int signum) const #endif /* ACE_WIN32 */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Addr.cpp b/ace/FILE_Addr.cpp index 6378b9aefa5..09d87c0d9b1 100644 --- a/ace/FILE_Addr.cpp +++ b/ace/FILE_Addr.cpp @@ -13,6 +13,8 @@ ACE_RCSID(ace, FILE_Addr, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Addr) ACE_FILE_Addr::ACE_FILE_Addr (void) @@ -123,3 +125,4 @@ ACE_FILE_Addr::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Addr.h b/ace/FILE_Addr.h index c1955e7994a..815319a834b 100644 --- a/ace/FILE_Addr.h +++ b/ace/FILE_Addr.h @@ -24,6 +24,8 @@ #include "ace/Flag_Manip.h" #include "ace/os_include/os_dirent.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_FILE_Addr * @@ -78,6 +80,8 @@ private: ACE_TCHAR filename_[MAXPATHLEN + 1]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FILE_Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FILE_Addr.inl b/ace/FILE_Addr.inl index cf6432bcefa..e03cd2ab156 100644 --- a/ace/FILE_Addr.inl +++ b/ace/FILE_Addr.inl @@ -5,6 +5,8 @@ #include "ace/SString.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Compare two addresses for equality. ACE_INLINE bool @@ -18,7 +20,7 @@ ACE_FILE_Addr::operator == (const ACE_FILE_Addr &sap) const ACE_INLINE bool ACE_FILE_Addr::operator != (const ACE_FILE_Addr &sap) const { - return !((*this) == sap); // This is lazy, of course... ;-) + return !((*this) == sap); // This is lazy, of course... ;-) } // Return the path name used for the rendezvous point. @@ -28,3 +30,5 @@ ACE_FILE_Addr::get_path_name (void) const { return this->filename_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Connector.cpp b/ace/FILE_Connector.cpp index b1854e54b17..cc471d5ce24 100644 --- a/ace/FILE_Connector.cpp +++ b/ace/FILE_Connector.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, FILE_Connector, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FILE_Connector) void @@ -84,3 +86,5 @@ ACE_FILE_Connector::connect (ACE_FILE_IO &new_io, new_io.set_handle (handle); return handle == ACE_INVALID_HANDLE ? -1 : 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_Connector.h b/ace/FILE_Connector.h index f59f13f4413..038f97ee5a1 100644 --- a/ace/FILE_Connector.h +++ b/ace/FILE_Connector.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_FILE_Connector * @@ -103,6 +105,8 @@ public: typedef ACE_FILE_IO PEER_STREAM; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FILE_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FILE_Connector.inl b/ace/FILE_Connector.inl index 5a3e909072d..7fbc9db5b33 100644 --- a/ace/FILE_Connector.inl +++ b/ace/FILE_Connector.inl @@ -1,22 +1,23 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// FILE_Connector.i - // Creates a Local ACE_FILE. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_FILE_Connector::ACE_FILE_Connector (ACE_FILE_IO &new_io, - const ACE_FILE_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) + const ACE_FILE_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms) { ACE_TRACE ("ACE_FILE_Connector::ACE_FILE_Connector"); if (this->connect (new_io, remote_sap, timeout, local_sap, - reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE + reuse_addr, flags, perms) == ACE_IO_SAP::INVALID_HANDLE && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("address %s, %p\n"), @@ -31,3 +32,5 @@ ACE_FILE_Connector::reset_new_handle (ACE_HANDLE handle) // Nothing to do here since the handle is not a socket return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_IO.cpp b/ace/FILE_IO.cpp index 7528447b7fd..29d818f4f10 100644 --- a/ace/FILE_IO.cpp +++ b/ace/FILE_IO.cpp @@ -1,4 +1,3 @@ -// FILE_IO.cpp // $Id$ #include "ace/FILE_IO.h" @@ -6,6 +5,7 @@ #include "ace/Log_Msg.h" #include "ace/OS_NS_sys_stat.h" #include "ace/OS_Memory.h" +#include "ace/Truncate.h" #if !defined (__ACE_INLINE__) #include "ace/FILE_IO.inl" @@ -13,6 +13,8 @@ ACE_RCSID(ace, FILE_IO, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_FILE_IO) void @@ -44,7 +46,7 @@ ACE_FILE_IO::send (size_t n, ...) const { ACE_TRACE ("ACE_FILE_IO::send"); va_list argp; - size_t total_tuples = n / 2; + int total_tuples = ACE_Utils::Truncate (n / 2); iovec *iovp = 0; #if defined (ACE_HAS_ALLOCA) iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); @@ -56,7 +58,7 @@ ACE_FILE_IO::send (size_t n, ...) const va_start (argp, n); - for (size_t i = 0; i < total_tuples; i++) + for (int i = 0; i < total_tuples; i++) { iovp[i].iov_base = va_arg (argp, char *); iovp[i].iov_len = va_arg (argp, int); @@ -83,7 +85,7 @@ ACE_FILE_IO::recv (size_t n, ...) const { ACE_TRACE ("ACE_FILE_IO::recv"); va_list argp; - size_t total_tuples = n / 2; + int total_tuples = ACE_Utils::Truncate (n / 2); iovec *iovp = 0; #if defined (ACE_HAS_ALLOCA) iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); @@ -95,7 +97,7 @@ ACE_FILE_IO::recv (size_t n, ...) const va_start (argp, n); - for (size_t i = 0; i < total_tuples; i++) + for (int i = 0; i < total_tuples; i++) { iovp[i].iov_base = va_arg (argp, char *); iovp[i].iov_len = va_arg (argp, int); @@ -136,3 +138,5 @@ ACE_FILE_IO::recvv (iovec *io_vec) else return length; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FILE_IO.h b/ace/FILE_IO.h index 0bc7c98e187..ada2266c618 100644 --- a/ace/FILE_IO.h +++ b/ace/FILE_IO.h @@ -30,6 +30,8 @@ # include "ace/OS_NS_stropts.h" #endif /* ACE_HAS_STREAM_PIPES */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. class ACE_Message_Block; class ACE_Time_Value; @@ -158,6 +160,8 @@ public: typedef ACE_FILE_Addr PEER_ADDR; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/FILE_IO.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/FILE_IO.inl b/ace/FILE_IO.inl index a55024798b0..7db33a0c717 100644 --- a/ace/FILE_IO.inl +++ b/ace/FILE_IO.inl @@ -1,12 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// FILE_IO.i - #include "ace/ACE.h" #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_unistd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ssize_t ACE_FILE_IO::sendv_n (const iovec iov[], int n) const { @@ -147,3 +148,5 @@ ACE_FILE_IO::recv (void *buf, size_t n, } #endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/File_Lock.cpp b/ace/File_Lock.cpp index 5f227e5c4e8..038e0224820 100644 --- a/ace/File_Lock.cpp +++ b/ace/File_Lock.cpp @@ -9,6 +9,8 @@ ACE_RCSID(ace, File_Lock, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_File_Lock) void @@ -67,14 +69,4 @@ ACE_File_Lock::~ACE_File_Lock (void) this->remove (this->unlink_in_destructor_); } -// These are instantiated both with and without ACE_HAS_THREADS. - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -// template class ACE_Guard<ACE_File_Lock>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -// #pragma instantiate ACE_Guard<ACE_File_Lock> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/File_Lock.h b/ace/File_Lock.h index 4fc5ee2889e..686fee3e0df 100644 --- a/ace/File_Lock.h +++ b/ace/File_Lock.h @@ -14,12 +14,7 @@ #define ACE_FILE_LOCK_H #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -27,6 +22,8 @@ #include "ace/OS_NS_stdio.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_File_Lock * @@ -35,7 +32,7 @@ * Allows us to "adapt" the UNIX file locking mechanisms to work * with all of our Guard stuff... */ -class ACE_Threads_Export ACE_File_Lock +class ACE_Export ACE_File_Lock { public: /** @@ -58,7 +55,7 @@ public: int unlink_in_destructor = 1); /// Open the <filename> with <flags> and <mode> and set the result to - /// <handle_>. + /// <handle_>. int open (const ACE_TCHAR *filename, int flags, mode_t mode = 0); @@ -123,11 +120,11 @@ public: */ int tryacquire_read (short whence = 0, off_t start = 0, off_t len = 1); - /// Get underlying <ACE_HANDLE> for the file. + /// Get underlying ACE_HANDLE for the file. ACE_HANDLE get_handle (void) const; /** - * Set underlying <ACE_HANDLE>. Note that this method assumes + * Set underlying ACE_HANDLE. Note that this method assumes * ownership of the <handle> and will close it down in <remove>. If * you want the <handle> to stay open when <remove> is called make * sure to call <dup> on the <handle> before closing it. You are @@ -163,6 +160,8 @@ private: ACE_File_Lock (const ACE_File_Lock &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/File_Lock.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/File_Lock.inl b/ace/File_Lock.inl index a0dc79dcc7b..be9c149b8d8 100644 --- a/ace/File_Lock.inl +++ b/ace/File_Lock.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_File_Lock::acquire_read (short whence, off_t start, off_t len) { @@ -87,3 +90,5 @@ ACE_File_Lock::set_handle (ACE_HANDLE h) this->lock_.handle_ = h; this->removed_ = 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Filecache.cpp b/ace/Filecache.cpp index ace8bc594a4..74c97688f8a 100644 --- a/ace/Filecache.cpp +++ b/ace/Filecache.cpp @@ -42,6 +42,8 @@ ACE_RCSID (ace, // static const int WCOPY_FLAGS = O_RDWR | O_CREAT | O_TRUNC; #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // static data members ACE_Filecache *ACE_Filecache::cvf_ = 0; @@ -746,16 +748,4 @@ ACE_Filecache_Object::update (void) const return result; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<const ACE_TCHAR *, ACE_Filecache_Object *>; -template class ACE_Hash_Map_Manager_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<const ACE_TCHAR *, ACE_Filecache_Object *> -#pragma instantiate ACE_Hash_Map_Manager_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<const ACE_TCHAR *, ACE_Filecache_Object *, ACE_Hash<const ACE_TCHAR *>, ACE_Equal_To<const ACE_TCHAR *>, ACE_Null_Mutex> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Filecache.h b/ace/Filecache.h index c6986bd465d..f6c1bef7b3b 100644 --- a/ace/Filecache.h +++ b/ace/Filecache.h @@ -28,6 +28,8 @@ #include "ace/RW_Thread_Mutex.h" #include "ace/OS_NS_sys_stat.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + enum ACE_Filecache_Flag { ACE_NOMAP = 0, @@ -344,6 +346,7 @@ private: ACE_SYNCH_RW_MUTEX &lock_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/ace/FlReactor.cpp b/ace/FlReactor.cpp index 1eed0acf20d..f45ce67a994 100644 --- a/ace/FlReactor.cpp +++ b/ace/FlReactor.cpp @@ -6,12 +6,14 @@ ACE_RCSID(ace, FlReactor, "$Id$") #include /**/ <FL/Fl.h> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_FlReactor) // Must be called with lock held ACE_FlReactor::ACE_FlReactor (size_t size, - int restart, - ACE_Sig_Handler *h) + int restart, + ACE_Sig_Handler *h) : ACE_Select_Reactor (size, restart, h) { // When the ACE_Select_Reactor is constructed it creates the notify @@ -40,7 +42,7 @@ ACE_FlReactor::~ACE_FlReactor (void) int ACE_FlReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, - ACE_Time_Value *max_wait_time) + ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_FlReactor::wait_for_multiple_events"); int nfound; @@ -124,9 +126,9 @@ ACE_FlReactor::fl_io_proc (int fd, void* reactor) wait_set.ex_mask_.set_bit (handle); int result = ACE_OS::select (fd + 1, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, &zero); + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, &zero); ACE_Select_Reactor_Handle_Set dispatch_set; @@ -134,11 +136,11 @@ ACE_FlReactor::fl_io_proc (int fd, void* reactor) if (result > 0) { if (wait_set.rd_mask_.is_set (handle)) - dispatch_set.rd_mask_.set_bit (handle); + dispatch_set.rd_mask_.set_bit (handle); if (wait_set.wr_mask_.is_set (handle)) - dispatch_set.wr_mask_.set_bit (handle); + dispatch_set.wr_mask_.set_bit (handle); if (wait_set.ex_mask_.is_set (handle)) - dispatch_set.ex_mask_.set_bit (handle); + dispatch_set.ex_mask_.set_bit (handle); self->dispatch (1, dispatch_set); } @@ -158,8 +160,8 @@ ACE_FlReactor::fl_timeout_proc (void* reactor) int ACE_FlReactor::register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_FlReactor::register_handler_i"); @@ -195,8 +197,8 @@ ACE_FlReactor::register_handler_i (ACE_HANDLE handle, int ACE_FlReactor::register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) { return ACE_Select_Reactor::register_handler_i (handles, handler, @@ -205,7 +207,7 @@ ACE_FlReactor::register_handler_i (const ACE_Handle_Set &handles, int ACE_FlReactor::remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_FlReactor::remove_handler_i"); @@ -223,10 +225,10 @@ ACE_FlReactor::remove_handler_i (ACE_HANDLE handle, int ACE_FlReactor::remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { return ACE_Select_Reactor::remove_handler_i (handles, - mask); + mask); } // The following function ensures there's an Fl timeout for the first @@ -271,9 +273,9 @@ ACE_FlReactor::reset_timer_interval long ACE_FlReactor::schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, + const void *arg, const ACE_Time_Value &delay, - const ACE_Time_Value &interval) + const ACE_Time_Value &interval) { ACE_TRACE ("ACE_FlReactor::schedule_timer"); ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); @@ -293,12 +295,12 @@ ACE_FlReactor::schedule_timer (ACE_Event_Handler *event_handler, int ACE_FlReactor::cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close) + int dont_call_handle_close) { ACE_TRACE ("ACE_FlReactor::cancel_timer"); if (ACE_Select_Reactor::cancel_timer (handler, - dont_call_handle_close) == -1) + dont_call_handle_close) == -1) return -1; else { @@ -309,14 +311,14 @@ ACE_FlReactor::cancel_timer (ACE_Event_Handler *handler, int ACE_FlReactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) + const void **arg, + int dont_call_handle_close) { ACE_TRACE ("ACE_FlReactor::cancel_timer"); if (ACE_Select_Reactor::cancel_timer (timer_id, - arg, - dont_call_handle_close) == -1) + arg, + dont_call_handle_close) == -1) return -1; else { @@ -324,3 +326,5 @@ ACE_FlReactor::cancel_timer (long timer_id, return 0; } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/FlReactor.h b/ace/FlReactor.h index b1813fdd9bd..75d88b0ab5c 100644 --- a/ace/FlReactor.h +++ b/ace/FlReactor.h @@ -28,6 +28,8 @@ #include "ace/ACE_FlReactor_export.h" #include "ace/Select_Reactor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_FlReactor * @@ -102,5 +104,7 @@ private: ACE_FlReactor &operator = (const ACE_FlReactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_FLREACTOR_H */ diff --git a/ace/Flag_Manip.cpp b/ace/Flag_Manip.cpp index e1b1c25b7a6..ee074a2d10d 100644 --- a/ace/Flag_Manip.cpp +++ b/ace/Flag_Manip.cpp @@ -19,6 +19,8 @@ ACE_RCSID (ace, Flag_Manip, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Flags are file status flags to turn on. int @@ -32,7 +34,7 @@ ACE::set_flags (ACE_HANDLE handle, int flags) // nonblocking argument (1) // blocking: (0) { - u_long nonblock = 1; + int nonblock = 1; return ACE_OS::ioctl (handle, FIONBIO, &nonblock); } default: @@ -68,7 +70,7 @@ ACE::clr_flags (ACE_HANDLE handle, int flags) // nonblocking argument (1) // blocking: (0) { - u_long nonblock = 0; + int nonblock = 0; return ACE_OS::ioctl (handle, FIONBIO, &nonblock); } default: @@ -89,3 +91,5 @@ ACE::clr_flags (ACE_HANDLE handle, int flags) return 0; #endif /* ACE_LACKS_FCNTL */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Flag_Manip.h b/ace/Flag_Manip.h index 28646f98350..e1f3fc1d997 100644 --- a/ace/Flag_Manip.h +++ b/ace/Flag_Manip.h @@ -31,6 +31,7 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE { @@ -47,6 +48,8 @@ namespace ACE ACE_NAMESPACE_INLINE_FUNCTION int get_flags (ACE_HANDLE handle); } +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Flag_Manip.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Flag_Manip.inl b/ace/Flag_Manip.inl index 0009be56695..da24f2a1282 100644 --- a/ace/Flag_Manip.inl +++ b/ace/Flag_Manip.inl @@ -1,17 +1,19 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Return flags currently associated with handle. - #include "ace/OS_NS_fcntl.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Return flags currently associated with handle. ACE_INLINE int ACE::get_flags (ACE_HANDLE handle) { ACE_TRACE ("ACE::get_flags"); #if defined (ACE_LACKS_FCNTL) - // ACE_OS::fcntl is not supported, e.g., on VxWorks. It + // ACE_OS::fcntl is not supported. It // would be better to store ACE's notion of the flags // associated with the handle, but this works for now. ACE_UNUSED_ARG (handle); @@ -20,3 +22,5 @@ ACE::get_flags (ACE_HANDLE handle) return ACE_OS::fcntl (handle, F_GETFL, 0); #endif /* ACE_LACKS_FCNTL */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Framework_Component.cpp b/ace/Framework_Component.cpp index 6b035cc922e..17c112f06c9 100644 --- a/ace/Framework_Component.cpp +++ b/ace/Framework_Component.cpp @@ -15,6 +15,8 @@ ACE_RCSID(ace, Framework_Component, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Framework_Component::~ACE_Framework_Component (void) { ACE_TRACE ("ACE_Framework_Component::~ACE_Framework_Component"); @@ -274,3 +276,5 @@ ACE_Framework_Repository::ACE_Framework_Repository (int size) ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Framework_Repository"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Framework_Component.h b/ace/Framework_Component.h index 318867773ba..d0d2e6f89e2 100644 --- a/ace/Framework_Component.h +++ b/ace/Framework_Component.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file Framework_Component.h @@ -8,7 +9,7 @@ * A prototype mechanism that allows framework components, singletons * such as ACE_Reactor, ACE_Proactor, etc, to be registered with a * central repository managed by the <ACE_Object_Manager> or - * <ACE_Service_Config> that will handle destruction. + * ACE_Service_Config that will handle destruction. * * This technique obviates changing ACE_Object_Manager and * ACE_Service_Config everytime a new framework is added. Which also @@ -47,6 +48,8 @@ #define ACE_DEFAULT_FRAMEWORK_REPOSITORY_SIZE 1024 +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Framework_Component * @@ -71,6 +74,11 @@ protected: virtual ~ACE_Framework_Component (void); private: + // No copy possible + ACE_Framework_Component (const ACE_Framework_Component &); + void operator= (const ACE_Framework_Component &); + +private: /// Pointer to the actual component. const void *this_; @@ -144,12 +152,13 @@ public: /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; -private: - // = Initialization and termination methods. +protected: /// Initialize the repository. ACE_Framework_Repository (int size = ACE_Framework_Repository::DEFAULT_SIZE); +private: + /// Actually removes the dll components, must be called with locks held. int remove_dll_components_i (const ACE_TCHAR *dll_name); @@ -157,6 +166,12 @@ private: /// order. void compact (void); + /// Disallow copying and assignment. + ACE_Framework_Repository (const ACE_Framework_Repository &); + ACE_Framework_Repository &operator= (const ACE_Framework_Repository &); + +private: + /// Contains all the framework components. ACE_Framework_Component **component_vector_; @@ -180,11 +195,10 @@ private: ACE_Thread_Mutex lock_; #endif /* ACE_MT_SAFE */ - /// Don't allow these to be called. - ACE_UNIMPLEMENTED_FUNC (ACE_Framework_Repository (const ACE_Framework_Repository &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Framework_Repository &operator= (const ACE_Framework_Repository &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Framework_Component.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Framework_Component.inl b/ace/Framework_Component.inl index 2d3662642bd..6e6146114f7 100644 --- a/ace/Framework_Component.inl +++ b/ace/Framework_Component.inl @@ -1,13 +1,14 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Framework_Component.inl - #include "ace/ACE.h" #include "ace/Guard_T.h" -ACE_INLINE -ACE_Framework_Component::ACE_Framework_Component (void *_this, +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +ACE_Framework_Component::ACE_Framework_Component (void *_this, const ACE_TCHAR *dll_name, const ACE_TCHAR *name) : this_ (_this), @@ -34,3 +35,5 @@ ACE_Framework_Repository::total_size (void) const ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1)); return this->total_size_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Framework_Component_T.cpp b/ace/Framework_Component_T.cpp index cbaf65463d8..509d6609daf 100644 --- a/ace/Framework_Component_T.cpp +++ b/ace/Framework_Component_T.cpp @@ -1,11 +1,11 @@ -// Framework_Component_T.cpp // $Id$ + #ifndef ACE_FRAMEWORK_COMPONENT_T_CPP #define ACE_FRAMEWORK_COMPONENT_T_CPP #include "ace/Framework_Component_T.h" -ACE_RCSID(ace, Framework_Component_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class Concrete> ACE_Framework_Component_T<Concrete>::ACE_Framework_Component_T (Concrete *concrete) @@ -28,4 +28,6 @@ ACE_Framework_Component_T<Concrete>::close_singleton (void) Concrete::close_singleton (); } -#endif /*ACE_FRAWORK_COMPONENT_T_CPP*/ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_FRAMEWORK_COMPONENT_T_CPP */ diff --git a/ace/Framework_Component_T.h b/ace/Framework_Component_T.h index 226fabbd432..13440ea88ae 100644 --- a/ace/Framework_Component_T.h +++ b/ace/Framework_Component_T.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file Framework_Component_T.h @@ -18,6 +19,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Framework_Component_T * @@ -47,6 +50,8 @@ public: void close_singleton (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + // This macro should be called in the instance() method // of the Concrete class that will be managed. Along // with the appropriate template instantiation. diff --git a/ace/Free_List.cpp b/ace/Free_List.cpp index d0d24e2ba05..60dfabafb1c 100644 --- a/ace/Free_List.cpp +++ b/ace/Free_List.cpp @@ -10,13 +10,11 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - -// Empty constructor +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class T> ACE_Free_List<T>::~ACE_Free_List (void) { - // Nothing } // Default constructor that takes in a preallocation number @@ -57,13 +55,13 @@ ACE_Locked_Free_List<T, ACE_LOCK>::~ACE_Locked_Free_List (void) // elements withing and it pasts the high water mark, delete the // element) -template <class T, class ACE_LOCK> void +template <class T, class ACE_LOCK> void ACE_Locked_Free_List<T, ACE_LOCK>::add (T *element) { ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); // Check to see that we not at the high water mark. - if (this->mode_ == ACE_PURE_FREE_LIST + if (this->mode_ == ACE_PURE_FREE_LIST || this->size_ < this->hwm_) { element->set_next (this->free_list_); @@ -102,7 +100,7 @@ ACE_Locked_Free_List<T, ACE_LOCK>::remove (void) // Returns the current size of the free list -template <class T, class ACE_LOCK> size_t +template <class T, class ACE_LOCK> size_t ACE_Locked_Free_List<T, ACE_LOCK>::size (void) { return this->size_; @@ -110,7 +108,7 @@ ACE_Locked_Free_List<T, ACE_LOCK>::size (void) // Resizes the free list to <newsize> -template <class T, class ACE_LOCK> void +template <class T, class ACE_LOCK> void ACE_Locked_Free_List<T, ACE_LOCK>::resize (size_t newsize) { ACE_MT (ACE_GUARD (ACE_LOCK, ace_mon, this->mutex_)); @@ -120,7 +118,7 @@ ACE_Locked_Free_List<T, ACE_LOCK>::resize (size_t newsize) // Check to see if we grow or shrink if (newsize < this->size_) this->dealloc (this->size_ - newsize); - else + else this->alloc (newsize - this->size_); } @@ -154,4 +152,6 @@ ACE_Locked_Free_List<T, ACE_LOCK>::dealloc (size_t n) } } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_FREE_LIST_CPP */ diff --git a/ace/Free_List.h b/ace/Free_List.h index b229406c991..d16b5e92945 100644 --- a/ace/Free_List.h +++ b/ace/Free_List.h @@ -24,6 +24,8 @@ #include "ace/Default_Constants.h" #include "ace/os_include/os_stddef.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Free_List * @@ -96,14 +98,14 @@ public: /// Returns the current size of the free list. virtual size_t size (void); - /// Resizes the free list to <newsize>. + /// Resizes the free list to @a newsize. virtual void resize (size_t newsize); protected: - /// Allocates <n> extra nodes for the freelist. + /// Allocates @a n extra nodes for the freelist. virtual void alloc (size_t n); - /// Removes and frees <n> nodes from the freelist. + /// Removes and frees @a n nodes from the freelist. virtual void dealloc (size_t n); /// Free list operation mode, either ACE_FREE_LIST_WITH_POOL or @@ -125,7 +127,7 @@ protected: /// Keeps track of the size of the list. size_t size_; - /// Synchronization variable for <ACE_Timer_Queue>. + /// Synchronization variable for ACE_Timer_Queue. ACE_LOCK mutex_; private: @@ -134,6 +136,8 @@ private: ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Locked_Free_List<T, ACE_LOCK> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Free_List.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Functor.cpp b/ace/Functor.cpp index b42375de277..3e943fe3d54 100644 --- a/ace/Functor.cpp +++ b/ace/Functor.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ // $Id$ // ============================================================================ @@ -29,9 +28,6 @@ // // ============================================================================ -#if !defined (ACE_FUNCTOR_C) -#define ACE_FUNCTOR_C - #include "ace/Functor_T.h" #include "ace/Functor.h" @@ -41,12 +37,10 @@ ACE_RCSID(ace, Functor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Command_Base::~ACE_Command_Base (void) { } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_FUNCTOR_C */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Functor.h b/ace/Functor.h index 22f160adef5..9cf8f200336 100644 --- a/ace/Functor.h +++ b/ace/Functor.h @@ -41,6 +41,8 @@ #include "ace/ACE_export.h" #include "ace/Basic_Types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ////////////////////////////////////////////////////////////// // GOF Command Pattern Classes and Template Specializations // ////////////////////////////////////////////////////////////// @@ -125,6 +127,7 @@ public: unsigned long operator () (unsigned char t) const; }; +#if 0 // @@ ADD HASHES FOR ACE TYPES /** @@ -193,6 +196,117 @@ public: }; // @@ DONE ADDING HASHES FOR ACE TYPES +#endif + +/** + * @class ACE_Hash<short> + * + * @brief Function object for hashing a short number + */ +template<> +class ACE_Export ACE_Hash<short> +{ +public: + /// Simply returns t + unsigned long operator () (short t) const; +}; + +/** + * @class ACE_Hash<unsigned short> + * + * @brief Function object for hashing an unsigned short number + */ +template<> +class ACE_Export ACE_Hash<unsigned short> +{ +public: + /// Simply returns t + unsigned long operator () (unsigned short t) const; +}; + +/** + * @class ACE_Hash<int> + * + * @brief Function object for hashing an int number + */ +template<> +class ACE_Export ACE_Hash<int> +{ +public: + /// Simply returns t + unsigned long operator () (int t) const; +}; + +/** + * @class ACE_Hash<unsigned int> + * + * @brief Function object for hashing an unsigned int number + */ +template<> +class ACE_Export ACE_Hash<unsigned int> +{ +public: + /// Simply returns t + unsigned long operator () (unsigned int t) const; +}; + +/** + * @class ACE_Hash<long> + * + * @brief Function object for hashing a long number + */ +template<> +class ACE_Export ACE_Hash<long> +{ +public: + /// Simply returns t + unsigned long operator () (long t) const; +}; + +/** + * @class ACE_Hash<unsigned long> + * + * @brief Function object for hashing an unsigned long number + */ +template<> +class ACE_Export ACE_Hash<unsigned long> +{ +public: + /// Simply returns t + unsigned long operator () (unsigned long t) const; +}; + +#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) +/** + * @class ACE_Hash<ACE_INT64> + * + * @brief Function object for hashing a signed 64-bit number + */ +template<> +class ACE_Export ACE_Hash<ACE_INT64> +{ +public: + /// Simply returns t + unsigned long operator () (ACE_INT64 t) const; +}; +#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ + +// We can do this even if ACE_LACKS_UNSIGNEDLONGLONG_T because there's an +// emulation for it in ACE_U_LongLong. +#if (ACE_SIZEOF_LONG < 8) +/** + * @class ACE_Hash<ACE_UINT64> + * + * @brief Function object for hashing an unsigned 64-bit number + */ +template<> +class ACE_Export ACE_Hash<ACE_UINT64> +{ +public: + /// Simply returns t + unsigned long operator () (const ACE_UINT64 &t) const; +}; +#endif /* ACE_SIZEOF_LONG < 8 */ /** * @class ACE_Hash<const char *> @@ -465,6 +579,9 @@ public: const wchar_t *rhs) const; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Functor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Functor.inl b/ace/Functor.inl index 99bc0af7216..c505ed328b3 100644 --- a/ace/Functor.inl +++ b/ace/Functor.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ // ============================================================================ @@ -7,7 +8,7 @@ // ace // // = FILENAME -// Functor.i +// Functor.inl // // = DESCRIPTION // Inlinable method definitions for non-templatized classes @@ -32,6 +33,8 @@ #include "ace/ACE.h" #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ////////////////////////////////////////////////////////////// // GOF Command Pattern Classes and Template Specializations // ////////////////////////////////////////////////////////////// @@ -73,6 +76,7 @@ ACE_Hash<unsigned char>::operator () (unsigned char t) const return t; } +#if 0 ACE_INLINE unsigned long ACE_Hash<ACE_INT16>::operator () (ACE_INT16 t) const { @@ -106,7 +110,64 @@ ACE_Hash<ACE_UINT64>::operator () (ACE_UINT64 t) const return static_cast<unsigned long> (t); #endif /* ACE_SIZEOF_LONG */ } +#endif + +ACE_INLINE unsigned long +ACE_Hash<short>::operator () (short t) const +{ + return static_cast<unsigned long> (t); +} + +ACE_INLINE unsigned long +ACE_Hash<unsigned short>::operator () (unsigned short t) const +{ + return static_cast<unsigned long> (t); +} + +ACE_INLINE unsigned long +ACE_Hash<int>::operator () (int t) const +{ + return static_cast<unsigned long> (t); +} + +ACE_INLINE unsigned long +ACE_Hash<unsigned int>::operator () (unsigned int t) const +{ + return static_cast<unsigned long> (t); +} + +ACE_INLINE unsigned long +ACE_Hash<long>::operator () (long t) const +{ + return static_cast<unsigned long> (t); +} +ACE_INLINE unsigned long +ACE_Hash<unsigned long>::operator () (unsigned long t) const +{ + return t; +} + +// This #if needs to match the one in Functor.h +#if !defined (ACE_LACKS_LONGLONG_T) && (ACE_SIZEOF_LONG < 8) +ACE_INLINE unsigned long +ACE_Hash<ACE_INT64>::operator () (ACE_INT64 t) const +{ + return static_cast<unsigned long> (t); +} +#endif /* !ACE_LACKS_LONGLONG_T && ACE_SIZEOF_LONG < 8 */ + +#if (ACE_SIZEOF_LONG < 8) +ACE_INLINE unsigned long +ACE_Hash<ACE_UINT64>::operator () (const ACE_UINT64 &t) const +{ +#if (ACE_SIZEOF_LONG == 4) + return ACE_U64_TO_U32 (t); +#else + return static_cast<unsigned long> (t); +#endif /* ACE_SIZEOF_LONG */ +} +#endif /* !ACE_LACKS_UNSIGNEDLONGLONG_T */ ACE_INLINE unsigned long ACE_Hash<const char *>::operator () (const char *t) const @@ -220,3 +281,5 @@ ACE_Less_Than<wchar_t *>::operator () (const wchar_t *lhs, const wchar_t *rhs) c return (ACE_OS::strcmp (lhs, rhs) < 0) ? 1 : 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Functor_String.h b/ace/Functor_String.h index 2e84295ef76..4becd6c4cf0 100644 --- a/ace/Functor_String.h +++ b/ace/Functor_String.h @@ -11,7 +11,6 @@ * could be placed in Functor.h. But we don't want to couple string * types to the rest of ACE+TAO. Hence they are placed in a seperate * file. - * */ //========================================================================== #ifndef ACE_FUNCTOR_STRING_H @@ -27,6 +26,8 @@ #include "ace/ACE_export.h" #include "ace/SStringfwd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + //////////////////////////////////////////////////////////// // STL-style Functor Classes and Template Specializations // //////////////////////////////////////////////////////////// @@ -125,6 +126,9 @@ public: const ACE_WString &rhs) const; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Functor_String.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Functor_String.inl b/ace/Functor_String.inl index e2fcf99a036..a9d5f0597d6 100644 --- a/ace/Functor_String.inl +++ b/ace/Functor_String.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/ACE.h" #include "ace/String_Base.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE unsigned long ACE_Hash<ACE_CString>::operator () (const ACE_CString &t) const { @@ -47,3 +50,5 @@ ACE_Less_Than<ACE_WString>::operator () (const ACE_WString &lhs, return (lhs < rhs); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Functor_T.cpp b/ace/Functor_T.cpp index c29f9029f75..53e8f170fc1 100644 --- a/ace/Functor_T.cpp +++ b/ace/Functor_T.cpp @@ -1,8 +1,7 @@ -/* -*- C++ -*- */ // $Id$ -#ifndef ACE_FUNCTOR_T_C -#define ACE_FUNCTOR_T_C +#ifndef ACE_FUNCTOR_T_CPP +#define ACE_FUNCTOR_T_CPP #include "ace/Functor_T.h" @@ -14,7 +13,7 @@ #include "ace/Functor_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Functor_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Command_Callback) @@ -45,5 +44,6 @@ ACE_Command_Callback<RECEIVER, ACTION>::execute (void *arg) return (receiver_.*action_) (arg); } +ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_FUNCTOR_T_C */ +#endif /* ACE_FUNCTOR_T_CPP */ diff --git a/ace/Functor_T.h b/ace/Functor_T.h index e960cad0d26..554820e3c0b 100644 --- a/ace/Functor_T.h +++ b/ace/Functor_T.h @@ -37,6 +37,9 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Functor_String.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /////////////////////////////////// // GOF Command Pattern Templates // /////////////////////////////////// @@ -136,6 +139,8 @@ public: const TYPE &rhs) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Functor_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Functor_T.inl b/ace/Functor_T.inl index 51caa11825d..6441c091b76 100644 --- a/ace/Functor_T.inl +++ b/ace/Functor_T.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TYPE> ACE_INLINE unsigned long ACE_Hash<TYPE>::operator () (const TYPE &t) const { @@ -36,3 +38,5 @@ ACE_Less_Than<TYPE>::operator () (const TYPE &lhs, { return lhs < rhs; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Future.cpp b/ace/Future.cpp index 2dc0fa5ddb8..3ca6f8225ba 100644 --- a/ace/Future.cpp +++ b/ace/Future.cpp @@ -16,6 +16,8 @@ ACE_RCSID (ace, Future, "$Id$") # include "ace/Guard_T.h" # include "ace/Recursive_Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_Future_Holder<T>::ACE_Future_Holder (void) { @@ -425,5 +427,8 @@ ACE_Future<T>::get_rep () return this->future_rep_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ + #endif /* ACE_FUTURE_CPP */ diff --git a/ace/Future.h b/ace/Future.h index 9d1e0f7800b..607ac6e8d75 100644 --- a/ace/Future.h +++ b/ace/Future.h @@ -30,6 +30,8 @@ #include "ace/Recursive_Thread_Mutex.h" #include "ace/Condition_Recursive_Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. template <class T> class ACE_Future_Holder; template <class T> class ACE_Future_Observer; @@ -122,7 +124,7 @@ private: /** * Attaches the specified observer to a subject (i.e., the <ACE_Future_Rep>). * The update method of the specified subject will be invoked with a copy of - * the written-to <ACE_Future> as input when the result gets set. + * the written-to ACE_Future as input when the result gets set. * * Returns 0 if the observer is successfully attached, 1 if the * observer is already attached, and -1 if failures occur. @@ -206,7 +208,7 @@ private: int ref_count_; typedef ACE_Future_Observer<T> - OBSERVER; + OBSERVER; typedef ACE_Unbounded_Set<OBSERVER *> OBSERVER_COLLECTION; @@ -371,6 +373,8 @@ private: FUTURE_REP *future_rep_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Future.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Future_Set.cpp b/ace/Future_Set.cpp index feac0b0d54f..d9b9e2a1ac9 100644 --- a/ace/Future_Set.cpp +++ b/ace/Future_Set.cpp @@ -1,4 +1,3 @@ -// Future.cpp // $Id$ #ifndef ACE_FUTURE_SET_CPP @@ -10,10 +9,10 @@ #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID (ace, Future_Set, "$Id$") - #if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_Future_Set<T>::ACE_Future_Set (ACE_Message_Queue<ACE_SYNCH> *new_queue) : delete_queue_ (0) @@ -119,8 +118,8 @@ ACE_Future_Set<T>::next_readable (ACE_Future<T> &future, // Remove the hash map entry with the specified future rep from our map. FUTURE_HOLDER *future_holder; - if ( this->future_map_.find (future_rep, - future_holder) != -1 ) + if (this->future_map_.find (future_rep, + future_holder) != -1) { future = future_holder->item_; this->future_map_.unbind (future_rep); @@ -131,5 +130,7 @@ ACE_Future_Set<T>::next_readable (ACE_Future<T> &future, return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ #endif /* ACE_FUTURE_SET_CPP */ diff --git a/ace/Future_Set.h b/ace/Future_Set.h index fcd17324d46..b51d1958c8b 100644 --- a/ace/Future_Set.h +++ b/ace/Future_Set.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,6 +26,8 @@ #if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Future_Set * @@ -74,17 +76,17 @@ public: /** * Wait up to <tv> time to get the <value>. Note that <tv> must be * specified in absolute time rather than relative time.); get the - * next <ACE_Future> that is readable. If <tv> = 0, the will block + * next ACE_Future that is readable. If <tv> = 0, the will block * forever. * * If a readable future becomes available, then the input - * <ACE_Future> object param will be assigned with it and 1 will - * be returned. If the <ACE_Future_Set> is empty (i.e. see definition - * of <ACE_Future_Set::is_empty>), then 0 is returned. + * ACE_Future object param will be assigned with it and 1 will + * be returned. If the ACE_Future_Set is empty (i.e. see definition + * of ACE_Future_Set::is_empty()), then 0 is returned. * - * When a readable <ACE_Future> object is retrieved via the - * <ACE_Future_Set::next_readable> method, the <ACE_Future_Set> will - * remove that <ACE_Future> object from its list of subjects. + * When a readable ACE_Future object is retrieved via the + * ACE_Future_Set::next_readable() method, the ACE_Future_Set will + * remove that ACE_Future object from its list of subjects. */ int next_readable (ACE_Future<T> &result, ACE_Time_Value *tv = 0); @@ -115,7 +117,7 @@ private: FUTURE_HOLDER *, FUTURE_REP_HASH, FUTURE_REP_COMPARE, - ACE_Null_Mutex> FUTURE_HASH_MAP; + ACE_Null_Mutex> FUTURE_HASH_MAP; /// Map of <ACE_Futures>, subjects, which have not been written to by /// client's writer thread. @@ -129,6 +131,8 @@ private: int delete_queue_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Future_Set.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Get_Opt.cpp b/ace/Get_Opt.cpp index 52c9ad67b26..50e6d4fa07b 100644 --- a/ace/Get_Opt.cpp +++ b/ace/Get_Opt.cpp @@ -2,6 +2,10 @@ #include "ace/Get_Opt.h" +#if !defined (__ACE_INLINE__) +#include "ace/Get_Opt.inl" +#endif /* __ACE_INLINE__ */ + ACE_RCSID (ace, Get_Opt, "$Id$") @@ -75,3 +79,17 @@ ACE_RCSID (ace, * POSSIBILITY OF SUCH DAMAGE. */ +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * Templates cannot be exported. Only explicit instances can. + * This is also a way to restrict what instances will be + * publicly available. + */ +#if !defined (__ACE_INLINE__) + template class ACE_Get_Arg_Opt< ACE_TCHAR >; +#endif /* __ACE_INLINE__ */ + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Get_Opt.h b/ace/Get_Opt.h index c47951a3271..2237dd412f9 100644 --- a/ace/Get_Opt.h +++ b/ace/Get_Opt.h @@ -26,6 +26,8 @@ #undef optarg #undef opterr +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /* * These definitions are for backward compatibility with previous versions. * of ACE_Get_Arg_Opt. @@ -40,7 +42,7 @@ */ template < typename CHAR_TYPE = char > -class ACE_Get_Arg_Opt +class ACE_Export ACE_Get_Arg_Opt { public: typedef CHAR_TYPE Char; @@ -373,7 +375,7 @@ private: int has_arg, int val = 0); - /// Default dtor. + /// Dtor. ~ACE_Get_Opt_Long_Option (void); bool operator < (const ACE_Get_Opt_Long_Option &rhs); @@ -413,6 +415,8 @@ private: /// Set last_option. void last_option (const String &s); +private: + /// Holds the option string. String *optstring_; @@ -460,13 +464,19 @@ private: /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; + // Disallow copying and assignment. ACE_UNIMPLEMENTED_FUNC (ACE_Get_Arg_Opt (const ACE_Get_Arg_Opt<CHAR_TYPE> &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Get_Arg_Opt &operator= (const ACE_Get_Arg_Opt<CHAR_TYPE> &)) + ACE_UNIMPLEMENTED_FUNC (ACE_Get_Arg_Opt &operator= (const ACE_Get_Arg_Opt<CHAR_TYPE> &)) }; typedef ACE_Get_Arg_Opt< ACE_TCHAR > ACE_Get_Opt; +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) #include "ace/Get_Opt.inl" +#endif /* __ACE_INLINE__ */ + #include /**/ "ace/post.h" #endif /* ACE_GET_OPT_H */ diff --git a/ace/Get_Opt.inl b/ace/Get_Opt.inl index 1db0c562aee..6683215bdf6 100644 --- a/ace/Get_Opt.inl +++ b/ace/Get_Opt.inl @@ -10,6 +10,8 @@ #include "ace/OS_NS_ctype.h" #include "ace/OS_NS_stdlib.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Get_Arg_Opt) template < typename CHAR_TYPE > @@ -739,3 +741,5 @@ ACE_Get_Arg_Opt<CHAR_TYPE>::opt_ind (void) { return this->optind; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Global_Macros.h b/ace/Global_Macros.h index 83ea5603395..8487880e797 100644 --- a/ace/Global_Macros.h +++ b/ace/Global_Macros.h @@ -28,6 +28,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/config-lite.h" +#include "ace/Assert.h" // For ACE_ASSERT // Start Global Macros # define ACE_BEGIN_DUMP ACE_LIB_TEXT ("\n====\n(%P|%t|%x)\n") @@ -48,6 +49,9 @@ # if defined (_DEBUG) && !defined (ACE_HAS_WINCE) && !defined (__BORLANDC__) # include /**/ <crtdbg.h> +// Open versioned namespace, if enabled by the user. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_No_Heap_Check { public: @@ -58,6 +62,10 @@ public: private: int old_state; }; + +// Close versioned namespace, if enabled by the user. +ACE_END_VERSIONED_NAMESPACE_DECL + # define ACE_NO_HEAP_CHECK ACE_No_Heap_Check ____no_heap; # else /* !_DEBUG */ # define ACE_NO_HEAP_CHECK @@ -120,14 +128,12 @@ private: // ---------------------------------------------------------------- -// Deal with MSVC++ 6 (or less) insanity for CORBA... -# if !defined (ACE_NESTED_CLASS) -# if defined (ACE_HAS_BROKEN_NAMESPACES) -# define ACE_NESTED_CLASS(TYPE, NAME) NAME -# else /* ! ACE_HAS_BROKEN_NAMESPACES */ -# define ACE_NESTED_CLASS(TYPE, NAME) TYPE::NAME -# endif /* ! ACE_HAS_BROKEN_NAMESPACES */ -# endif /* !ACE_NESTED_CLASS */ +#if !defined (ACE_LACKS_DEPRECATED_MACROS) + /** + * This macro is deprecated + */ + #define ACE_NESTED_CLASS(TYPE, NAME) TYPE::NAME +#endif /* ACE_LACKS_DEPRECATED_MACROS */ #if !defined (ACE_LACKS_DEPRECATED_MACROS) /** @@ -141,9 +147,9 @@ private: * release. */ //@{ - # define ACE_CORBA_1(NAME) CORBA::NAME - # define ACE_CORBA_2(TYPE, NAME) CORBA::TYPE::NAME - # define ACE_CORBA_3(TYPE, NAME) CORBA::TYPE::NAME + #define ACE_CORBA_1(NAME) CORBA::NAME + #define ACE_CORBA_2(TYPE, NAME) CORBA::TYPE::NAME + #define ACE_CORBA_3(TYPE, NAME) CORBA::TYPE::NAME //@} #endif /* ACE_LACKS_DEPRECATED_MACROS */ @@ -586,6 +592,27 @@ static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS; #endif /* !ACE_LACKS_STATIC_CONSTRUCTORS */ +// Preprocessor symbols will not be expanded if they are +// concatenated. Force the preprocessor to expand them during the +// argument prescan by calling a macro that itself calls another that +// performs the actual concatenation. +#define ACE_PREPROC_CONCATENATE_IMPL(A,B) A ## B +#define ACE_PREPROC_CONCATENATE(A,B) ACE_PREPROC_CONCATENATE_IMPL(A,B) + +#if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1 +// Preprocessor symbols will not be expanded if they are +// concatenated. Force the preprocessor to expand them during the +// argument prescan by calling a macro that itself calls another that +// performs the actual concatenation. +# define ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(PREFIX,VERSIONED_NAMESPACE,SERVICE_CLASS) PREFIX ## _ ## VERSIONED_NAMESPACE ## _ ## SERVICE_CLASS +#else +# define ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(PREFIX,VERSIONED_NAMESPACE,SERVICE_CLASS) PREFIX ## _ ## SERVICE_CLASS +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + +#define ACE_MAKE_SVC_CONFIG_FACTORY_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_make,VERSIONED_NAMESPACE,SERVICE_CLASS) +#define ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(VERSIONED_NAMESPACE,SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FUNCTION_NAME(_gobble,VERSIONED_NAMESPACE,SERVICE_CLASS) + + /// Declare the factory method used to create dynamically loadable /// services. /** @@ -602,9 +629,9 @@ static ACE_Static_Svc_##SERVICE_CLASS ace_static_svc_##SERVICE_CLASS; * implements the service. * */ -#define ACE_FACTORY_DECLARE(CLS,SERVICE_CLASS) \ -extern "C" CLS##_Export ACE_Service_Object *\ -_make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *); +# define ACE_FACTORY_DECLARE(CLS,SERVICE_CLASS) \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * \ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *); /// Define the factory method (and destructor) for a dynamically /// loadable service. @@ -623,16 +650,17 @@ _make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *); # define ACE_Local_Service_Export # define ACE_FACTORY_DEFINE(CLS,SERVICE_CLASS) \ -void _gobble_##SERVICE_CLASS (void *p) { \ - ACE_Service_Object *_p = static_cast<ACE_Service_Object *> (p); \ +void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \ + static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \ ACE_ASSERT (_p != 0); \ delete _p; } \ -extern "C" CLS##_Export ACE_Service_Object *\ -_make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *gobbler) \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \ { \ ACE_TRACE (#SERVICE_CLASS); \ if (gobbler != 0) \ - *gobbler = (ACE_Service_Object_Exterminator) _gobble_##SERVICE_CLASS; \ + *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \ return new SERVICE_CLASS; \ } @@ -663,25 +691,26 @@ _make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *gobbler) \ * style functions. */ # define ACE_FACTORY_NAMESPACE_DEFINE(CLS,SERVICE_CLASS,NAMESPACE_CLASS) \ -void _gobble_##SERVICE_CLASS (void *p) { \ - ACE_Service_Object *_p = static_cast<ACE_Service_Object *> (p); \ +void ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (void *p) { \ + ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object * _p = \ + static_cast< ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *> (p); \ ACE_ASSERT (_p != 0); \ delete _p; } \ -extern "C" CLS##_Export ACE_Service_Object *\ -_make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *gobbler) \ +extern "C" CLS##_Export ACE_VERSIONED_NAMESPACE_NAME::ACE_Service_Object *\ +ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) (ACE_Service_Object_Exterminator *gobbler) \ { \ ACE_TRACE (#SERVICE_CLASS); \ if (gobbler != 0) \ - *gobbler = (ACE_Service_Object_Exterminator) _gobble_##SERVICE_CLASS; \ + *gobbler = (ACE_Service_Object_Exterminator) ACE_MAKE_SVC_CONFIG_GOBBLER_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS); \ return new NAMESPACE_CLASS; \ } /// The canonical name for a service factory method -#define ACE_SVC_NAME(SERVICE_CLASS) _make_##SERVICE_CLASS +# define ACE_SVC_NAME(SERVICE_CLASS) ACE_MAKE_SVC_CONFIG_FACTORY_NAME(ACE_VERSIONED_NAMESPACE_NAME,SERVICE_CLASS) /// The canonical way to invoke (i.e. construct) a service factory /// method. -#define ACE_SVC_INVOKE(SERVICE_CLASS) _make_##SERVICE_CLASS (0) +#define ACE_SVC_INVOKE(SERVICE_CLASS) ACE_SVC_NAME(SERVICE_CLASS) (0) //@} @@ -847,15 +876,9 @@ _make_##SERVICE_CLASS (ACE_Service_Object_Exterminator *gobbler) \ # define ACE_SEH_EXCEPT(X) while (0) # define ACE_SEH_FINALLY if (1) # elif defined(__BORLANDC__) -# if (__BORLANDC__ >= 0x0530) /* Borland C++ Builder 3.0 */ -# define ACE_SEH_TRY try -# define ACE_SEH_EXCEPT(X) __except(X) -# define ACE_SEH_FINALLY __finally -# else -# define ACE_SEH_TRY if (1) -# define ACE_SEH_EXCEPT(X) while (0) -# define ACE_SEH_FINALLY if (1) -# endif +# define ACE_SEH_TRY try +# define ACE_SEH_EXCEPT(X) __except(X) +# define ACE_SEH_FINALLY __finally # elif defined (__IBMCPP__) && (__IBMCPP__ >= 400) # define ACE_SEH_TRY if (1) # define ACE_SEH_EXCEPT(X) while (0) diff --git a/ace/Guard_T.cpp b/ace/Guard_T.cpp index 00cbfb4ebf1..bd60ebd2356 100644 --- a/ace/Guard_T.cpp +++ b/ace/Guard_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_GUARD_T_C -#define ACE_GUARD_T_C +#ifndef ACE_GUARD_T_CPP +#define ACE_GUARD_T_CPP #include "ace/Guard_T.h" @@ -9,8 +9,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Guard_T, "$Id$") - #if !defined (__ACE_INLINE__) #include "ace/Guard_T.inl" #endif /* __ACE_INLINE__ */ @@ -20,6 +18,9 @@ ACE_RCSID(ace, Guard_T, "$Id$") #endif /* ACE_HAS_DUMP */ // **************************************************************** + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // ACE_ALLOC_HOOK_DEFINE(ACE_Guard) template <class ACE_LOCK> void @@ -55,4 +56,6 @@ ACE_Read_Guard<ACE_LOCK>::dump (void) const ACE_Guard<ACE_LOCK>::dump (); } -#endif /* ACE_GUARD_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_GUARD_T_CPP */ diff --git a/ace/Guard_T.h b/ace/Guard_T.h index 552385b298e..d7eedef2715 100644 --- a/ace/Guard_T.h +++ b/ace/Guard_T.h @@ -25,6 +25,8 @@ #include "ace/Global_Macros.h" #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Guard * @@ -45,7 +47,7 @@ public: ACE_Guard (ACE_LOCK &l); /// Implicitly and automatically acquire (or try to acquire) the - /// lock. If <block> is non-0 then <acquire> the <ACE_LOCK>, else + /// lock. If @a block is non-0 then <acquire> the <ACE_LOCK>, else /// <tryacquire> it. ACE_Guard (ACE_LOCK &l, int block); @@ -108,7 +110,7 @@ private: /** * @class ACE_Write_Guard * - * @brief This class is similar to class <ACE_Guard>, though it + * @brief This class is similar to class ACE_Guard, though it * acquires/releases a write lock automatically (naturally, the * <ACE_LOCK> it is instantiated with must support the appropriate * API). @@ -152,7 +154,7 @@ public: /** * @class ACE_Read_Guard * - * @brief This class is similar to class <ACE_Guard>, though it + * @brief This class is similar to class ACE_Guard, though it * acquires/releases a read lock automatically (naturally, the * <ACE_LOCK> it is instantiated with must support the appropriate * API). @@ -342,8 +344,11 @@ public: // ACE_ALLOC_HOOK_DECLARE; // Declare the dynamic allocation hooks. }; + #endif /* !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */ +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Guard_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Guard_T.inl b/ace/Guard_T.inl index 0ce34431d2c..8c2e281f447 100644 --- a/ace/Guard_T.inl +++ b/ace/Guard_T.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/RW_Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class ACE_LOCK> ACE_INLINE int ACE_Guard<ACE_LOCK>::acquire (void) { @@ -164,3 +167,5 @@ ACE_Read_Guard<ACE_LOCK>::ACE_Read_Guard (ACE_LOCK &m, else this->tryacquire_read (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Handle_Gobbler.h b/ace/Handle_Gobbler.h index 8b3e472e7b8..36c16b56ed7 100644 --- a/ace/Handle_Gobbler.h +++ b/ace/Handle_Gobbler.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Handle_Gobbler * @@ -44,7 +47,7 @@ public: */ inline int consume_handles (size_t n_handles_to_keep_available); - /// Free up <n_handles>. + /// Free up @a n_handles. inline int free_handles (size_t n_handles); /// All remaining handles are closed. @@ -58,6 +61,8 @@ private: HANDLE_SET handle_set_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include "ace/Handle_Gobbler.inl" #include /**/ "ace/post.h" diff --git a/ace/Handle_Gobbler.inl b/ace/Handle_Gobbler.inl index 12887593086..6b51908e45e 100644 --- a/ace/Handle_Gobbler.inl +++ b/ace/Handle_Gobbler.inl @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ // Since this is only included in Handle_Gobbler.h, these should be @@ -7,6 +9,8 @@ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_fcntl.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + inline void ACE_Handle_Gobbler::close_remaining_handles (void) { @@ -89,3 +93,5 @@ ACE_Handle_Gobbler::consume_handles (size_t n_handles_to_keep_available) return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Handle_Ops.cpp b/ace/Handle_Ops.cpp index eb373af8020..eae24314864 100644 --- a/ace/Handle_Ops.cpp +++ b/ace/Handle_Ops.cpp @@ -10,6 +10,9 @@ ACE_RCSID (ace, Handle_Ops, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_HANDLE ACE::handle_timed_open (ACE_Time_Value *timeout, const ACE_TCHAR *name, @@ -43,3 +46,5 @@ ACE::handle_timed_open (ACE_Time_Value *timeout, else return ACE_OS::open (name, flags, perms, sa); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Handle_Ops.h b/ace/Handle_Ops.h index 7f50eba8270..de6918753a9 100644 --- a/ace/Handle_Ops.h +++ b/ace/Handle_Ops.h @@ -6,9 +6,7 @@ * * $Id$ * - * This class consolidates the operations on the Handles. - * - * @author Priyanka Gontla <pgontla@ece.uci.edu> + * Handle operations. */ //============================================================================= @@ -25,6 +23,8 @@ #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; // = Operations on HANDLEs. @@ -43,6 +43,8 @@ namespace ACE LPSECURITY_ATTRIBUTES sa = 0); } +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_HANDLE_OPS_H */ diff --git a/ace/Handle_Set.cpp b/ace/Handle_Set.cpp index a24605a5367..3b76da06460 100644 --- a/ace/Handle_Set.cpp +++ b/ace/Handle_Set.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, Handle_Set, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Handle_Set) // ACE_MSB_MASK is only used here. @@ -235,13 +237,13 @@ ACE_Handle_Set::set_max (ACE_HANDLE current_max) for (fd_mask val = maskp[i]; (val & ACE_MSB_MASK) != 0; val = (val << 1)) - this->max_handle_++; + ++this->max_handle_; #elif 1 /* !defined(ACE_HAS_BIG_FD_SET) */ this->max_handle_ = ACE_MULT_BY_WORDSIZE (i); for (fd_mask val = maskp[i]; (val & ~1) != 0; // This obscure code is needed since "bit 0" is in location 1... val = (val >> 1) & ACE_MSB_MASK) - this->max_handle_++; + ++this->max_handle_; #else register u_long val = this->mask_.fds_bits[i]; this->max_handle_ = ACE_MULT_BY_WORDSIZE (i) @@ -572,3 +574,5 @@ ACE_Handle_Set_Iterator::reset_state (void) } #endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Handle_Set.h b/ace/Handle_Set.h index d732dfe4ef5..2e944bc5b97 100644 --- a/ace/Handle_Set.h +++ b/ace/Handle_Set.h @@ -40,6 +40,8 @@ # define ACE_DEFAULT_SELECT_REACTOR_SIZE ACE_FD_SETSIZE #endif /* ACE_DEFAULT_SELECT_REACTOR_SIZE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Handle_Set * @@ -171,7 +173,7 @@ private: /** * @class ACE_Handle_Set_Iterator * - * @brief Iterator for the <ACE_Handle_Set> abstraction. + * @brief Iterator for the ACE_Handle_Set abstraction. */ class ACE_Export ACE_Handle_Set_Iterator { @@ -187,7 +189,7 @@ public: void reset_state (void); /** - * "Next" operator. Returns the next unseen <ACE_HANDLE> in the + * "Next" operator. Returns the next unseen ACE_HANDLE in the * <Handle_Set> up to <handle_set_.max_handle_>). When all the * handles have been seen returns <ACE_INVALID_HANDLE>. Advances * the iterator automatically, so you need not call <operator++> @@ -197,6 +199,7 @@ public: /// This is a no-op and no longer does anything. It's only here for /// backwards compatibility. + /// @deprecated void operator++ (void); /// Dump the state of an object. @@ -236,6 +239,8 @@ private: #endif /* !ACE_WIN32 && !ACE_HAS_BIG_FD_SET */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Handle_Set.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Handle_Set.inl b/ace/Handle_Set.inl index d00fb384863..b6f77cfac93 100644 --- a/ace/Handle_Set.inl +++ b/ace/Handle_Set.inl @@ -1,7 +1,7 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Handle_Set.i #include "ace/Log_Msg.h" // todo: This should be cleaned up a bit. @@ -21,6 +21,8 @@ # include "ace/os_include/os_strings.h" #endif /* ACE_HAS_STRINGS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Initialize the bitmask to all 0s and reset the associated fields. ACE_INLINE void @@ -100,7 +102,7 @@ ACE_Handle_Set::set_bit (ACE_HANDLE handle) #if defined (ACE_WIN32) FD_SET ((SOCKET) handle, &this->mask_); - this->size_++; + ++this->size_; #else /* ACE_WIN32 */ #if defined (ACE_HAS_BIG_FD_SET) if (this->size_ == 0) @@ -112,7 +114,7 @@ ACE_Handle_Set::set_bit (ACE_HANDLE handle) FD_SET (handle, &this->mask_); - this->size_++; + ++this->size_; if (handle > this->max_handle_) this->max_handle_ = handle; @@ -132,7 +134,7 @@ ACE_Handle_Set::clr_bit (ACE_HANDLE handle) { FD_CLR ((ACE_SOCKET) handle, &this->mask_); - this->size_--; + --this->size_; #if !defined (ACE_WIN32) if (handle == this->max_handle_) @@ -184,3 +186,5 @@ ACE_INLINE ACE_Handle_Set_Iterator::~ACE_Handle_Set_Iterator (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Hash_Cache_Map_Manager_T.cpp b/ace/Hash_Cache_Map_Manager_T.cpp index 72b84d88715..5baac0ae1a0 100644 --- a/ace/Hash_Cache_Map_Manager_T.cpp +++ b/ace/Hash_Cache_Map_Manager_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_HASH_CACHE_MAP_MANAGER_T_C -#define ACE_HASH_CACHE_MAP_MANAGER_T_C +#ifndef ACE_HASH_CACHE_MAP_MANAGER_T_CPP +#define ACE_HASH_CACHE_MAP_MANAGER_T_CPP #include "ace/Hash_Cache_Map_Manager_T.h" @@ -13,7 +13,7 @@ #include "ace/Hash_Cache_Map_Manager_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Hash_Cache_Map_Manager_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Hash_Cache_Map_Manager) @@ -224,7 +224,9 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (CACHE_ENTRY *entry) return unbind_result; } +ACE_END_VERSIONED_NAMESPACE_DECL + #undef ACE_T1 #undef ACE_T2 -#endif /* ACE_HASH_CACHE_MAP_MANAGER_T_C */ +#endif /* ACE_HASH_CACHE_MAP_MANAGER_T_CPP */ diff --git a/ace/Hash_Cache_Map_Manager_T.h b/ace/Hash_Cache_Map_Manager_T.h index 26ccbf78432..023e9d17568 100644 --- a/ace/Hash_Cache_Map_Manager_T.h +++ b/ace/Hash_Cache_Map_Manager_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,6 +13,7 @@ #ifndef HASH_CACHE_MAP_MANAGER_T_H #define HASH_CACHE_MAP_MANAGER_T_H + #include /**/ "ace/pre.h" #include "ace/Hash_Map_Manager_T.h" @@ -24,6 +25,8 @@ #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration. class ACE_Allocator; @@ -191,6 +194,8 @@ protected: typedef ACE_CACHE_MAP_MANAGER ACE_HCMM_BASE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Hash_Cache_Map_Manager_T.inl" @@ -205,4 +210,5 @@ protected: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include /**/ "ace/post.h" + #endif /* HASH_CACHE_MAP_MANAGER_T_H */ diff --git a/ace/Hash_Cache_Map_Manager_T.inl b/ace/Hash_Cache_Map_Manager_T.inl index 84d40bffbb6..0388abd6c6e 100644 --- a/ace/Hash_Cache_Map_Manager_T.inl +++ b/ace/Hash_Cache_Map_Manager_T.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #define ACE_T1 class KEY, class VALUE, class HASH_KEY, class COMPARE_KEYS, class CACHING_STRATEGY, class ATTRIBUTES #define ACE_T2 KEY, VALUE, HASH_KEY, COMPARE_KEYS, CACHING_STRATEGY, ATTRIBUTES +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <ACE_T1> ACE_INLINE int ACE_Hash_Cache_Map_Manager<ACE_T2>::bind (const KEY &key, const VALUE &value) @@ -64,5 +67,7 @@ ACE_Hash_Cache_Map_Manager<ACE_T2>::unbind (const KEY &key, value); } +ACE_END_VERSIONED_NAMESPACE_DECL + #undef ACE_T1 #undef ACE_T2 diff --git a/ace/Hash_Map_Manager.cpp b/ace/Hash_Map_Manager.cpp deleted file mode 100644 index 4378551c7f8..00000000000 --- a/ace/Hash_Map_Manager.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Hash_Map_Manager.cpp -// -// = AUTHOR -// Douglas C. Schmidt <schmidt@cs.wustl.edu> -// -// ============================================================================ - -#include "ace/Hash_Map_Manager.h" - -ACE_RCSID(ace, Hash_Map_Manager, "$Id$") - diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h index 4468cda5af0..ad9cc390295 100644 --- a/ace/Hash_Map_Manager.h +++ b/ace/Hash_Map_Manager.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -6,6 +6,8 @@ * * $Id$ * + * Backward compatibility header. + * * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //============================================================================= diff --git a/ace/Hash_Map_Manager_T.cpp b/ace/Hash_Map_Manager_T.cpp index 4d442a61234..bb08c21db0b 100644 --- a/ace/Hash_Map_Manager_T.cpp +++ b/ace/Hash_Map_Manager_T.cpp @@ -24,21 +24,11 @@ #if !defined (__ACE_INLINE__) # include "ace/Hash_Map_Manager_T.inl" -#elif defined (__SUNPRO_CC) && (__SUNPRO_CC == 0x420) -// If ACE_INLINE is on and we are on SunCC, undefine ACE_INLINE, -// include ace/Hash_Map_Manager_T.i, and then redefine ACE_INLINE. -// This nonsense is necessary since SunCC (version 4.2) cannot inline -// the code in ace/Hash_Map_Manager_T.i (with the fast option). -# undef ACE_INLINE -# define ACE_INLINE -# include "ace/Hash_Map_Manager_T.inl" -# undef ACE_INLINE -# define ACE_INLINE inline #endif /* __ACE_INLINE__ */ #include "ace/Malloc_Base.h" -ACE_RCSID(ace, Hash_Map_Manager_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class EXT_ID, class INT_ID> ACE_Hash_Map_Entry<EXT_ID, INT_ID>::ACE_Hash_Map_Entry (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *next, @@ -518,4 +508,6 @@ ACE_Hash_Map_Const_Iterator_Base_Ex<EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_ return this->index_ >= 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HASH_MAP_MANAGER_T_CPP */ diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h index eefd5862f89..23ce8d690ec 100644 --- a/ace/Hash_Map_Manager_T.h +++ b/ace/Hash_Map_Manager_T.h @@ -24,6 +24,8 @@ #include "ace/Functor_T.h" #include "ace/Log_Msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Hash_Map_Entry * @@ -101,9 +103,9 @@ class ACE_Allocator; * This implementation of a map uses a hash table. Key hashing * is achieved through the HASH_KEY object and key comparison is * achieved through the COMPARE_KEYS object. - * This class uses an <ACE_Allocator> to allocate memory. The + * This class uses an ACE_Allocator to allocate memory. The * user can make this a persistent class by providing an - * <ACE_Allocator> with a persistable memory pool. + * ACE_Allocator with a persistable memory pool. */ template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> class ACE_Hash_Map_Manager_Ex @@ -308,8 +310,8 @@ public: * possible to acquire the lock explicitly, which can be useful in * some cases if you instantiate the <ACE_Atomic_Op> with an * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to - * guard the state of an iterator. NOTE: the right name would be - * <lock>, but HP/C++ will choke on that! + * guard the state of an iterator. + * @note The right name would be <lock>, but HP/C++ will choke on that! */ ACE_LOCK &mutex (void); @@ -415,8 +417,8 @@ protected: int unbind_i (ACE_Hash_Map_Entry<EXT_ID, INT_ID> *entry); /** - * Resize the map. Must be called with locks held. Note, that this - * method should never be called more than once or else all the + * Resize the map. Must be called with locks held. + * @note This method should never be called more than once or else all the * hashing will get screwed up as the size will change. */ int create_buckets (size_t size); @@ -464,8 +466,9 @@ private: /// Total size of the hash table. size_t total_size_; - /// Current number of entries in the table (note that this can be - /// larger than <total_size_> due to the bucket chaining). + /// Current number of entries in the table + /// @note That this can be larger than <total_size_> due to the + /// bucket chaining). size_t cur_size_; // = Disallow these operations. @@ -610,7 +613,7 @@ protected: * <ACE_Hash_Map_Manager_Ex> it is iterating upon since locking is * inherently inefficient and/or error-prone within an STL-style * iterator. If you require locking, you can explicitly use an - * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s + * ACE_Guard or ACE_Read_Guard on the <ACE_Hash_Map_Manager_Ex>'s * internal lock, which is accessible via its <mutex> method. */ template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> @@ -656,7 +659,7 @@ public: * <ACE_Hash_Map_Manager_Ex> it is iterating upon since locking is * inherently inefficient and/or error-prone within an STL-style * iterator. If you require locking, you can explicitly use an - * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s + * ACE_Guard or ACE_Read_Guard on the <ACE_Hash_Map_Manager_Ex>'s * internal lock, which is accessible via its <mutex> method. */ template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> @@ -704,7 +707,7 @@ public: * <ACE_Hash_Map_Manager_Ex> it is iterating upon since locking is * inherently inefficient and/or error-prone within an STL-style * iterator. If you require locking, you can explicitly use an - * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s + * ACE_Guard or ACE_Read_Guard on the <ACE_Hash_Map_Manager_Ex>'s * internal lock, which is accessible via its <mutex> method. * * Note that a creation method for this new iterator cannot be added @@ -775,7 +778,7 @@ protected: * <ACE_Hash_Map_Manager_Ex> it is iterating upon since locking is * inherently inefficient and/or error-prone within an STL-style * iterator. If you require locking, you can explicitly use an - * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Hash_Map_Manager_Ex>'s + * ACE_Guard or ACE_Read_Guard on the <ACE_Hash_Map_Manager_Ex>'s * internal lock, which is accessible via its <mutex> method. */ template <class EXT_ID, class INT_ID, class HASH_KEY, class COMPARE_KEYS, class ACE_LOCK> @@ -934,13 +937,10 @@ public: operator= (const ACE_Hash_Map_Reverse_Iterator_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_LOCK> &base); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) -// Include ace/Hash_Map_Manager_T.i on all platforms excluding SunCC. -// This nonsense is necessary since SunCC (version 4.2) cannot inline -// the code in ace/Hash_Map_Manager_T.i (with the fast option). -# if !(defined (__SUNPRO_CC) && (__SUNPRO_CC == 0x420)) # include "ace/Hash_Map_Manager_T.inl" -# endif /* ! __SUNPRO_CC */ #endif /* __ACE_INLINE__ */ #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) diff --git a/ace/Hash_Map_Manager_T.inl b/ace/Hash_Map_Manager_T.inl index 05383a07e69..6dd3626dea3 100644 --- a/ace/Hash_Map_Manager_T.inl +++ b/ace/Hash_Map_Manager_T.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Guard_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + 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) @@ -980,3 +983,5 @@ ACE_Hash_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator= (const ACE_Ha return *this; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Hash_Map_With_Allocator_T.cpp b/ace/Hash_Map_With_Allocator_T.cpp index 20587b9d7ba..9927147e865 100644 --- a/ace/Hash_Map_With_Allocator_T.cpp +++ b/ace/Hash_Map_With_Allocator_T.cpp @@ -1,4 +1,3 @@ -// Hash_Map_With_Allocator_T.cpp // $Id$ #ifndef ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP @@ -14,6 +13,8 @@ #include "ace/Hash_Map_With_Allocator_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class EXT_ID, class INT_ID> ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::ACE_Hash_Map_With_Allocator (ACE_Allocator *alloc) : ACE_Hash_Map_Manager_Ex<EXT_ID, INT_ID, ACE_Hash<EXT_ID>, ACE_Equal_To<EXT_ID>, ACE_Null_Mutex> (alloc) @@ -29,4 +30,6 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::ACE_Hash_Map_With_Allocator (size_t ACE_TRACE ("ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::ACE_Hash_Map_With_Allocator"); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HASH_MAP_WITH_ALLOCATOR_T_CPP */ diff --git a/ace/Hash_Map_With_Allocator_T.h b/ace/Hash_Map_With_Allocator_T.h index 6ae11547c0c..088956b48a1 100644 --- a/ace/Hash_Map_With_Allocator_T.h +++ b/ace/Hash_Map_With_Allocator_T.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file Hash_Map_With_Allocator_T.h @@ -21,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Hash_Map_With_Allocator * @@ -53,9 +56,9 @@ public: ACE_Allocator *alloc); // = The following methods are Proxies to the corresponding methods - // in <ACE_Hash_Map_Manager>. Each method sets the allocator to + // in ACE_Hash_Map_Manager. Each method sets the allocator to // the one specified by the invoking entity, and then calls the - // corresponding method in <ACE_Hash_Map_Manager> to do the + // corresponding method in ACE_Hash_Map_Manager to do the // actual work. int bind (const EXT_ID &, @@ -79,13 +82,15 @@ public: INT_ID &, ACE_Allocator *alloc); - /// Returns 0 if the <ext_id> is in the mapping, otherwise -1. - int find (const EXT_ID &, + /// Returns 0 if the @a ext_id is in the mapping, otherwise -1. + int find (const EXT_ID &ext_id, ACE_Allocator *alloc); int close (ACE_Allocator *alloc); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Hash_Map_With_Allocator_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Hash_Map_With_Allocator_T.inl b/ace/Hash_Map_With_Allocator_T.inl index 5b8c42dde3d..67f2f8247f8 100644 --- a/ace/Hash_Map_With_Allocator_T.inl +++ b/ace/Hash_Map_With_Allocator_T.inl @@ -1,8 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Hash_Map_With_Allocator_T.i - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class EXT_ID, class INT_ID> ACE_INLINE int ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::close (ACE_Allocator *alloc) @@ -71,3 +71,5 @@ ACE_Hash_Map_With_Allocator<EXT_ID, INT_ID>::find (const EXT_ID &ext_id, this->allocator_ = alloc; return this->find_i (ext_id); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Hashable.cpp b/ace/Hashable.cpp index fca05cf96c5..cab51f7aa26 100644 --- a/ace/Hashable.cpp +++ b/ace/Hashable.cpp @@ -12,6 +12,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Hashable::~ACE_Hashable (void) { } @@ -26,7 +28,9 @@ ACE_Hashable::hash (void) const // relative to the simple comparison. if (this->hash_value_ == 0) - (const_cast <ACE_Hashable *> (this))->hash_value_ = this->hash_i (); + this->hash_value_ = this->hash_i (); return this->hash_value_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Hashable.h b/ace/Hashable.h index 3544feb5290..1a4a7011c28 100644 --- a/ace/Hashable.h +++ b/ace/Hashable.h @@ -21,6 +21,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Hashable @@ -49,10 +50,11 @@ protected: protected: /// Pre-computed hash-value. - unsigned long hash_value_; + mutable unsigned long hash_value_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Hashable.inl" diff --git a/ace/Hashable.inl b/ace/Hashable.inl index 55f28b31da4..7ec54ea1337 100644 --- a/ace/Hashable.inl +++ b/ace/Hashable.inl @@ -3,8 +3,12 @@ // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Hashable::ACE_Hashable (void) : hash_value_ (0) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/High_Res_Timer.cpp b/ace/High_Res_Timer.cpp index e0f7813329a..e83c6573c9c 100644 --- a/ace/High_Res_Timer.cpp +++ b/ace/High_Res_Timer.cpp @@ -23,8 +23,12 @@ ACE_RCSID(ace, High_Res_Timer, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_High_Res_Timer) +ACE_END_VERSIONED_NAMESPACE_DECL + // For Intel platforms, a scale factor is required for // ACE_OS::gethrtime. We'll still set this to one to prevent division // by zero errors. @@ -36,23 +40,34 @@ ACE_ALLOC_HOOK_DEFINE(ACE_High_Res_Timer) # include "ace/Recursive_Thread_Mutex.h" # include "ace/Object_Manager.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Initialize the global_scale_factor_ to 1. The first // ACE_High_Res_Timer instance construction will override this // value. /* static */ ACE_UINT32 ACE_High_Res_Timer::global_scale_factor_ = 1u; +ACE_END_VERSIONED_NAMESPACE_DECL + #else /* ! (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \ ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) || ACE_HAS_HI_RES_TIMER */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // A scale_factor of 1000 converts nanosecond ticks to microseconds. // That is, on these platforms, 1 tick == 1 nanosecond. /* static */ ACE_UINT32 ACE_High_Res_Timer::global_scale_factor_ = 1000u; + +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ! (ACE_WIN32 || ACE_HAS_POWERPC_TIMER || \ ACE_HAS_PENTIUM || ACE_HAS_ALPHA_TIMER) || ACE_HAS_HI_RES_TIMER */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // This is used to tell if the global_scale_factor_ has been // set, and if high resolution timers are supported. /* static */ @@ -371,15 +386,9 @@ ACE_High_Res_Timer::elapsed_time (struct timespec &elapsed_time) const // Get just the microseconds (dropping any left over nanoseconds). ACE_UINT32 useconds = (ACE_UINT32) (elapsed / global_scale_factor ()); -#if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) elapsed_time.tv_sec = (time_t) (useconds / ACE_ONE_SECOND_IN_USECS); // Transforms one second in microseconds into nanoseconds. elapsed_time.tv_nsec = (time_t) ((useconds % ACE_ONE_SECOND_IN_USECS) * 1000u + nseconds); -#else - elapsed_time.ts_sec = (time_t) (useconds / ACE_ONE_SECOND_IN_USECS); - // Transforms one second in microseconds into nanoseconds. - elapsed_time.ts_nsec = (time_t) ((useconds % ACE_ONE_SECOND_IN_USECS) * 1000u + nseconds); -#endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ } #endif /* ACE_HAS_POSIX_TIME */ @@ -533,3 +542,5 @@ ACE_High_Res_Timer::get_env_global_scale_factor (const char *env) #endif /* !ACE_HAS_WINCE */ return -1; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/High_Res_Timer.h b/ace/High_Res_Timer.h index 705165547f7..5359ddc70d3 100644 --- a/ace/High_Res_Timer.h +++ b/ace/High_Res_Timer.h @@ -24,6 +24,8 @@ #include "ace/OS_NS_time.h" #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_High_Res_Timer * @@ -68,9 +70,9 @@ * different implementation depending on the used windows HAL * (Hardware Abstraction Layer). On some it uses the PC "timer chip" * while it uses RDTSC on others. - * NOTE: the elapsed time calculations in the print methods use + * @note The elapsed time calculations in the print methods use * ACE_hrtime_t values. Those methods do _not_ check for overflow! - * NOTE: Gabe <begeddov@proaxis.com> raises this issue regarding + * @note Gabe <begeddov@proaxis.com> raises this issue regarding * <ACE_OS::gethrtime>: on multi-processors, the processor that * you query for your <timer.stop> value might not be the one * you queried for <timer.start>. Its not clear how much @@ -131,8 +133,8 @@ public: /** * Sets the global_scale_factor to the value in the <env> - * environment variable. Returns 0 on success, -1 on failure. Note - * if @a env points to string "0" (value zero), this call will fail. + * environment variable. Returns 0 on success, -1 on failure. + * @note If @a env points to string "0" (value zero), this call will fail. * This is basically a no-op on CE because there is no concept of * environment variable on CE. */ @@ -212,8 +214,8 @@ public: // @@ WINCE These two functions are currently not supported on Windows CE. // However, we should probably use the handle and ACE_Log_Msg to // print out the result. - /// Print total time. NOTE: only use <print_total> if incremental - /// timings had been used! + /// Print total time. + /// @note only use <print_total> if incremental timings had been used! void print_total (const ACE_TCHAR *message, const int iterations = 1, ACE_HANDLE handle = ACE_STDOUT) const; @@ -309,6 +311,8 @@ private: static int global_scale_factor_status_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/High_Res_Timer.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/High_Res_Timer.inl b/ace/High_Res_Timer.inl index 49fff1aabe4..1b37f522439 100644 --- a/ace/High_Res_Timer.inl +++ b/ace/High_Res_Timer.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- */ +// // $Id$ #include "ace/Global_Macros.h" @@ -7,9 +8,11 @@ # include "ace/OS_NS_sys_time.h" #endif /* ACE_WIN32 */ -// Be very carefull before changing the calculations inside +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Be very careful before changing the calculations inside // ACE_High_Res_Timer. The precision matters and we are using integer -// calculations not floating point. Also look good at the emulated 64 +// calculations not floating point. Also look closely at the emulated 64 // bit int class (inside Basic_Types{h,i,cpp} before changing // anything. It's operator/ only returns 32 bits not 64 bits, among // other things. @@ -170,3 +173,5 @@ ACE_High_Res_Timer::global_scale_factor (ACE_UINT32 gsf) { global_scale_factor_ = gsf; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/ICMP_Socket.cpp b/ace/ICMP_Socket.cpp index 52ae288631b..2904524d25c 100644 --- a/ace/ICMP_Socket.cpp +++ b/ace/ICMP_Socket.cpp @@ -9,15 +9,14 @@ #include "ace/OS_NS_netdb.h" #include "ace/OS_NS_sys_socket.h" -#if !defined (__ACE_INLINE__) -# include "ace/ICMP_Socket.inl" -#endif /* !__ACE_INLINE__ */ - ACE_RCSID (ace, ICMP_Socket, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_ICMP_Socket) @@ -182,4 +181,6 @@ ACE_ICMP_Socket::calculate_checksum (unsigned short * paddress, return (answer); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_ICMP_SUPPORT == 1 */ diff --git a/ace/ICMP_Socket.h b/ace/ICMP_Socket.h index 795817f65db..77e2a018984 100644 --- a/ace/ICMP_Socket.h +++ b/ace/ICMP_Socket.h @@ -28,8 +28,10 @@ #include "ace/Time_Value.h" #include "ace/os_include/netinet/os_in.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** - * @class ICMP_Socket + * @class ACE_ICMP_Socket * * @brief An abstract class that forms the basis for usage of the ICMP * protocol (that is, support for things such as ping). @@ -39,8 +41,6 @@ class ACE_Export ACE_ICMP_Socket : public ACE_SOCK public: // = Initialization methods. - ~ACE_ICMP_Socket (void); - /** * @name Data transfer routines. * @@ -101,9 +101,7 @@ protected: int len); }; -#if defined (__ACE_INLINE__) -# include "ace/ICMP_Socket.inl" -#endif /* __ACE_INLINE__ */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_ICMP_SUPPORT == 1 */ diff --git a/ace/ICMP_Socket.inl b/ace/ICMP_Socket.inl deleted file mode 100644 index bda45ff8c61..00000000000 --- a/ace/ICMP_Socket.inl +++ /dev/null @@ -1,9 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -ACE_INLINE -ACE_ICMP_Socket::~ACE_ICMP_Socket (void) -{ - ACE_TRACE ("ACE_ICMP_Socket::~ACE_ICMP_Socket"); -} diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 420172707af..bde2a17ae8e 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -22,6 +22,8 @@ ACE_RCSID (ace, INET_Addr, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_INET_Addr) // Transform the current address into string format. @@ -35,9 +37,10 @@ ACE_INET_Addr::addr_to_string (ACE_TCHAR s[], // XXX Can we (should we) include the scope id for IPv6 addresses? - size_t total_len = (ipaddr_format == 0 ? - ACE_OS::strlen (this->get_host_name ()) : - ACE_OS::strlen (this->get_host_addr ())) + size_t const total_len = + (ipaddr_format == 0 + ? ACE_OS::strlen (this->get_host_name ()) + : ACE_OS::strlen (this->get_host_addr ())) + ACE_OS::strlen ("65536") // Assume the max port number. + sizeof (':') + sizeof ('\0'); // For trailing '\0'. @@ -111,7 +114,7 @@ ACE_INET_Addr::hash (void) const } ACE_INET_Addr::ACE_INET_Addr (void) - : ACE_Addr (this->determine_type(), sizeof (inet_addr_)) + : ACE_Addr (this->determine_type (), sizeof (inet_addr_)) { // ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr"); this->reset (); @@ -181,7 +184,7 @@ ACE_INET_Addr::string_to_addr (const char s[]) char *endp = 0; u_short port = static_cast<u_short> (ACE_OS::strtol (ip_addr, &endp, 10)); - if (port > 0 && *endp == '\0') + if (*endp == '\0') // strtol scanned the entire string - all digits result = this->set (port, ACE_UINT32 (INADDR_ANY)); else // port name result = this->set (ip_addr, ACE_UINT32 (INADDR_ANY)); @@ -192,7 +195,7 @@ ACE_INET_Addr::string_to_addr (const char s[]) char *endp = 0; u_short port = static_cast<u_short> (ACE_OS::strtol (port_p, &endp, 10)); - if (port > 0 && *endp == '\0') + if (*endp == '\0') // strtol scanned the entire string - all digits result = this->set (port, ip_addr); else result = this->set (port_p, ip_addr); @@ -307,7 +310,7 @@ ACE_INET_Addr::set (u_short port_number, // IPv6 not supported... insure the family is set to IPv4 address_family = AF_INET; this->set_type (address_family); - this->inet_addr_.in4_.sin_family = address_family; + this->inet_addr_.in4_.sin_family = static_cast<short> (address_family); struct in_addr addrv4; if (ACE_OS::inet_aton (host_name, &addrv4) == 1) @@ -316,7 +319,7 @@ ACE_INET_Addr::set (u_short port_number, encode); else { -# if defined (VXWORKS) || defined (CHORUS) +# if (defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)) || defined (CHORUS) hostent *hp = ACE_OS::gethostbyname (host_name); # else hostent hentry; @@ -325,7 +328,7 @@ ACE_INET_Addr::set (u_short port_number, hostent *hp = ACE_OS::gethostbyname_r (host_name, &hentry, buf, &h_error); -# endif /* VXWORKS */ +# endif /* ACE_VXWORKS */ if (hp == 0) { @@ -767,7 +770,7 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const } else { -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) ACE_UNUSED_ARG (len); int error = ::hostGetByAddr ((int) this->inet_addr_.in4_.sin_addr.s_addr, @@ -816,7 +819,7 @@ ACE_INET_Addr::get_host_name_i (char hostname[], size_t len) const ACE_OS::strcpy (hostname, hp->h_name); return 0; -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ } } @@ -844,6 +847,9 @@ int ACE_INET_Addr::set_address (const char *ip_addr, if (this->get_type () == AF_INET && map == 0) { this->base_set (AF_INET, sizeof (this->inet_addr_.in4_)); +#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN + this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_); +#endif this->inet_addr_.in4_.sin_family = AF_INET; this->set_size (sizeof (this->inet_addr_.in4_)); ACE_OS::memcpy (&this->inet_addr_.in4_.sin_addr, @@ -855,6 +861,9 @@ int ACE_INET_Addr::set_address (const char *ip_addr, { // this->set_type (AF_INET); this->base_set (AF_INET, sizeof (this->inet_addr_.in4_)); +#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN + this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_); +#endif this->inet_addr_.in4_.sin_family = AF_INET; this->set_size (sizeof (this->inet_addr_.in4_)); ACE_OS::memcpy (&this->inet_addr_.in4_.sin_addr, @@ -865,6 +874,9 @@ int ACE_INET_Addr::set_address (const char *ip_addr, else { this->base_set (AF_INET6, sizeof (this->inet_addr_.in6_)); +#ifdef ACE_HAS_SOCKADDR_IN6_SIN6_LEN + this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_); +#endif this->inet_addr_.in6_.sin6_family = AF_INET6; this->set_size (sizeof (this->inet_addr_.in6_)); if (ip4 == INADDR_ANY) @@ -1006,7 +1018,7 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const } #endif /* ACE_HAS_IPV6 */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) ACE_UNUSED_ARG (dst); ACE_UNUSED_ARG (size); @@ -1019,7 +1031,7 @@ ACE_INET_Addr::get_host_addr (char *dst, int size) const inet_ntoa_b(this->inet_addr_.in4_.sin_addr, ncthis->buf_); ACE_OS::strsncpy (dst, &buf_[0], size); return &buf_[0]; -#else /* VXWORKS */ +#else /* ACE_VXWORKS */ char *ch = ACE_OS::inet_ntoa (this->inet_addr_.in4_.sin_addr); ACE_OS::strsncpy (dst, ch, size); return ch; @@ -1035,7 +1047,7 @@ ACE_INET_Addr::get_host_addr (void) const static char buf[INET6_ADDRSTRLEN]; return this->get_host_addr (buf, INET6_ADDRSTRLEN); #else /* ACE_HAS_IPV6 */ -# if defined (VXWORKS) +# if defined (ACE_VXWORKS) // It would be nice to be able to encapsulate this into // ACE_OS::inet_ntoa(), but that would lead to either inefficiencies // on vxworks or lack of thread safety. @@ -1044,9 +1056,9 @@ ACE_INET_Addr::get_host_addr (void) const ACE_INET_Addr *ncthis = const_cast<ACE_INET_Addr *> (this); inet_ntoa_b (this->inet_addr_.in4_.sin_addr, ncthis->buf_); return &buf_[0]; -# else /* VXWORKS */ +# else /* ACE_VXWORKS */ return ACE_OS::inet_ntoa (this->inet_addr_.in4_.sin_addr); -# endif /* !VXWORKS */ +# endif /* !ACE_VXWORKS */ #endif /* !ACE_HAS_IPV6 */ } @@ -1077,3 +1089,5 @@ ACE_INET_Addr::get_ip_address (void) const #endif /* ACE_HAS_IPV6 */ return ntohl (ACE_UINT32 (this->inet_addr_.in4_.sin_addr.s_addr)); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/INET_Addr.h b/ace/INET_Addr.h index 6cdc1ae62cb..ab74a1bb276 100644 --- a/ace/INET_Addr.h +++ b/ace/INET_Addr.h @@ -27,6 +27,8 @@ # include /**/ "inetLib.h" #endif /* VXWORKS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_INET_Addr * @@ -44,10 +46,10 @@ public: /// Copy constructor. ACE_INET_Addr (const ACE_INET_Addr &); - /// Creates an <ACE_INET_Addr> from a sockaddr_in structure. + /// Creates an ACE_INET_Addr from a sockaddr_in structure. ACE_INET_Addr (const sockaddr_in *, int len); - /// Creates an <ACE_INET_Addr> from a <port_number> and the remote + /// Creates an ACE_INET_Addr from a <port_number> and the remote /// <host_name>. The port number is assumed to be in host byte order. /// To set a port already in network byte order, please @see set(). /// Use address_family to select IPv6 (PF_INET6) vs. IPv4 (PF_INET). @@ -56,7 +58,7 @@ public: int address_family = AF_UNSPEC); /** - * Initializes an <ACE_INET_Addr> from the <address>, which can be + * Initializes an ACE_INET_Addr from the <address>, which can be * "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or * "128.252.166.57:1234"). If there is no ':' in the <address> it * is assumed to be a port number, with the IP address being @@ -65,22 +67,22 @@ public: explicit ACE_INET_Addr (const char address[]); /** - * Creates an <ACE_INET_Addr> from a <port_number> and an Internet + * Creates an ACE_INET_Addr from a <port_number> and an Internet * <ip_addr>. This method assumes that <port_number> and <ip_addr> * are in host byte order. If you have addressing information in * network byte order, @see set(). */ - ACE_INET_Addr (u_short port_number, - ACE_UINT32 ip_addr = INADDR_ANY); + explicit ACE_INET_Addr (u_short port_number, + ACE_UINT32 ip_addr = INADDR_ANY); - /// Uses <getservbyname> to create an <ACE_INET_Addr> from a + /// Uses <getservbyname> to create an ACE_INET_Addr from a /// <port_name>, the remote <host_name>, and the <protocol>. ACE_INET_Addr (const char port_name[], const char host_name[], const char protocol[] = "tcp"); /** - * Uses <getservbyname> to create an <ACE_INET_Addr> from a + * Uses <getservbyname> to create an ACE_INET_Addr from a * <port_name>, an Internet <ip_addr>, and the <protocol>. This * method assumes that <ip_addr> is in host byte order. */ @@ -109,11 +111,11 @@ public: // These methods are useful after the object has been constructed. - /// Initializes from another <ACE_INET_Addr>. + /// Initializes from another ACE_INET_Addr. int set (const ACE_INET_Addr &); /** - * Initializes an <ACE_INET_Addr> from a <port_number> and the + * Initializes an ACE_INET_Addr from a <port_number> and the * remote <host_name>. If <encode> is non-zero then <port_number> is * converted into network byte order, otherwise it is assumed to be * in network byte order already and are passed straight through. @@ -127,7 +129,7 @@ public: int address_family = AF_UNSPEC); /** - * Initializes an <ACE_INET_Addr> from a @a port_number and an Internet + * Initializes an ACE_INET_Addr from a @a port_number and an Internet * @a ip_addr. If @a encode is non-zero then the port number and IP address * are converted into network byte order, otherwise they are assumed to be * in network byte order already and are passed straight through. @@ -140,14 +142,14 @@ public: int encode = 1, int map = 0); - /// Uses <getservbyname> to initialize an <ACE_INET_Addr> from a + /// Uses <getservbyname> to initialize an ACE_INET_Addr from a /// <port_name>, the remote <host_name>, and the <protocol>. int set (const char port_name[], const char host_name[], const char protocol[] = "tcp"); /** - * Uses <getservbyname> to initialize an <ACE_INET_Addr> from a + * Uses <getservbyname> to initialize an ACE_INET_Addr from a * <port_name>, an <ip_addr>, and the <protocol>. This assumes that * <ip_addr> is already in network byte order. */ @@ -156,7 +158,7 @@ public: const char protocol[] = "tcp"); /** - * Initializes an <ACE_INET_Addr> from the <addr>, which can be + * Initializes an ACE_INET_Addr from the <addr>, which can be * "ip-number:port-number" (e.g., "tango.cs.wustl.edu:1234" or * "128.252.166.57:1234"). If there is no ':' in the <address> it * is assumed to be a port number, with the IP address being @@ -164,7 +166,7 @@ public: */ int set (const char addr[]); - /// Creates an <ACE_INET_Addr> from a sockaddr_in structure. + /// Creates an ACE_INET_Addr from a sockaddr_in structure. int set (const sockaddr_in *, int len); @@ -194,7 +196,7 @@ public: virtual void set_addr (void *, int len, int map); /** - * Transform the current <ACE_INET_Addr> address into string format. + * Transform the current ACE_INET_Addr address into string format. * If <ipaddr_format> is non-0 this produces "ip-number:port-number" * (e.g., "128.252.166.57:1234"), whereas if <ipaddr_format> is 0 * this produces "ip-name:port-number" (e.g., @@ -206,7 +208,7 @@ public: int ipaddr_format = 1) const; /** - * Initializes an <ACE_INET_Addr> from the <address>, which can be + * Initializes an ACE_INET_Addr from the @a address, which can be * "ip-addr:port-number" (e.g., "tango.cs.wustl.edu:1234"), * "ip-addr:port-name" (e.g., "tango.cs.wustl.edu:telnet"), * "ip-number:port-number" (e.g., "128.252.166.57:1234"), or @@ -344,11 +346,13 @@ private: #endif /* ACE_HAS_IPV6 */ } inet_addr_; -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) char buf_[INET_ADDR_LEN]; #endif }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/INET_Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/INET_Addr.inl b/ace/INET_Addr.inl index 63c8f480c4b..3fa5c778e5a 100644 --- a/ace/INET_Addr.inl +++ b/ace/INET_Addr.inl @@ -7,16 +7,27 @@ #include "ace/Global_Macros.h" #include "ace/OS_NS_arpa_inet.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_INET_Addr::reset (void) { ACE_OS::memset (&this->inet_addr_, 0, sizeof (this->inet_addr_)); if (this->get_type() == AF_INET) - this->inet_addr_.in4_.sin_family = AF_INET; + { +#ifdef ACE_HAS_SOCKADDR_IN_SIN_LEN + this->inet_addr_.in4_.sin_len = sizeof (this->inet_addr_.in4_); +#endif + this->inet_addr_.in4_.sin_family = AF_INET; + } #if defined (ACE_HAS_IPV6) else if (this->get_type() == AF_INET6) - this->inet_addr_.in6_.sin6_family = AF_INET6; + { +#ifdef ACE_HAS_SOCKADDR_IN6_SIN6_LEN + this->inet_addr_.in6_.sin6_len = sizeof (this->inet_addr_.in6_); +#endif + this->inet_addr_.in6_.sin6_family = AF_INET6; + } #endif /* ACE_HAS_IPV6 */ } @@ -29,8 +40,9 @@ ACE_INET_Addr::determine_type (void) const # else return AF_INET6; # endif /* ACE_USES_IPV4_IPV6_MIGRATION */ -#endif /* ACE_HAS_IPV6 */ +#else return AF_INET; +#endif /* ACE_HAS_IPV6 */ } ACE_INLINE void * @@ -202,3 +214,4 @@ ACE_INET_Addr::is_ipv4_compat_ipv6 (void) const } #endif /* ACE_HAS_IPV6 */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/IOStream.cpp b/ace/IOStream.cpp index 1ad5c0f3aca..23790425eeb 100644 --- a/ace/IOStream.cpp +++ b/ace/IOStream.cpp @@ -1,7 +1,7 @@ // $Id$ -#if !defined (ACE_IOSTREAM_C) -#define ACE_IOSTREAM_C +#ifndef ACE_IOSTREAM_CPP +#define ACE_IOSTREAM_CPP #include "ace/IOStream.h" @@ -86,6 +86,8 @@ ACE_RCSID(ace, IOStream, "$Id$") // function will be invoked by the first >>. Since it returns // a myiostream&, the second >> will be invoked as desired. */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_HANDLE ACE_Streambuf::get_handle (void) { @@ -657,5 +659,7 @@ u_char ACE_Streambuf::timeout (void) return rval; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_LACKS_ACE_IOSTREAM */ -#endif /* ACE_IOSTREAM_C */ +#endif /* ACE_IOSTREAM_CPP */ diff --git a/ace/IOStream.h b/ace/IOStream.h index 66aa738227a..49c0612da13 100644 --- a/ace/IOStream.h +++ b/ace/IOStream.h @@ -40,18 +40,26 @@ # if defined (ACE_HAS_STRING_CLASS) # if defined (ACE_WIN32) && defined (_MSC_VER) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef CString ACE_IOStream_String; +ACE_END_VERSIONED_NAMESPACE_DECL # else # if !defined (ACE_HAS_STDCPP_STL_INCLUDES) #include /**/ <String.h> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef String ACE_IOStream_String; +ACE_END_VERSIONED_NAMESPACE_DECL # else # include /**/ <string> # if defined(ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef std::string ACE_IOStream_String; +ACE_END_VERSIONED_NAMESPACE_DECL # else +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef string ACE_IOStream_String; +ACE_END_VERSIONED_NAMESPACE_DECL # endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ # endif /* ! ACE_HAS_STDCPP_STL_INCLUDES */ # endif /* ACE_WIN32 && defined (_MSC_VER) */ @@ -64,6 +72,8 @@ typedef string ACE_IOStream_String; # endif /* __DECCXX_VER < 50700000 */ # endif /* __DECCXX_VER */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Quoted_String : public ACE_IOStream_String { public: @@ -88,11 +98,15 @@ public: # endif /* ACE_WIN32 && defined (_MSC_VER) */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + # endif /* ACE_HAS_STRING_CLASS */ # include "ace/Time_Value.h" # include "ace/os_include/sys/os_types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Streambuf * @@ -202,8 +216,8 @@ public: /// Query the streambuf for the size of its buffers. u_int streambuf_size (void); - /// Did we take an error because of an IO operation timeout? Note: - /// Invoking this resets the flag. + /// Did we take an error because of an IO operation timeout? + /// @note Invoking this resets the flag. u_char timeout (void); protected: @@ -342,6 +356,8 @@ protected: # endif /* ACE_HAS_STANDARD_CPP_LIBRARY */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + /////////////////////////////////////////////////////////////////////////// // These typedefs are provided by G++ (on some systems?) without the diff --git a/ace/IOStream_T.cpp b/ace/IOStream_T.cpp index 237ce56b8bc..082274256fe 100644 --- a/ace/IOStream_T.cpp +++ b/ace/IOStream_T.cpp @@ -16,6 +16,8 @@ #include "ace/IOStream_T.inl" #endif /* !__ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // We will be given a STREAM by the iostream object which creates us. // See the ACE_IOStream template for how that works. Like other // streambuf objects, we can be input-only, output-only or both. @@ -238,6 +240,8 @@ operator<< (STREAM &stream, return stream; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_STRING_CLASS */ #endif /* ACE_LACKS_ACE_IOSTREAM */ #endif /* ACE_IOSTREAM_T_CPP */ diff --git a/ace/IOStream_T.h b/ace/IOStream_T.h index e6577e041d8..4460ef4be9e 100644 --- a/ace/IOStream_T.h +++ b/ace/IOStream_T.h @@ -9,8 +9,8 @@ * @author James CE Johnson <jcej@lads.com> * @author Jim Crossley <jim@lads.com> * - * This file should not be #included directly by application - * code. Instead, it should #include "ace/IOStream.h". That's because + * This file should not be included directly by application + * code. Instead, it should include "ace/IOStream.h". That's because * we only put some conditional compilations in that file. */ //============================================================================= @@ -28,13 +28,14 @@ #if !defined (ACE_LACKS_ACE_IOSTREAM) # include "ace/INET_Addr.h" -# include "ace/Handle_Set.h" # include "ace/Global_Macros.h" # if defined (ACE_LACKS_IOSTREAM_FX) # include "ace/os_include/os_ctype.h" # endif /**/ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_STRING_CLASS) template <class STREAM> STREAM & operator>> (STREAM &stream, ACE_Quoted_String &str); template <class STREAM> STREAM & operator<< (STREAM &stream, ACE_Quoted_String &str); @@ -277,6 +278,8 @@ protected: ACE_INET_Addr peer_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (__ACE_INLINE__) # include "ace/IOStream_T.inl" # endif /* __ACE_INLINE__ */ diff --git a/ace/IOStream_T.inl b/ace/IOStream_T.inl index 9d2fd414ca1..73e00fa7bbf 100644 --- a/ace/IOStream_T.inl +++ b/ace/IOStream_T.inl @@ -1,9 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +#include "ace/Handle_Set.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_sys_select.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class STREAM> ACE_INLINE int ACE_IOStream<STREAM>::eof (void) const { @@ -113,3 +117,5 @@ ACE_SOCK_Dgram_SC<STREAM>::get_remote_addr (ACE_INET_Addr &addr) const addr = peer_; return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/IO_Cntl_Msg.cpp b/ace/IO_Cntl_Msg.cpp index 3fac7c4abe6..9d64f05dd66 100644 --- a/ace/IO_Cntl_Msg.cpp +++ b/ace/IO_Cntl_Msg.cpp @@ -1,4 +1,3 @@ -// IO_Cntl_Msg.cpp // $Id$ #include "ace/IO_Cntl_Msg.h" @@ -16,6 +15,8 @@ ACE_RCSID(ace, IO_Cntl_Msg, "$Id$") #include "ace/Intrusive_List.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl template <class SYNCH> class ACE_Module; @@ -35,7 +36,7 @@ public: ACE_Module *lower (void) { return this->mod_lower_; } void lower (ACE_Module *l) { this->mod_lower_ = l; } - int count (void) { return this->count_; } + int count (void) const { return this->count_; } void count (int c) { this->count_ = c; } private: @@ -43,5 +44,8 @@ private: ACE_Module *mod_lower_; int count_; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif diff --git a/ace/IO_Cntl_Msg.h b/ace/IO_Cntl_Msg.h index 95277235643..c3101c7fac4 100644 --- a/ace/IO_Cntl_Msg.h +++ b/ace/IO_Cntl_Msg.h @@ -23,6 +23,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_IO_Cntl_Msg * @@ -99,6 +101,8 @@ private: int rval_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/IO_Cntl_Msg.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/IO_Cntl_Msg.inl b/ace/IO_Cntl_Msg.inl index 215ea8caf8c..0fbf4190f35 100644 --- a/ace/IO_Cntl_Msg.inl +++ b/ace/IO_Cntl_Msg.inl @@ -1,6 +1,9 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_IO_Cntl_Msg::ACE_IO_Cntl_Msg (ACE_IO_Cntl_Cmds c) { @@ -55,3 +58,4 @@ ACE_IO_Cntl_Msg::rval (int r) this->rval_ = r; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/IO_SAP.cpp b/ace/IO_SAP.cpp index b5c45f1b128..d65bc34c091 100644 --- a/ace/IO_SAP.cpp +++ b/ace/IO_SAP.cpp @@ -1,4 +1,3 @@ -// IO_SAP.cpp // $Id$ #include "ace/IO_SAP.h" @@ -15,6 +14,8 @@ ACE_RCSID(ace, IO_SAP, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_IO_SAP) // This is the do-nothing constructor. It does not perform a @@ -137,3 +138,5 @@ ACE_IO_SAP::disable (int value) const } return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/IO_SAP.h b/ace/IO_SAP.h index 50d530de4ae..b4ed13e451c 100644 --- a/ace/IO_SAP.h +++ b/ace/IO_SAP.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,6 +22,9 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_IO_SAP * @@ -83,6 +86,8 @@ private: static pid_t pid_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/IO_SAP.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/IO_SAP.inl b/ace/IO_SAP.inl index d120cd91b17..9d7d244e4db 100644 --- a/ace/IO_SAP.inl +++ b/ace/IO_SAP.inl @@ -1,10 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// IO_SAP.i - #include "ace/OS_NS_stropts.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_IO_SAP::~ACE_IO_SAP (void) { @@ -38,4 +39,4 @@ ACE_IO_SAP::control (int cmd, void *arg) const return ACE_OS::ioctl (this->handle_, cmd, arg); } - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/IPC_SAP.cpp b/ace/IPC_SAP.cpp index a67e8a2bd95..5e6f5d3199b 100644 --- a/ace/IPC_SAP.cpp +++ b/ace/IPC_SAP.cpp @@ -14,6 +14,8 @@ ACE_RCSID(ace, IPC_SAP, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP) void @@ -57,7 +59,7 @@ ACE_IPC_SAP::enable (int value) const { // nonblocking argument (1) // blocking: (0) - u_long nonblock = 1; + int nonblock = 1; return ACE_OS::ioctl (this->handle_, FIONBIO, &nonblock); @@ -129,7 +131,7 @@ ACE_IPC_SAP::disable (int value) const // nonblocking argument (1) // blocking: (0) { - u_long nonblock = 0; + int nonblock = 0; return ACE_OS::ioctl (this->handle_, FIONBIO, &nonblock); @@ -187,3 +189,5 @@ ACE_IPC_SAP::disable (int value) const #endif /* ! ACE_WIN32 && ! VXWORKS */ /* NOTREACHED */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/IPC_SAP.h b/ace/IPC_SAP.h index 72828c8f74c..98aa2bbf450 100644 --- a/ace/IPC_SAP.h +++ b/ace/IPC_SAP.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_IPC_SAP * @@ -30,8 +32,6 @@ class ACE_Export ACE_IPC_SAP { public: - /// Default dtor. - ~ACE_IPC_SAP (void); /// Interface for <ioctl>. int control (int cmd, void *) const; @@ -65,10 +65,19 @@ public: ACE_ALLOC_HOOK_DECLARE; protected: + // = Ensure that ACE_IPC_SAP is an abstract base class. /// Default constructor. ACE_IPC_SAP (void); + /// Protected destructor. + /** + * Not a virtual destructor. Protected destructor to prevent + * operator delete() from being called through a base class + * ACE_IPC_SAP pointer/reference. + */ + ~ACE_IPC_SAP (void); + private: /// Underlying I/O handle. ACE_HANDLE handle_; @@ -77,6 +86,8 @@ private: static pid_t pid_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/IPC_SAP.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/IPC_SAP.inl b/ace/IPC_SAP.inl index 69a5befa3b1..0adcb6e9b09 100644 --- a/ace/IPC_SAP.inl +++ b/ace/IPC_SAP.inl @@ -1,11 +1,10 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// IPC_SAP.i - #include "ace/OS_NS_stropts.h" -// Used to return the underlying handle_. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_IPC_SAP::~ACE_IPC_SAP (void) @@ -37,3 +36,5 @@ ACE_IPC_SAP::control (int cmd, void *arg) const ACE_TRACE ("ACE_IPC_SAP::control"); return ACE_OS::ioctl (this->handle_, cmd, arg); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/If_Then_Else.h b/ace/If_Then_Else.h index e9ca33a0631..163219e206b 100644 --- a/ace/If_Then_Else.h +++ b/ace/If_Then_Else.h @@ -17,6 +17,10 @@ #ifndef ACE_IF_THEN_ELSE_H #define ACE_IF_THEN_ELSE_H +#include "ace/config-lite.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE { @@ -80,4 +84,6 @@ namespace ACE } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_IF_THEN_ELSE_H */ diff --git a/ace/Init_ACE.cpp b/ace/Init_ACE.cpp index d1f098438bc..f997c09d4f8 100644 --- a/ace/Init_ACE.cpp +++ b/ace/Init_ACE.cpp @@ -7,6 +7,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + unsigned int ACE::init_fini_count_ = 0; int @@ -39,3 +41,5 @@ ACE::fini (void) // application! return -1; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Init_ACE.h b/ace/Init_ACE.h index 4d9d14da998..df2cea0c62f 100644 --- a/ace/Init_ACE.h +++ b/ace/Init_ACE.h @@ -8,8 +8,6 @@ * * Initialize ACE library services. Can be called only once per * program invocation. - * - * @author Priyanka Gontla <pgontla@ece.uci.edu> */ //============================================================================= @@ -25,12 +23,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -/** - * @class ACE_Init_ACE - * - * @brief - * - */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE { /** @@ -61,6 +55,8 @@ namespace ACE extern unsigned int init_fini_count_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_INIT_ACE_H */ diff --git a/ace/Intrusive_List.cpp b/ace/Intrusive_List.cpp index 7a23921288b..4a374c9b045 100644 --- a/ace/Intrusive_List.cpp +++ b/ace/Intrusive_List.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_INTRUSIVE_LIST_C -#define ACE_INTRUSIVE_LIST_C +#ifndef ACE_INTRUSIVE_LIST_CPP +#define ACE_INTRUSIVE_LIST_CPP #include "ace/Intrusive_List.h" @@ -13,7 +13,7 @@ #include "ace/Intrusive_List.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Intrusive_List, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class T> ACE_Intrusive_List<T>::ACE_Intrusive_List (void) @@ -148,4 +148,6 @@ ACE_Intrusive_List<T>::check_invariants (void) } #endif /* 0 */ -#endif /* ACE_INTRUSIVE_LIST_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_INTRUSIVE_LIST_CPP */ diff --git a/ace/Intrusive_List.h b/ace/Intrusive_List.h index a19e641c17d..fee24290712 100644 --- a/ace/Intrusive_List.h +++ b/ace/Intrusive_List.h @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Intrusive_List * @@ -117,6 +119,8 @@ private: T *tail_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Intrusive_List.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Intrusive_List.inl b/ace/Intrusive_List.inl index 2c513b4584f..56371fdd030 100644 --- a/ace/Intrusive_List.inl +++ b/ace/Intrusive_List.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class T> ACE_INLINE int ACE_Intrusive_List<T>::empty (void) const { @@ -17,3 +21,5 @@ ACE_Intrusive_List<T>::tail (void) const { return this->tail_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Intrusive_List_Node.cpp b/ace/Intrusive_List_Node.cpp index 58002653d2e..cd39a0cc91e 100644 --- a/ace/Intrusive_List_Node.cpp +++ b/ace/Intrusive_List_Node.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_INTRUSIVE_LIST_NODE_C -#define ACE_INTRUSIVE_LIST_NODE_C +#ifndef ACE_INTRUSIVE_LIST_NODE_CPP +#define ACE_INTRUSIVE_LIST_NODE_CPP #include "ace/Intrusive_List_Node.h" @@ -13,7 +13,7 @@ #include "ace/Intrusive_List_Node.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Intrusive_List_Node, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template<class T> ACE_Intrusive_List_Node<T>::ACE_Intrusive_List_Node (void) @@ -22,4 +22,6 @@ ACE_Intrusive_List_Node<T>::ACE_Intrusive_List_Node (void) { } -#endif /* ACE_INTRUSIVE_LIST_NODE_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_INTRUSIVE_LIST_NODE_CPP */ diff --git a/ace/Intrusive_List_Node.h b/ace/Intrusive_List_Node.h index b37b1c0204b..161a359f226 100644 --- a/ace/Intrusive_List_Node.h +++ b/ace/Intrusive_List_Node.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Intrusive_List_Node * @@ -65,6 +67,8 @@ private: T *next_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Intrusive_List_Node.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Intrusive_List_Node.inl b/ace/Intrusive_List_Node.inl index e7f2c5ee3eb..0672be2f345 100644 --- a/ace/Intrusive_List_Node.inl +++ b/ace/Intrusive_List_Node.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class T> ACE_INLINE T* ACE_Intrusive_List_Node<T>::prev (void) const { @@ -23,3 +27,5 @@ ACE_Intrusive_List_Node<T>::next (T *x) { this->next_ = x; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/LOCK_SOCK_Acceptor.cpp b/ace/LOCK_SOCK_Acceptor.cpp index 7c3f1763f14..183338b7efa 100644 --- a/ace/LOCK_SOCK_Acceptor.cpp +++ b/ace/LOCK_SOCK_Acceptor.cpp @@ -6,7 +6,7 @@ #include "ace/Guard_T.h" #include "ace/LOCK_SOCK_Acceptor.h" -ACE_RCSID(ace, LOCK_SOCK_Acceptor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class ACE_LOCK> int ACE_LOCK_SOCK_Acceptor<ACE_LOCK>::accept (ACE_SOCK_Stream &stream, @@ -30,4 +30,6 @@ ACE_LOCK_SOCK_Acceptor<ACE_LOCK>::lock (void) return this->lock_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LOCK_SOCK_ACCEPTOR_CPP */ diff --git a/ace/LOCK_SOCK_Acceptor.h b/ace/LOCK_SOCK_Acceptor.h index 36a0afe19c8..ae7775d3039 100644 --- a/ace/LOCK_SOCK_Acceptor.h +++ b/ace/LOCK_SOCK_Acceptor.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -20,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_LOCK_SOCK_Acceptor * @@ -50,6 +53,8 @@ protected: ACE_LOCK lock_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/LOCK_SOCK_Acceptor.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/LSOCK.cpp b/ace/LSOCK.cpp index 694744f01be..a1b210424ea 100644 --- a/ace/LSOCK.cpp +++ b/ace/LSOCK.cpp @@ -13,6 +13,8 @@ ACE_RCSID(ace, LSOCK, "$Id$") #include "ace/LSOCK.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK) void @@ -173,4 +175,7 @@ ACE_LSOCK::recv_handle (ACE_HANDLE &handle, char *pbuf, ssize_t *len) const return ACE_INVALID_HANDLE; } #endif /* ACE_HAS_MSG */ + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/LSOCK.h b/ace/LSOCK.h index 18921ef6d2f..fc9183a604d 100644 --- a/ace/LSOCK.h +++ b/ace/LSOCK.h @@ -16,12 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -31,13 +26,15 @@ #include "ace/SOCK.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_LSOCK * * @brief Create a Local ACE_SOCK, which is used for passing file * descriptors. */ -class ACE_Sockets_Export ACE_LSOCK +class ACE_Export ACE_LSOCK { public: #if defined (ACE_HAS_MSG) @@ -76,6 +73,8 @@ private: ACE_HANDLE aux_handle_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/LSOCK.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/LSOCK.inl b/ace/LSOCK.inl index fcd0e6887fc..5dbbb0626a1 100644 --- a/ace/LSOCK.inl +++ b/ace/LSOCK.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Simple-minded constructor. ACE_INLINE @@ -36,3 +39,5 @@ ACE_LSOCK::ACE_LSOCK (ACE_HANDLE handle) { ACE_TRACE ("ACE_LSOCK::ACE_LSOCK"); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/LSOCK_Acceptor.cpp b/ace/LSOCK_Acceptor.cpp index e8674429e77..ee154e3e087 100644 --- a/ace/LSOCK_Acceptor.cpp +++ b/ace/LSOCK_Acceptor.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, LSOCK_Acceptor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Acceptor) // Return the local endpoint address. @@ -47,50 +49,50 @@ ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor (void) int ACE_LSOCK_Acceptor::open (const ACE_Addr &remote_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) + int reuse_addr, + int protocol_family, + int backlog, + int protocol) { ACE_TRACE ("ACE_LSOCK_Acceptor::open"); this->local_addr_ = *((ACE_UNIX_Addr *) &remote_sap); // This is a gross hack... return ACE_SOCK_Acceptor::open (remote_sap, reuse_addr, - protocol_family, backlog, protocol); + protocol_family, backlog, protocol); } // General purpose routine for performing server ACE_SOCK creation. ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor (const ACE_Addr &remote_sap, - int reuse_addr, - int protocol_family, - int backlog, - int protocol) + int reuse_addr, + int protocol_family, + int backlog, + int protocol) { ACE_TRACE ("ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor"); if (this->open (remote_sap, - reuse_addr, - protocol_family, - backlog, - protocol) == -1) + reuse_addr, + protocol_family, + backlog, + protocol) == -1) ACE_ERROR ((LM_ERROR, - "ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor")); + "ACE_LSOCK_Acceptor::ACE_LSOCK_Acceptor")); } // General purpose routine for accepting new connections. int ACE_LSOCK_Acceptor::accept (ACE_LSOCK_Stream &new_stream, - ACE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, + ACE_Addr *remote_addr, + ACE_Time_Value *timeout, + int restart, int reset_new_handle) const { ACE_TRACE ("ACE_LSOCK_Acceptor::accept"); int in_blocking_mode = 0; if (this->shared_accept_start (timeout, - restart, - in_blocking_mode) == -1) + restart, + in_blocking_mode) == -1) return -1; else { @@ -98,30 +100,30 @@ ACE_LSOCK_Acceptor::accept (ACE_LSOCK_Stream &new_stream, int len = 0; if (remote_addr != 0) - { - len = remote_addr->get_size (); - addr = (sockaddr *) remote_addr->get_addr (); - } + { + len = remote_addr->get_size (); + addr = (sockaddr *) remote_addr->get_addr (); + } do - new_stream.set_handle (ACE_OS::accept (this->get_handle (), - addr, - &len)); + new_stream.set_handle (ACE_OS::accept (this->get_handle (), + addr, + &len)); while (new_stream.get_handle () == ACE_INVALID_HANDLE - && restart != 0 - && errno == EINTR - && timeout == 0); + && restart != 0 + && errno == EINTR + && timeout == 0); // Reset the size of the addr, which is only necessary for UNIX // domain sockets. if (new_stream.get_handle () != ACE_INVALID_HANDLE - && remote_addr != 0) - remote_addr->set_size (len); + && remote_addr != 0) + remote_addr->set_size (len); } return this->shared_accept_finish (new_stream, - in_blocking_mode, - reset_new_handle); + in_blocking_mode, + reset_new_handle); } // Close down the UNIX domain stream and remove the rendezvous point @@ -136,4 +138,6 @@ ACE_LSOCK_Acceptor::remove (void) || result == -1 ? -1 : 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/LSOCK_Acceptor.h b/ace/LSOCK_Acceptor.h index cc7c1dca103..8fec44e0f22 100644 --- a/ace/LSOCK_Acceptor.h +++ b/ace/LSOCK_Acceptor.h @@ -27,6 +27,8 @@ #include "ace/UNIX_Addr.h" #include "ace/LSOCK_Stream.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. class ACE_Reactor; @@ -36,7 +38,7 @@ class ACE_Reactor; * @brief Defines the format and interface for the acceptor side of the * local ACE_SOCK ACE_Stream. */ -class ACE_Sockets_Export ACE_LSOCK_Acceptor : public ACE_SOCK_Acceptor +class ACE_Export ACE_LSOCK_Acceptor : public ACE_SOCK_Acceptor { public: // = Initialization methods. @@ -86,6 +88,8 @@ private: ACE_UNIX_Addr local_addr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ #include /**/ "ace/post.h" #endif /* ACE_LOCAL_SOCK_ACCEPTOR_H */ diff --git a/ace/LSOCK_CODgram.cpp b/ace/LSOCK_CODgram.cpp index 4e58022b36c..17f80b9836f 100644 --- a/ace/LSOCK_CODgram.cpp +++ b/ace/LSOCK_CODgram.cpp @@ -1,4 +1,3 @@ -// LSOCK_CODgram.cpp // $Id$ #include "ace/LSOCK_CODgram.h" @@ -12,6 +11,8 @@ ACE_RCSID(ace, LSOCK_CODgram, "$Id$") #include "ace/LSOCK_CODgram.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_CODgram) void @@ -31,13 +32,13 @@ ACE_LSOCK_CODgram::dump (void) const int ACE_LSOCK_CODgram::open (const ACE_Addr &remote, - const ACE_Addr &local, - int protocol_family, - int protocol) + const ACE_Addr &local, + int protocol_family, + int protocol) { ACE_TRACE ("ACE_LSOCK_CODgram::open"); if (ACE_SOCK_CODgram::open (remote, local, protocol_family, - protocol) == -1) + protocol) == -1) return -1; ACE_LSOCK::set_handle (this->get_handle ()); return 0; @@ -46,13 +47,16 @@ ACE_LSOCK_CODgram::open (const ACE_Addr &remote, /* Create a local ACE_SOCK datagram. */ ACE_LSOCK_CODgram::ACE_LSOCK_CODgram (const ACE_Addr &remote, - const ACE_Addr &local, - int protocol_family, - int protocol) + const ACE_Addr &local, + int protocol_family, + int protocol) { ACE_TRACE ("ACE_LSOCK_CODgram::ACE_LSOCK_CODgram"); if (this->open (remote, local, protocol_family, - protocol) == -1) + protocol) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_LSOCK_CODgram"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/LSOCK_CODgram.h b/ace/LSOCK_CODgram.h index e0c8cfc6dfb..3f017e8816b 100644 --- a/ace/LSOCK_CODgram.h +++ b/ace/LSOCK_CODgram.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,13 +27,15 @@ #include "ace/SOCK_CODgram.h" #include "ace/Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_LSOCK_CODgram * * @brief Defines the member functions for the <ACE_LSOCK> connected * datagram abstraction. */ -class ACE_Sockets_Export ACE_LSOCK_CODgram : public ACE_SOCK_CODgram, public ACE_LSOCK +class ACE_Export ACE_LSOCK_CODgram : public ACE_SOCK_CODgram, public ACE_LSOCK { public: // = Initialization methods. @@ -65,6 +67,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/LSOCK_CODgram.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/LSOCK_CODgram.inl b/ace/LSOCK_CODgram.inl index 48c7280459f..d27ee2fd881 100644 --- a/ace/LSOCK_CODgram.inl +++ b/ace/LSOCK_CODgram.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Do nothing constructor. ACE_INLINE @@ -23,3 +26,5 @@ ACE_LSOCK_CODgram::get_handle (void) const ACE_TRACE ("ACE_LSOCK_CODgram::get_handle"); return this->ACE_SOCK_CODgram::get_handle (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/LSOCK_Connector.cpp b/ace/LSOCK_Connector.cpp index 4b29ff1e0cf..f495744b1b8 100644 --- a/ace/LSOCK_Connector.cpp +++ b/ace/LSOCK_Connector.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, LSOCK_Connector, "$Id$") #include "ace/LSOCK_Connector.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Connector) void @@ -32,16 +34,16 @@ ACE_LSOCK_Connector::ACE_LSOCK_Connector (void) // Establish a connection. ACE_LSOCK_Connector::ACE_LSOCK_Connector (ACE_LSOCK_Stream &new_stream, - const ACE_UNIX_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) + const ACE_UNIX_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms) : ACE_SOCK_Connector (new_stream, remote_sap, timeout, - local_sap, + local_sap, reuse_addr, flags, perms) @@ -52,4 +54,6 @@ ACE_LSOCK_Connector::ACE_LSOCK_Connector (ACE_LSOCK_Stream &new_stream, new_stream.set_handle (new_stream.get_handle ()); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/LSOCK_Connector.h b/ace/LSOCK_Connector.h index 558fc4a8f81..a362a1587d4 100644 --- a/ace/LSOCK_Connector.h +++ b/ace/LSOCK_Connector.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,13 +26,15 @@ #include "ace/LSOCK_Stream.h" #include "ace/UNIX_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_LSOCK_Connector * * @brief Defines the format and interface for the connector side of * the <ACE_LSOCK_Stream>. */ -class ACE_Sockets_Export ACE_LSOCK_Connector : public ACE_SOCK_Connector +class ACE_Export ACE_LSOCK_Connector : public ACE_SOCK_Connector { public: // = Initialization methods. @@ -78,6 +80,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/LSOCK_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/LSOCK_Connector.inl b/ace/LSOCK_Connector.inl index 3638a687297..f9cdffbf6dc 100644 --- a/ace/LSOCK_Connector.inl +++ b/ace/LSOCK_Connector.inl @@ -1,24 +1,27 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Establish a connection. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +// Establish a connection. ACE_INLINE int ACE_LSOCK_Connector::connect (ACE_LSOCK_Stream &new_stream, - const ACE_UNIX_Addr &remote_sap, - ACE_Time_Value *timeout, - const ACE_Addr &local_sap, - int reuse_addr, - int flags, - int perms) + const ACE_UNIX_Addr &remote_sap, + ACE_Time_Value *timeout, + const ACE_Addr &local_sap, + int reuse_addr, + int flags, + int perms) { ACE_TRACE ("ACE_LSOCK_Connector::connect"); int result = ACE_SOCK_Connector::connect (new_stream, remote_sap, - timeout, local_sap, - reuse_addr, flags, perms); + timeout, local_sap, + reuse_addr, flags, perms); if (result != -1) // This is necessary due to the weird inheritance relationships of ACE_LSOCK_Stream. new_stream.set_handle (new_stream.get_handle ()); return result; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/LSOCK_Dgram.cpp b/ace/LSOCK_Dgram.cpp index 9b4cebddc89..3c65d24b88c 100644 --- a/ace/LSOCK_Dgram.cpp +++ b/ace/LSOCK_Dgram.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, LSOCK_Dgram, "$Id$") #include "ace/LSOCK_Dgram.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Dgram) void @@ -37,13 +39,13 @@ ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (void) int ACE_LSOCK_Dgram::open (const ACE_Addr &local, - int protocol_family, - int protocol) + int protocol_family, + int protocol) { ACE_TRACE ("ACE_LSOCK_Dgram::open"); if (ACE_SOCK_Dgram::open (local, protocol_family, - protocol) == -1) + protocol) == -1) return -1; ACE_LSOCK::set_handle (this->ACE_SOCK_Dgram::get_handle ()); return 0; @@ -52,16 +54,18 @@ ACE_LSOCK_Dgram::open (const ACE_Addr &local, // Create a local ACE_SOCK datagram. ACE_LSOCK_Dgram::ACE_LSOCK_Dgram (const ACE_Addr &local, - int protocol_family, - int protocol) + int protocol_family, + int protocol) { ACE_TRACE ("ACE_LSOCK_Dgram::ACE_LSOCK_Dgram"); if (this->open (local, protocol_family, - protocol) == -1) + protocol) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_LSOCK_Dgram"))); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/LSOCK_Dgram.h b/ace/LSOCK_Dgram.h index 4d6939e1c73..4a1b43eaf8c 100644 --- a/ace/LSOCK_Dgram.h +++ b/ace/LSOCK_Dgram.h @@ -1,5 +1,4 @@ -/* -*- C++ -*- */ - +// -*- C++ -*- //============================================================================= /** @@ -27,12 +26,14 @@ #include "ace/SOCK_Dgram.h" #include "ace/LSOCK.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_LSOCK_Dgram * * @brief Create a Local ACE_SOCK datagram. */ -class ACE_Sockets_Export ACE_LSOCK_Dgram : public ACE_SOCK_Dgram, public ACE_LSOCK +class ACE_Export ACE_LSOCK_Dgram : public ACE_SOCK_Dgram, public ACE_LSOCK { public: // = Initialization methods. @@ -62,6 +63,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/LSOCK_Dgram.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/LSOCK_Dgram.inl b/ace/LSOCK_Dgram.inl index 14c415ceaa8..2c29136e06d 100644 --- a/ace/LSOCK_Dgram.inl +++ b/ace/LSOCK_Dgram.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// LSOCK_Dgram.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE void ACE_LSOCK_Dgram::set_handle (ACE_HANDLE h) @@ -18,3 +19,4 @@ ACE_LSOCK_Dgram::get_handle (void) const return this->ACE_SOCK_Dgram::get_handle (); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/LSOCK_Stream.cpp b/ace/LSOCK_Stream.cpp index 51cbaa74db0..6ac123661cf 100644 --- a/ace/LSOCK_Stream.cpp +++ b/ace/LSOCK_Stream.cpp @@ -1,4 +1,3 @@ -// LSOCK_Stream.cpp // $Id$ #include "ace/LSOCK_Stream.h" @@ -13,6 +12,8 @@ ACE_RCSID(ace, LSOCK_Stream, "$Id$") #include "ace/LSOCK_Stream.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_LSOCK_Stream) int @@ -91,7 +92,7 @@ ACE_LSOCK_Stream::send_msg (const iovec iov[], #endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ return ACE_OS::sendmsg (this->ACE_SOCK_Stream::get_handle (), - &send_msg, 0); + &send_msg, 0); } // Read a readv-style vector of buffers, along with an open I/O @@ -99,8 +100,8 @@ ACE_LSOCK_Stream::send_msg (const iovec iov[], ssize_t ACE_LSOCK_Stream::recv_msg (iovec iov[], - size_t n, - ACE_HANDLE &handle) + size_t n, + ACE_HANDLE &handle) { ACE_TRACE ("ACE_LSOCK_Stream::recv_msg"); msghdr recv_msg; @@ -118,7 +119,7 @@ ACE_LSOCK_Stream::recv_msg (iovec iov[], recv_msg.msg_control = cmsgbuf; recv_msg.msg_controllen = sizeof cmsgbuf; ssize_t result = ACE_OS::recvmsg (this->ACE_SOCK_Stream::get_handle (), - &recv_msg, 0); + &recv_msg, 0); handle = *(ACE_HANDLE*) CMSG_DATA (cmsgptr) ; return result; #else @@ -126,8 +127,11 @@ ACE_LSOCK_Stream::recv_msg (iovec iov[], recv_msg.msg_accrightslen = sizeof handle; return ACE_OS::recvmsg (this->ACE_SOCK_Stream::get_handle (), - &recv_msg, 0); + &recv_msg, 0); #endif /* ACE_HAS_4_4BSD_SENDMSG_RECVMSG */ } #endif /* ACE_HAS_MSG */ + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/LSOCK_Stream.h b/ace/LSOCK_Stream.h index 639047db334..68c43a4c221 100644 --- a/ace/LSOCK_Stream.h +++ b/ace/LSOCK_Stream.h @@ -27,12 +27,14 @@ #include "ace/UNIX_Addr.h" #include "ace/LSOCK.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_LSOCK_Stream * * @brief Create a Local ACE_SOCK stream. */ -class ACE_Sockets_Export ACE_LSOCK_Stream : public ACE_SOCK_Stream, public ACE_LSOCK +class ACE_Export ACE_LSOCK_Stream : public ACE_SOCK_Stream, public ACE_LSOCK { public: // = Send/recv methods. @@ -69,6 +71,8 @@ public: int get_remote_addr (ACE_Addr &) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/LSOCK_Stream.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/LSOCK_Stream.inl b/ace/LSOCK_Stream.inl index 7b94768e3c7..bf7e45b376d 100644 --- a/ace/LSOCK_Stream.inl +++ b/ace/LSOCK_Stream.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Sets both the file descriptors... Overrides handle from the base // classes. @@ -19,5 +22,4 @@ ACE_LSOCK_Stream::get_handle (void) const return this->ACE_SOCK_Stream::get_handle (); } - - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Lib_Find.cpp b/ace/Lib_Find.cpp index 9c6ae0faff6..c95c29aab17 100644 --- a/ace/Lib_Find.cpp +++ b/ace/Lib_Find.cpp @@ -25,6 +25,8 @@ extern "C" int LIB$FIND_IMAGE_SYMBOL(...); ACE_RCSID(ace, Lib_Find, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if ! defined (ACE_PSOS_DIAB_MIPS) int ACE::ldfind (const ACE_TCHAR* filename, @@ -700,3 +702,6 @@ ACE::strrepl (wchar_t *s, wchar_t search, wchar_t replace) return replaced; } + + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Lib_Find.h b/ace/Lib_Find.h index 17d28284f14..8ca34d44367 100644 --- a/ace/Lib_Find.h +++ b/ace/Lib_Find.h @@ -8,8 +8,6 @@ * libraries. * * $Id$ - * - * @author Priyanka Gontla <pgontla@ece.uci.edu> */ //============================================================================= @@ -21,6 +19,7 @@ #include "ace/ACE_export.h" #include "ace/os_include/os_stdio.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE { @@ -100,5 +99,8 @@ namespace ACE wchar_t *&next_start); } +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_LIB_FIND_H */ + diff --git a/ace/Local_Memory_Pool.cpp b/ace/Local_Memory_Pool.cpp index c7029c0c951..96a647ed6fd 100644 --- a/ace/Local_Memory_Pool.cpp +++ b/ace/Local_Memory_Pool.cpp @@ -8,6 +8,8 @@ ACE_RCSID(ace, Local_Memory_Pool, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Local_Memory_Pool) void @@ -139,12 +141,4 @@ ACE_Local_Memory_Pool::round_up (size_t nbytes) return ACE::round_to_pagesize (static_cast<off_t> (nbytes)); } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Auto_Basic_Array_Ptr<char>; -template class ACE_Unbounded_Set<char *>; -template class ACE_Unbounded_Set_Iterator<char *>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Auto_Basic_Array_Ptr<char> -#pragma instantiate ACE_Unbounded_Set<char *> -#pragma instantiate ACE_Unbounded_Set_Iterator<char *> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Local_Memory_Pool.h b/ace/Local_Memory_Pool.h index f5762b9bc14..caf22055273 100644 --- a/ace/Local_Memory_Pool.h +++ b/ace/Local_Memory_Pool.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #include "ace/Unbounded_Set.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Local_Memory_Pool_Options * @@ -125,5 +127,7 @@ protected: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_LOCAL_MEMORY_POOL_H */ diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp index 27ee8c84ddf..1c58e14ae19 100644 --- a/ace/Local_Name_Space.cpp +++ b/ace/Local_Name_Space.cpp @@ -1,4 +1,5 @@ #include "ace/Local_Name_Space.h" +#include "ace/ACE.h" #include "ace/RW_Process_Mutex.h" #include "ace/SString.h" #include "ace/OS_NS_string.h" @@ -7,6 +8,8 @@ ACE_RCSID (ace, Local_Name_Space, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_NS_String::~ACE_NS_String (void) { if (this->delete_rep_) @@ -129,6 +132,8 @@ ACE_NS_String::hash (void) const } ACE_NS_Internal::ACE_NS_Internal (void) + : value_ (), + type_ () { } @@ -160,55 +165,4 @@ ACE_NS_Internal::type (void) return this->type_; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -#if (1) -template class ACE_Hash_Map_Entry<ACE_NS_String, ACE_NS_Internal>; -template class ACE_Hash<ACE_NS_String>; -template class ACE_Equal_To<ACE_NS_String>; -template class ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex>; -#else -template class ACE_Map_Entry<ACE_NS_String, ACE_NS_Internal>; -template class ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -template class ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex>; -#endif -template class ACE_Unbounded_Set<ACE_Name_Binding>; -template class ACE_Unbounded_Set_Iterator<ACE_Name_Binding>; -template class ACE_Unbounded_Set<ACE_NS_WString>; -template class ACE_Unbounded_Set_Iterator<ACE_NS_WString>; -template class ACE_Node<ACE_NS_WString>; -template class ACE_Node<ACE_Name_Binding>; -template class ACE_Guard<ACE_RW_Process_Mutex>; -template class ACE_Read_Guard<ACE_RW_Process_Mutex>; -template class ACE_Write_Guard<ACE_RW_Process_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#if (1) -#pragma instantiate ACE_Hash_Map_Entry<ACE_NS_String, ACE_NS_Internal> -#pragma instantiate ACE_Hash<ACE_NS_String> -#pragma instantiate ACE_Equal_To<ACE_NS_String> -#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> -#else -#pragma instantiate ACE_Map_Entry<ACE_NS_String, ACE_NS_Internal> -#pragma instantiate ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> -#endif -#pragma instantiate ACE_Unbounded_Set<ACE_Name_Binding> -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Name_Binding> -#pragma instantiate ACE_Unbounded_Set<ACE_NS_WString> -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_NS_WString> -#pragma instantiate ACE_Node<ACE_NS_WString> -#pragma instantiate ACE_Node<ACE_Name_Binding> -#pragma instantiate ACE_Guard<ACE_RW_Process_Mutex> -#pragma instantiate ACE_Read_Guard<ACE_RW_Process_Mutex> -#pragma instantiate ACE_Write_Guard<ACE_RW_Process_Mutex> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Local_Name_Space.h b/ace/Local_Name_Space.h index ae08bd37917..fbb837824c8 100644 --- a/ace/Local_Name_Space.h +++ b/ace/Local_Name_Space.h @@ -23,6 +23,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_NS_WString; /** @@ -120,6 +122,8 @@ private: const char *type_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + // Include the ACE_Local_Name_Space templates stuff at this point. #include "ace/Local_Name_Space_T.h" diff --git a/ace/Local_Name_Space_T.cpp b/ace/Local_Name_Space_T.cpp index 674c774e153..87f5e51362e 100644 --- a/ace/Local_Name_Space_T.cpp +++ b/ace/Local_Name_Space_T.cpp @@ -1,3 +1,5 @@ +// $Id$ + #ifndef ACE_LOCAL_NAME_SPACE_T_CPP #define ACE_LOCAL_NAME_SPACE_T_CPP @@ -14,10 +16,7 @@ #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" -ACE_RCSID (ace, - Local_Name_Space_T, - "$Id$") - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class ALLOCATOR> ACE_Name_Space_Map<ALLOCATOR>::ACE_Name_Space_Map (ALLOCATOR *alloc) @@ -331,7 +330,7 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::resolve_i ( size_t len = ACE_OS::strlen (ns_internal.type ()); // Makes a copy here. Caller needs to call delete to free up // memory. - char *new_type; + char *new_type = 0; ACE_NEW_RETURN (new_type, char [len + 1], -1); @@ -965,4 +964,6 @@ ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK>::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LOCAL_NAME_SPACE_T_CPP */ diff --git a/ace/Local_Name_Space_T.h b/ace/Local_Name_Space_T.h index 97602b7019f..14ed9377b30 100644 --- a/ace/Local_Name_Space_T.h +++ b/ace/Local_Name_Space_T.h @@ -27,19 +27,29 @@ #include "ace/Local_Name_Space.h" #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /// A short-hand name for our set of name/value/type tuples passed back /// to callers. typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET; +ACE_END_VERSIONED_NAMESPACE_DECL + // Simplify later usage by defining typedefs. #if (1) # include "ace/Hash_Map_Manager_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_Hash_Map_Manager_Ex<ACE_NS_String, ACE_NS_Internal, ACE_Hash<ACE_NS_String>, ACE_Equal_To<ACE_NS_String>, ACE_Null_Mutex> MAP_MANAGER; +ACE_END_VERSIONED_NAMESPACE_DECL #else # include "ace/Map_Manager.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_Map_Manager<ACE_NS_String, ACE_NS_Internal, ACE_Null_Mutex> MAP_MANAGER; +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* 0 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /// @deprecated Deprecated typedefs. Use the map's traits instead. typedef MAP_MANAGER::ITERATOR MAP_ITERATOR; typedef MAP_MANAGER::ENTRY MAP_ENTRY; @@ -256,6 +266,8 @@ private: ACE_LOCK *lock_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Local_Name_Space_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Local_Tokens.cpp b/ace/Local_Tokens.cpp index c575ac63735..b2b5ab476a6 100644 --- a/ace/Local_Tokens.cpp +++ b/ace/Local_Tokens.cpp @@ -17,6 +17,8 @@ ACE_RCSID (ace, Local_Tokens, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Tokens::dump (void) const { @@ -1621,21 +1623,6 @@ ACE_Local_WLock::clone (void) const return temp; } -// ************************************************************ - - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -#if !defined (ACE_NO_TSS_TOKENS) -template class ACE_TSS <ACE_TPQ_Entry>; -#endif /* ACE_NO_TSS_TOKENS */ -template class ACE_Unbounded_Stack <ACE_TPQ_Entry *>; -template class ACE_Node <ACE_TPQ_Entry *>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#if !defined (ACE_NO_TSS_TOKENS) -#pragma instantiate ACE_TSS <ACE_TPQ_Entry> -#endif /* ACE_NO_TSS_TOKENS */ -#pragma instantiate ACE_Unbounded_Stack <ACE_TPQ_Entry *> -#pragma instantiate ACE_Node <ACE_TPQ_Entry *> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Local_Tokens.h b/ace/Local_Tokens.h index 6e68856d02e..1351f73f49f 100644 --- a/ace/Local_Tokens.h +++ b/ace/Local_Tokens.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -67,6 +67,8 @@ # define ACE_NO_TSS_TOKENS 1 #endif /* !(defined (ACE_HAS_THREADS) && defined (ACE_HAS_THREAD_SPECIFIC_STORAGE)) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // 1. /** * @class ACE_TOKEN_CONST @@ -77,9 +79,8 @@ * this class is necessary to fight the compiler with order of * declaration errors. */ -class ACE_Export ACE_TOKEN_CONST +namespace ACE_TOKEN_CONST { -public: #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) // ACE platform supports some form of threading. typedef ACE_Condition_Thread_Mutex COND_VAR; @@ -90,7 +91,7 @@ public: typedef ACE_Null_Mutex MUTEX; typedef ACE_Guard<ACE_Null_Mutex> GUARD; #endif /* ACE_HAS_THREADS */ -}; +} // Forward decl. class ACE_Token_Proxy; @@ -105,7 +106,7 @@ class ACE_Token_Proxy; */ class ACE_Export ACE_TPQ_Entry { -friend class ACE_Token_Manager; + friend class ACE_Token_Manager; public: typedef void (*PTVF) (void *); @@ -357,15 +358,15 @@ protected: * Not a public interface. * Currently, I don't see a reason for providing an abstract * interface at this level of the library. As of yet, no one - * uses <ACE_Tokens> derivatives through this abstract interface - * except for <ACE_Token_Manager>. It only uses the statistical + * uses ACE_Tokens derivatives through this abstract interface + * except for ACE_Token_Manager. It only uses the statistical * methods which are shared by all Tokens. For that reason, it * still makes since to have a common base class. However, * acquire, renew, and release do not need to have matching * interfaces throughout all Tokens. * To add a new type of token (e.g. semaphore), this class must * be subtyped to define the new semantics. See - * <ACE_Token_Manager> for details. + * ACE_Token_Manager for details. */ class ACE_Export ACE_Tokens { @@ -1109,6 +1110,8 @@ protected: ACE_Tokens *create_token (const ACE_TCHAR *name); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ #if defined (__ACE_INLINE__) diff --git a/ace/Local_Tokens.inl b/ace/Local_Tokens.inl index 3008f25c69a..ddbbf0343cf 100644 --- a/ace/Local_Tokens.inl +++ b/ace/Local_Tokens.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #if defined (ACE_HAS_TOKENS_LIBRARY) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // ************************************************************ ACE_INLINE int @@ -281,4 +284,6 @@ ACE_Token_Name::operator== (const ACE_Token_Name &rhs) const return (ACE_OS::strcmp (this->token_name_, rhs.name ()) == 0); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Lock.cpp b/ace/Lock.cpp index e0ea8397846..dca934b8067 100644 --- a/ace/Lock.cpp +++ b/ace/Lock.cpp @@ -8,6 +8,8 @@ ACE_RCSID(ace, Lock, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Lock::~ACE_Lock (void) { } @@ -82,3 +84,5 @@ ACE_Adaptive_Lock::dump (void) const // return this->lock_->dump (); #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Lock.h b/ace/Lock.h index 68bacb35dd8..3a8eac292e4 100644 --- a/ace/Lock.h +++ b/ace/Lock.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Lock * @@ -149,6 +151,8 @@ protected: ACE_Lock *lock_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Lock.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Lock.inl b/ace/Lock.inl index bd6d1585cc9..7e4842a0e33 100644 --- a/ace/Lock.inl +++ b/ace/Lock.inl @@ -1,8 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Lock::ACE_Lock (void) { } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Lock_Adapter_T.cpp b/ace/Lock_Adapter_T.cpp index d71a1fbd2fc..ec0c013a220 100644 --- a/ace/Lock_Adapter_T.cpp +++ b/ace/Lock_Adapter_T.cpp @@ -14,6 +14,7 @@ #include "ace/Lock_Adapter_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // This constructor isn't inlined, because SunPRO C++ 4.2 + patch // 104631-07 has trouble compiling TAO with it inline. @@ -111,4 +112,6 @@ ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::tryacquire_write_upgrade (void) return this->lock_->tryacquire_write_upgrade (); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LOCK_ADAPTER_T_CPP */ diff --git a/ace/Lock_Adapter_T.h b/ace/Lock_Adapter_T.h index 76445506e0a..93ee250de4b 100644 --- a/ace/Lock_Adapter_T.h +++ b/ace/Lock_Adapter_T.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Lock_Adapter * @@ -103,6 +105,8 @@ private: int delete_lock_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Lock_Adapter_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Lock_Adapter_T.inl b/ace/Lock_Adapter_T.inl index 2ecd393d56d..f3b09bc0ab7 100644 --- a/ace/Lock_Adapter_T.inl +++ b/ace/Lock_Adapter_T.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class ACE_LOCKING_MECHANISM> ACE_INLINE ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter ( @@ -10,3 +12,5 @@ ACE_Lock_Adapter<ACE_LOCKING_MECHANISM>::ACE_Lock_Adapter ( delete_lock_ (0) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp index cbb5c22b008..31d32bb6ca4 100644 --- a/ace/Log_Msg.cpp +++ b/ace/Log_Msg.cpp @@ -43,6 +43,8 @@ ACE_RCSID(ace, Log_Msg, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg) // only used here... dhinton @@ -58,11 +60,11 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Log_Msg) # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ defined (ACE_HAS_TSS_EMULATION) +static ACE_thread_key_t the_log_msg_tss_key = 0; + ACE_thread_key_t *log_msg_tss_key (void) { - static ACE_thread_key_t key = 0; - - return &key; + return &the_log_msg_tss_key; } # endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ @@ -91,16 +93,6 @@ ACE_thread_key_t *log_msg_tss_key (void) /// deleted. int ACE_Log_Msg::instance_count_ = 0; -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -# if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE == 0) - template class ACE_Cleanup_Adapter<ACE_Log_Msg>; -# endif /* ! ACE_MT_SAFE */ -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -# if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE == 0) -# pragma instantiate ACE_Cleanup_Adapter<ACE_Log_Msg> -# endif /* ! ACE_MT_SAFE */ -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - /** * @class ACE_Log_Msg_Manager * @@ -240,7 +232,7 @@ ACE_Log_Msg_Manager::close (void) # endif /* ACE_HAS_THR_C_DEST */ LOCAL_EXTERN_PREFIX void -ACE_TSS_cleanup (void *ptr) +ACE_TSS_CLEANUP_NAME (void *ptr) { #if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) // Delegate to thr_desc if this not has terminated @@ -307,7 +299,7 @@ ACE_Log_Msg::instance (void) { ACE_NO_HEAP_CHECK; if (ACE_Thread::keycreate (log_msg_tss_key (), - &ACE_TSS_cleanup) != 0) + &ACE_TSS_CLEANUP_NAME) != 0) { if (1 == ACE_OS_Object_Manager::starting_up()) //This function is called before ACE_OS_Object_Manager is @@ -491,6 +483,32 @@ ACE_Log_Msg::close (void) // already deleted by ACE_TSS_Cleanup::exit (), so we // don't want to access it again. key_created_ = 0; +#ifdef ACE_HAS_BROKEN_THREAD_KEYFREE + // for some systems, e.g. LynxOS, we need to ensure that + // any registered thread destructor action for this thread + // is disabled. Otherwise in the event of a dynamic library + // unload of libACE, by a program not linked with libACE, + // ACE_TSS_cleanup will be invoked after libACE has been unloaded. + + ACE_Log_Msg *tss_log_msg = 0; + + // Get the tss_log_msg from thread-specific storage. + if ( ACE_Thread::getspecific (*(log_msg_tss_key ()), + ACE_reinterpret_cast (void **, &tss_log_msg)) != -1 + && tss_log_msg) + { + // we haven't been cleaned up + ACE_TSS_cleanup(tss_log_msg); + + if ( ACE_Thread::setspecific( (*log_msg_tss_key()), + (void *)NULL ) != 0 ) + { + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%P|%t) ACE_Log_Msg::close failed to ACE_Thread::setspecific to NULL\n"))); + } + + } +#endif /* ACE_HAS_BROKEN_THREAD_KEYFREE */ } ACE_OS::thread_mutex_unlock (lock); @@ -627,6 +645,7 @@ ACE_Log_Msg::ACE_Log_Msg (void) : status_ (0), errnum_ (0), linenum_ (0), + msg_ (0), restart_ (1), // Restart by default... ostream_ (0), msg_callback_ (0), @@ -666,6 +685,8 @@ ACE_Log_Msg::ACE_Log_Msg (void) this->timestamp_ = 2; } } + + ACE_NEW_NORETURN (this->msg_, ACE_TCHAR[ACE_MAXLOGMSGLEN+1]); } ACE_Log_Msg::~ACE_Log_Msg (void) @@ -734,6 +755,8 @@ ACE_Log_Msg::~ACE_Log_Msg (void) ostream_ = 0; } #endif + + delete[] this->msg_; } // Open the sender-side of the message queue. @@ -1650,68 +1673,73 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, #if !defined (ACE_WIN32) && defined (ACE_USES_WCHAR) wchar_t *str = va_arg (argp, wchar_t *); ACE_OS::strcpy (fp, ACE_LIB_TEXT ("ls")); - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, str ? str : ACE_LIB_TEXT ("(null)")); - else - this_len = ACE_OS::sprintf - (bp, format, str ? str : ACE_LIB_TEXT ("(null)")); #else /* ACE_WIN32 && ACE_USES_WCHAR */ ACE_TCHAR *str = va_arg (argp, ACE_TCHAR *); ACE_OS::strcpy (fp, ACE_LIB_TEXT ("s")); +#endif /* ACE_WIN32 && ACE_USES_WCHAR */ if (can_check) this_len = ACE_OS::snprintf (bp, bspace, format, str ? str : ACE_LIB_TEXT ("(null)")); else this_len = ACE_OS::sprintf (bp, format, str ? str : ACE_LIB_TEXT ("(null)")); -#endif /* ACE_WIN32 && ACE_USES_WCHAR */ ACE_UPDATE_COUNT (bspace, this_len); } break; case 'C': // Char string, Unicode for Win32/WCHAR + { + ACE_TCHAR *cstr = va_arg (argp, ACE_TCHAR *); #if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); + ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); #else /* ACE_WIN32 && ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_LIB_TEXT ("s")); + ACE_OS::strcpy (fp, ACE_LIB_TEXT ("s")); #endif /* ACE_WIN32 && ACE_USES_WCHAR */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, ACE_TCHAR *)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, ACE_TCHAR *)); - ACE_UPDATE_COUNT (bspace, this_len); + if (can_check) + this_len = ACE_OS::snprintf + (bp, bspace, format, cstr ? cstr : ACE_LIB_TEXT ("(null)")); + else + this_len = ACE_OS::sprintf + (bp, format, cstr ? cstr : ACE_LIB_TEXT ("(null)")); + ACE_UPDATE_COUNT (bspace, this_len); + } break; case 'W': + { #if defined (ACE_WIN32) + ACE_TCHAR *wstr = va_arg (argp, ACE_TCHAR *); # if defined (ACE_USES_WCHAR) - ACE_OS::strcpy (fp, ACE_LIB_TEXT ("s")); + ACE_OS::strcpy (fp, ACE_LIB_TEXT ("s")); # else /* ACE_USES_WCHAR */ - ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); + ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); # endif /* ACE_USES_WCHAR */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, ACE_TCHAR *)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, ACE_TCHAR *)); + + if (can_check) + this_len = ACE_OS::snprintf + (bp, bspace, format, wstr ? wstr : ACE_LIB_TEXT ("(null)")); + else + this_len = ACE_OS::sprintf + (bp, format, wstr ? wstr : ACE_LIB_TEXT ("(null)")); + #else + wchar_t *wchar_str = va_arg (argp, wchar_t *); + # if defined (HPUX) - ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); + ACE_OS::strcpy (fp, ACE_LIB_TEXT ("S")); # else - ACE_OS::strcpy (fp, ACE_LIB_TEXT ("ls")); + ACE_OS::strcpy (fp, ACE_LIB_TEXT ("ls")); # endif /* HPUX */ - if (can_check) - this_len = ACE_OS::snprintf - (bp, bspace, format, va_arg (argp, wchar_t *)); - else - this_len = ACE_OS::sprintf - (bp, format, va_arg (argp, wchar_t *)); + + if (can_check) + this_len = ACE_OS::snprintf + (bp, bspace, format, wchar_str); + else + this_len = ACE_OS::sprintf + (bp, format, wchar_str); #endif /* ACE_WIN32 */ - ACE_UPDATE_COUNT (bspace, this_len); + ACE_UPDATE_COUNT (bspace, this_len); + } break; case 'w': // Wide character @@ -1968,7 +1996,7 @@ ACE_Log_Msg::log (const ACE_TCHAR *format_str, // Check that memory was not corrupted, if it corrupted we can't log anything // anymore because all our members could be corrupted. - if (bp >= this->msg_ + sizeof this->msg_) + if (bp >= (this->msg_ + ACE_MAXLOGMSGLEN+1)) { abort_prog = 1; ACE_OS::fprintf (stderr, @@ -2154,11 +2182,12 @@ ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority, if (this->log_priority_enabled (log_priority) == 0) return 0; - ACE_TCHAR buf[ACE_Log_Record::MAXLOGMSGLEN - - ACE_Log_Record::VERBOSE_LEN - 58]; - // 58 for the HEXDUMP header; + ACE_TCHAR* buf = 0; + const size_t buf_sz = + ACE_Log_Record::MAXLOGMSGLEN - ACE_Log_Record::VERBOSE_LEN - 58; + ACE_NEW_RETURN (buf, ACE_TCHAR[buf_sz], -1); - ACE_TCHAR *msg_buf; + ACE_TCHAR *msg_buf = 0; const size_t text_sz = text ? ACE_OS::strlen(text) : 0; ACE_NEW_RETURN (msg_buf, ACE_TCHAR[text_sz + 58], @@ -2167,7 +2196,7 @@ ACE_Log_Msg::log_hexdump (ACE_Log_Priority log_priority, buf[0] = 0; // in case size = 0 const size_t len = ACE::format_hexdump - (buffer, size, buf, sizeof (buf) / sizeof (ACE_TCHAR) - text_sz); + (buffer, size, buf, buf_sz / sizeof (ACE_TCHAR) - text_sz); int sz = 0; @@ -2447,7 +2476,7 @@ void ACE_Log_Msg::msg (const ACE_TCHAR *m) { ACE_OS::strsncpy (this->msg_, m, - (sizeof this->msg_ / sizeof (ACE_TCHAR))); + ((ACE_MAXLOGMSGLEN+1) / sizeof (ACE_TCHAR))); } ACE_Log_Msg_Callback * @@ -2647,3 +2676,5 @@ ACE_Log_Msg::inherit_hook (ACE_OS_Thread_Descriptor *thr_desc, # endif /* ACE_PSOS */ #endif /* ! ACE_THREADS_DONT_INHERIT_LOG_MSG && ! ACE_HAS_MINIMAL_ACE_OS */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h index 9d4b878d375..bc890417445 100644 --- a/ace/Log_Msg.h +++ b/ace/Log_Msg.h @@ -25,20 +25,9 @@ #include "ace/Log_Priority.h" #include "ace/os_include/os_limits.h" -// The following ASSERT macro is courtesy of Alexandre Karev -// <akg@na47sun05.cern.ch>. -#if defined (ACE_NDEBUG) -#define ACE_ASSERT(x) -#elif !defined (ACE_ASSERT) -#define ACE_ASSERT(X) \ - do { if(!(X)) { \ - int __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Msg *ace___ = ACE_Log_Msg::instance (); \ - ace___->set (__FILE__, __LINE__, -1, __ace_error, ace___->restart (), \ - ace___->msg_ostream (), ace___->msg_callback ()); \ - ace___->log (LM_ERROR, ACE_LIB_TEXT ("ACE_ASSERT: file %N, line %l assertion failed for '%s'.%a\n"), ACE_TEXT_TO_TCHAR_IN (#X), -1); \ - } } while (0) -#endif /* ACE_NDEBUG */ +// The ACE_ASSERT macro used to be defined here, include ace/Assert.h +// for backwards compatibility. +#include "ace/Assert.h" #if defined (ACE_NLOGGING) #define ACE_HEX_DUMP(X) do {} while (0) @@ -113,6 +102,8 @@ # undef THREAD #endif /* THREAD */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Log_Msg_Callback; class ACE_Log_Msg_Backend; @@ -347,7 +338,7 @@ public: * allow "chaining". Note that as opposed to ACE_Log_Msg_Callback, * ACE_Log_Msg_Backend is a per-process entity. * - * Note: Be aware that because of the current architecture there is + * @note Be aware that because of the current architecture there is * no guarantee that open (), reset () and close () will be called * on a backend object. * @@ -388,19 +379,19 @@ public: // because the *semantics* have changed (the objects are no longer // TSS). /// Get TSS exception action. - /// NOTE: The action is no longer TSS, they are global! + /// @note The action is no longer TSS, they are global! ACE_SEH_EXCEPT_HANDLER seh_except_selector (void); /// Set TSS exception action. - /// NOTE: The action is no longer TSS, they are global! + /// @note The action is no longer TSS, they are global! ACE_SEH_EXCEPT_HANDLER seh_except_selector (ACE_SEH_EXCEPT_HANDLER); /// Get TSS exception handler. - /// NOTE: The handler is no longer TSS, they are global! + /// @note The handler is no longer TSS, they are global! ACE_SEH_EXCEPT_HANDLER seh_except_handler (void); /// Set TSS exception handler. - /// NOTE: The handler is no longer TSS, they are global! + /// @note The handler is no longer TSS, they are global! ACE_SEH_EXCEPT_HANDLER seh_except_handler (ACE_SEH_EXCEPT_HANDLER); #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS && ACE_LEGACY_MODE */ @@ -585,7 +576,7 @@ private: /// The log message, which resides in thread-specific storage. Note /// that only the current log message is stored here -- it will be /// overwritten by the subsequent call to log(). - ACE_TCHAR msg_[ACE_MAXLOGMSGLEN + 1]; // Add one for NUL-terminator. + ACE_TCHAR* msg_; // Add one for NUL-terminator. /// Indicates whether we should restart system calls that are /// interrupted. @@ -697,6 +688,8 @@ private: ACE_Log_Msg (const ACE_Log_Msg &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) # if defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ defined (ACE_HAS_TSS_EMULATION) @@ -706,9 +699,15 @@ private: # else # define LOCAL_EXTERN_PREFIX # endif /* ACE_HAS_THR_C_DEST */ + +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# define ACE_TSS_CLEANUP_NAME ACE_PREPROC_CONCATENATE(ACE_,ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _TSS_cleanup)) +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + + LOCAL_EXTERN_PREFIX void -ACE_TSS_cleanup (void *ptr); +ACE_TSS_CLEANUP_NAME (void *ptr); # endif /* ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION */ #endif /* ACE_MT_SAFE */ diff --git a/ace/Log_Msg_Backend.cpp b/ace/Log_Msg_Backend.cpp index 8e4ae6208f3..de9b9c22b7b 100644 --- a/ace/Log_Msg_Backend.cpp +++ b/ace/Log_Msg_Backend.cpp @@ -4,6 +4,11 @@ ACE_RCSID(ace, Log_Msg_Backend, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Log_Msg_Backend::~ACE_Log_Msg_Backend (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Log_Msg_Backend.h b/ace/Log_Msg_Backend.h index 50392cd92cf..6203287011d 100644 --- a/ace/Log_Msg_Backend.h +++ b/ace/Log_Msg_Backend.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Log_Record; /** @@ -60,5 +62,7 @@ public: virtual int log (ACE_Log_Record &log_record) = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_LOG_MSG_BACKEND_H */ diff --git a/ace/Log_Msg_Callback.cpp b/ace/Log_Msg_Callback.cpp index c2ab8da127c..2fcf5206dd1 100644 --- a/ace/Log_Msg_Callback.cpp +++ b/ace/Log_Msg_Callback.cpp @@ -4,6 +4,10 @@ ACE_RCSID(ace, Log_Msg_Callback, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Log_Msg_Callback::~ACE_Log_Msg_Callback (void) { } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Log_Msg_Callback.h b/ace/Log_Msg_Callback.h index 4de1b85bb8a..2d3af46a1b3 100644 --- a/ace/Log_Msg_Callback.h +++ b/ace/Log_Msg_Callback.h @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Log_Record; /** @@ -47,7 +49,7 @@ class ACE_Log_Record; * is spawned because it might have been allocated off of the * stack of the original thread, in which case all hell would * break loose... Therefore, you'll need to reset these in each - * new thread. + * new thread. */ class ACE_Export ACE_Log_Msg_Callback { @@ -61,5 +63,7 @@ public: virtual void log (ACE_Log_Record &log_record) = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_LOG_MSG_CALLBACK_H */ diff --git a/ace/Log_Msg_IPC.cpp b/ace/Log_Msg_IPC.cpp index aa410e3150d..e6da947d80e 100644 --- a/ace/Log_Msg_IPC.cpp +++ b/ace/Log_Msg_IPC.cpp @@ -5,6 +5,8 @@ ACE_RCSID(ace, Log_Msg_IPC, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Log_Msg_IPC::ACE_Log_Msg_IPC (void) { } @@ -68,3 +70,5 @@ ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record) log_record.length ()); #endif /* ACE_HAS_STREAM_PIPES */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Log_Msg_IPC.h b/ace/Log_Msg_IPC.h index fa7f90ba59f..2b05c02de02 100644 --- a/ace/Log_Msg_IPC.h +++ b/ace/Log_Msg_IPC.h @@ -25,16 +25,22 @@ // problems it can't be... #if defined (ACE_HAS_STREAM_PIPES) # include "ace/SPIPE_Connector.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_SPIPE_Stream ACE_LOG_MSG_IPC_STREAM; typedef ACE_SPIPE_Connector ACE_LOG_MSG_IPC_CONNECTOR; typedef ACE_SPIPE_Addr ACE_LOG_MSG_IPC_ADDR; +ACE_END_VERSIONED_NAMESPACE_DECL #else # include "ace/SOCK_Connector.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_SOCK_Stream ACE_LOG_MSG_IPC_STREAM; typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR; typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR; +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_STREAM_PIPES */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /// Defines the interfaces for ACE_Log_Msg backend. /** * Implement an ACE_Log_Msg_Backend that logs to a remote logging @@ -59,5 +65,7 @@ private: ACE_LOG_MSG_IPC_STREAM message_queue_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_LOG_MSG_H */ diff --git a/ace/Log_Msg_NT_Event_Log.cpp b/ace/Log_Msg_NT_Event_Log.cpp index 1d51bbad03b..8053624283c 100644 --- a/ace/Log_Msg_NT_Event_Log.cpp +++ b/ace/Log_Msg_NT_Event_Log.cpp @@ -12,6 +12,8 @@ ACE_RCSID(ace, Log_Msg_NT_Event_Log, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Log_Msg_NT_Event_Log::ACE_Log_Msg_NT_Event_Log (void) : evlog_handle_(0) { @@ -153,4 +155,6 @@ ACE_Log_Msg_NT_Event_Log::log (ACE_Log_Record &log_record) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_LOG_MSG_NT_EVENT_LOG */ diff --git a/ace/Log_Msg_NT_Event_Log.h b/ace/Log_Msg_NT_Event_Log.h index f4c975011f8..3edc049aea3 100644 --- a/ace/Log_Msg_NT_Event_Log.h +++ b/ace/Log_Msg_NT_Event_Log.h @@ -24,6 +24,8 @@ #include "ace/Log_Msg_Backend.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Log_Msg_NT_Event_Log * @@ -62,6 +64,8 @@ private: HANDLE evlog_handle_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_LOG_MSG_NT_EVENT_LOG */ #include /**/ "ace/post.h" diff --git a/ace/Log_Msg_UNIX_Syslog.cpp b/ace/Log_Msg_UNIX_Syslog.cpp index 4a685231f32..55adf75791b 100644 --- a/ace/Log_Msg_UNIX_Syslog.cpp +++ b/ace/Log_Msg_UNIX_Syslog.cpp @@ -11,6 +11,8 @@ #include "ace/OS_NS_string.h" #include "ace/os_include/os_syslog.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // NOTE: // The ACE_Log_Msg_UNIX_Syslog class can use the openlog(), // setlogmask(), syslog() and closelog() routines in a thread safe @@ -195,4 +197,6 @@ ACE_Log_Msg_UNIX_Syslog::convert_log_mask (int lm_mask) return syslog_mask; } -#endif /* !defined (ACE_LACKS_UNIX_SYSLOG) */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* !ACE_LACKS_UNIX_SYSLOG */ diff --git a/ace/Log_Msg_UNIX_Syslog.h b/ace/Log_Msg_UNIX_Syslog.h index 78ed77bfcd4..0031e043431 100644 --- a/ace/Log_Msg_UNIX_Syslog.h +++ b/ace/Log_Msg_UNIX_Syslog.h @@ -24,6 +24,8 @@ #include "ace/Log_Msg_Backend.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Log_Msg_UNIX_Syslog * @@ -66,6 +68,8 @@ private: int convert_log_mask (int lm_mask); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_LACKS_UNIX_SYSLOG */ #include /**/ "ace/post.h" diff --git a/ace/Log_Priority.h b/ace/Log_Priority.h index d648dff381b..c1084bbeee5 100644 --- a/ace/Log_Priority.h +++ b/ace/Log_Priority.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,16 +12,23 @@ #ifndef ACE_LOG_PRIORITY_H #define ACE_LOG_PRIORITY_H + #include /**/ "ace/pre.h" +#include "ace/config-lite.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** + * @enum ACE_Log_Priority + * * @brief This data type indicates the relative priorities of the - * logging messages, from lowest to highest priority. + * logging messages, from lowest to highest priority. * * These values are defined using powers of two so that it's * possible to form a mask to turn them on or off dynamically. * We only use 12 bits, however, so users are free to use the - * remaining 19 bits to define their own priority masks. + * remaining 19 bits to define their own priority masks. */ enum ACE_Log_Priority { @@ -72,5 +79,7 @@ enum ACE_Log_Priority LM_ENSURE_32_BITS = 0x7FFFFFFF }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_LOG_PRIORITY_H */ diff --git a/ace/Log_Record.cpp b/ace/Log_Record.cpp index 11b24b7b8d2..2fed56760da 100644 --- a/ace/Log_Record.cpp +++ b/ace/Log_Record.cpp @@ -16,50 +16,58 @@ # include "ace/streams.h" #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +#include "ace/OS_Memory.h" + ACE_RCSID(ace, Log_Record, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Log_Record) -const ACE_TCHAR *ACE_Log_Record::priority_names_[] = +namespace { - ACE_LIB_TEXT ("LM_SHUTDOWN"), - ACE_LIB_TEXT ("LM_TRACE"), - ACE_LIB_TEXT ("LM_DEBUG"), - ACE_LIB_TEXT ("LM_INFO"), - ACE_LIB_TEXT ("LM_NOTICE"), - ACE_LIB_TEXT ("LM_WARNING"), - ACE_LIB_TEXT ("LM_STARTUP"), - ACE_LIB_TEXT ("LM_ERROR"), - ACE_LIB_TEXT ("LM_CRITICAL"), - ACE_LIB_TEXT ("LM_ALERT"), - ACE_LIB_TEXT ("LM_EMERGENCY"), - ACE_LIB_TEXT ("LM_UNK(04000)"), - ACE_LIB_TEXT ("LM_UNK(010000)"), - ACE_LIB_TEXT ("LM_UNK(020000)"), - ACE_LIB_TEXT ("LM_UNK(040000)"), - ACE_LIB_TEXT ("LM_UNK(0100000)"), - ACE_LIB_TEXT ("LM_UNK(0200000)"), - ACE_LIB_TEXT ("LM_UNK(0400000)"), - ACE_LIB_TEXT ("LM_UNK(01000000)"), - ACE_LIB_TEXT ("LM_UNK(02000000)"), - ACE_LIB_TEXT ("LM_UNK(04000000)"), - ACE_LIB_TEXT ("LM_UNK(010000000)"), - ACE_LIB_TEXT ("LM_UNK(020000000)"), - ACE_LIB_TEXT ("LM_UNK(040000000)"), - ACE_LIB_TEXT ("LM_UNK(0100000000)"), - ACE_LIB_TEXT ("LM_UNK(0200000000)"), - ACE_LIB_TEXT ("LM_UNK(0400000000)"), - ACE_LIB_TEXT ("LM_UNK(01000000000)"), - ACE_LIB_TEXT ("LM_UNK(02000000000)"), - ACE_LIB_TEXT ("LM_UNK(04000000000)"), - ACE_LIB_TEXT ("LM_UNK(010000000000)"), - ACE_LIB_TEXT ("LM_UNK(020000000000)") -}; + // Symbolic names for the <ACE_Log_Priority> enumerators. + ACE_TCHAR const * ace_priority_names[] = + { + ACE_LIB_TEXT ("LM_SHUTDOWN"), + ACE_LIB_TEXT ("LM_TRACE"), + ACE_LIB_TEXT ("LM_DEBUG"), + ACE_LIB_TEXT ("LM_INFO"), + ACE_LIB_TEXT ("LM_NOTICE"), + ACE_LIB_TEXT ("LM_WARNING"), + ACE_LIB_TEXT ("LM_STARTUP"), + ACE_LIB_TEXT ("LM_ERROR"), + ACE_LIB_TEXT ("LM_CRITICAL"), + ACE_LIB_TEXT ("LM_ALERT"), + ACE_LIB_TEXT ("LM_EMERGENCY"), + ACE_LIB_TEXT ("LM_UNK(04000)"), + ACE_LIB_TEXT ("LM_UNK(010000)"), + ACE_LIB_TEXT ("LM_UNK(020000)"), + ACE_LIB_TEXT ("LM_UNK(040000)"), + ACE_LIB_TEXT ("LM_UNK(0100000)"), + ACE_LIB_TEXT ("LM_UNK(0200000)"), + ACE_LIB_TEXT ("LM_UNK(0400000)"), + ACE_LIB_TEXT ("LM_UNK(01000000)"), + ACE_LIB_TEXT ("LM_UNK(02000000)"), + ACE_LIB_TEXT ("LM_UNK(04000000)"), + ACE_LIB_TEXT ("LM_UNK(010000000)"), + ACE_LIB_TEXT ("LM_UNK(020000000)"), + ACE_LIB_TEXT ("LM_UNK(040000000)"), + ACE_LIB_TEXT ("LM_UNK(0100000000)"), + ACE_LIB_TEXT ("LM_UNK(0200000000)"), + ACE_LIB_TEXT ("LM_UNK(0400000000)"), + ACE_LIB_TEXT ("LM_UNK(01000000000)"), + ACE_LIB_TEXT ("LM_UNK(02000000000)"), + ACE_LIB_TEXT ("LM_UNK(04000000000)"), + ACE_LIB_TEXT ("LM_UNK(010000000000)"), + ACE_LIB_TEXT ("LM_UNK(020000000000)") + }; +} const ACE_TCHAR * ACE_Log_Record::priority_name (ACE_Log_Priority p) { - return ACE_Log_Record::priority_names_[ACE::log2 (p)]; + return ace_priority_names[ACE::log2 (p)]; } void @@ -67,7 +75,7 @@ ACE_Log_Record::priority_name (ACE_Log_Priority p, const ACE_TCHAR *name) { // Name must be a statically allocated string - ACE_Log_Record::priority_names_[ACE::log2 (p)] = name; + ace_priority_names[ACE::log2 (p)] = name; } u_long @@ -112,7 +120,7 @@ ACE_Log_Record::msg_data (const ACE_TCHAR *data) { // ACE_TRACE ("ACE_Log_Record::msg_data"); ACE_OS::strsncpy (this->msg_data_, data, - (sizeof this->msg_data_ / sizeof (ACE_TCHAR))); + (MAXLOGMSGLEN / sizeof (ACE_TCHAR))); this->round_up (); } @@ -126,6 +134,7 @@ ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp, pid_ (ACE_UINT32 (p)) { // ACE_TRACE ("ACE_Log_Record::ACE_Log_Record"); + ACE_NEW_NORETURN (this->msg_data_, ACE_TCHAR[MAXLOGMSGLEN]); } ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp, @@ -138,6 +147,7 @@ ACE_Log_Record::ACE_Log_Record (ACE_Log_Priority lp, pid_ (ACE_UINT32 (p)) { // ACE_TRACE ("ACE_Log_Record::ACE_Log_Record"); + ACE_NEW_NORETURN (this->msg_data_, ACE_TCHAR[MAXLOGMSGLEN]); } void @@ -145,7 +155,7 @@ ACE_Log_Record::round_up (void) { // ACE_TRACE ("ACE_Log_Record::round_up"); // Determine the length of the payload. - size_t len = (sizeof (*this) - sizeof (this->msg_data_)) + size_t len = (sizeof (*this) - MAXLOGMSGLEN) + (sizeof (ACE_TCHAR) * ((ACE_OS::strlen (this->msg_data_) + 1))); // Round up to the alignment. @@ -162,6 +172,7 @@ ACE_Log_Record::ACE_Log_Record (void) pid_ (0) { // ACE_TRACE ("ACE_Log_Record::ACE_Log_Record"); + ACE_NEW_NORETURN (this->msg_data_, ACE_TCHAR[MAXLOGMSGLEN]); } int @@ -190,7 +201,7 @@ ACE_Log_Record::format_msg (const ACE_TCHAR host_name[], || ACE_BIT_ENABLED (verbose_flag, ACE_Log_Msg::VERBOSE_LITE)) { - time_t now = this->secs_; + time_t const now = this->secs_; ACE_TCHAR ctp[26]; // 26 is a magic number... if (ACE_OS::ctime_r (&now, ctp, sizeof ctp) == 0) @@ -245,7 +256,9 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[], u_long verbose_flag, FILE *fp) { - ACE_TCHAR verbose_msg [MAXVERBOSELOGMSGLEN]; + ACE_TCHAR* verbose_msg = 0; + ACE_NEW_RETURN (verbose_msg,ACE_TCHAR[MAXVERBOSELOGMSGLEN], -1); + int result = this->format_msg (host_name, verbose_flag, verbose_msg); @@ -266,6 +279,8 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[], } } + delete[] verbose_msg; + return result; } @@ -276,8 +291,10 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[], u_long verbose_flag, ACE_OSTREAM_TYPE &s) { - ACE_TCHAR verbose_msg [MAXVERBOSELOGMSGLEN]; - int result = this->format_msg (host_name, verbose_flag, verbose_msg); + ACE_TCHAR* verbose_msg = 0; + ACE_NEW_RETURN (verbose_msg,ACE_TCHAR[MAXVERBOSELOGMSGLEN], -1); + + int const result = this->format_msg (host_name, verbose_flag, verbose_msg); if (result == 0) { @@ -286,7 +303,11 @@ ACE_Log_Record::print (const ACE_TCHAR host_name[], s.flush (); } + delete[] verbose_msg; + return result; } #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Log_Record.h b/ace/Log_Record.h index 8e7ff3980a0..ef6b8104711 100644 --- a/ace/Log_Record.h +++ b/ace/Log_Record.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -29,6 +29,8 @@ #include "ace/Basic_Types.h" #include "ace/iosfwd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /// Defines the structure of an ACE logging record. @@ -38,7 +40,7 @@ public: enum { /// Maximum size of a logging message. - MAXLOGMSGLEN = ACE_MAXLOGMSGLEN, + MAXLOGMSGLEN = ACE_MAXLOGMSGLEN+1, /// Most restrictive alignment. ALIGN_WORDB = 8, @@ -56,8 +58,6 @@ public: /** * Create a <Log_Record> and set its priority, time stamp, and * process id. - * Create a <Log_Record> and set its priority, time stamp, and - * process id. */ ACE_Log_Record (void); ACE_Log_Record (ACE_Log_Priority lp, @@ -140,7 +140,7 @@ public: ACE_Time_Value time_stamp (void) const; /// Set the time stamp of the <Log_Record>. - void time_stamp (const ACE_Time_Value &); + void time_stamp (const ACE_Time_Value &ts); /// Get the process id of the <Log_Record>. long pid (void) const; @@ -187,12 +187,12 @@ private: ACE_UINT32 pid_; /// Logging record data - ACE_TCHAR msg_data_[MAXLOGMSGLEN + 1]; // Add one for NUL-terminator. + ACE_TCHAR* msg_data_; // Add one for NUL-terminator. - /// Symbolic names for the <ACE_Log_Priority> enums. - static const ACE_TCHAR *priority_names_[]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Log_Record.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Log_Record.inl b/ace/Log_Record.inl index 0b81be7c7ec..b31af15384a 100644 --- a/ace/Log_Record.inl +++ b/ace/Log_Record.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Global_Macros.h" @@ -6,9 +7,13 @@ #include "ace/Time_Value.h" #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Log_Record::~ACE_Log_Record (void) { + if (this->msg_data_) + delete[] this->msg_data_; } ACE_INLINE void @@ -108,3 +113,5 @@ ACE_Log_Record::msg_data_len (void) const ACE_TRACE ("ACE_Log_Record::msg_data_len"); return ACE_OS::strlen (this->msg_data_) + 1; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Logging_Strategy.cpp b/ace/Logging_Strategy.cpp index 9814deb25de..36033e2d60e 100644 --- a/ace/Logging_Strategy.cpp +++ b/ace/Logging_Strategy.cpp @@ -20,6 +20,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Parse the string containing (thread) priorities and set them // accordingly. @@ -360,7 +362,7 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[]) if (output_file->rdstate () != ios::goodbit) { - if (delete_ostream) + if (delete_ostream) delete output_file; return -1; } @@ -547,9 +549,10 @@ ACE_Logging_Strategy::log_msg (ACE_Log_Msg *log_msg) this->log_msg_ = log_msg; } +ACE_END_VERSIONED_NAMESPACE_DECL + // The following is a "Factory" used by the ACE_Service_Config and // svc.conf file to dynamically initialize the state of the // Logging_Strategy. ACE_FACTORY_DEFINE (ACE, ACE_Logging_Strategy) - diff --git a/ace/Logging_Strategy.h b/ace/Logging_Strategy.h index b4123221622..d8ee19bba76 100644 --- a/ace/Logging_Strategy.h +++ b/ace/Logging_Strategy.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -6,8 +6,8 @@ * * $Id$ * - * @author Prashant Jain <pjain@cs.wustl.edu> and - * Orlando Ribeiro <oribeiro@inescporto.pt> + * @author Prashant Jain <pjain@cs.wustl.edu> + * @author Orlando Ribeiro <oribeiro@inescporto.pt> */ //============================================================================= @@ -25,6 +25,8 @@ #define ACE_DEFAULT_LOGFILE_POLL_INTERVAL 600 /* Seconds */ #endif /* ACE_DEFAULT_LOGFILE_POLL_INTERVAL */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Logging_Strategy * @@ -62,10 +64,10 @@ * to set the reactor used by @c ACE_Logging_Strategy to something * other than the singleton reactor you'll need to get a pointer to * the @c ACE_Logging_Strategy instance and do this - * + * * ACE_Reactor my_reactor; * ACE_Logging_Strategy *logging_strategy = ...... // Get instance. - * + * * logging_strategy->reactor (&my_reactor); * * and then logging_strategy will use your reactor. If you're @@ -181,6 +183,8 @@ protected: ACE_Log_Msg *log_msg_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + ACE_FACTORY_DECLARE (ACE, ACE_Logging_Strategy) #endif /* ACE_LOGGING_STRATEGY_H */ diff --git a/ace/MEM_Acceptor.cpp b/ace/MEM_Acceptor.cpp index 3f1b9828576..08ec50034f4 100644 --- a/ace/MEM_Acceptor.cpp +++ b/ace/MEM_Acceptor.cpp @@ -1,4 +1,3 @@ -// MEM_Acceptor.cpp // $Id$ #include "ace/MEM_Acceptor.h" @@ -16,6 +15,8 @@ ACE_RCSID(ace, MEM_Acceptor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Acceptor) void @@ -175,7 +176,7 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream, // Protocol negociation: // Tell the client side what level of signaling strategy // we support. - ACE_INT16 client_signaling = + ACE_MEM_IO::Signal_Strategy client_signaling = #if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM) this->preferred_strategy_; #else @@ -260,4 +261,6 @@ ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream, return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/ace/MEM_Acceptor.h b/ace/MEM_Acceptor.h index a33cb5f5dce..7b085f825ca 100644 --- a/ace/MEM_Acceptor.h +++ b/ace/MEM_Acceptor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -14,12 +14,7 @@ #define ACE_MEM_ACCEPTOR_H #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #include "ace/SOCK_Acceptor.h" @@ -36,6 +31,8 @@ #include "ace/OS_QoS.h" #endif // ACE_HAS_WINCE +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. class ACE_Reactor; @@ -54,7 +51,7 @@ class ACE_Reactor; * if so desired. (Currently, using UNIX-domain sockets, i.e., * ACE_LSOCK_*, with this class will not work.) */ -class ACE_Memory_Export ACE_MEM_Acceptor : public ACE_SOCK_Acceptor +class ACE_Export ACE_MEM_Acceptor : public ACE_SOCK_Acceptor { public: // = Initialization methods. @@ -183,6 +180,8 @@ private: ACE_MEM_IO::Signal_Strategy preferred_strategy_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/MEM_Acceptor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/MEM_Acceptor.inl b/ace/MEM_Acceptor.inl index d7e3f66f18f..388e1541cdf 100644 --- a/ace/MEM_Acceptor.inl +++ b/ace/MEM_Acceptor.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_MEM_Acceptor::open (const ACE_Addr &local_sap, ACE_Protocol_Info *protocolinfo, @@ -96,3 +99,5 @@ ACE_MEM_Acceptor::malloc_options (void) return this->malloc_options_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MEM_Addr.cpp b/ace/MEM_Addr.cpp index e4ad1f353f0..42fed32e400 100644 --- a/ace/MEM_Addr.cpp +++ b/ace/MEM_Addr.cpp @@ -16,8 +16,10 @@ #include "ace/os_include/os_netdb.h" ACE_RCSID (ace, - MEM_Addr, - "$Id$") + MEM_Addr, + "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Addr) @@ -163,4 +165,6 @@ ACE_MEM_Addr::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/ace/MEM_Addr.h b/ace/MEM_Addr.h index 497443de8d6..3d50e5d06b3 100644 --- a/ace/MEM_Addr.h +++ b/ace/MEM_Addr.h @@ -15,12 +15,7 @@ #define ACE_MEM_ADDR_H #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -30,13 +25,15 @@ #include "ace/INET_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_MEM_Addr * * @brief Defines a C++ wrapper facade for the shared memory transport * address family format. */ -class ACE_Memory_Export ACE_MEM_Addr : public ACE_Addr +class ACE_Export ACE_MEM_Addr : public ACE_Addr { public: // = Initialization methods. @@ -60,7 +57,7 @@ public: /// Default initialization routine. int initialize_local (u_short port); - /// Check if @a sap designate an enpoint withing the same host. + /// Check if @a sap designates an endpoint on the same host. int same_host (const ACE_INET_Addr& sap); // These methods are useful after the object has been constructed. @@ -147,6 +144,8 @@ private: ACE_INET_Addr internal_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/MEM_Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/MEM_Addr.inl b/ace/MEM_Addr.inl index dd52742637d..ca2c0de2089 100644 --- a/ace/MEM_Addr.inl +++ b/ace/MEM_Addr.inl @@ -5,6 +5,7 @@ #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Set the port number. @@ -106,3 +107,5 @@ ACE_MEM_Addr::operator != (const ACE_INET_Addr &sap) const ACE_TRACE ("ACE_MEM_Addr::operator !="); return !((*this) == sap); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MEM_Connector.cpp b/ace/MEM_Connector.cpp index b2ffb2b3fc1..f5155b9d961 100644 --- a/ace/MEM_Connector.cpp +++ b/ace/MEM_Connector.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, MEM_Connector, "$Id$") #include "ace/MEM_Connector.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Connector) void @@ -142,4 +144,6 @@ ACE_MEM_Connector::connect (ACE_MEM_Stream &new_stream, return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/ace/MEM_Connector.h b/ace/MEM_Connector.h index 868cec68656..78fae54d0c1 100644 --- a/ace/MEM_Connector.h +++ b/ace/MEM_Connector.h @@ -14,13 +14,7 @@ #define ACE_MEM_CONNECTOR_H #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ -#include "ace/SOCK_Connector.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -28,16 +22,19 @@ #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) +#include "ace/SOCK_Connector.h" #include "ace/MEM_Stream.h" #include "ace/MEM_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_MEM_Connector * * @brief Defines the format and interface for connecting to a peer * on a @c ACE_MEM_Stream object. */ -class ACE_Memory_Export ACE_MEM_Connector : public ACE_SOCK_Connector +class ACE_Export ACE_MEM_Connector : public ACE_SOCK_Connector { public: // = Initialization methods. @@ -170,6 +167,8 @@ private: ACE_MEM_IO::Signal_Strategy preferred_strategy_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/MEM_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/MEM_Connector.inl b/ace/MEM_Connector.inl index 15bf7c9ee75..024ab5d8b5b 100644 --- a/ace/MEM_Connector.inl +++ b/ace/MEM_Connector.inl @@ -1,10 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// MEM_Connector.i - // Establish a connection. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_MEM_IO::Signal_Strategy ACE_MEM_Connector::preferred_strategy (void) const { @@ -25,3 +26,5 @@ ACE_MEM_Connector::malloc_options (void) return this->malloc_options_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MEM_IO.cpp b/ace/MEM_IO.cpp index a3ebd3a839e..7a9616f5220 100644 --- a/ace/MEM_IO.cpp +++ b/ace/MEM_IO.cpp @@ -12,9 +12,11 @@ ACE_RCSID(ace, MEM_IO, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_MEM_IO) -ACE_Reactive_MEM_IO::~ACE_Reactive_MEM_IO () +ACE_Reactive_MEM_IO::~ACE_Reactive_MEM_IO (void) { } @@ -271,8 +273,6 @@ ACE_MT_MEM_IO::recv_buf (ACE_MEM_SAP_Node *&buf, return buf->size (); return -1; } - - ACE_NOTREACHED (return 0;) } ssize_t @@ -432,11 +432,11 @@ ACE_MEM_IO::recvv (iovec *io_vec, break; } - u_long inlen; + int inlen; if (ACE_OS::ioctl (this->get_handle (), FIONREAD, - (u_long *) &inlen) == -1) + &inlen) == -1) return -1; else if (inlen > 0) { @@ -536,4 +536,6 @@ ACE_MEM_IO::recv (size_t n, ...) const } #endif /* 0 */ +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/ace/MEM_IO.h b/ace/MEM_IO.h index ecf4588f2ba..595caf0ff6f 100644 --- a/ace/MEM_IO.h +++ b/ace/MEM_IO.h @@ -15,27 +15,24 @@ #define ACE_MEM_IO_H #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) #include "ace/SOCK.h" #include "ace/MEM_SAP.h" -#include "ace/Memory_Pool.h" #include "ace/Message_Block.h" #include "ace/Process_Semaphore.h" #include "ace/Process_Mutex.h" -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ -#if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL -class ACE_Memory_Export ACE_Reactive_MEM_IO : public ACE_MEM_SAP +class ACE_Export ACE_Reactive_MEM_IO : public ACE_MEM_SAP { public: ACE_Reactive_MEM_IO (void); @@ -55,7 +52,7 @@ public: /** * Fetch location of next available data into <recv_buffer_>. * As this operation read the address of the data off the socket - * using ACE::recv, <timeout> only applies to ACE::recv. + * using ACE::recv, @a timeout only applies to ACE::recv. */ virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf, int flags, @@ -78,7 +75,7 @@ public: }; #if defined (ACE_WIN32) || !defined (_ACE_USE_SV_SEM) -class ACE_Memory_Export ACE_MT_MEM_IO : public ACE_MEM_SAP +class ACE_Export ACE_MT_MEM_IO : public ACE_MEM_SAP { public: typedef struct @@ -170,7 +167,7 @@ private: * the other end. The receiving side then reverses the * procedures and copies the information into user buffer. */ -class ACE_Memory_Export ACE_MEM_IO : public ACE_SOCK +class ACE_Export ACE_MEM_IO : public ACE_SOCK { public: // = Initialization and termination methods. @@ -301,6 +298,8 @@ private: ssize_t cur_offset_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/MEM_IO.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/MEM_IO.inl b/ace/MEM_IO.inl index 7d4685334cf..07f13764e94 100644 --- a/ace/MEM_IO.inl +++ b/ace/MEM_IO.inl @@ -1,10 +1,10 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ - -// MEM_IO.i - #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Reactive_MEM_IO::ACE_Reactive_MEM_IO () { @@ -229,3 +229,5 @@ ACE_MEM_IO::send (const void *buf, ACE_TRACE ("ACE_MEM_IO::send"); return this->send (buf, len, 0, timeout); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MEM_SAP.cpp b/ace/MEM_SAP.cpp index f1e79c29851..453f86f5bfd 100644 --- a/ace/MEM_SAP.cpp +++ b/ace/MEM_SAP.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, MEM_SAP, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_IPC_SAP) void @@ -90,18 +92,6 @@ ACE_MEM_SAP::close_shm_malloc (void) return retv; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Write_Guard<ACE_Process_Mutex>; -template class ACE_Read_Guard<ACE_Process_Mutex>; -template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block>; -template class ACE_Based_Pointer<ACE_MEM_SAP_Node>; -template class ACE_Based_Pointer_Basic<ACE_MEM_SAP_Node>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Write_Guard<ACE_Process_Mutex> -#pragma instantiate ACE_Read_Guard<ACE_Process_Mutex> -#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Process_Mutex, ACE_PI_Control_Block> -#pragma instantiate ACE_Based_Pointer<ACE_MEM_SAP_Node> -#pragma instantiate ACE_Based_Pointer_Basic<ACE_MEM_SAP_Node> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MEM_SAP.h b/ace/MEM_SAP.h index dcbad75b584..e33c6b77104 100644 --- a/ace/MEM_SAP.h +++ b/ace/MEM_SAP.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -10,19 +10,12 @@ */ //============================================================================= - #ifndef ACE_MEM_SAP_H #define ACE_MEM_SAP_H -#include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include /**/ "ace/pre.h" -#include "ace/PI_Malloc.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -31,10 +24,13 @@ // MEM_SAP requries position independent pointers to work #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) +#include "ace/PI_Malloc.h" #include "ace/Malloc_T.h" #include "ace/MMAP_Memory_Pool.h" #include "ace/Process_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_MEM_SAP; class ACE_Reactive_MEM_IO; class ACE_MT_MEM_IO; @@ -43,7 +39,7 @@ class ACE_MEM_IO; // Internal data structure // MEM_SAP uses to queue up // data. -class ACE_Memory_Export ACE_MEM_SAP_Node +class ACE_MEM_SAP_Node { public: // friend class ACE_MEM_SAP; @@ -80,7 +76,7 @@ public: * @brief Defines the methods of shared memory management for * shared memory transport. */ -class ACE_Memory_Export ACE_MEM_SAP +class ACE_Export ACE_MEM_SAP { public: // = Initialization and termination methods. @@ -107,7 +103,7 @@ public: /** * Fetch location of next available data into <recv_buffer_>. * As this operation read the address of the data off the socket - * using ACE::recv, <timeout> only applies to ACE::recv. + * using ACE::recv, @a timeout only applies to ACE::recv. */ virtual ssize_t recv_buf (ACE_MEM_SAP_Node *&buf, int flags, @@ -160,6 +156,8 @@ protected: ACE_MEM_SAP (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/MEM_SAP.inl" #endif /* __ACE_INLINE__ */ @@ -167,4 +165,5 @@ protected: #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ #include /**/ "ace/post.h" + #endif /* ACE_SOCK_IO_H */ diff --git a/ace/MEM_SAP.inl b/ace/MEM_SAP.inl index e687618b7f8..3c2a4eb9d9a 100644 --- a/ace/MEM_SAP.inl +++ b/ace/MEM_SAP.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/RW_Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_MEM_SAP_Node::ACE_MEM_SAP_Node (size_t cap) : capacity_ (cap), @@ -57,3 +60,5 @@ ACE_MEM_SAP::release_buffer (ACE_MEM_SAP_Node *buf) this->shm_malloc_->free (buf); return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MEM_Stream.cpp b/ace/MEM_Stream.cpp index dc32670142a..0e8edb9ced7 100644 --- a/ace/MEM_Stream.cpp +++ b/ace/MEM_Stream.cpp @@ -1,4 +1,3 @@ -// MEM_Stream.cpp // $Id$ #include "ace/MEM_Stream.h" @@ -11,6 +10,8 @@ ACE_RCSID(ace, MEM_Stream, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_MEM_Stream) void @@ -41,4 +42,6 @@ ACE_MEM_Stream::close (void) return ACE_SOCK::close (); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/ace/MEM_Stream.h b/ace/MEM_Stream.h index e513be87387..6b4ff4cdd41 100644 --- a/ace/MEM_Stream.h +++ b/ace/MEM_Stream.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -29,15 +29,17 @@ # define ACE_MEM_STREAM_MIN_BUFFER 4096 #endif /* ACE_MEM_STREAM_MIN_BUFFER */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_MEM_Acceptor; class ACE_MEM_Connector; /** * @class ACE_MEM_Stream * - * @brief Defines the methods in the <ACE_MEM_Stream> abstraction. + * @brief Defines the methods in the ACE_MEM_Stream abstraction. * - * This adds additional wrapper methods atop the <ACE_MEM_IO> + * This adds additional wrapper methods atop the ACE_MEM_IO * class. Notice that ACE_MEM_Stream can only send messages no bigger * than the underlying MMAP file size minus sizeof (ACE_MEM_SAP_Node). * The size of the MMAP file is default to ACE_MEM_STREAM_MIN_BUFFER. @@ -48,7 +50,7 @@ class ACE_MEM_Connector; * @c ACE_MEM_Acceptor::init_buffer_size (size_t size); * before establishing a connection. */ -class ACE_Memory_Export ACE_MEM_Stream : public ACE_MEM_IO +class ACE_Export ACE_MEM_Stream : public ACE_MEM_IO { public: @@ -59,7 +61,7 @@ public: /// Constructor. ACE_MEM_Stream (void); - /// Constructor (sets the underlying <ACE_HANDLE> with <h>). + /// Constructor (sets the underlying ACE_HANDLE with <h>). ACE_MEM_Stream (ACE_HANDLE h); /// Destructor. @@ -144,6 +146,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/MEM_Stream.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/MEM_Stream.inl b/ace/MEM_Stream.inl index df33caaf630..c29459ed35c 100644 --- a/ace/MEM_Stream.inl +++ b/ace/MEM_Stream.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/MEM_Stream.h" #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_MEM_Stream::ACE_MEM_Stream (void) { @@ -173,3 +176,5 @@ ACE_MEM_Stream::recv_urg (void *ptr, timeout); } #endif /* 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MMAP_Memory_Pool.cpp b/ace/MMAP_Memory_Pool.cpp index 3329c3f5292..4cce9fff7d3 100644 --- a/ace/MMAP_Memory_Pool.cpp +++ b/ace/MMAP_Memory_Pool.cpp @@ -13,7 +13,15 @@ #include "ace/Based_Pointer_Repository.h" #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ -ACE_RCSID(ace, MMAP_Memory_Pool, "$Id$") +#if !defined (__ACE_INLINE__) +#include "ace/MMAP_Memory_Pool.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, + MMAP_Memory_Pool, + "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_MMAP_Memory_Pool) @@ -220,7 +228,7 @@ ACE_MMAP_Memory_Pool::commit_backing_store_name (size_t rounded_bytes, #endif // Increment by one to put us at the beginning of the next chunk... - map_size++; + ++map_size; #endif /* CHORUS */ return 0; } @@ -471,7 +479,7 @@ ACE_MMAP_Memory_Pool::handle_signal (int signum, siginfo_t *siginfo, ucontext_t if (guess_on_fault_) { // Check if the current mapping is up to date. - off_t current_map_size = ACE_OS::filesize (this->mmap_.handle ()); + off_t const current_map_size = ACE_OS::filesize (this->mmap_.handle ()); if (static_cast<size_t> (current_map_size) == this->mmap_.size ()) { @@ -530,3 +538,5 @@ ACE_Lite_MMAP_Memory_Pool::sync (void *, size_t, int) ACE_TRACE ("ACE_Lite_MMAP_Memory_Pool::sync"); return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/MMAP_Memory_Pool.h b/ace/MMAP_Memory_Pool.h index 63da965b80d..91162b5863c 100644 --- a/ace/MMAP_Memory_Pool.h +++ b/ace/MMAP_Memory_Pool.h @@ -16,12 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -32,6 +27,8 @@ #include "ace/Signal.h" #include "ace/Mem_Map.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_MMAP_Memory_Pool_Options * @@ -40,7 +37,7 @@ * This should be a nested class, but that breaks too many * compilers. */ -class ACE_Memory_Export ACE_MMAP_Memory_Pool_Options +class ACE_Export ACE_MMAP_Memory_Pool_Options { public: enum @@ -128,7 +125,7 @@ private: * @brief Make a memory pool that is based on @c mmap(2). This * implementation allows memory to be shared between processes. */ -class ACE_Memory_Export ACE_MMAP_Memory_Pool : public ACE_Event_Handler +class ACE_Export ACE_MMAP_Memory_Pool : public ACE_Event_Handler { public: typedef ACE_MMAP_Memory_Pool_Options OPTIONS; @@ -204,6 +201,12 @@ public: /// Dump the state of an object. virtual void dump (void) const; + /// Get reference to underlying ACE_Mem_Map object. + ACE_Mem_Map const & mmap (void) const; + + /// Get reference to underlying ACE_Mem_Map object. + ACE_Mem_Map & mmap (void); + /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -270,16 +273,16 @@ protected: /** * @class ACE_Lite_MMAP_Memory_Pool * - * @brief Make a ``lighter-weight'' memory pool based <ACE_Mem_Map>. + * @brief Make a ``lighter-weight'' memory pool based ACE_Mem_Map. * * This implementation allows memory to be shared between - * processes. However, unlike the <ACE_MMAP_Memory_Pool> + * processes. However, unlike the ACE_MMAP_Memory_Pool * the <sync> methods are no-ops, which means that we don't pay * for the price of flushing the memory to the backing store on * every update. Naturally, this trades off increased * performance for less reliability if the machine crashes. */ -class ACE_Memory_Export ACE_Lite_MMAP_Memory_Pool : public ACE_MMAP_Memory_Pool +class ACE_Export ACE_Lite_MMAP_Memory_Pool : public ACE_MMAP_Memory_Pool { public: /// Initialize the pool. @@ -296,5 +299,11 @@ public: virtual int sync (void *addr, size_t len, int flags = MS_SYNC); }; +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) +#include "ace/MMAP_Memory_Pool.inl" +#endif /* __ACE_INLINE__ */ + #include /**/ "ace/post.h" #endif /* ACE_MMAP_MEMORY_POOL_H */ diff --git a/ace/Makefile.am b/ace/Makefile.am index 1a418763551..6aa2ec7e49a 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -2,6 +2,11 @@ ## ## $Id$ ## +## This file was generated by MPC. Any changes made directly to +## this file will be lost the next time it is generated. +## +## MPC Command: +## ./bin/mwc.pl -type automake -noreldefs ACE.mwc includedir = @includedir@/ace pkgconfigdir = @libdir@/pkgconfig @@ -15,10 +20,16 @@ SUBDIRS = \ QoS \ SSL +CLEANFILES = +lib_LTLIBRARIES = +nobase_include_HEADERS = +pkgconfig_DATA = ## Makefile.ACE.am -lib_LTLIBRARIES = libACE.la +if !BUILD_ACE_FOR_TAO + +lib_LTLIBRARIES += libACE.la libACE_la_CPPFLAGS = \ -I$(ACE_ROOT) \ @@ -42,6 +53,7 @@ libACE_la_SOURCES = \ Addr.cpp \ Arg_Shifter.cpp \ Argv_Type_Converter.cpp \ + Assert.cpp \ Asynch_IO.cpp \ Asynch_IO_Impl.cpp \ Asynch_Pseudo_Task.cpp \ @@ -53,8 +65,8 @@ libACE_la_SOURCES = \ Basic_Stats.cpp \ Basic_Types.cpp \ CDR_Base.cpp \ - CDR_Stream.cpp \ CDR_Size.cpp \ + CDR_Stream.cpp \ Capabilities.cpp \ Cleanup.cpp \ Codecs.cpp \ @@ -66,7 +78,6 @@ libACE_la_SOURCES = \ Configuration.cpp \ Configuration_Import_Export.cpp \ Connection_Recycling_Strategy.cpp \ - Container_Instantiations.cpp \ Containers.cpp \ Copy_Disabled.cpp \ Countdown_Time.cpp \ @@ -83,6 +94,8 @@ libACE_la_SOURCES = \ Dump.cpp \ Dynamic.cpp \ Dynamic_Service_Base.cpp \ + Encoding_Converter.cpp \ + Encoding_Converter_Factory.cpp \ Event.cpp \ Event_Handler.cpp \ FIFO.cpp \ @@ -103,7 +116,6 @@ libACE_la_SOURCES = \ Get_Opt.cpp \ Handle_Ops.cpp \ Handle_Set.cpp \ - Hash_Map_Manager.cpp \ Hashable.cpp \ High_Res_Timer.cpp \ ICMP_Socket.cpp \ @@ -141,13 +153,11 @@ libACE_la_SOURCES = \ MMAP_Memory_Pool.cpp \ Malloc.cpp \ Malloc_Allocator.cpp \ - Malloc_Instantiations.cpp \ Manual_Event.cpp \ Mem_Map.cpp \ Message_Block.cpp \ Message_Queue.cpp \ Method_Request.cpp \ - Metrics_Cache.cpp \ Msg_WFMO_Reactor.cpp \ Multihomed_INET_Addr.cpp \ Mutex.cpp \ @@ -198,7 +208,6 @@ libACE_la_SOURCES = \ Obchunk.cpp \ Object_Manager.cpp \ Object_Manager_Base.cpp \ - Obstack.cpp \ PI_Malloc.cpp \ POSIX_Asynch_IO.cpp \ POSIX_CB_Proactor.cpp \ @@ -257,14 +266,12 @@ libACE_la_SOURCES = \ Sample_History.cpp \ Sbrk_Memory_Pool.cpp \ Sched_Params.cpp \ - Select_Reactor.cpp \ Select_Reactor_Base.cpp \ Semaphore.cpp \ Service_Config.cpp \ Service_Manager.cpp \ Service_Object.cpp \ Service_Repository.cpp \ - Service_Templates.cpp \ Service_Types.cpp \ Shared_Memory.cpp \ Shared_Memory_MM.cpp \ @@ -275,8 +282,7 @@ libACE_la_SOURCES = \ Sock_Connect.cpp \ Stats.cpp \ String_Base_Const.cpp \ - Svc_Conf_Lexer_Guard.cpp \ - Svc_Conf_l.cpp \ + Svc_Conf_Lexer.cpp \ Svc_Conf_y.cpp \ Synch_Options.cpp \ System_Time.cpp \ @@ -314,6 +320,9 @@ libACE_la_SOURCES = \ UPIPE_Acceptor.cpp \ UPIPE_Connector.cpp \ UPIPE_Stream.cpp \ + UTF16_Encoding_Converter.cpp \ + UTF32_Encoding_Converter.cpp \ + UTF8_Encoding_Converter.cpp \ UUID.cpp \ WFMO_Reactor.cpp \ WIN32_Asynch_IO.cpp \ @@ -325,7 +334,7 @@ libACE_la_SOURCES = \ libACE_la_LDFLAGS = \ -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ -nobase_include_HEADERS = \ +nobase_include_HEADERS += \ ACE.h \ ACE.inl \ ACE_export.h \ @@ -364,6 +373,7 @@ nobase_include_HEADERS = \ Array_Map.cpp \ Array_Map.h \ Array_Map.inl \ + Assert.h \ Asynch_Acceptor.cpp \ Asynch_Acceptor.h \ Asynch_Connector.cpp \ @@ -404,10 +414,10 @@ nobase_include_HEADERS = \ Bound_Ptr.inl \ CDR_Base.h \ CDR_Base.inl \ - CDR_Stream.h \ - CDR_Stream.inl \ CDR_Size.h \ CDR_Size.inl \ + CDR_Stream.h \ + CDR_Stream.inl \ CORBA_macros.h \ Cache_Map_Manager_T.cpp \ Cache_Map_Manager_T.h \ @@ -475,6 +485,8 @@ nobase_include_HEADERS = \ Dynamic_Service.h \ Dynamic_Service.inl \ Dynamic_Service_Base.h \ + Encoding_Converter.h \ + Encoding_Converter_Factory.h \ Env_Value_T.cpp \ Env_Value_T.h \ Env_Value_T.inl \ @@ -552,7 +564,6 @@ nobase_include_HEADERS = \ High_Res_Timer.h \ High_Res_Timer.inl \ ICMP_Socket.h \ - ICMP_Socket.inl \ INET_Addr.h \ INET_Addr.inl \ IOStream.h \ @@ -688,7 +699,6 @@ nobase_include_HEADERS = \ OS_Log_Msg_Attributes.h \ OS_Log_Msg_Attributes.inl \ OS_Memory.h \ - OS_Memory.inl \ OS_NS_Thread.h \ OS_NS_Thread.inl \ OS_NS_arpa_inet.h \ @@ -745,7 +755,6 @@ nobase_include_HEADERS = \ OS_NS_sys_uio.h \ OS_NS_sys_uio.inl \ OS_NS_sys_utsname.h \ - OS_NS_sys_utsname.inl \ OS_NS_sys_wait.h \ OS_NS_sys_wait.inl \ OS_NS_time.h \ @@ -756,7 +765,6 @@ nobase_include_HEADERS = \ OS_NS_wchar.inl \ OS_QoS.h \ OS_String.h \ - OS_String.inl \ OS_TLI.h \ OS_TLI.inl \ OS_Thread_Adapter.h \ @@ -826,9 +834,9 @@ nobase_include_HEADERS = \ Recyclable.inl \ Refcountable.h \ Refcountable.inl \ + Refcounted_Auto_Ptr.cpp \ Refcounted_Auto_Ptr.h \ Refcounted_Auto_Ptr.inl \ - Refcounted_Auto_Ptr.cpp \ Registry.h \ Registry_Name_Space.h \ Remote_Name_Space.h \ @@ -900,7 +908,6 @@ nobase_include_HEADERS = \ Service_Config.h \ Service_Config.inl \ Service_Manager.h \ - Service_Manager.inl \ Service_Object.h \ Service_Object.inl \ Service_Repository.h \ @@ -939,7 +946,7 @@ nobase_include_HEADERS = \ String_Base.inl \ String_Base_Const.h \ Svc_Conf.h \ - Svc_Conf_Lexer_Guard.h \ + Svc_Conf_Lexer.h \ Svc_Conf_Tokens.h \ Svc_Handler.cpp \ Svc_Handler.h \ @@ -947,7 +954,6 @@ nobase_include_HEADERS = \ Swap.inl \ Synch.h \ Synch_Options.h \ - Synch_Options.inl \ Synch_T.cpp \ Synch_T.h \ Synch_Traits.h \ @@ -962,7 +968,6 @@ nobase_include_HEADERS = \ TP_Reactor.h \ TP_Reactor.inl \ TSS_Adapter.h \ - TSS_Adapter.inl \ TSS_T.cpp \ TSS_T.h \ TSS_T.inl \ @@ -975,7 +980,6 @@ nobase_include_HEADERS = \ Task_T.cpp \ Task_T.h \ Task_T.inl \ - Template_Instantiations.cpp \ Test_and_Set.cpp \ Test_and_Set.h \ Thread.h \ @@ -1029,6 +1033,7 @@ nobase_include_HEADERS = \ Token_Request_Reply.h \ Token_Request_Reply.inl \ Trace.h \ + Truncate.h \ Typed_SV_Message.cpp \ Typed_SV_Message.h \ Typed_SV_Message.inl \ @@ -1044,6 +1049,10 @@ nobase_include_HEADERS = \ UPIPE_Connector.inl \ UPIPE_Stream.h \ UPIPE_Stream.inl \ + UTF16_Encoding_Converter.h \ + UTF16_Encoding_Converter.inl \ + UTF32_Encoding_Converter.h \ + UTF8_Encoding_Converter.h \ UUID.h \ UUID.inl \ Unbounded_Queue.cpp \ @@ -1057,6 +1066,7 @@ nobase_include_HEADERS = \ Vector_T.h \ Vector_T.inl \ Version.h \ + Versioned_Namespace.h \ WFMO_Reactor.h \ WFMO_Reactor.inl \ WIN32_Asynch_IO.h \ @@ -1070,11 +1080,11 @@ nobase_include_HEADERS = \ config-all.h \ config-borland-common.h \ config-lite.h \ + config-macros.h \ config-minimal.h \ config-win32-borland.h \ config-win32-common.h \ config-win32-ghs.h \ - config-win32-msvc-6.h \ config-win32-msvc-7.h \ config-win32-msvc.h \ config-win32-visualage.h \ @@ -1159,6 +1169,7 @@ nobase_include_HEADERS = \ os_include/sys/os_socket.h \ os_include/sys/os_stat.h \ os_include/sys/os_statvfs.h \ + os_include/sys/os_sysctl.h \ os_include/sys/os_time.h \ os_include/sys/os_timeb.h \ os_include/sys/os_times.h \ @@ -1172,11 +1183,17 @@ nobase_include_HEADERS = \ streams.h \ svc_export.h -pkgconfig_DATA = ACE.pc +pkgconfig_DATA += \ + ACE.pc + +CLEANFILES += \ + ACE.pc ACE.pc: ${top_builddir}/config.status ${srcdir}/ACE.pc.in ${top_builddir}/config.status --file $@:${srcdir}/ACE.pc.in +endif !BUILD_ACE_FOR_TAO + EXTRA_DIST = \ ACE.pc.in \ ace.rc @@ -1193,22 +1210,28 @@ lib_LTLIBRARIES += libACE_FlReactor.la libACE_FlReactor_la_CPPFLAGS = \ -I$(ACE_ROOT) \ -I$(ACE_BUILDDIR) \ + $(ACE_FLTK_CPPFLAGS) \ -DACE_FLREACTOR_BUILD_DLL libACE_FlReactor_la_SOURCES = \ FlReactor.cpp libACE_FlReactor_la_LDFLAGS = \ - -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ + -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ $(ACE_FLTK_LDFLAGS) libACE_FlReactor_la_LIBADD = \ - libACE.la + libACE.la \ + $(ACE_FLTK_LIBS) nobase_include_HEADERS += \ ACE_FlReactor_export.h \ FlReactor.h -pkgconfig_DATA += ACE_FlReactor.pc +pkgconfig_DATA += \ + ACE_FlReactor.pc + +CLEANFILES += \ + ACE_FlReactor.pc ACE_FlReactor.pc: ${top_builddir}/config.status ${srcdir}/ACE_FlReactor.pc.in ${top_builddir}/config.status --file $@:${srcdir}/ACE_FlReactor.pc.in @@ -1228,19 +1251,18 @@ if BUILD_QT BUILT_SOURCES = \ QtReactor_moc.cpp -CLEANFILES = \ +CLEANFILES += \ QtReactor_moc.cpp QtReactor_moc.cpp: $(srcdir)/QtReactor.h - $(QTDIR)/bin/moc $(srcdir)/QtReactor.h -o QtReactor_moc.cpp + $(QTDIR)/bin/moc -o QtReactor_moc.cpp $(srcdir)/QtReactor.h lib_LTLIBRARIES += libACE_QtReactor.la libACE_QtReactor_la_CPPFLAGS = \ -I$(ACE_ROOT) \ -I$(ACE_BUILDDIR) \ - -I$(QTDIR)/include \ - -DQT_THREAD_SUPPORT \ + $(ACE_QT_CPPFLAGS) \ -DACE_QTREACTOR_BUILD_DLL libACE_QtReactor_la_SOURCES = \ @@ -1248,17 +1270,21 @@ libACE_QtReactor_la_SOURCES = \ QtReactor_moc.cpp libACE_QtReactor_la_LDFLAGS = \ - -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ + -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ $(ACE_QT_LDFLAGS) libACE_QtReactor_la_LIBADD = \ libACE.la \ - -lqt-mt + $(ACE_QT_LIBS) nobase_include_HEADERS += \ ACE_QtReactor_export.h \ QtReactor.h -pkgconfig_DATA += ACE_QtReactor.pc +pkgconfig_DATA += \ + ACE_QtReactor.pc + +CLEANFILES += \ + ACE_QtReactor.pc ACE_QtReactor.pc: ${top_builddir}/config.status ${srcdir}/ACE_QtReactor.pc.in ${top_builddir}/config.status --file $@:${srcdir}/ACE_QtReactor.pc.in @@ -1278,22 +1304,30 @@ lib_LTLIBRARIES += libACE_TkReactor.la libACE_TkReactor_la_CPPFLAGS = \ -I$(ACE_ROOT) \ -I$(ACE_BUILDDIR) \ + $(ACE_TK_CPPFLAGS) \ + $(ACE_TCL_CPPFLAGS) \ -DACE_TKREACTOR_BUILD_DLL libACE_TkReactor_la_SOURCES = \ TkReactor.cpp libACE_TkReactor_la_LDFLAGS = \ - -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ + -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ $(ACE_TK_LDFLAGS) $(ACE_TCL_LDFLAGS) libACE_TkReactor_la_LIBADD = \ - libACE.la + libACE.la \ + $(ACE_TK_LIBS) \ + $(ACE_TCL_LIBS) nobase_include_HEADERS += \ ACE_TkReactor_export.h \ TkReactor.h -pkgconfig_DATA += ACE_TkReactor.pc +pkgconfig_DATA += \ + ACE_TkReactor.pc + +CLEANFILES += \ + ACE_TkReactor.pc ACE_TkReactor.pc: ${top_builddir}/config.status ${srcdir}/ACE_TkReactor.pc.in ${top_builddir}/config.status --file $@:${srcdir}/ACE_TkReactor.pc.in @@ -1314,22 +1348,30 @@ lib_LTLIBRARIES += libACE_XtReactor.la libACE_XtReactor_la_CPPFLAGS = \ -I$(ACE_ROOT) \ -I$(ACE_BUILDDIR) \ + $(ACE_X11_CPPFLAGS) \ + $(ACE_XT_CPPFLAGS) \ -DACE_XTREACTOR_BUILD_DLL libACE_XtReactor_la_SOURCES = \ XtReactor.cpp libACE_XtReactor_la_LDFLAGS = \ - -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ + -version-number @ACE_MAJOR@:@ACE_MINOR@:@ACE_BETA@ $(ACE_X11_LDFLAGS) $(ACE_XT_LDFLAGS) libACE_XtReactor_la_LIBADD = \ - libACE.la + libACE.la \ + $(ACE_XT_LIBS) \ + $(ACE_X11_LIBS) nobase_include_HEADERS += \ ACE_XtReactor_export.h \ XtReactor.h -pkgconfig_DATA += ACE_XtReactor.pc +pkgconfig_DATA += \ + ACE_XtReactor.pc + +CLEANFILES += \ + ACE_XtReactor.pc ACE_XtReactor.pc: ${top_builddir}/config.status ${srcdir}/ACE_XtReactor.pc.in ${top_builddir}/config.status --file $@:${srcdir}/ACE_XtReactor.pc.in diff --git a/ace/Malloc.cpp b/ace/Malloc.cpp index 6ef923634ba..7dbd8272dd8 100644 --- a/ace/Malloc.cpp +++ b/ace/Malloc.cpp @@ -16,6 +16,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Process-wide ACE_Allocator. ACE_Allocator *ACE_Allocator::allocator_ = 0; @@ -121,14 +123,6 @@ ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const char *name, next->prev_ = this; } -ACE_Control_Block::ACE_Name_Node::ACE_Name_Node (const ACE_Name_Node &) -{ - ACE_TRACE ("ACE_Control_Block::ACE_Name_Node::ACE_Name_Node"); -#if !defined (ACE_PSOS) - ACE_ASSERT (!"not implemented!"); -#endif /* ! ACE_PSOS */ -} - const char * ACE_Control_Block::ACE_Name_Node::name (void) const { @@ -136,14 +130,6 @@ ACE_Control_Block::ACE_Name_Node::name (void) const return c; } -void -ACE_Control_Block::ACE_Name_Node::name (const char *) -{ -#if !defined (ACE_PSOS) - ACE_ASSERT (!"not implemented!"); -#endif /* ! ACE_PSOS */ -} - ACE_Control_Block::ACE_Malloc_Header::ACE_Malloc_Header (void) : next_block_ (0), size_ (0) @@ -185,9 +171,9 @@ ACE_Malloc_Stats::dump (void) const ACE_TRACE ("ACE_Malloc_Stats::dump"); ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - int nblocks = this->nblocks_.value (); - int ninuse = this->ninuse_.value (); - int nchunks = this->nchunks_.value (); + int const nblocks = this->nblocks_.value (); + int const ninuse = this->ninuse_.value (); + int const nchunks = this->nchunks_.value (); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("nblocks = %d"), nblocks)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT("\nninuse = %d"), ninuse)); @@ -197,11 +183,6 @@ ACE_Malloc_Stats::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Atomic_Op<ACE_PROCESS_MUTEX, int>; -template class ACE_Atomic_Op_Ex<ACE_PROCESS_MUTEX, int>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> -#pragma instantiate ACE_Atomic_Op_Ex<ACE_PROCESS_MUTEX, int> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /*ACE_HAS_MALLOC_STATS*/ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Malloc.h b/ace/Malloc.h index d19a5f12ebb..5362c0baaf6 100644 --- a/ace/Malloc.h +++ b/ace/Malloc.h @@ -33,6 +33,9 @@ # define ACE_PROCESS_MUTEX ACE_SV_Semaphore_Simple # endif /* ACE_HAS_THREADS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + typedef ACE_Atomic_Op<ACE_PROCESS_MUTEX, int> ACE_INT; /****************************************************************** @@ -198,6 +201,9 @@ struct ACE_Export ACE_Malloc_Stats /// Number of blocks in use ACE_INT ninuse_; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + # define ACE_MALLOC_STATS(X) X #else # define ACE_MALLOC_STATS(X) @@ -212,6 +218,8 @@ struct ACE_Export ACE_Malloc_Stats # define ACE_MALLOC_PADDING 1 #endif /* ACE_MALLOC_PADDING */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + union ACE_max_align_info { int (*i)(); @@ -301,9 +309,6 @@ public: char *pointer, ACE_Name_Node *head); - /// Copy constructor. - ACE_Name_Node (const ACE_Name_Node &); - /// Constructor. ACE_Name_Node (void); @@ -318,9 +323,6 @@ public: /// Return a pointer to the name of this node. const char *name (void) const; - /// Assign a name; - void name (const char *); - /// Name of the Node. char *name_; @@ -335,6 +337,9 @@ public: /// Dump the state of the object. void dump (void) const; + private: + /// Copy constructor. + ACE_Name_Node (const ACE_Name_Node &); }; /// Print out a bunch of size info for debugging. @@ -380,6 +385,8 @@ public: void dump (void) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Malloc.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Malloc.inl b/ace/Malloc.inl index 76722f13fb7..fdfbd1a612d 100644 --- a/ace/Malloc.inl +++ b/ace/Malloc.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Control_Block::ACE_Name_Node::~ACE_Name_Node (void) { @@ -19,3 +22,5 @@ ACE_Control_Block::ACE_Name_Node::init_ptr { *ptr = init; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Malloc_Allocator.cpp b/ace/Malloc_Allocator.cpp index ec12aa32954..deeaffc54eb 100644 --- a/ace/Malloc_Allocator.cpp +++ b/ace/Malloc_Allocator.cpp @@ -1,16 +1,5 @@ // $Id$ -// FILENAME -// Malloc_Allocator.cpp -// -// AUTHOR -// Priyanka Gontla <pgontla@uci.edu> -// -// ========================================================================== - -#if !defined (ACE_MALLOC_ALLOCATOR_CPP) -#define ACE_MALLOC_ALLOCATOR_CPP - #include "ace/Malloc_Allocator.h" #include "ace/Object_Manager.h" @@ -25,6 +14,8 @@ ACE_RCSID (ace, Malloc_Allocator, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Allocator * ACE_Allocator::instance (void) { @@ -367,4 +358,4 @@ ACE_Static_Allocator_Base::dump (void) const #endif /* ACE_HAS_DUMP */ } -#endif /* ACE_MALLOC_ALLOCATOR_CPP */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Malloc_Allocator.h b/ace/Malloc_Allocator.h index 4fecb2a3d6a..f70555a74da 100644 --- a/ace/Malloc_Allocator.h +++ b/ace/Malloc_Allocator.h @@ -34,6 +34,8 @@ #endif /* ACE_HAS_MALLOC_STATS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_New_Allocator * @@ -133,6 +135,8 @@ protected: size_t offset_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Malloc_Allocator.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Malloc_Allocator.inl b/ace/Malloc_Allocator.inl index 7ec860c8591..87a96099c1a 100644 --- a/ace/Malloc_Allocator.inl +++ b/ace/Malloc_Allocator.inl @@ -1,11 +1,16 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE -ACE_Static_Allocator_Base::ACE_Static_Allocator_Base (char *buffer, +ACE_Static_Allocator_Base::ACE_Static_Allocator_Base (char * buffer, size_t size) : buffer_ (buffer), size_ (size), offset_ (0) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Malloc_Base.h b/ace/Malloc_Base.h index 34605eb05bf..048123ad13f 100644 --- a/ace/Malloc_Base.h +++ b/ace/Malloc_Base.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -25,6 +25,8 @@ #include "ace/os_include/sys/os_mman.h" #include "ace/os_include/sys/os_types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // The definition of this class is located in Malloc.cpp. /** @@ -39,10 +41,10 @@ class ACE_Export ACE_Allocator public: // = Memory Management - /// Get pointer to a default <ACE_Allocator>. + /// Get pointer to a default ACE_Allocator. static ACE_Allocator *instance (void); - /// Set pointer to a process-wide <ACE_Allocator> and return existing + /// Set pointer to a process-wide ACE_Allocator and return existing /// pointer. static ACE_Allocator *instance (ACE_Allocator *); @@ -117,14 +119,14 @@ public: // backing store). /** - * Sync <len> bytes of the memory region to the backing store - * starting at <this->base_addr_>. If <len> == -1 then sync the + * Sync @a len bytes of the memory region to the backing store + * starting at @c this->base_addr_. If @a len == -1 then sync the * whole region. */ virtual int sync (ssize_t len = -1, int flags = MS_SYNC) = 0; - /// Sync <len> bytes of the memory region to the backing store - /// starting at <addr_>. + /// Sync @a len bytes of the memory region to the backing store + /// starting at @a addr. virtual int sync (void *addr, size_t len, int flags = MS_SYNC) = 0; /** @@ -149,12 +151,14 @@ private: // DO NOT ADD ANY STATE (DATA MEMBERS) TO THIS CLASS!!!! See the // <ACE_Allocator::instance> implementation for explanation. - /// Pointer to a process-wide <ACE_Allocator> instance. + /// Pointer to a process-wide ACE_Allocator instance. static ACE_Allocator *allocator_; /// Must delete the <allocator_> if non-0. static int delete_allocator_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_MALLOC_BASE_H */ diff --git a/ace/Malloc_Instantiations.cpp b/ace/Malloc_Instantiations.cpp index 90ffee4b1f1..5eea274f6bb 100644 --- a/ace/Malloc_Instantiations.cpp +++ b/ace/Malloc_Instantiations.cpp @@ -1,7 +1,12 @@ // $Id$ -#include "ace/Malloc.h" +#include "ace/Local_Memory_Pool.h" +#include "ace/Malloc_T.h" #include "ace/Null_Mutex.h" +#include "ace/Synch_Traits.h" +#include "ace/Thread_Mutex.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) @@ -32,3 +37,5 @@ template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_ # endif /* ACE_HAS_THREADS */ #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Malloc_T.cpp b/ace/Malloc_T.cpp index 599191272ed..86560f5cea8 100644 --- a/ace/Malloc_T.cpp +++ b/ace/Malloc_T.cpp @@ -17,6 +17,8 @@ #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T, class ACE_LOCK> ACE_Cached_Allocator<T, ACE_LOCK>::ACE_Cached_Allocator (size_t n_chunks) : pool_ (0), @@ -78,7 +80,8 @@ ACE_Cached_Allocator<T, ACE_LOCK>::calloc (size_t nbytes, // addr() call is really not absolutely necessary because of the way // ACE_Cached_Mem_Pool_Node's internal structure arranged. void *ptr = this->free_list_.remove ()->addr (); - ACE_OS::memset (ptr, initial_value, sizeof (T)); + if (ptr != 0) + ACE_OS::memset (ptr, initial_value, sizeof (T)); return ptr; } @@ -150,7 +153,8 @@ ACE_Dynamic_Cached_Allocator<ACE_LOCK>::calloc (size_t nbytes, // addr() call is really not absolutely necessary because of the way // ACE_Cached_Mem_Pool_Node's internal structure arranged. void *ptr = this->free_list_.remove ()->addr (); - ACE_OS::memset (ptr, initial_value, chunk_size_); + if (ptr != 0) + ACE_OS::memset (ptr, initial_value, chunk_size_); return ptr; } @@ -468,7 +472,8 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::open (void) template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name) - : memory_pool_ (pool_name), + : cb_ptr_ (0), + memory_pool_ (pool_name), bad_flag_ (0) { ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T"); @@ -490,7 +495,8 @@ template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name, const ACE_TCHAR *lock_name, const ACE_MEM_POOL_OPTIONS *options) - : memory_pool_ (pool_name, options), + : cb_ptr_ (0), + memory_pool_ (pool_name, options), bad_flag_ (0) { ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T"); @@ -514,7 +520,8 @@ template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name, const ACE_MEM_POOL_OPTIONS *options, ACE_LOCK *lock) - : memory_pool_ (pool_name, options), + : cb_ptr_ (0), + memory_pool_ (pool_name, options), lock_ (lock), delete_lock_ (0), bad_flag_ (0) @@ -540,7 +547,8 @@ template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::ACE_Malloc_T (const ACE_TCHAR *pool_name, const ACE_TCHAR *lock_name, const void *options) - : memory_pool_ (pool_name, + : cb_ptr_ (0), + memory_pool_ (pool_name, (const ACE_MEM_POOL_OPTIONS *) options), bad_flag_ (0) { @@ -578,7 +586,6 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove (void) { ACE_TRACE ("ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove"); // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%P|%t) destroying ACE_Malloc_T\n"))); - int result = 0; #if defined (ACE_HAS_MALLOC_STATS) this->print_stats (); @@ -589,7 +596,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::remove (void) this->lock_->remove (); // Give the memory pool a chance to release its resources. - result = this->memory_pool_.release (); + int const result = this->memory_pool_.release (); // Reset this->cb_ptr_ as it is no longer valid. // There's also no need to keep the reference counter as the @@ -615,7 +622,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_malloc (size_t nbytes) return 0; // Round up request to a multiple of the MALLOC_HEADER size. - size_t nunits = + size_t const nunits = (nbytes + sizeof (MALLOC_HEADER) - 1) / sizeof (MALLOC_HEADER) + 1; // Add one for the <MALLOC_HEADER> itself. @@ -772,7 +779,6 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_free (void *ap) if (ap == 0 || this->cb_ptr_ == 0) return; - // Adjust AP to point to the block MALLOC_HEADER MALLOC_HEADER *blockp = ((MALLOC_HEADER *) ap) - 1; MALLOC_HEADER *currp = this->cb_ptr_->freep_; @@ -1249,4 +1255,6 @@ ACE_Malloc_FIFO_Iterator_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::start (void) return this->curr_ != 0; } -#endif /* ACE_MALLOC_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_MALLOC_T_CPP */ diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h index 241d1529f49..79c92dfe99e 100644 --- a/ace/Malloc_T.h +++ b/ace/Malloc_T.h @@ -16,6 +16,7 @@ #include /**/ "ace/pre.h" #include "ace/Malloc.h" /* Need ACE_Control_Block */ +#include "ace/Malloc_Base.h" /* Need ACE_Allocator */ #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -25,6 +26,8 @@ #include "ace/Free_List.h" #include "ace/Guard_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Cached_Mem_Pool_Node * @@ -886,6 +889,8 @@ public: ACE_LOCK * operator () (const ACE_TCHAR *myname); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Malloc_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Malloc_T.inl b/ace/Malloc_T.inl index ff9fc26f4be..dee20160cb2 100644 --- a/ace/Malloc_T.inl +++ b/ace/Malloc_T.inl @@ -4,6 +4,8 @@ #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE T * ACE_Cached_Mem_Pool_Node<T>::addr (void) { @@ -59,7 +61,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::release (int close) ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1); if (this->cb_ptr_ != 0) { - int retv = --this->cb_ptr_->ref_counter_; + int const retv = --this->cb_ptr_->ref_counter_; #if 0 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%P) ACE_Malloc_T::release ->%d\n"), @@ -167,7 +169,6 @@ ACE_Malloc_FIFO_Iterator<ACE_MEM_POOL_2, ACE_LOCK>::ACE_Malloc_FIFO_Iterator (AC } - #if 0 template <ACE_MEM_POOL_1, class ACE_LOCK, class ACE_CB> ACE_INLINE void ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::init_malloc_header_ptr (void* ptr) @@ -178,4 +179,6 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::init_malloc_header_ptr (void* pt ACE_UNUSED_ARG (ptr); #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ } -#endif +#endif /* 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Managed_Object.cpp b/ace/Managed_Object.cpp index cd798b2216d..53381f88a7e 100644 --- a/ace/Managed_Object.cpp +++ b/ace/Managed_Object.cpp @@ -13,11 +13,13 @@ #include "ace/Managed_Object.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Managed_Object, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class TYPE> ACE_Cleanup_Adapter<TYPE>::~ACE_Cleanup_Adapter (void) { } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_MANAGED_OBJECT_CPP */ diff --git a/ace/Managed_Object.h b/ace/Managed_Object.h index 041e7c2d82a..b700a59cf13 100644 --- a/ace/Managed_Object.h +++ b/ace/Managed_Object.h @@ -24,6 +24,8 @@ #include "ace/Object_Manager.h" #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Cleanup_Adapter * @@ -115,7 +117,7 @@ public: // Get the preallocated object identified by "id". Returns a // pointer to the object. Beware: no error indication is provided, // because it can _only_ be used for accessing preallocated objects. - // Note: the function definition is inlined here so that it compiles + // @note The function definition is inlined here so that it compiles // on AIX 4.1 w/xlC v. 3.01. static TYPE *get_preallocated_array (ACE_Object_Manager::Preallocated_Array identifier) @@ -133,18 +135,22 @@ public: // Get the preallocated array identified by "id". Returns a // pointer to the array. Beware: no error indication is provided, // because it can _only_ be used for accessing preallocated arrays. - // Note: the function definition is inlined here so that it compiles + // @note The function definition is inlined here so that it compiles // on AIX 4.1 w/xlC v. 3.01. -private: +protected: + // Disallow instantiation of this class. ACE_UNIMPLEMENTED_FUNC (ACE_Managed_Object (void)) + +private: + ACE_UNIMPLEMENTED_FUNC (ACE_Managed_Object (const ACE_Managed_Object<TYPE> &)) ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Managed_Object<TYPE> &)) - - friend class this_prevents_compiler_warning_about_only_private_constructors; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Managed_Object.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Managed_Object.inl b/ace/Managed_Object.inl index d4dd6043418..0619691d8a6 100644 --- a/ace/Managed_Object.inl +++ b/ace/Managed_Object.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TYPE> ACE_INLINE ACE_Cleanup_Adapter<TYPE>::ACE_Cleanup_Adapter (void) @@ -16,3 +19,5 @@ ACE_Cleanup_Adapter<TYPE>::object (void) { return this->object_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Manual_Event.cpp b/ace/Manual_Event.cpp index 3864da3e06e..5acefac1109 100644 --- a/ace/Manual_Event.cpp +++ b/ace/Manual_Event.cpp @@ -9,6 +9,8 @@ ACE_RCSID(ace, Manual_Event, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Manual_Event::ACE_Manual_Event (int initial_state, int type, const char *name, @@ -41,3 +43,4 @@ ACE_Manual_Event::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Manual_Event.h b/ace/Manual_Event.h index 888df828cc9..fd3b5743188 100644 --- a/ace/Manual_Event.h +++ b/ace/Manual_Event.h @@ -24,6 +24,8 @@ #include "ace/Event.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Manual_Event * @@ -59,6 +61,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Manual_Event.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Manual_Event.inl b/ace/Manual_Event.inl index 1e4d560a855..42bf94f6404 100644 --- a/ace/Manual_Event.inl +++ b/ace/Manual_Event.inl @@ -1,7 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Manual_Event::~ACE_Manual_Event (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Map.cpp b/ace/Map.cpp deleted file mode 100644 index 1faa6c18f23..00000000000 --- a/ace/Map.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Map.cpp -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Map_T.h" - -ACE_RCSID(ace, Map, "$Id$") - diff --git a/ace/Map.h b/ace/Map.h index 1da1db7a4a5..0e7c00b30b5 100644 --- a/ace/Map.h +++ b/ace/Map.h @@ -6,6 +6,8 @@ * * $Id$ * + * Backward compatibility header. + * * @author Irfan Pyarali */ //============================================================================= diff --git a/ace/Map_Manager.cpp b/ace/Map_Manager.cpp index 5c6267f2b5f..f39124ce9d9 100644 --- a/ace/Map_Manager.cpp +++ b/ace/Map_Manager.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_MAP_MANAGER_C -#define ACE_MAP_MANAGER_C +#ifndef ACE_MAP_MANAGER_CPP +#define ACE_MAP_MANAGER_CPP #include "ace/Map_Manager.h" @@ -15,20 +15,14 @@ #include "ace/Map_Manager.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Map_Manager, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Map_Entry) - ACE_ALLOC_HOOK_DEFINE(ACE_Map_Manager) - ACE_ALLOC_HOOK_DEFINE(ACE_Map_Const_Iterator_Base) - ACE_ALLOC_HOOK_DEFINE(ACE_Map_Iterator_Base) - ACE_ALLOC_HOOK_DEFINE(ACE_Map_Const_Iterator) - ACE_ALLOC_HOOK_DEFINE(ACE_Map_Iterator) - ACE_ALLOC_HOOK_DEFINE(ACE_Map_Reverse_Iterator) template <class EXT_ID, class INT_ID, class ACE_LOCK> int @@ -702,4 +696,6 @@ ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::dump (void) const #endif /* ACE_HAS_DUMP */ } -#endif /* ACE_MAP_MANAGER_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_MAP_MANAGER_CPP */ diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h index 1cf39698914..847c7167e2c 100644 --- a/ace/Map_Manager.h +++ b/ace/Map_Manager.h @@ -21,8 +21,11 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Log_Msg.h" #include "ace/Basic_Types.h" +#include "ace/Global_Macros.h" +#include "ace/Default_Constants.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Forward declaration. class ACE_Allocator; @@ -113,9 +116,9 @@ class ACE_Map_Reverse_Iterator; * The <EXT_ID> must support <operator==>. This constraint can * be alleviated via template specialization, as shown in the * $ACE_ROOT/tests/Conn_Test.cpp test. - * This class uses an <ACE_Allocator> to allocate memory. The + * This class uses an ACE_Allocator to allocate memory. The * user can make this a persistant class by providing an - * <ACE_Allocator> with a persistable memory pool. + * ACE_Allocator with a persistable memory pool. * This implementation of a map uses an array, which is searched * linearly. For more efficient searching you should use the * <ACE_Hash_Map_Manager>. @@ -261,8 +264,8 @@ public: * possible to acquire the lock explicitly, which can be useful in * some cases if you instantiate the <ACE_Atomic_Op> with an * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to - * guard the state of an iterator. NOTE: the right name would be - * <lock>, but HP/C++ will choke on that! + * guard the state of an iterator. + * @note The right name would be <lock>, but HP/C++ will choke on that! */ ACE_LOCK &mutex (void); @@ -564,7 +567,7 @@ protected: * <ACE_Map_Manager> it is iterating upon since locking is * inherently inefficient and/or error-prone within an STL-style * iterator. If you require locking, you can explicitly use an - * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Map_Manager>'s + * ACE_Guard or ACE_Read_Guard on the <ACE_Map_Manager>'s * internal lock, which is accessible via its <mutex> method. */ template <class EXT_ID, class INT_ID, class ACE_LOCK> @@ -611,7 +614,7 @@ public: * <ACE_Map_Manager> it is iterating upon since locking is * inherently inefficient and/or error-prone within an STL-style * iterator. If you require locking, you can explicitly use an - * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Map_Manager>'s + * ACE_Guard or ACE_Read_Guard on the <ACE_Map_Manager>'s * internal lock, which is accessible via its <mutex> method. */ template <class EXT_ID, class INT_ID, class ACE_LOCK> @@ -658,7 +661,7 @@ public: * <ACE_Map_Manager> it is iterating upon since locking is * inherently inefficient and/or error-prone within an STL-style * iterator. If you require locking, you can explicitly use an - * <ACE_Guard> or <ACE_Read_Guard> on the <ACE_Map_Manager>'s + * ACE_Guard or ACE_Read_Guard on the <ACE_Map_Manager>'s * internal lock, which is accessible via its <mutex> method. */ template <class EXT_ID, class INT_ID, class ACE_LOCK> @@ -696,6 +699,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Map_Manager.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Map_Manager.inl b/ace/Map_Manager.inl index 7ef6fdfbf3b..c40a72d79f1 100644 --- a/ace/Map_Manager.inl +++ b/ace/Map_Manager.inl @@ -3,6 +3,9 @@ // $Id$ #include "ace/Guard_T.h" +#include "ace/Log_Msg.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL # if ! defined (ACE_HAS_BROKEN_NOOP_DTORS) template <class EXT_ID, class INT_ID> ACE_INLINE @@ -714,3 +717,5 @@ ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, ACE_LOCK>::operator-- (int) --*this; return retv; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Map_T.cpp b/ace/Map_T.cpp index 8aab011ffef..2487481edc3 100644 --- a/ace/Map_T.cpp +++ b/ace/Map_T.cpp @@ -13,6 +13,8 @@ #include "ace/Map_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class KEY, class VALUE> ACE_Map<KEY, VALUE>::~ACE_Map (void) { @@ -1336,4 +1338,6 @@ ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::rend_impl (void) return temp; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_MAP_T_CPP */ diff --git a/ace/Map_T.h b/ace/Map_T.h index 9ff658d4a7d..942b8bf1156 100644 --- a/ace/Map_T.h +++ b/ace/Map_T.h @@ -23,6 +23,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Noop_Key_Generator * @@ -1591,6 +1593,8 @@ private: ACE_UNIMPLEMENTED_FUNC (ACE_Map_Manager_Adapter (const ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Map_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Map_T.inl b/ace/Map_T.inl index 91a9f678ccc..8dea4a198b3 100644 --- a/ace/Map_T.inl +++ b/ace/Map_T.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE int ACE_Noop_Key_Generator<T>::operator() (T &) { @@ -408,3 +411,5 @@ ACE_Map_Manager_Adapter<KEY, VALUE, KEY_GENERATOR>::key_generator (void) { return this->key_generator_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp index 086051a79d9..32fd2161d60 100644 --- a/ace/Mem_Map.cpp +++ b/ace/Mem_Map.cpp @@ -23,6 +23,8 @@ ACE_RCSID(ace, Mem_Map, "Mem_Map.cpp,v 4.39 2003/11/01 11:15:13 dhinton Exp") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Mem_Map) #if defined (ACE_USE_MAPPING_NAME) @@ -123,7 +125,7 @@ ACE_Mem_Map::map_it (ACE_HANDLE handle, if (result == -1) return -1; #else - long result = ACE_OS::filesize (this->handle_); + off_t result = ACE_OS::filesize (this->handle_); #endif /* CHORUS */ // At this point we know <result> is not negative... @@ -246,10 +248,6 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name, { ACE_TRACE ("ACE_Mem_Map::open"); - ACE_OS::strsncpy (this->filename_, - file_name, - MAXPATHLEN); - #if defined (CHORUS) || defined(INTEGRITY) || defined (__QNXNTO__) this->handle_ = ACE_OS::shm_open (file_name, flags, mode, sa); #elif defined (ACE_OPENVMS) @@ -262,6 +260,10 @@ ACE_Mem_Map::open (const ACE_TCHAR *file_name, return -1; else { + ACE_OS::strsncpy (this->filename_, + file_name, + MAXPATHLEN); + this->close_handle_ = 1; return 0; } @@ -392,3 +394,5 @@ ACE_Mem_Map::remove (void) else return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Mem_Map.h b/ace/Mem_Map.h index 8f270f633ac..c72093faf40 100644 --- a/ace/Mem_Map.h +++ b/ace/Mem_Map.h @@ -15,12 +15,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -32,6 +27,8 @@ #include "ace/os_include/os_fcntl.h" #include "ace/Default_Constants.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Mem_Map * @@ -40,7 +37,7 @@ * This class works with both the mmap(2) UNIX system and the * Win32 family of memory mapping system calls. */ -class ACE_Memory_Export ACE_Mem_Map +class ACE_Export ACE_Mem_Map { public: // = Initialization and termination methods. @@ -48,7 +45,7 @@ public: /// Default constructor. ACE_Mem_Map (void); - /// Map a file from an open file descriptor <handle>. This function + /// Map a file from an open file descriptor @a handle. This function /// will lookup the length of the file if it is not given. ACE_Mem_Map (ACE_HANDLE handle, int length = -1, @@ -58,7 +55,7 @@ public: off_t offset = 0, LPSECURITY_ATTRIBUTES sa = 0); - /// Map a file specified by <file_name>. + /// Map a file specified by @a file_name. ACE_Mem_Map (const ACE_TCHAR *filename, int len = -1, int flags = O_RDWR | O_CREAT, @@ -69,7 +66,7 @@ public: off_t offset = 0, LPSECURITY_ATTRIBUTES sa = 0); - /// Map a file from an open file descriptor <handle>. This function + /// Map a file from an open file descriptor @a handle. This function /// will lookup the length of the file if it is not given. int map (ACE_HANDLE handle, int length = -1, @@ -178,6 +175,23 @@ public: ACE_ALLOC_HOOK_DECLARE; private: + + /// This method does the dirty work of actually calling ::mmap to map + /// the file into memory. + int map_it (ACE_HANDLE handle, + int len = -1, + int prot = PROT_RDWR, + int share = MAP_SHARED, + void *addr = 0, + off_t offset = 0, + LPSECURITY_ATTRIBUTES sa = 0); + + // = Disallow copying and assignment. + ACE_Mem_Map (const ACE_Mem_Map &); + void operator = (const ACE_Mem_Map &); + +private: + /// Base address of the memory-mapped file. void *base_addr_; @@ -202,21 +216,10 @@ private: /// if we opened the file. int close_handle_; - /// This method does the dirty work of actually calling ::mmap to map - /// the file into memory. - int map_it (ACE_HANDLE handle, - int len = -1, - int prot = PROT_RDWR, - int share = MAP_SHARED, - void *addr = 0, - off_t offset = 0, - LPSECURITY_ATTRIBUTES sa = 0); - - // = Disallow copying and assignment. - ACE_UNIMPLEMENTED_FUNC (ACE_Mem_Map (const ACE_Mem_Map &)) - ACE_UNIMPLEMENTED_FUNC (void operator = (const ACE_Mem_Map &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Mem_Map.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Mem_Map.inl b/ace/Mem_Map.inl index 3293b9a1365..0d67cfc5b02 100644 --- a/ace/Mem_Map.inl +++ b/ace/Mem_Map.inl @@ -1,9 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_mman.h" #include "ace/OS_NS_sys_stat.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_HANDLE ACE_Mem_Map::handle (void) const { @@ -253,3 +257,5 @@ ACE_Mem_Map::close_handle (void) return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Message_Block.cpp b/ace/Message_Block.cpp index 6dfce19a0ec..79ef07f3c26 100644 --- a/ace/Message_Block.cpp +++ b/ace/Message_Block.cpp @@ -16,6 +16,8 @@ ACE_RCSID (ace, Message_Block, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_Message_Block) #if defined (ACE_ENABLE_TIMEPROBES) @@ -582,10 +584,14 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb, mb.message_block_allocator_) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_Message_Block"))); - +#if !defined (ACE_LACKS_CDR_ALIGNMENT) // Align ourselves char *start = ACE_ptr_align_binary (this->base (), align); +#else + char *start = this->base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + // Set our rd & wr pointers this->rd_ptr (start); this->wr_ptr (start); @@ -609,21 +615,29 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb, ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("ACE_Message_Block"))); +#if !defined (ACE_LACKS_CDR_ALIGNMENT) // Align ourselves char *start = ACE_ptr_align_binary (this->base (), align); +#else + char *start = this->base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ + // Set our rd & wr pointers this->rd_ptr (start); this->wr_ptr (start); +#if !defined (ACE_LACKS_CDR_ALIGNMENT) // Get the alignment offset of the incoming ACE_Message_Block start = ACE_ptr_align_binary (mb.base (), align); - +#else + start = mb.base (); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ // Actual offset for the incoming message block assuming that it // is also aligned to the same "align" byte - size_t wr_offset = mb.wr_ptr_ - (start - mb.base ()); + size_t const wr_offset = mb.wr_ptr_ - (start - mb.base ()); // Copy wr_offset amount of data in to <this->data_block> (void) ACE_OS::memcpy (this->wr_ptr (), @@ -634,6 +648,9 @@ ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb, // to do what it wants } +#if defined (ACE_LACKS_CDR_ALIGNMENT) + ACE_UNUSED_ARG (align); +#endif /* ACE_LACKS_CDR_ALIGNMENT */ } int @@ -736,7 +753,7 @@ ACE_Data_Block::release_i (void) ACE_Data_Block *result = 0; // decrement reference count - this->reference_count_--; + --this->reference_count_; if (this->reference_count_ == 0) // this will cause deletion of this @@ -948,10 +965,10 @@ ACE_Data_Block::duplicate (void) { // We need to acquire the lock before incrementing the count. ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->locking_strategy_, 0); - this->reference_count_++; + ++this->reference_count_; } else - this->reference_count_++; + ++this->reference_count_; return this; } @@ -1203,6 +1220,7 @@ ACE_Data_Block::base (char *msg_data, if (ACE_BIT_DISABLED (this->flags_, ACE_Message_Block::DONT_DELETE)) this->allocator_strategy_->free (this->base_); + this->max_size_ = msg_length; this->cur_size_ = msg_length; this->base_ = msg_data; @@ -1350,18 +1368,4 @@ ACE_Laxity_Message_Strategy::dump (void) const } // Dump the state of the strategy. -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Guard <ACE_Lock>; -// These specializations aren't needed for the ACE library because -// Service_Config.cpp has them: -// -// template class ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>; -// template class ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> >; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Guard <ACE_Lock> -// These specializations aren't needed for the ACE library because -// Service_Config.cpp has them: -// -// #pragma instantiate ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> -// #pragma instantiate ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> > -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Message_Block.h b/ace/Message_Block.h index f5111c199db..20b20810587 100644 --- a/ace/Message_Block.h +++ b/ace/Message_Block.h @@ -26,6 +26,8 @@ #include "ace/Global_Macros.h" #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration. class ACE_Allocator; class ACE_Data_Block; @@ -521,25 +523,25 @@ public: size_t space (void) const; //@} - // = <ACE_Data_Block> methods. + // = ACE_Data_Block methods. /** - * Get a pointer to the data block. Note that the <ACE_Message_Block> + * Get a pointer to the data block. Note that the ACE_Message_Block * still references the block; this call does not change the reference * count. */ ACE_Data_Block *data_block (void) const; /** - * Set a new data block pointer. The original <ACE_Data_Block> is released + * Set a new data block pointer. The original ACE_Data_Block is released * as a result of this call. If you need to keep the original block, call - * <replace_data_block> instead. Upon return, this <ACE_Message_Block> - * holds a pointer to the new <ACE_Data_Block>, taking over the reference + * <replace_data_block> instead. Upon return, this ACE_Message_Block + * holds a pointer to the new ACE_Data_Block, taking over the reference * you held on it prior to the call. */ void data_block (ACE_Data_Block *); - /// Set a new data block pointer. A pointer to the original <ACE_Data_Block> + /// Set a new data block pointer. A pointer to the original ACE_Data_Block /// is returned, and not released (as it is with <data_block>). ACE_Data_Block *replace_data_block (ACE_Data_Block*); @@ -550,14 +552,14 @@ public: /// Set the continuation field. void cont (ACE_Message_Block *); - // = Pointer to the <Message_Block> directly ahead in the <ACE_Message_Queue>. + // = Pointer to the <Message_Block> directly ahead in the ACE_Message_Queue. /// Get link to next message. ACE_Message_Block *next (void) const; /// Set link to next message. void next (ACE_Message_Block *); - // = Pointer to the <Message_Block> directly behind in the <ACE_Message_Queue>. + // = Pointer to the <Message_Block> directly behind in the ACE_Message_Queue. /// Get link to prev message. ACE_Message_Block *prev (void) const; @@ -664,7 +666,7 @@ private: * @class ACE_Data_Block * * @brief Stores the data payload that is accessed via one or more - * <ACE_Message_Block>s. + * ACE_Message_Block's. * * This data structure is reference counted to maximize * sharing. It also contains the <locking_strategy_> (which @@ -822,25 +824,25 @@ protected: // = Strategies. /** - * Pointer to the allocator defined for this <ACE_Data_Block>. Note + * Pointer to the allocator defined for this ACE_Data_Block. Note * that this pointer is shared by all owners of this - * <ACE_Data_Block>. + * ACE_Data_Block. */ ACE_Allocator *allocator_strategy_; /** * Pointer to the locking strategy defined for this - * <ACE_Data_Block>. This is used to protect regions of code that - * access shared <ACE_Data_Block> state. Note that this lock is - * shared by all owners of the <ACE_Data_Block>'s data. + * ACE_Data_Block. This is used to protect regions of code that + * access shared ACE_Data_Block state. Note that this lock is + * shared by all owners of the ACE_Data_Block's data. */ ACE_Lock *locking_strategy_; /** - * Reference count for this <ACE_Data_Block>, which is used to avoid + * Reference count for this ACE_Data_Block, which is used to avoid * deep copies (i.e., <clone>). Note that this pointer value is * shared by all owners of the <Data_Block>'s data, i.e., all the - * <ACE_Message_Block>s. + * ACE_Message_Blocks. */ int reference_count_; @@ -857,9 +859,9 @@ private: * @class ACE_Dynamic_Message_Strategy * * @brief An abstract base class which provides dynamic priority - * evaluation methods for use by the <ACE_Dynamic_Message_Queue> + * evaluation methods for use by the ACE_Dynamic_Message_Queue * class or any other class which needs to manage the priorities - * of a collection of <ACE_Message_Block>s dynamically. + * of a collection of ACE_Message_Block's dynamically. * * Methods for deadline and laxity based priority evaluation are * provided. These methods assume a specific partitioning of @@ -1033,6 +1035,8 @@ public: virtual void dump (void) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Message_Block.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Message_Block.inl b/ace/Message_Block.inl index b1d5152fbe7..2f67cc25078 100644 --- a/ace/Message_Block.inl +++ b/ace/Message_Block.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Message_Block.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Data_Block * ACE_Message_Block::data_block (void) const @@ -621,3 +622,5 @@ ACE_Dynamic_Message_Strategy::priority_status (ACE_Message_Block & mb, return status; } // returns the priority status of the message + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Message_Block_T.cpp b/ace/Message_Block_T.cpp index 70621872a19..d2cf9464ab0 100644 --- a/ace/Message_Block_T.cpp +++ b/ace/Message_Block_T.cpp @@ -1,9 +1,7 @@ // $Id$ -#if !defined (ACE_MESSAGE_BLOCK_T_C) -#define ACE_MESSAGE_BLOCK_T_C - -ACE_RCSID(ace, Message_Block_T, "$Id$") +#ifndef ACE_MESSAGE_BLOCK_T_CPP +#define ACE_MESSAGE_BLOCK_T_CPP #include "ace/Malloc_Base.h" /* Need ACE_Allocator */ @@ -13,6 +11,8 @@ ACE_RCSID(ace, Message_Block_T, "$Id$") #include "ace/os_include/os_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class L> ACE_Locked_Data_Block<L>::~ACE_Locked_Data_Block (void) { @@ -28,7 +28,7 @@ ACE_Locked_Data_Block<ACE_LOCK>::clone_nocopy (ACE_Message_Block::Message_Flags const ACE_Message_Block::Message_Flags always_clear = ACE_Message_Block::DONT_DELETE; - ACE_Locked_Data_Block<ACE_LOCK> *nb; + ACE_Locked_Data_Block<ACE_LOCK> *nb = 0; ACE_NEW_MALLOC_RETURN (nb, static_cast<ACE_Locked_Data_Block<ACE_LOCK>*> ( @@ -46,4 +46,6 @@ ACE_Locked_Data_Block<ACE_LOCK>::clone_nocopy (ACE_Message_Block::Message_Flags return nb; } -#endif /* ACE_MESSAGE_BLOCK_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_MESSAGE_BLOCK_T_CPP */ diff --git a/ace/Message_Block_T.h b/ace/Message_Block_T.h index f2f1732c56a..c1b4818a880 100644 --- a/ace/Message_Block_T.h +++ b/ace/Message_Block_T.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Locked_Data_Block * @@ -67,6 +69,8 @@ private: ACE_UNIMPLEMENTED_FUNC (ACE_Locked_Data_Block (const ACE_Locked_Data_Block<ACE_LOCK> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Message_Block_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Message_Block_T.inl b/ace/Message_Block_T.inl index 279dcaa704d..6829bd6c360 100644 --- a/ace/Message_Block_T.inl +++ b/ace/Message_Block_T.inl @@ -1,8 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Message_Block_T.i - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template<class ACE_LOCK> ACE_INLINE ACE_Locked_Data_Block<ACE_LOCK>::ACE_Locked_Data_Block (void) @@ -27,3 +27,5 @@ ACE_Locked_Data_Block (size_t size, data_block_allocator) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Message_Queue.cpp b/ace/Message_Queue.cpp index 019835e1cef..599f5e6b05e 100644 --- a/ace/Message_Queue.cpp +++ b/ace/Message_Queue.cpp @@ -13,6 +13,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Message_Queue_Base::~ACE_Message_Queue_Base (void) { } @@ -251,7 +253,7 @@ ACE_Message_Queue_Vx::enqueue_tail_i (ACE_Message_Block *new_item) // Don't try to send a composite message!!!! Only the first // block will be sent. - this->cur_count_++; + ++this->cur_count_; // Always use this method to actually send a message on the queue. if (::msgQSend (msgq (), @@ -369,9 +371,8 @@ ACE_Message_Queue_Vx::wait_not_empty_cond (ACE_Guard<ACE_Null_Mutex> &mon, #if ! defined (ACE_NEEDS_FUNC_DEFINITIONS) int ACE_Message_Queue_Vx::peek_dequeue_head (ACE_Message_Block *&, - ACE_Time_Value *tv) + ACE_Time_Value *) { - ACE_UNUSED_ARG (tv); ACE_NOTSUP_RETURN (-1); } #endif /* ! ACE_NEEDS_FUNC_DEFINITIONS */ @@ -427,15 +428,11 @@ ACE_Message_Queue_NT::enqueue (ACE_Message_Block *new_item, ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); if (this->state_ != ACE_Message_Queue_Base::DEACTIVATED) { - size_t msize = new_item->total_size (); - size_t mlength = new_item->total_length (); + size_t const msize = new_item->total_size (); + size_t const mlength = new_item->total_length (); // Note - we send ACTIVATED in the 3rd arg to tell the completion // routine it's _NOT_ being woken up because of deactivate(). -#if defined (ACE_WIN64) ULONG_PTR state_to_post; -#else - DWORD state_to_post; -#endif /* ACE_WIN64 */ state_to_post = ACE_Message_Queue_Base::ACTIVATED; if (::PostQueuedCompletionStatus (this->completion_port_, static_cast<DWORD> (msize), @@ -445,7 +442,7 @@ ACE_Message_Queue_NT::enqueue (ACE_Message_Block *new_item, // Update the states once I succeed. this->cur_bytes_ += msize; this->cur_length_ += mlength; - return ++this->cur_count_; + return ACE_Utils::Truncate (++this->cur_count_); } } else @@ -474,11 +471,7 @@ ACE_Message_Queue_NT::dequeue (ACE_Message_Block *&first_item, ++this->cur_thrs_; // Increase the waiting thread count. } -#if defined (ACE_WIN64) ULONG_PTR queue_state; -#else - DWORD queue_state; -#endif /* ACE_WIN64 */ DWORD msize; // Get a message from the completion port. int retv = ::GetQueuedCompletionStatus (this->completion_port_, @@ -496,7 +489,7 @@ ACE_Message_Queue_NT::dequeue (ACE_Message_Block *&first_item, --this->cur_count_; this->cur_bytes_ -= msize; this->cur_length_ -= first_item->total_length (); - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } else // Woken up by deactivate () or pulse (). errno = ESHUTDOWN; @@ -511,7 +504,7 @@ ACE_Message_Queue_NT::deactivate (void) ACE_TRACE ("ACE_Message_Queue_NT::deactivate"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - int previous_state = this->state_; + int const previous_state = this->state_; if (previous_state != ACE_Message_Queue_Base::DEACTIVATED) { this->state_ = ACE_Message_Queue_Base::DEACTIVATED; @@ -534,7 +527,7 @@ ACE_Message_Queue_NT::activate (void) { ACE_TRACE ("ACE_Message_Queue_NT::activate"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - int previous_status = this->state_; + int const previous_status = this->state_; this->state_ = ACE_Message_Queue_Base::ACTIVATED; return previous_status; } @@ -545,7 +538,7 @@ ACE_Message_Queue_NT::pulse (void) ACE_TRACE ("ACE_Message_Queue_NT::pulse"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - int previous_state = this->state_; + int const previous_state = this->state_; if (previous_state != ACE_Message_Queue_Base::DEACTIVATED) { this->state_ = ACE_Message_Queue_Base::PULSED; @@ -605,3 +598,5 @@ ACE_Message_Queue_NT::dump (void) const } #endif /* ACE_WIN32 && ACE_HAS_WINNT4 != 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Message_Queue.h b/ace/Message_Queue.h index 0abb4156312..e33563bc4a8 100644 --- a/ace/Message_Queue.h +++ b/ace/Message_Queue.h @@ -22,6 +22,8 @@ #include "ace/IO_Cntl_Msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decls. class ACE_Notification_Strategy; template <ACE_SYNCH_DECL> class ACE_Message_Queue_Iterator; @@ -30,7 +32,7 @@ template <ACE_SYNCH_DECL> class ACE_Message_Queue_Reverse_Iterator; /** * @class ACE_Message_Queue_Base * - * @brief Base class for <ACE_Message_Queue>, which is the central + * @brief Base class for ACE_Message_Queue, which is the central * queueing facility for messages in the ACE framework. * * For all the <ACE_Time_Value> pointer parameters the caller will @@ -88,7 +90,7 @@ public: // = Enqueue and dequeue methods. /** - * Retrieve the first <ACE_Message_Block> without removing it. Note + * Retrieve the first ACE_Message_Block without removing it. Note * that <timeout> uses <{absolute}> time rather than <{relative}> * time. If the <timeout> elapses without receiving a message -1 is * returned and <errno> is set to <EWOULDBLOCK>. If the queue is @@ -206,17 +208,20 @@ public: /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; +private: + // = Disallow copying and assignment. + ACE_Message_Queue_Base (const ACE_Message_Queue_Base &); + void operator= (const ACE_Message_Queue_Base &); + protected: /// Indicates the state of the queue, which can be /// <ACTIVATED>, <DEACTIVATED>, or <PULSED>. int state_; -private: - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Message_Queue_Base &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Message_Queue_Base (const ACE_Message_Queue_Base &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + // Include the templates here. #include "ace/Message_Queue_T.h" @@ -225,6 +230,8 @@ private: # include "ace/Null_Mutex.h" # include "ace/Null_Condition.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Message_Queue_Vx * @@ -235,7 +242,7 @@ private: * on the native MsgQ implementation to take care of that. The * only system calls that it uses are VxWorks msgQLib calls, so * it is suitable for use in interrupt service routines. - * NOTE: *Many* ACE_Message_Queue features are not supported with + * @note *Many* ACE_Message_Queue features are not supported with * this specialization, including: * * The two size arguments to the constructor and <open> are * interpreted differently. The first is interpreted as the @@ -252,7 +259,7 @@ private: * * <peek_dequeue_head>. * * <ACE_Message_Queue_Iterators>. * * The ability to change low and high water marks after creation. - * * <Message_Block> chains. The continuation field of <ACE_Message_Block> + * * <Message_Block> chains. The continuation field of ACE_Message_Block * * is ignored; only the first block of a fragment chain is * * recognized. */ @@ -388,6 +395,16 @@ protected: MSG_Q_ID msgq (void); private: + + // Disallow copying and assignment. + ACE_Message_Queue_Vx (const ACE_Message_Queue_Vx &); + void operator= (const ACE_Message_Queue_Vx &); + + ACE_UNIMPLEMENTED_FUNC (virtual int peek_dequeue_head + (ACE_Message_Block *&first_item, + ACE_Time_Value *tv = 0)) + +private: /// Maximum number of messages that can be queued. int max_messages_; @@ -397,16 +414,14 @@ private: /// Native message queue options. int options_; - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Message_Queue_Vx &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Message_Queue_Vx (const ACE_Message_Queue_Vx &)) - - ACE_UNIMPLEMENTED_FUNC (virtual int peek_dequeue_head - (ACE_Message_Block *&first_item, - ACE_Time_Value *tv = 0)) }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* VXWORKS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) && (ACE_HAS_WINNT4 != 0) /** * @class ACE_Message_Queue_NT @@ -415,11 +430,11 @@ private: * * Implementation of a strip-downed ACE_Message_Queue using NT's * IO completion port mechanism. - * NOTE: *Many* ACE_Message_Queue features are not supported with + * @note *Many* ACE_Message_Queue features are not supported with * this implementation, including: * * <open> method have different signatures. - * * <dequeue_head> *requires* that the <ACE_Message_Block> - * pointer argument point to an <ACE_Message_Block> that was + * * <dequeue_head> *requires* that the ACE_Message_Block + * pointer argument point to an ACE_Message_Block that was * allocated by the caller. * * <peek_dequeue_head>. * * <ACE_Message_Queue_Iterators>. @@ -565,6 +580,12 @@ public: ACE_ALLOC_HOOK_DECLARE; private: + + // Disallow copying and assignment. + ACE_Message_Queue_NT (const ACE_Message_Queue_NT &); + void operator= (const ACE_Message_Queue_NT &); + +private: // = Internal states. /// Maximum threads that can be released (and run) concurrently. @@ -592,12 +613,10 @@ private: /// Underlying NT IoCompletionPort. ACE_HANDLE completion_port_; - // = Disallow these operations. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Message_Queue_NT &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Message_Queue_NT (const ACE_Message_Queue_NT &)) }; #endif /* ACE_WIN32 && ACE_HAS_WINNT4 != 0 */ +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Message_Queue.inl" diff --git a/ace/Message_Queue.inl b/ace/Message_Queue.inl index 4280f5b1c5b..4ae6c43f3eb 100644 --- a/ace/Message_Queue.inl +++ b/ace/Message_Queue.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Message_Queue_Base::ACE_Message_Queue_Base (void) { @@ -136,3 +139,5 @@ ACE_Message_Queue_NT::notification_strategy (ACE_Notification_Strategy *) } #endif /* ACE_WIN32 && ACE_HAS_WINNT4 != 0 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Message_Queue_T.cpp b/ace/Message_Queue_T.cpp index 9fc5ad5ec92..859e8b64e68 100644 --- a/ace/Message_Queue_T.cpp +++ b/ace/Message_Queue_T.cpp @@ -14,6 +14,9 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Notification_Strategy.h" +#include "ace/Truncate.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Message_Queue) ACE_ALLOC_HOOK_DEFINE(ACE_Dynamic_Message_Queue) @@ -109,7 +112,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::peek_dequeue_head (ACE_ME ACE_Message_Block *mb = 0; - int cur_count = this->queue_.peek_dequeue_head (mb, timeout); + int const cur_count = this->queue_.peek_dequeue_head (mb, timeout); if (cur_count != -1) first_item = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ()); @@ -131,7 +134,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_head (ACE_MESSAGE ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY), -1); - int result = this->queue_.enqueue_head (mb, timeout); + int const result = this->queue_.enqueue_head (mb, timeout); if (result == -1) // Zap the message. mb->release (); @@ -165,7 +168,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_prio (ACE_MESSAGE ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY), -1); - int result = this->queue_.enqueue_prio (mb, timeout); + int const result = this->queue_.enqueue_prio (mb, timeout); if (result == -1) // Zap the message. mb->release (); @@ -187,7 +190,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_deadline (ACE_MES ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY ), -1); - int result = this->queue_.enqueue_deadline (mb, timeout); + int const result = this->queue_.enqueue_deadline (mb, timeout); if (result == -1) // Zap the message. mb->release (); @@ -212,7 +215,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::enqueue_tail (ACE_MESSAGE ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::DEFAULT_PRIORITY), -1); - int result = this->queue_.enqueue_tail (mb, timeout); + int const result = this->queue_.enqueue_tail (mb, timeout); if (result == -1) // Zap the message. mb->release (); @@ -231,7 +234,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_head (ACE_MESSAGE ACE_Message_Block *mb = 0; - int cur_count = this->queue_.dequeue_head (mb, timeout); + int const cur_count = this->queue_.dequeue_head (mb, timeout); // Dequeue the message. if (cur_count != -1) @@ -239,10 +242,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_head (ACE_MESSAGE first_item = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ()); // Delete the message block. mb->release (); - return cur_count; } - else - return -1; + + return cur_count; } // Remove the item with the lowest priority from the queue. If timeout == 0 @@ -257,7 +259,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_prio (ACE_MESSAGE ACE_Message_Block *mb = 0; - int cur_count = this->queue_.dequeue_prio (mb, timeout); + int const cur_count = this->queue_.dequeue_prio (mb, timeout); // Dequeue the message. if (cur_count != -1) @@ -265,10 +267,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_prio (ACE_MESSAGE dequeued = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ()); // Delete the message block. mb->release (); - return cur_count; } - else - return -1; + + return cur_count; } // Remove an item from the end of the queue. If timeout == 0 block @@ -283,7 +284,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_tail (ACE_MESSAGE ACE_Message_Block *mb = 0; - int cur_count = this->queue_.dequeue_tail (mb, timeout); + int const cur_count = this->queue_.dequeue_tail (mb, timeout); // Dequeue the message. if (cur_count != -1) @@ -291,10 +292,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_tail (ACE_MESSAGE dequeued = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ()); // Delete the message block. mb->release (); - return cur_count; } - else - return -1; + + return cur_count; } // Remove an item with the lowest deadline time. If timeout == 0 block @@ -309,7 +309,7 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_deadline (ACE_MES ACE_Message_Block *mb = 0; - int cur_count = this->queue_.dequeue_deadline (mb, timeout); + int const cur_count = this->queue_.dequeue_deadline (mb, timeout); // Dequeue the message. if (cur_count != -1) @@ -317,10 +317,9 @@ ACE_Message_Queue_Ex<ACE_MESSAGE_TYPE, ACE_SYNCH_USE>::dequeue_deadline (ACE_MES dequeued = reinterpret_cast<ACE_MESSAGE_TYPE *> (mb->base ()); // Delete the message block. mb->release (); - return cur_count; } - else - return -1; + + return cur_count; } template <class ACE_MESSAGE_TYPE, ACE_SYNCH_DECL> int @@ -845,7 +844,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::flush_i (void) // and <release> their memory. for (this->tail_ = 0; this->head_ != 0; ) { - number_flushed++; + ++number_flushed; size_t mb_bytes = 0; size_t mb_length = 0; @@ -854,7 +853,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::flush_i (void) // Subtract off all of the bytes associated with this message. this->cur_bytes_ -= mb_bytes; this->cur_length_ -= mb_length; - this->cur_count_--; + --this->cur_count_; ACE_Message_Block *temp = this->head_; this->head_ = this->head_->next (); @@ -896,7 +895,7 @@ template <ACE_SYNCH_DECL> int ACE_Message_Queue<ACE_SYNCH_USE>::deactivate_i (int pulse) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::deactivate_i"); - int previous_state = this->state_; + int const previous_state = this->state_; if (previous_state != ACE_Message_Queue_Base::DEACTIVATED) { @@ -916,7 +915,7 @@ template <ACE_SYNCH_DECL> int ACE_Message_Queue<ACE_SYNCH_USE>::activate_i (void) { ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::activate_i"); - int previous_state = this->state_; + int const previous_state = this->state_; this->state_ = ACE_Message_Queue_Base::ACTIVATED; return previous_state; } @@ -939,7 +938,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::close (void) ACE_TRACE ("ACE_Message_Queue<ACE_SYNCH_USE>::close"); ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, ace_mon, this->lock_, -1); - int result = this->deactivate_i (); + int const result = this->deactivate_i (); // Free up the remaining messages on the queue. this->flush_i (); @@ -975,35 +974,48 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_tail_i (ACE_Message_Block *new_item) if (new_item == 0) return -1; + // Update the queued size and length, taking into account any chained + // blocks (total_size_and_length() counts all continuation blocks). + // Keep count of how many blocks we're adding and, if there is a chain of + // blocks, find the end in seq_tail and be sure they're properly + // back-connected along the way. + ACE_Message_Block *seq_tail = new_item; + ++this->cur_count_; + new_item->total_size_and_length (this->cur_bytes_, + this->cur_length_); + while (seq_tail->next () != 0) + { + seq_tail->next ()->prev (seq_tail); + seq_tail = seq_tail->next (); + ++this->cur_count_; + seq_tail->total_size_and_length (this->cur_bytes_, + this->cur_length_); + } + // List was empty, so build a new one. if (this->tail_ == 0) { this->head_ = new_item; - this->tail_ = new_item; - new_item->next (0); + this->tail_ = seq_tail; + // seq_tail->next (0); This is a condition of the while() loop above. new_item->prev (0); } // Link at the end. else { - new_item->next (0); + // seq_tail->next (0); This is a condition of the while() loop above. this->tail_->next (new_item); new_item->prev (this->tail_); - this->tail_ = new_item; + this->tail_ = seq_tail; } - // Make sure to count all the bytes in a composite message!!! - new_item->total_size_and_length (this->cur_bytes_, - this->cur_length_); - this->cur_count_++; - if (this->signal_dequeue_waiters () == -1) return -1; else - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } -// Actually put the node at the head (no locking) +// Actually put the node(s) at the head (no locking) template <ACE_SYNCH_DECL> int ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head_i (ACE_Message_Block *new_item) @@ -1013,25 +1025,38 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_head_i (ACE_Message_Block *new_item) if (new_item == 0) return -1; + // Update the queued size and length, taking into account any chained + // blocks (total_size_and_length() counts all continuation blocks). + // Keep count of how many blocks we're adding and, if there is a chain of + // blocks, find the end in seq_tail and be sure they're properly + // back-connected along the way. + ACE_Message_Block *seq_tail = new_item; + ++this->cur_count_; + new_item->total_size_and_length (this->cur_bytes_, + this->cur_length_); + while (seq_tail->next () != 0) + { + seq_tail->next ()->prev (seq_tail); + seq_tail = seq_tail->next (); + ++this->cur_count_; + seq_tail->total_size_and_length (this->cur_bytes_, + this->cur_length_); + } + new_item->prev (0); - new_item->next (this->head_); + seq_tail->next (this->head_); if (this->head_ != 0) - this->head_->prev (new_item); + this->head_->prev (seq_tail); else - this->tail_ = new_item; + this->tail_ = seq_tail; this->head_ = new_item; - // Make sure to count all the bytes in a composite message!!! - new_item->total_size_and_length (this->cur_bytes_, - this->cur_length_); - this->cur_count_++; - if (this->signal_dequeue_waiters () == -1) return -1; else - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } // Actually put the node at its proper position relative to its @@ -1045,6 +1070,12 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item) if (new_item == 0) return -1; + // Since this method uses enqueue_head_i() and enqueue_tail_i() for + // special situations, and this method doesn't support enqueueing + // chains of blocks off the 'next' pointer, make sure the new_item's + // next pointer is 0. + new_item->next (0); + if (this->head_ == 0) // Check for simple case of an empty queue, where all we need to // do is insert <new_item> into the head. @@ -1091,12 +1122,12 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item) // Make sure to count all the bytes in a composite message!!! new_item->total_size_and_length (this->cur_bytes_, this->cur_length_); - this->cur_count_++; + ++this->cur_count_; if (this->signal_dequeue_waiters () == -1) return -1; else - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } // Actually put the node at its proper position relative to its @@ -1111,6 +1142,12 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline_i (ACE_Message_Block *new_ite if (new_item == 0) return -1; + // Since this method uses enqueue_head_i() and enqueue_tail_i() for + // special situations, and this method doesn't support enqueueing + // chains of blocks off the 'next' pointer, make sure the new_item's + // next pointer is 0. + new_item->next (0); + if (this->head_ == 0) // Check for simple case of an empty queue, where all we need to // do is insert <new_item> into the head. @@ -1152,7 +1189,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::enqueue_deadline_i (ACE_Message_Block *new_ite // Make sure to count all the bytes in a composite message!!! new_item->total_size_and_length (this->cur_bytes_, this->cur_length_); - this->cur_count_++; + ++this->cur_count_; if (this->signal_dequeue_waiters () == -1) return -1; @@ -1191,7 +1228,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&first_item // Subtract off all of the bytes associated with this message. this->cur_bytes_ -= mb_bytes; this->cur_length_ -= mb_length; - this->cur_count_--; + --this->cur_count_; if (this->cur_count_ == 0 && this->head_ == this->tail_) this->head_ = this->tail_ = 0; @@ -1206,7 +1243,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&first_item && this->signal_enqueue_waiters () == -1) return -1; else - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } // Get the earliest (i.e., FIFO) ACE_Message_Block with the lowest @@ -1267,7 +1304,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio_i (ACE_Message_Block *&dequeued) // Subtract off all of the bytes associated with this message. this->cur_bytes_ -= mb_bytes; this->cur_length_ -= mb_length; - this->cur_count_--; + --this->cur_count_; if (this->cur_count_ == 0 && this->head_ == this->tail_) this->head_ = this->tail_ = 0; @@ -1282,7 +1319,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_prio_i (ACE_Message_Block *&dequeued) && this->signal_enqueue_waiters () == -1) return -1; else - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } // Actually get the last ACE_Message_Block (no locking, so must be @@ -1316,7 +1353,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail_i (ACE_Message_Block *&dequeued) // Subtract off all of the bytes associated with this message. this->cur_bytes_ -= mb_bytes; this->cur_length_ -= mb_length; - this->cur_count_--; + --this->cur_count_; if (this->cur_count_ == 0 && this->head_ == this->tail_) this->head_ = this->tail_ = 0; @@ -1331,7 +1368,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_tail_i (ACE_Message_Block *&dequeued) && this->signal_enqueue_waiters () == -1) return -1; else - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } // Actually get the ACE_Message_Block with the lowest deadline time @@ -1385,7 +1422,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::dequeue_deadline_i (ACE_Message_Block *&dequeu // Subtract off all of the bytes associated with this message. this->cur_bytes_ -= mb_bytes; this->cur_length_ -= mb_length; - this->cur_count_--; + --this->cur_count_; if (this->cur_count_ == 0 && this->head_ == this->tail_) this->head_ = this->tail_ = 0; @@ -1427,7 +1464,7 @@ ACE_Message_Queue<ACE_SYNCH_USE>::peek_dequeue_head (ACE_Message_Block *&first_i return -1; first_item = this->head_; - return this->cur_count_; + return ACE_Utils::Truncate (this->cur_count_); } template <ACE_SYNCH_DECL> int @@ -1869,7 +1906,7 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::remove_messages (ACE_Message_Block *&l temp1 != 0; temp1 = temp1->next ()) { - this->cur_count_--; + --this->cur_count_; size_t mb_bytes = 0; size_t mb_length = 0; @@ -2089,7 +2126,7 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::enqueue_i (ACE_Message_Block *new_item mb_length); this->cur_bytes_ += mb_bytes; this->cur_length_ += mb_length; - this->cur_count_++; + ++this->cur_count_; if (this->signal_dequeue_waiters () == -1) return -1; @@ -2278,7 +2315,7 @@ ACE_Dynamic_Message_Queue<ACE_SYNCH_USE>::dequeue_head_i (ACE_Message_Block *&fi // Subtract off all of the bytes associated with this message. this->cur_bytes_ -= mb_bytes; this->cur_length_ -= mb_length; - this->cur_count_--; + --this->cur_count_; // Only signal enqueueing threads if we've fallen below the low // water mark. @@ -2663,4 +2700,7 @@ ACE_Message_Queue_Factory<ACE_SYNCH_USE>::create_NT_message_queue (size_t max_th #endif /* ACE_WIN32 && ACE_HAS_WINNT4 != 0 */ #endif /* defined (VXWORKS) */ + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_MESSAGE_QUEUE_T_CPP */ diff --git a/ace/Message_Queue_T.h b/ace/Message_Queue_T.h index 6bd8186fd84..46ef61c79c7 100644 --- a/ace/Message_Queue_T.h +++ b/ace/Message_Queue_T.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (VXWORKS) class ACE_Message_Queue_Vx; #endif /* defined (VXWORKS) */ @@ -33,14 +35,19 @@ class ACE_Message_Queue_NT; /** * @class ACE_Message_Queue * - * @brief A threaded message queueing facility, modeled after the - * queueing facilities in System V STREAMs. + * @brief A message queueing facility with parameterized synchronization + * capability. ACE_Message_Queue is modeled after the queueing facilities + * in System V STREAMs. + * + * ACE_Message_Queue is the primary queueing facility for + * messages in the ACE framework. It's one template argument parameterizes + * the queue's synchronization. The argument specifies a synchronization + * strategy. The two main strategies available for ACE_SYNCH_DECL are: + * -# ACE_MT_SYNCH: all operations are thread-safe + * -# ACE_NULL_SYNCH: no synchronization and no locking overhead * - * An <ACE_Message_Queue> is the central queueing facility for - * messages in the ACE framework. If <ACE_SYNCH_DECL> is - * <ACE_MT_SYNCH> then all operations are thread-safe. - * Otherwise, if it's <ACE_NULL_SYNCH> then there's no locking - * overhead. + * All data passing through ACE_Message_Queue is in the form of + * ACE_Message_Block objects. @sa ACE_Message_Block. */ template <ACE_SYNCH_DECL> class ACE_Message_Queue : public ACE_Message_Queue_Base @@ -56,83 +63,91 @@ public: REVERSE_ITERATOR; // = Initialization and termination methods. + //@{ /** - * Initialize an <ACE_Message_Queue>. The <high_water_mark> - * determines how many bytes can be stored in a queue before it's - * considered "full." Supplier threads must block until the queue - * is no longer full. The <low_water_mark> determines how many - * bytes must be in the queue before supplier threads are allowed to - * enqueue additional <ACE_Message_Block>s. By default, the - * <high_water_mark> equals the <low_water_mark>, which means that - * suppliers will be able to enqueue new messages as soon as a - * consumer removes any message from the queue. Making the - * <low_water_mark> smaller than the <high_water_mark> forces - * consumers to drain more messages from the queue before suppliers - * can enqueue new messages, which can minimize the "silly window - * syndrome." - */ - ACE_Message_Queue (size_t high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM, - size_t low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM, - ACE_Notification_Strategy * = 0); - - /** - * Initialize an <ACE_Message_Queue>. The <high_water_mark> - * determines how many bytes can be stored in a queue before it's - * considered "full." Supplier threads must block until the queue - * is no longer full. The <low_water_mark> determines how many - * bytes must be in the queue before supplier threads are allowed to - * enqueue additional <ACE_Message_Block>s. By default, the - * <high_water_mark> equals the <low_water_mark>, which means that - * suppliers will be able to enqueue new messages as soon as a - * consumer removes any message from the queue. Making the - * <low_water_mark> smaller than the <high_water_mark> forces - * consumers to drain more messages from the queue before suppliers - * can enqueue new messages, which can minimize the "silly window - * syndrome." + * Initialize an ACE_Message_Queue. + * + * @param hwm High water mark. Determines how many bytes can be stored in a + * queue before it's considered full. Supplier threads must block + * until the queue is no longer full. + * @param lwm Low water mark. Determines how many bytes must be in the queue + * before supplier threads are allowed to enqueue additional + * data. By default, the @a hwm equals @a lwm, which means + * that suppliers will be able to enqueue new messages as soon as + * a consumer removes any message from the queue. Making the low + * water mark smaller than the high water mark forces consumers to + * drain more messages from the queue before suppliers can enqueue + * new messages, which can minimize the "silly window syndrome." + * @param ns Notification strategy. Pointer to an object conforming to the + * ACE_Notification_Strategy interface. If set, the object's + * notify(void) method will be called each time data is added to + * this ACE_Message_Queue. @see ACE_Reactor_Notification_Strategy. */ + ACE_Message_Queue (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM, + size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM, + ACE_Notification_Strategy *ns = 0); virtual int open (size_t hwm = ACE_Message_Queue_Base::DEFAULT_HWM, size_t lwm = ACE_Message_Queue_Base::DEFAULT_LWM, - ACE_Notification_Strategy * = 0); + ACE_Notification_Strategy *ns = 0); + //@} - /// Release all resources from the message queue and mark it as deactivated. - /// Returns the number of messages released from the queue. + /// Releases all resources from the message queue and marks it deactivated. + /// @sa flush(). + /// + /// @retval The number of messages released from the queue; -1 on error. virtual int close (void); - /// Release all resources from the message queue and mark it as deactivated. + /// Releases all resources from the message queue and marks it deactivated. virtual ~ACE_Message_Queue (void); - /// Release all resources from the message queue but do not mark it - /// as deactivated. + /// Releases all resources from the message queue but does not mark it + /// deactivated. + /// @sa close(). /** * This method holds the queue lock during this operation. * - * @return The number of messages flushed. + * @return The number of messages flushed; -1 on error. */ virtual int flush (void); /// Release all resources from the message queue but do not mark it /// as deactivated. /** - * The caller must be holding the queue lock before calling this + * @pre The caller must be holding the queue lock before calling this * method. * * @return The number of messages flushed. */ virtual int flush_i (void); - // = Enqueue and dequeue methods. - - // For the following enqueue and dequeue methods if <timeout> == 0, - // the caller will block until action is possible, else will wait - // until the absolute time specified in *<timeout> elapses). These - // calls will return, however, when queue is closed, deactivated, - // when a signal occurs, or if the time specified in timeout - // elapses, (in which case errno = EWOULDBLOCK). - + /** @name Enqueue and dequeue methods + * + * The enqueue and dequeue methods accept a timeout value passed as + * an ACE_Time_Value *. In all cases, if the timeout pointer is 0, + * the caller will block until action is possible. If the timeout pointer + * is non-zero, the call will wait (if needed, subject to water mark + * settings) until the absolute time specified in the referenced + * ACE_Time_Value object is reached. If the time is reached before the + * desired action is possible, the method will return -1 with errno set + * to @c EWOULDBLOCK. Regardless of the timeout setting, however, + * these methods will also fail and return -1 when the queue is closed, + * deactivated, pulsed, or when a signal occurs. + * + * See C++NPv2 Section 6.2 and APG Section 12.3 for a fuller treatment of + * ACE_Message_Queue, enqueueing, dequeueing, and how these operations are + * affected by queue state transitions. + */ + //@{ /** * Retrieve a pointer to the first ACE_Message_Block in the queue * without removing it. * + * @note Because the block whose pointer is returned is still on the queue, + * another thread may dequeue the referenced block at any time, + * including before the calling thread examines the peeked-at block. + * Be very careful with this method in multithreaded queueing + * situations. + * * @param first_item Reference to an ACE_Message_Block * that will * point to the first block on the queue. The block * remains on the queue until this or another thread @@ -141,9 +156,9 @@ public: * for a block to be queued. * * @retval >0 The number of ACE_Message_Blocks on the queue. - * @retval -1 On failure. errno holds the reason. If EWOULDBLOCK, - * the timeout elapsed. If ESHUTDOWN, the queue was - * deactivated or pulsed. + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int peek_dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout = 0); @@ -162,112 +177,161 @@ public: * * @retval >0 The number of ACE_Message_Blocks on the queue after adding * the specified block. - * @retval -1 On failure. errno holds the reason. If EWOULDBLOCK, - * the timeout elapsed. If ESHUTDOWN, the queue was - * deactivated or pulsed. + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int enqueue_prio (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); /** - * Enqueue an <ACE_Message_Block *> into the <Message_Queue> in - * accordance with its <msg_deadline_time>. FIFO - * order is maintained when messages of the same deadline time are - * inserted consecutively. Note that <timeout> uses <{absolute}> - * time rather than <{relative}> time. If the <timeout> elapses - * without receiving a message -1 is returned and <errno> is set to - * <EWOULDBLOCK>. If the queue is deactivated -1 is returned and - * <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, - * else the number of items still on the queue. + * Enqueue an ACE_Message_Block into the queue in accordance with the + * block's deadline time. FIFO order is maintained when messages of + * the same deadline time are inserted consecutively. + * + * @param new_item Pointer to an ACE_Message_Block that will be + * added to the queue. The block's @c msg_deadline_time() + * method will be called to obtain the relative queueing + * position. + * @param timeout The absolute time the caller will wait until + * for the block to be queued. + * + * @retval >0 The number of ACE_Message_Blocks on the queue after adding + * the specified block. + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int enqueue_deadline (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); /** - * This is an alias for <enqueue_prio>. It's only here for + * @deprecated This is an alias for enqueue_prio(). It's only here for * backwards compatibility and will go away in a subsequent release. - * Please use <enqueue_prio> instead. Note that <timeout> uses - * <{absolute}> time rather than <{relative}> time. + * Please use enqueue_prio() instead. */ virtual int enqueue (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); /** - * Enqueue an <ACE_Message_Block *> at the end of the queue. Note - * that <timeout> uses <{absolute}> time rather than <{relative}> - * time. If the <timeout> elapses without receiving a message -1 is - * returned and <errno> is set to <EWOULDBLOCK>. If the queue is - * deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. - * Otherwise, returns -1 on failure, else the number of items still - * on the queue. + * Enqueue one or more ACE_Message_Block objects at the tail of the queue. + * If the @a new_item @c next() pointer is non-zero, it is assumed to be the + * start of a series of ACE_Message_Block objects connected via their + * @c next() pointers. The series of blocks will be added to the queue in + * the same order they are passed in as. + * + * @param new_item Pointer to an ACE_Message_Block that will be + * added to the queue. If the block's @c next() pointer + * is non-zero, all blocks chained from the @c next() + * pointer are enqueued as well. + * @param timeout The absolute time the caller will wait until + * for the block to be queued. + * + * @retval >0 The number of ACE_Message_Blocks on the queue after adding + * the specified block(s). + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int enqueue_tail (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); /** - * Enqueue an <ACE_Message_Block *> at the head of the queue. Note - * that <timeout> uses <{absolute}> time rather than <{relative}> - * time. If the <timeout> elapses without receiving a message -1 is - * returned and <errno> is set to <EWOULDBLOCK>. If the queue is - * deactivated -1 is returned and <errno> is set to <ESHUTDOWN>. - * Otherwise, returns -1 on failure, else the number of items still - * on the queue. + * Enqueue one or more ACE_Message_Block objects at the head of the queue. + * If the @a new_item @c next() pointer is non-zero, it is assumed to be the + * start of a series of ACE_Message_Block objects connected via their + * @c next() pointers. The series of blocks will be added to the queue in + * the same order they are passed in as. + * + * @param new_item Pointer to an ACE_Message_Block that will be + * added to the queue. If the block's @c next() pointer + * is non-zero, all blocks chained from the @c next() + * pointer are enqueued as well. + * @param timeout The absolute time the caller will wait until + * for the block to be queued. + * + * @retval >0 The number of ACE_Message_Blocks on the queue after adding + * the specified block(s). + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int enqueue_head (ACE_Message_Block *new_item, ACE_Time_Value *timeout = 0); - /// This method is an alias for the following <dequeue_head> method. + /// This method is an alias for the dequeue_head() method. virtual int dequeue (ACE_Message_Block *&first_item, ACE_Time_Value *timeout = 0); /** - * Dequeue and return the <ACE_Message_Block *> at the head of the - * queue. Note that <timeout> uses <{absolute}> time rather than - * <{relative}> time. If the <timeout> elapses without receiving a - * message -1 is returned and <errno> is set to <EWOULDBLOCK>. If - * the queue is deactivated -1 is returned and <errno> is set to - * <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number - * of items still on the queue. + * Dequeue the ACE_Message_Block at the head of the queue and return + * a pointer to the dequeued block. + * + * @param first_item Reference to an ACE_Message_Block * that will + * be set to the address of the dequeued block. + * @param timeout The absolute time the caller will wait until + * for a block to be dequeued. + * + * @retval >=0 The number of ACE_Message_Blocks remaining in the queue. + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int dequeue_head (ACE_Message_Block *&first_item, ACE_Time_Value *timeout = 0); /** - * Dequeue and return earliest the <ACE_Message_Block *> that has - * the lowest priority (i.e., preserves FIFO order for messages with - * the same priority). Note that <timeout> uses <{absolute}> time - * rather than <{relative}> time. If the <timeout> elapses without - * receiving a message -1 is returned and <errno> is set to - * <EWOULDBLOCK>. If the queue is deactivated -1 is returned and - * <errno> is set to <ESHUTDOWN>. Otherwise, returns -1 on failure, - * else the number of items still on the queue. + * Dequeue the ACE_Message_Block that has the lowest priority (preserves + * FIFO order for messages with the same priority) and return a pointer + * to the dequeued block. + * + * @param first_item Reference to an ACE_Message_Block * that will + * be set to the address of the dequeued block. + * @param timeout The absolute time the caller will wait until + * for a block to be dequeued. + * + * @retval >=0 The number of ACE_Message_Blocks remaining in the queue. + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int dequeue_prio (ACE_Message_Block *&first_item, ACE_Time_Value *timeout = 0); /** - * Dequeue and return the <ACE_Message_Block *> at the tail of the - * queue. Note that <timeout> uses <{absolute}> time rather than - * <{relative}> time. If the <timeout> elapses without receiving a - * message -1 is returned and <errno> is set to <EWOULDBLOCK>. If - * the queue is deactivated -1 is returned and <errno> is set to - * <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number - * of items still on the queue. + * Dequeue the ACE_Message_Block at the tail of the queue and return + * a pointer to the dequeued block. + * + * @param dequeued Reference to an ACE_Message_Block * that will + * be set to the address of the dequeued block. + * @param timeout The absolute time the caller will wait until + * for a block to be dequeued. + * + * @retval >=0 The number of ACE_Message_Blocks remaining in the queue. + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int dequeue_tail (ACE_Message_Block *&dequeued, ACE_Time_Value *timeout = 0); /** - * Dequeue and return the <ACE_Message_Block *> with the lowest - * deadline time. Note that <timeout> uses <{absolute}> time rather than - * <{relative}> time. If the <timeout> elapses without receiving a - * message -1 is returned and <errno> is set to <EWOULDBLOCK>. If - * the queue is deactivated -1 is returned and <errno> is set to - * <ESHUTDOWN>. Otherwise, returns -1 on failure, else the number - * of items still on the queue. + * Dequeue the ACE_Message_Block with the earliest deadline time and return + * a pointer to the dequeued block. + * + * @param dequeued Reference to an ACE_Message_Block * that will + * be set to the address of the dequeued block. + * @param timeout The absolute time the caller will wait until + * for a block to be dequeued. + * + * @retval >=0 The number of ACE_Message_Blocks remaining in the queue. + * @retval -1 On failure. errno holds the reason. Common errno values are: + * - EWOULDBLOCK: the timeout elapsed + * - ESHUTDOWN: the queue was deactivated or pulsed */ virtual int dequeue_deadline (ACE_Message_Block *&dequeued, ACE_Time_Value *timeout = 0); + //@} // = Check if queue is full/empty. /// True if queue is full, else false. @@ -275,7 +339,10 @@ public: /// True if queue is empty, else false. virtual int is_empty (void); - // = Queue statistic methods. + /** @name Queue statistics methods + */ + //@{ + /** * Number of total bytes on the queue, i.e., sum of the message * block sizes. @@ -306,7 +373,12 @@ public: */ virtual void message_length (size_t new_length); - // = Flow control methods. + //@} + + + /** @name Water mark (flow control) methods + */ + //@{ /** * Get high watermark. @@ -325,11 +397,17 @@ public: /** * Set the low watermark, which determines how many bytes must be in * the queue before supplier threads are allowed to enqueue - * additional <ACE_Message_Block>s. + * additional ACE_Message_Blocks. */ virtual void low_water_mark (size_t lwm); + //@} - // = Activation control methods. + /** @name Activation and queue state methods + * See C++NPv2 Section 6.2 and APG Section 12.3 for a fuller treatment of + * queue states and transitions and how the transitions affect message + * enqueueing and dequeueing operations. + */ + //@{ /** * Deactivate the queue and wakeup all threads waiting on the queue @@ -363,8 +441,11 @@ public: /// Returns true if the state of the queue is <DEACTIVATED>, /// but false if the queue's is <ACTIVATED> or <PULSED>. virtual int deactivated (void); + //@} - // = Notification hook. + /** @name Notification strategy methods + */ + //@{ /** * This hook is automatically invoked by <enqueue_head>, @@ -383,8 +464,9 @@ public: /// Set the notification strategy for the <Message_Queue> virtual void notification_strategy (ACE_Notification_Strategy *s); + //@} - /// Returns a reference to the lock used by the <ACE_Message_Queue>. + /// Returns a reference to the lock used by the ACE_Message_Queue. virtual ACE_SYNCH_MUTEX_T &lock (void); /// Dump the state of an object. @@ -398,7 +480,7 @@ protected: // These routines assume that locks are held by the corresponding // public methods. Since they are virtual, you can change the - // queueing mechanism by subclassing from <ACE_Message_Queue>. + // queueing mechanism by subclassing from ACE_Message_Queue. /// Enqueue an <ACE_Message_Block *> in accordance with its priority. virtual int enqueue_i (ACE_Message_Block *new_item); @@ -494,7 +576,7 @@ protected: size_t cur_length_; /// Current number of messages in the queue. - int cur_count_; + size_t cur_count_; /// The notification strategy used when a new message is enqueued. ACE_Notification_Strategy *notification_strategy_; @@ -523,7 +605,7 @@ typedef ACE_Message_Queue<ACE_SYNCH> ACE_DEFAULT_MESSAGE_QUEUE_TYPE; /** * @class ACE_Message_Queue_Iterator * - * @brief Iterator for the <ACE_Message_Queue>. + * @brief Iterator for the ACE_Message_Queue. */ template <ACE_SYNCH_DECL> class ACE_Message_Queue_Iterator @@ -561,7 +643,7 @@ private: /** * @class ACE_Message_Queue_Reverse_Iterator * - * @brief Reverse Iterator for the <ACE_Message_Queue>. + * @brief Reverse Iterator for the ACE_Message_Queue. */ template <ACE_SYNCH_DECL> class ACE_Message_Queue_Reverse_Iterator @@ -599,7 +681,7 @@ private: /** * @class ACE_Dynamic_Message_Queue * - * @brief A derived class which adapts the <ACE_Message_Queue> + * @brief A derived class which adapts the ACE_Message_Queue * class in order to maintain dynamic priorities for enqueued * <ACE_Message_Blocks> and manage the queue order according * to these dynamic priorities. @@ -867,7 +949,7 @@ public: * queueing facilities in System V STREAMs. * * An <ACE_Message_Queue_Ex> is a strongly-typed version of the - * <ACE_Message_Queue>. If + * ACE_Message_Queue. If * <ACE_SYNCH_DECL> is <ACE_MT_SYNCH> then all operations are * thread-safe. Otherwise, if it's <ACE_NULL_SYNCH> then there's no * locking overhead. @@ -899,12 +981,12 @@ public: // = Initialization and termination methods. /** - * Initialize an <ACE_Message_Queue>. The <high_water_mark> + * Initialize an ACE_Message_Queue. The <high_water_mark> * determines how many bytes can be stored in a queue before it's * considered "full." Supplier threads must block until the queue * is no longer full. The <low_water_mark> determines how many * bytes must be in the queue before supplier threads are allowed to - * enqueue additional <ACE_Message_Block>s. By default, the + * enqueue additional ACE_Message_Blocks. By default, the * <high_water_mark> equals the <low_water_mark>, which means that * suppliers will be able to enqueue new messages as soon as a * consumer removes any message from the queue. Making the @@ -918,12 +1000,12 @@ public: ACE_Notification_Strategy * = 0); /** - * Initialize an <ACE_Message_Queue>. The <high_water_mark> + * Initialize an ACE_Message_Queue. The <high_water_mark> * determines how many bytes can be stored in a queue before it's * considered "full." Supplier threads must block until the queue * is no longer full. The <low_water_mark> determines how many * bytes must be in the queue before supplier threads are allowed to - * enqueue additional <ACE_Message_Block>s. By default, the + * enqueue additional ACE_Message_Blocks. By default, the * <high_water_mark> equals the <low_water_mark>, which means that * suppliers will be able to enqueue new messages as soon as a * consumer removes any message from the queue. Making the @@ -947,9 +1029,10 @@ public: /// messages flushed. virtual int flush (void); - /// Release all resources from the message queue but do not mark it as deactivated. - /// This method does not hold the queue lock during this operation, i.e., it assume - /// the lock is held externally. Returns the number of messages flushed. + /// Release all resources from the message queue but do not mark it as + /// deactivated. This method does not hold the queue lock during this + /// operation, i.e., it assume the lock is held externally. + /// Returns the number of messages flushed. virtual int flush_i (void); // = Enqueue and dequeue methods. @@ -1210,10 +1293,12 @@ public: ACE_ALLOC_HOOK_DECLARE; protected: - /// Implement this via an <ACE_Message_Queue>. + /// Implement this via an ACE_Message_Queue. ACE_Message_Queue<ACE_SYNCH_USE> queue_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Message_Queue_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Method_Object.h b/ace/Method_Object.h index eee59175ea5..ffabf82d454 100644 --- a/ace/Method_Object.h +++ b/ace/Method_Object.h @@ -26,9 +26,13 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Maintain backwards compatibility so that Steve Huston doesn't go // postal... ;-) typedef ACE_Method_Request ACE_Method_Object; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_METHOD_OBJECT_H */ diff --git a/ace/Method_Request.cpp b/ace/Method_Request.cpp index 3215e1042d2..283a087905f 100644 --- a/ace/Method_Request.cpp +++ b/ace/Method_Request.cpp @@ -4,6 +4,8 @@ ACE_RCSID (ace, Method_Request, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Method_Request::ACE_Method_Request (unsigned long prio) : priority_ (prio) { @@ -24,3 +26,5 @@ ACE_Method_Request::priority (unsigned long prio) { this->priority_ = prio; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Method_Request.h b/ace/Method_Request.h index ca048863079..e6b4564f91b 100644 --- a/ace/Method_Request.h +++ b/ace/Method_Request.h @@ -17,12 +17,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -30,6 +25,8 @@ #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Method_Request * @@ -45,7 +42,7 @@ * * @sa ACE_Activation_Queue */ -class ACE_Threads_Export ACE_Method_Request +class ACE_Export ACE_Method_Request { public: // = Initialization and termination methods. @@ -84,15 +81,20 @@ public: */ virtual int call (void) = 0; +private: + + /// Disallow copying and assignment. + ACE_Method_Request (const ACE_Method_Request &); + void operator= (const ACE_Method_Request &); + protected: /// The priority of the request. unsigned long priority_; -private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Method_Request &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Method_Request (const ACE_Method_Request &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_METHOD_REQUEST_H */ diff --git a/ace/Metrics_Cache.cpp b/ace/Metrics_Cache.cpp deleted file mode 100644 index f9a28c800f6..00000000000 --- a/ace/Metrics_Cache.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* - * $Id$ - */ - -//#define ACE_BUILD_DLL - -#include "ace/Metrics_Cache.h" - -ACE_RCSID(ace, Metrics_Cache, "Metrics_Cache.cpp,v 4.18 1998/07/11 08:53:56 gonzo Exp") - -#if defined (ACE_COMPILE_TIMEPROBES) - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_COMPILE_TIMEPROBES */ - diff --git a/ace/Metrics_Cache_T.cpp b/ace/Metrics_Cache_T.cpp index de520773da7..a3850eb2237 100644 --- a/ace/Metrics_Cache_T.cpp +++ b/ace/Metrics_Cache_T.cpp @@ -1,14 +1,19 @@ // $Id$ -#ifndef METRICS_CACHE_CPP -#define METRICS_CACHE_CPP +#ifndef ACE_METRICS_CACHE_CPP +#define ACE_METRICS_CACHE_CPP //#define ACE_BUILD_DLL +#include "ace/Metrics_Cache_T.h" + #if defined (ACE_COMPILE_TIMEPROBES) #include "ace/Metrics_Cache.h" -#include "ace/Metrics_Cache_T.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Metrics_Cache_T.inl" +#endif /* __ACE_INLINE__ */ // Const strings for timeprobe event type descriptions. @@ -20,6 +25,7 @@ static const char * event_description_strings [] = "resume" }; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ///////////////////////////////// // class ACE_Metrics_Timeprobe // @@ -39,7 +45,7 @@ ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::ACE_Metrics_Timeprobe (u_int id, name = ""; } - char * name_tmp; + char * name_tmp = 0; ACE_NEW_MALLOC_ARRAY (name_tmp, (char *) this->allocator ()->malloc (strlen(name)+1), char, @@ -58,8 +64,8 @@ ACE_Metrics_Timeprobe (ALLOCATOR *alloc, const char *name, u_long size) : - ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR> (size), - id_ (id), + ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR> (size), + id_ (id), name_ (0) { if (name == 0) @@ -67,9 +73,8 @@ ACE_Metrics_Timeprobe (ALLOCATOR *alloc, name = ""; } - char * name_tmp; + char * name_tmp = 0; ACE_NEW_MALLOC_ARRAY (name_tmp, -// (char *) this->allocator ()->malloc (strlen(name)+1), (char *) alloc->malloc(strlen(name)+1), char, strlen(name)+1); @@ -95,11 +100,11 @@ ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::~ACE_Metrics_Timeprobe () template <class ACE_LOCK, class ALLOCATOR> int ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::is_event (const ACE_Metrics_Timeprobe<ACE_LOCK, - ALLOCATOR>:: - ACE_METRICS_TIMEPROBE_DATA_TYPE &t, + ALLOCATOR>:: + ACE_METRICS_TIMEPROBE_DATA_TYPE &t, ACE_Metrics_Timeprobe<ACE_LOCK, - ALLOCATOR>:: - event_id id) + ALLOCATOR>:: + event_id id) { return (t.event_.event_number_ == (u_long) id) ? 1 : 0; } @@ -115,7 +120,7 @@ template <class ACE_LOCK, class ALLOCATOR> void ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::probe_name (char * name) { - char * name_tmp; + char * name_tmp = 0; ACE_NEW_MALLOC_ARRAY (name_tmp, (char *) this->allocator ()->malloc (strlen(name)+1), char, @@ -226,16 +231,8 @@ flush_ACE_Metrics_Cache () { } - -#if !defined (__ACE_INLINE__) -#include "ace/Metrics_Cache_T.inl" -#endif /* __ACE_INLINE__ */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* defined (ACE_COMPILE_TIMEPROBES) */ -#endif /* METRICS_CACHE_CPP */ - - - - - +#endif /* ACE_METRICS_CACHE_CPP */ diff --git a/ace/Metrics_Cache_T.h b/ace/Metrics_Cache_T.h index d101ae734b8..8d6c44acd13 100644 --- a/ace/Metrics_Cache_T.h +++ b/ace/Metrics_Cache_T.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + //============================================================================= /** * @file Metrics_Cache_T.h @@ -9,8 +11,8 @@ //============================================================================= -#ifndef METRICS_CACHE_T_H -#define METRICS_CACHE_T_H +#ifndef ACE_METRICS_CACHE_T_H +#define ACE_METRICS_CACHE_T_H #include "ace/config-all.h" @@ -30,6 +32,8 @@ #define METRICS_DEFAULT_TIMEPROBE_TABLE_SIZE METRICS_MIN_TIMEPROBE_TABLE_SIZE #define METRICS_DEFAULT_TIMEPROBE_COUNT 6 +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Metrics_Timeprobe * @@ -220,6 +224,8 @@ private: void operator = (const ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR> &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Metrics_Cache_T.inl" #endif /* __ACE_INLINE__ */ @@ -234,4 +240,4 @@ private: #endif /* defined (ACE_COMPILE_TIMEPROBES) */ -#endif /* METRICS_CACHE_T_H */ +#endif /* ACE_METRICS_CACHE_T_H */ diff --git a/ace/Metrics_Cache_T.inl b/ace/Metrics_Cache_T.inl index 6d48c917059..e0f542ab366 100644 --- a/ace/Metrics_Cache_T.inl +++ b/ace/Metrics_Cache_T.inl @@ -1,7 +1,11 @@ +// -*- C++ -*- +// // $Id$ -\ -#ifndef METRICS_CACHE_T_I -#define METRICS_CACHE_T_I + +#ifndef ACE_METRICS_CACHE_T_INL +#define ACE_METRICS_CACHE_T_INL + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ///////////////////////////// // Class ACE_Metrics_Cache // @@ -14,8 +18,8 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_start (u_long i) { if (i < this->probe_set_size_) { - u_long & count = - this->enqueue_count_ [this->supplier_index_] [i]; + u_long & count = + this->enqueue_count_ [this->supplier_index_] [i]; ++count; if (! this->interval_initialized_) @@ -23,15 +27,15 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_start (u_long i) this->interval_initialized_ = 1; ACE_hrtime_t hrtime_now = ACE_OS::gethrtime (); ACE_High_Res_Timer::hrtime_to_tv (this->interval_start_, - hrtime_now); + hrtime_now); this->interval_end_.set (this->interval_start_.sec(), this->interval_start_.usec()); } - + // Take the metrics timeprobe last, to avoid measuring the above // metrics processing. ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe = - this->enqueue_probes_ [this->supplier_index_][i]; + this->enqueue_probes_ [this->supplier_index_][i]; probe-> timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_START); } @@ -47,13 +51,13 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_stop (u_long i) // Take the metrics timeprobe first, to avoid measuring the below // metrics processing. ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe = - this->enqueue_probes_ [this->supplier_index_][i]; + this->enqueue_probes_ [this->supplier_index_][i]; probe-> timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_STOP); ACE_hrtime_t hrtime_now = ACE_OS::gethrtime (); ACE_High_Res_Timer::hrtime_to_tv (this->interval_end_, - hrtime_now); + hrtime_now); u_long & count = enqueue_count_ [this->supplier_index_][i]; ++count; @@ -71,8 +75,8 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_suspend (u_long i) ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe = this->enqueue_probes_ [this->supplier_index_][i]; probe-> - timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_SUSPEND); - u_long & count = + timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_SUSPEND); + u_long & count = this->enqueue_count_ [this->supplier_index_] [i]; ++count; } @@ -85,11 +89,11 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_enqueue_resume (u_long i) { if (i < this->probe_set_size_) { - u_long & count = - this->enqueue_count_ [this->supplier_index_] [i]; + u_long & count = + this->enqueue_count_ [this->supplier_index_] [i]; ++count; ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe = - this->enqueue_probes_ [this->supplier_index_][i]; + this->enqueue_probes_ [this->supplier_index_][i]; probe-> timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_RESUME); } @@ -103,7 +107,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_start (u_long i) if (i < this->probe_set_size_) { u_long & count = - this->dequeue_count_ [this->supplier_index_] [i]; + this->dequeue_count_ [this->supplier_index_] [i]; ++count; if (! this->interval_initialized_) @@ -111,7 +115,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_start (u_long i) this->interval_initialized_ = 1; ACE_hrtime_t hrtime_now = ACE_OS::gethrtime (); ACE_High_Res_Timer::hrtime_to_tv (this->interval_start_, - hrtime_now); + hrtime_now); this->interval_end_.set (this->interval_start_.sec(), this->interval_start_.usec()); } @@ -136,12 +140,12 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_stop (u_long i) // metrics processing below. ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe = this->dequeue_probes_ [this->supplier_index_][i]; - + probe->timeprobe (ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR>::WORK_STOP); ACE_hrtime_t hrtime_now = ACE_OS::gethrtime (); ACE_High_Res_Timer::hrtime_to_tv (this->interval_end_, - hrtime_now); + hrtime_now); u_long & count = dequeue_count_ [this->supplier_index_] [i]; ++count; @@ -156,7 +160,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_suspend (u_long i) if (i < this->probe_set_size_) { u_long & count = - this->dequeue_count_ [this->supplier_index_] [i]; + this->dequeue_count_ [this->supplier_index_] [i]; ++count; ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe = this->dequeue_probes_ [this->supplier_index_][i]; @@ -172,8 +176,8 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_resume (u_long i) { if (i < this->probe_set_size_) { - u_long & count = - this->dequeue_count_ [this->supplier_index_] [i]; + u_long & count = + this->dequeue_count_ [this->supplier_index_] [i]; ++count; ACE_Metrics_Timeprobe<ACE_LOCK, ALLOCATOR> * probe = this->dequeue_probes_ [this->supplier_index_][i]; @@ -184,7 +188,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::report_dequeue_resume (u_long i) template <class ACE_LOCK, class ALLOCATOR> -ACE_INLINE void +ACE_INLINE void ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::reset_base_statistics () { this->interval_initialized_ = 0; @@ -200,7 +204,7 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::reset_base_statistics () this->enqueue_probes_ [this->consumer_index_][i]; probe->reset (); probe = - this->dequeue_probes_ [this->consumer_index_][i]; + this->dequeue_probes_ [this->consumer_index_][i]; probe->reset (); } } @@ -218,17 +222,19 @@ ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::flip_supplier_and_consumer () } template <class ACE_LOCK, class ALLOCATOR> -ACE_INLINE void +ACE_INLINE void ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::metrics_enabled(int enabled) { metrics_enabled_ = enabled; } template <class ACE_LOCK, class ALLOCATOR> -ACE_INLINE int +ACE_INLINE int ACE_Metrics_Cache<ACE_LOCK, ALLOCATOR>::metrics_enabled(void) const { return metrics_enabled_; } -#endif /* METRICS_CACHE_T_I */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_METRICS_CACHE_T_INL */ diff --git a/ace/Min_Max.h b/ace/Min_Max.h index e961b510ee8..7bff181088e 100644 --- a/ace/Min_Max.h +++ b/ace/Min_Max.h @@ -24,6 +24,9 @@ # endif /* ACE_LACKS_PRAGMA_ONCE */ # if !defined (ACE_LACKS_MIN_MAX_TEMPLATES) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> inline const T & ace_min (const T &t1, const T &t2) @@ -58,6 +61,9 @@ ace_range (const T &min, const T &max, const T &val) { return ace_min (ace_max (min, val), max); } + +ACE_END_VERSIONED_NAMESPACE_DECL + # else // These macros should only be used if a C++ compiler can't grok the // inline templates diff --git a/ace/Module.cpp b/ace/Module.cpp index ef101352e0b..20e5638e367 100644 --- a/ace/Module.cpp +++ b/ace/Module.cpp @@ -1,8 +1,7 @@ -// Module.cpp // $Id$ -#ifndef ACE_MODULE_C -#define ACE_MODULE_C +#ifndef ACE_MODULE_CPP +#define ACE_MODULE_CPP #include "ace/Module.h" @@ -16,7 +15,7 @@ #include "ace/Module.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Module, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Module) @@ -268,4 +267,7 @@ ACE_Module<ACE_SYNCH_USE>::close_i (int which, return result; } -#endif /* ACE_MODULE_C */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_MODULE_CPP */ diff --git a/ace/Module.h b/ace/Module.h index a3e6f4126b8..c7a99de92f1 100644 --- a/ace/Module.h +++ b/ace/Module.h @@ -1,4 +1,5 @@ // -*- C++ -*- + //========================================================================== /** * @file Module.h @@ -23,6 +24,8 @@ #include "ace/Task_T.h" #include "ace/os_include/os_dirent.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Module_Base * @@ -72,14 +75,12 @@ template <ACE_SYNCH_DECL> class ACE_Module : public ACE_Module_Base { public: - friend class ACE_Shutup_GPlusPlus; // Turn off g++ warning - // = Initialization and termination methods. /// Create an empty Module. ACE_Module (void); /// Shutdown the Module. - ~ACE_Module (void); + virtual ~ACE_Module (void); /// Create an initialized module with @a module_name as its identity /// and @a reader and @a writer as its tasks. @@ -116,7 +117,7 @@ public: ACE_Task<ACE_SYNCH_USE> *writer (void); /** - * Set the writer task. <flags> can be used to indicate that the + * Set the writer task. @a flags can be used to indicate that the * module should delete the writer during a call to close or to the * destructor. If a previous writer exists, it is closed. It may * also be deleted, depending on the old flags_ value. Should not @@ -128,7 +129,7 @@ public: ACE_Task<ACE_SYNCH_USE> *reader (void); /** - * Set the reader task. <flags> can be used to indicate that the + * Set the reader task. @a flags can be used to indicate that the * module should delete the reader during a call to close or to the * destructor. If a previous reader exists, it is closed. It may * also be deleted, depending on the old flags_ value. Should not @@ -192,6 +193,8 @@ private: int flags_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Module.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Module.inl b/ace/Module.inl index ba93e8e5df7..483d436aa69 100644 --- a/ace/Module.inl +++ b/ace/Module.inl @@ -1,9 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Module.i #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <ACE_SYNCH_DECL> ACE_INLINE void * ACE_Module<ACE_SYNCH_USE>::arg (void) const { @@ -34,7 +36,7 @@ ACE_Module<ACE_SYNCH_USE>::name (const ACE_TCHAR *n) template <ACE_SYNCH_DECL> ACE_INLINE ACE_Task<ACE_SYNCH_USE> * ACE_Module<ACE_SYNCH_USE>::writer (void) -{ +{ ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::writer"); return this->q_pair_[1]; } @@ -54,10 +56,10 @@ ACE_Module<ACE_SYNCH_USE>::next (void) } template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Module<ACE_SYNCH_USE>::next (ACE_Module<ACE_SYNCH_USE> *m) +ACE_Module<ACE_SYNCH_USE>::next (ACE_Module<ACE_SYNCH_USE> *m) { ACE_TRACE ("ACE_Module<ACE_SYNCH_USE>::next"); this->next_ = m; } - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Msg_WFMO_Reactor.cpp b/ace/Msg_WFMO_Reactor.cpp index dfe86740efc..aaedb391b51 100644 --- a/ace/Msg_WFMO_Reactor.cpp +++ b/ace/Msg_WFMO_Reactor.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, Msg_WFMO_Reactor, "$Id$") #include "ace/Msg_WFMO_Reactor.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Msg_WFMO_Reactor::ACE_Msg_WFMO_Reactor (ACE_Sig_Handler *sh, ACE_Timer_Queue *tq) : ACE_WFMO_Reactor (sh, tq) @@ -71,7 +73,7 @@ ACE_Msg_WFMO_Reactor::dispatch_window_messages (void) } ::DispatchMessage (&msg); - number_of_messages++; + ++number_of_messages; } return number_of_messages; @@ -87,4 +89,6 @@ ACE_Msg_WFMO_Reactor::poll_remaining_handles (DWORD slot) QS_ALLINPUT); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */ diff --git a/ace/Msg_WFMO_Reactor.h b/ace/Msg_WFMO_Reactor.h index af6c2bad214..d86258bb690 100644 --- a/ace/Msg_WFMO_Reactor.h +++ b/ace/Msg_WFMO_Reactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -16,12 +16,7 @@ #define ACE_MSG_WFMO_REACTOR_H #include /**/ "ace/pre.h" -#ifdef ACE_REACTOR_BUILD_DLL -# include "ace/ACE_Reactor_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Reactor_Export ACE_Export -#endif /* ACE_REACTOR_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -31,6 +26,8 @@ #include "ace/WFMO_Reactor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Msg_WFMO_Reactor * @@ -42,7 +39,7 @@ * its ability to react on Windows messages. It is needed when * the task should serve also as a COM/DCOM server. */ -class ACE_Reactor_Export ACE_Msg_WFMO_Reactor : public ACE_WFMO_Reactor +class ACE_Export ACE_Msg_WFMO_Reactor : public ACE_WFMO_Reactor { public: // = Initialization and termination methods. @@ -79,7 +76,7 @@ public: * * <MsgWaitForMultipleObjects> is used as the demultiplexing call * - * Returns the total number of <ACE_Event_Handler>s that were + * Returns the total number of ACE_Event_Handlers that were * dispatched, 0 if the <max_wait_time> elapsed without dispatching * any handlers, or -1 if an error occurs. * @@ -111,11 +108,13 @@ protected: virtual int dispatch_window_messages (void); }; -#endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */ +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Msg_WFMO_Reactor.inl" #endif /* __ACE_INLINE__ */ +#endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */ + #include /**/ "ace/post.h" #endif /* ACE_MSG_WFMO_REACTOR_H */ diff --git a/ace/Msg_WFMO_Reactor.inl b/ace/Msg_WFMO_Reactor.inl index c8d7f25c8d7..be021dc58a5 100644 --- a/ace/Msg_WFMO_Reactor.inl +++ b/ace/Msg_WFMO_Reactor.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #if defined (ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Msg_WFMO_Reactor::handle_events (ACE_Time_Value &how_long) { @@ -27,4 +30,6 @@ ACE_Msg_WFMO_Reactor::alertable_handle_events (ACE_Time_Value *how_long) return this->event_handling (how_long, MWMO_ALERTABLE); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */ diff --git a/ace/Multihomed_INET_Addr.cpp b/ace/Multihomed_INET_Addr.cpp index 15d985c3265..a24f98957e3 100644 --- a/ace/Multihomed_INET_Addr.cpp +++ b/ace/Multihomed_INET_Addr.cpp @@ -13,6 +13,8 @@ ACE_RCSID (ace, Multihomed_INET_Addr, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Multihomed_INET_Addr) // Default constructor @@ -115,9 +117,9 @@ ACE_Multihomed_INET_Addr::ACE_Multihomed_INET_Addr(u_short port_number, size_t next_empty_slot = 0; for (size_t i = 0; i < size; ++i) { - int ret = this->secondaries_[next_empty_slot].set(port_number, - secondary_ip_addrs[i], - encode); + int const ret = this->secondaries_[next_empty_slot].set(port_number, + secondary_ip_addrs[i], + encode); if (ret) { ACE_DEBUG ((LM_DEBUG, @@ -146,10 +148,10 @@ ACE_Multihomed_INET_Addr::set (u_short port_number, for (size_t i = 0; i < size; ++i) { - int ret = this->secondaries_[i].set(port_number, - secondary_host_names[i], - encode, - address_family); + int const ret = this->secondaries_[i].set(port_number, + secondary_host_names[i], + encode, + address_family); if (ret) { return ret; } @@ -291,12 +293,4 @@ ACE_Multihomed_INET_Addr::~ACE_Multihomed_INET_Addr (void) } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Array_Base<ACE_INET_Addr>; -template class ACE_Array<ACE_INET_Addr>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Array_Base<ACE_INET_Addr> -#pragma instantiate ACE_Array<ACE_INET_Addr> - -#endif /*ACE_HAS_TEMPLATE_INSTANTIATION*/ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Multihomed_INET_Addr.h b/ace/Multihomed_INET_Addr.h index 6ff13a74c00..75799cf0077 100644 --- a/ace/Multihomed_INET_Addr.h +++ b/ace/Multihomed_INET_Addr.h @@ -15,12 +15,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -29,6 +24,7 @@ #include "ace/INET_Addr.h" #include "ace/Containers_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Multihomed_INET_Addr @@ -36,7 +32,7 @@ * @brief Extends ACE_INET_Addr with support for multi-homed * addresses. */ -class ACE_Sockets_Export ACE_Multihomed_INET_Addr : public ACE_INET_Addr +class ACE_Export ACE_Multihomed_INET_Addr : public ACE_INET_Addr { public: // = Initialization methods. @@ -188,6 +184,8 @@ private: ACE_Array<ACE_INET_Addr> secondaries_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/Multihomed_INET_Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Multihomed_INET_Addr.inl b/ace/Multihomed_INET_Addr.inl index 71ec578a177..50f67c01191 100644 --- a/ace/Multihomed_INET_Addr.inl +++ b/ace/Multihomed_INET_Addr.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Accessor implementations ACE_INLINE size_t @@ -8,3 +11,5 @@ ACE_Multihomed_INET_Addr::get_num_secondary_addresses() const { return this->secondaries_.size(); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Multiplexor.h b/ace/Multiplexor.h index 12336afaac9..6afb5a653c5 100644 --- a/ace/Multiplexor.h +++ b/ace/Multiplexor.h @@ -10,7 +10,6 @@ * Note that these classes have never been implemented due to lack * of need. * - * * @author Doug Schmidt */ //============================================================================= @@ -20,17 +19,21 @@ #define ACE_MULTIPLEXOR_H #include /**/ "ace/pre.h" -#include "ace/Module.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Map_Manager.h" - #if defined (ACE_HAS_THREADS) #if 0 + +#include "ace/Module.h" +#include "ace/Map_Manager.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Driver * @@ -70,6 +73,8 @@ public: virtual int unlink_from_below (ACE_Module *mod); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Multiplexor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Multiplexor.inl b/ace/Multiplexor.inl index 18e022ac911..76e9d267006 100644 --- a/ace/Multiplexor.inl +++ b/ace/Multiplexor.inl @@ -1,9 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Multiplexor.i #if 0 +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int Driver::link_from_below (ACE_Module *stream_head) { @@ -88,4 +90,6 @@ ACE_Multiplexor::unlink_from_below (ACE_Module *) return -1; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* 0 */ diff --git a/ace/Mutex.cpp b/ace/Mutex.cpp index a427703eca5..83261c5d39d 100644 --- a/ace/Mutex.cpp +++ b/ace/Mutex.cpp @@ -15,6 +15,7 @@ ACE_RCSID (ace, Mutex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Mutex) @@ -120,3 +121,5 @@ ACE_Mutex::~ACE_Mutex (void) // ACE_TRACE ("ACE_Mutex::~ACE_Mutex"); this->remove (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Mutex.h b/ace/Mutex.h index bcd62c12b63..61d4db02491 100644 --- a/ace/Mutex.h +++ b/ace/Mutex.h @@ -32,6 +32,8 @@ # define ACE_DEFAULT_MUTEX_W ACE_TEXT_WIDE(ACE_DEFAULT_MUTEX_A) # define ACE_DEFAULT_MUTEX ACE_LIB_TEXT (ACE_DEFAULT_MUTEX_A) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -174,6 +176,8 @@ private: ACE_Mutex (const ACE_Mutex &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Mutex.inl b/ace/Mutex.inl index a038aa6d9be..26fb51a0c50 100644 --- a/ace/Mutex.inl +++ b/ace/Mutex.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_sys_mman.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Mutex::acquire_read (void) { @@ -168,3 +171,5 @@ ACE_Mutex::remove (void) #endif /* CHORUS || ACE_HAS_PTHREADS || ACE_HAS_STHREADS */ return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/NT_Service.cpp b/ace/NT_Service.cpp index 7a60f27fdaf..0a1e249cb4f 100644 --- a/ace/NT_Service.cpp +++ b/ace/NT_Service.cpp @@ -14,6 +14,8 @@ #include "ace/Service_Object.h" #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_NT_Service) // ACE_NT_Service destructor. @@ -611,4 +613,6 @@ ACE_NT_Service::wait_for_service_state (DWORD desired_state, return; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 && !ACE_HAS_PHARLAP */ diff --git a/ace/NT_Service.h b/ace/NT_Service.h index e7be7c68047..99fc0f1f2ec 100644 --- a/ace/NT_Service.h +++ b/ace/NT_Service.h @@ -38,6 +38,8 @@ #define ACE_NT_SERVICE_START_TIMEOUT 5000 #endif /* ACE_NT_SERVICE_TIMEOUT */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_NT_Service * @@ -367,6 +369,8 @@ protected: ACE_OS_Log_Msg_Attributes log_msg_attributes_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + // These macros help to get things set up correctly at compile time // and to take most of the grudge work out of creating the proper // functions and doing the registrations. diff --git a/ace/NT_Service.inl b/ace/NT_Service.inl index a1a9e9469b8..bd9b7ea5b63 100644 --- a/ace/NT_Service.inl +++ b/ace/NT_Service.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_NT_Service::ACE_NT_Service (DWORD start_timeout, DWORD service_type, @@ -78,3 +81,5 @@ ACE_NT_Service::svc_handle(const SERVICE_STATUS_HANDLE new_svc_handle) this->svc_handle_ = new_svc_handle; return; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Name_Proxy.cpp b/ace/Name_Proxy.cpp index 5a3e61cbb16..82d0bd27eca 100644 --- a/ace/Name_Proxy.cpp +++ b/ace/Name_Proxy.cpp @@ -1,4 +1,3 @@ -// Name_Proxy.cpp // $Id$ #include "ace/Name_Proxy.h" @@ -7,6 +6,8 @@ ACE_RCSID(ace, Name_Proxy, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Name_Proxy::dump (void) const { @@ -33,7 +34,7 @@ ACE_Name_Proxy::ACE_Name_Proxy (void) int ACE_Name_Proxy::open (const ACE_INET_Addr &remote_addr, - ACE_Synch_Options& options) + ACE_Synch_Options& options) { ACE_TRACE ("ACE_Name_Proxy::open"); ACE_Time_Value *timeout = 0; @@ -154,7 +155,7 @@ ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply) default: ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p got %d bytes, expected %d bytes\n"), - ACE_LIB_TEXT ("recv failed"), + ACE_LIB_TEXT ("recv failed"), n, sizeof (ACE_UINT32))); // FALLTHROUGH @@ -171,14 +172,14 @@ ACE_Name_Proxy::recv_reply (ACE_Name_Request &reply) // @@ beware of blocking read!!!. n = this->peer_.recv ((void *) (((char *) &reply) + sizeof (ACE_UINT32)), - length - sizeof (ACE_UINT32)); + length - sizeof (ACE_UINT32)); // Subtract off the size of the part we skipped over... if (n != ssize_t (length - sizeof (ACE_UINT32))) { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p expected %d, got %d\n"), - ACE_LIB_TEXT ("invalid length"), + ACE_LIB_TEXT ("invalid length"), length, n)); return -1; @@ -204,3 +205,5 @@ ACE_Name_Proxy::~ACE_Name_Proxy (void) ACE_TRACE ("ACE_Name_Proxy::~ACE_Name_Proxy"); this->peer_.close (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Name_Proxy.h b/ace/Name_Proxy.h index 594df3c3c2a..16411b17334 100644 --- a/ace/Name_Proxy.h +++ b/ace/Name_Proxy.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -34,6 +34,8 @@ #include "ace/Name_Request_Reply.h" #include "ace/Event_Handler.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Name_Proxy * @@ -93,5 +95,7 @@ private: ACE_Name_Proxy &operator= (const ACE_Name_Proxy &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_NAME_PROXY_H */ diff --git a/ace/Name_Request_Reply.cpp b/ace/Name_Request_Reply.cpp index a9f4ecd3e3c..7cee855d644 100644 --- a/ace/Name_Request_Reply.cpp +++ b/ace/Name_Request_Reply.cpp @@ -8,6 +8,7 @@ ACE_RCSID (ace, Name_Request_Reply, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Default "do nothing" constructor. @@ -563,3 +564,5 @@ ACE_Name_Reply::dump (void) const } #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Name_Request_Reply.h b/ace/Name_Request_Reply.h index f5704b7472b..cb9173cd7bc 100644 --- a/ace/Name_Request_Reply.h +++ b/ace/Name_Request_Reply.h @@ -27,6 +27,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -256,6 +258,8 @@ private: Transfer transfer_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_NAME_REQUEST_REPLY_H */ diff --git a/ace/Name_Space.cpp b/ace/Name_Space.cpp index b3939f4095e..2f15a9e71d3 100644 --- a/ace/Name_Space.cpp +++ b/ace/Name_Space.cpp @@ -7,8 +7,12 @@ ACE_RCSID(ace, Name_Space, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Name_Binding::ACE_Name_Binding (void) - : type_ (ACE_OS::strdup ("")) + : name_ (), + value_ (), + type_ (ACE_OS::strdup ("")) { ACE_TRACE ("ACE_Name_Binding::ACE_Name_Binding"); } @@ -65,3 +69,5 @@ ACE_Name_Space::~ACE_Name_Space (void) { ACE_TRACE ("ACE_Name_Space::~ACE_Name_Space"); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Name_Space.h b/ace/Name_Space.h index aedaf801276..18bda096326 100644 --- a/ace/Name_Space.h +++ b/ace/Name_Space.h @@ -25,6 +25,8 @@ #include "ace/SString.h" #include "ace/Unbounded_Set.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + typedef ACE_Unbounded_Set<ACE_NS_WString> ACE_WSTRING_SET; /** @@ -157,6 +159,8 @@ public: virtual void dump (void) const = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_NAME_SPACE_H */ diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index a6c5df58573..b7ad702ac54 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -5,7 +5,7 @@ #include "ace/Remote_Name_Space.h" #include "ace/Local_Name_Space_T.h" #include "ace/Registry_Name_Space.h" -#include "ace/Memory_Pool.h" +#include "ace/MMAP_Memory_Pool.h" #include "ace/RW_Process_Mutex.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" @@ -16,25 +16,13 @@ ACE_RCSID(ace, Naming_Context, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Make life easier later on... typedef ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> LOCAL_NAME_SPACE; typedef ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> LITE_LOCAL_NAME_SPACE; -// The following Factory is used by the ACE_Service_Config and -// svc.conf file to dynamically initialize the state of the Name -// Server client. - -ACE_FACTORY_DEFINE (ACE, ACE_Naming_Context) -ACE_STATIC_SVC_DEFINE (ACE_Naming_Context, - ACE_LIB_TEXT ("ACE_Naming_Context"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (ACE_Naming_Context), - ACE_Service_Type::DELETE_THIS | - ACE_Service_Type::DELETE_OBJ, - 0) -ACE_STATIC_SVC_REQUIRE (ACE_Naming_Context) - // The ACE_Naming_Context static service object is now defined // by the ACE_Object_Manager, in Object_Manager.cpp. @@ -680,26 +668,18 @@ ACE_Name_Options::parse_args (int argc, ACE_TCHAR *argv[]) } } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; -template class ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; -template class ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; -template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex>; -template class ACE_Malloc_T<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>; -template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block>; -template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >; -template class ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> >; -template class ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > >; -template class ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > >; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Local_Name_Space <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> -#pragma instantiate ACE_Local_Name_Space <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> -#pragma instantiate ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> -#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> -#pragma instantiate ACE_Malloc_T<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block> -#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex, ACE_Control_Block> -#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > -#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > -#pragma instantiate ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > > -#pragma instantiate ACE_Name_Space_Map <ACE_Allocator_Adapter <ACE_Malloc <ACE_LITE_MMAP_MEMORY_POOL, ACE_RW_Process_Mutex> > > -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL + +// The following Factory is used by the ACE_Service_Config and +// svc.conf file to dynamically initialize the state of the Name +// Server client. + +ACE_FACTORY_DEFINE (ACE, ACE_Naming_Context) +ACE_STATIC_SVC_DEFINE (ACE_Naming_Context, + ACE_LIB_TEXT ("ACE_Naming_Context"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (ACE_Naming_Context), + ACE_Service_Type::DELETE_THIS | + ACE_Service_Type::DELETE_OBJ, + 0) +ACE_STATIC_SVC_REQUIRE (ACE_Naming_Context) diff --git a/ace/Naming_Context.h b/ace/Naming_Context.h index e66783f48ca..7bef675b23f 100644 --- a/ace/Naming_Context.h +++ b/ace/Naming_Context.h @@ -26,6 +26,8 @@ #include "ace/Name_Space.h" #include "ace/os_include/os_netdb.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl class ACE_Name_Options; class ACE_Static_Svc_Descriptor; @@ -372,6 +374,8 @@ private: ACE_Naming_Context::Context_Scope_Type context_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + ACE_FACTORY_DECLARE (ACE, ACE_Naming_Context) ACE_STATIC_SVC_DECLARE_EXPORT (ACE, ACE_Naming_Context) diff --git a/ace/Node.cpp b/ace/Node.cpp index 91e989d739b..8976a9c379e 100644 --- a/ace/Node.cpp +++ b/ace/Node.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_NODE_C -#define ACE_NODE_C +#ifndef ACE_NODE_CPP +#define ACE_NODE_CPP #include "ace/Node.h" @@ -9,7 +9,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Node, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Node) @@ -43,4 +43,6 @@ ACE_Node<T>::ACE_Node (const ACE_Node<T> &s) // ACE_TRACE ("ACE_Node<T>::ACE_Node"); } -#endif /* ACE_NODE_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_NODE_CPP */ diff --git a/ace/Node.h b/ace/Node.h index 607d0b6f137..6ec514d8141 100644 --- a/ace/Node.h +++ b/ace/Node.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. template <class T> class ACE_Unbounded_Set; template <class T> class ACE_Unbounded_Set_Iterator; @@ -59,7 +61,11 @@ private: ACE_Node (const T &i, ACE_Node<T> *n); ACE_Node (ACE_Node<T> *n = 0, int = 0); ACE_Node (const ACE_Node<T> &n); +private: + /// Not possible + void operator= (const ACE_Node<T> &); +private: /// Pointer to next element in the list of <ACE_Node>s. ACE_Node<T> *next_; @@ -67,6 +73,8 @@ private: T item_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Node.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Notification_Strategy.cpp b/ace/Notification_Strategy.cpp index 77d5dc235b0..f12bf3a569e 100644 --- a/ace/Notification_Strategy.cpp +++ b/ace/Notification_Strategy.cpp @@ -6,6 +6,8 @@ ACE_RCSID(ace, Strategies, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Notification_Strategy::ACE_Notification_Strategy (ACE_Event_Handler *eh, ACE_Reactor_Mask mask) : eh_ (eh), @@ -16,3 +18,5 @@ ACE_Notification_Strategy::ACE_Notification_Strategy (ACE_Event_Handler *eh, ACE_Notification_Strategy::~ACE_Notification_Strategy (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Notification_Strategy.h b/ace/Notification_Strategy.h index 07e1a179563..751868152b4 100644 --- a/ace/Notification_Strategy.h +++ b/ace/Notification_Strategy.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file Notification_Strategy.h @@ -18,6 +19,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decls. class ACE_Reactor; @@ -64,6 +67,7 @@ protected: ACE_Reactor_Mask mask_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Notification_Strategy.inl" diff --git a/ace/Notification_Strategy.inl b/ace/Notification_Strategy.inl index fac4b0cd3b6..47479030ab6 100644 --- a/ace/Notification_Strategy.inl +++ b/ace/Notification_Strategy.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// //$Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Event_Handler * ACE_Notification_Strategy::event_handler (void) { @@ -24,3 +27,5 @@ ACE_Notification_Strategy::mask (ACE_Reactor_Mask m) { this->mask_ = m; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Null_Barrier.h b/ace/Null_Barrier.h index 0c5f5609972..9b3bc16912a 100644 --- a/ace/Null_Barrier.h +++ b/ace/Null_Barrier.h @@ -16,6 +16,8 @@ #define ACE_NULL_BARRIER_H #include /**/ "ace/pre.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // All methods in this class are inline, so there is no // need to import or export on Windows. -- CAE 12/18/2003 @@ -51,5 +53,7 @@ private: ACE_Null_Barrier (const ACE_Null_Barrier &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_NULL_BARRIER_H */ diff --git a/ace/Null_Condition.h b/ace/Null_Condition.h index eb1fa10e436..a72df210a51 100644 --- a/ace/Null_Condition.h +++ b/ace/Null_Condition.h @@ -26,12 +26,14 @@ #include "ace/os_include/os_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** * @class ACE_Null_Condition * - * @brief Implement a do nothing <ACE_Condition> variable wrapper, + * @brief Implement a do nothing ACE_Condition variable wrapper, * i.e., all methods are no ops. This class is necessary since * some C++ compilers are *very* lame... */ @@ -77,5 +79,7 @@ private: ACE_Null_Condition (const ACE_Null_Condition &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_NULL_CONDITION_H */ diff --git a/ace/Null_Mutex.h b/ace/Null_Mutex.h index a0c9bf8d374..022cc034df6 100644 --- a/ace/Null_Mutex.h +++ b/ace/Null_Mutex.h @@ -27,6 +27,9 @@ #include "ace/Global_Macros.h" #include "ace/OS_Memory.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -119,8 +122,8 @@ class ACE_Guard; /** * @class ACE_Guard<ACE_Null_Mutex> * - * @brief Template specialization of <ACE_Guard> for the - * <ACE_Null_Mutex>. + * @brief Template specialization of ACE_Guard for the + * ACE_Null_Mutex. * * This specialization is useful since it helps to speedup * performance of the "Null_Mutex" considerably. @@ -146,9 +149,11 @@ public: void dump (void) const {} private: - // = Prevent assignment and initialization. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Guard<ACE_Null_Mutex> &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Guard (const ACE_Guard<ACE_Null_Mutex> &)) + + // Disallow copying and assignment. + ACE_Guard (const ACE_Guard<ACE_Null_Mutex> &); + void operator= (const ACE_Guard<ACE_Null_Mutex> &); + }; template <class ACE_LOCK> @@ -215,5 +220,7 @@ public: } }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_NULL_MUTEX_H */ diff --git a/ace/Null_Semaphore.h b/ace/Null_Semaphore.h index 43349202541..9124f46cf73 100644 --- a/ace/Null_Semaphore.h +++ b/ace/Null_Semaphore.h @@ -24,12 +24,14 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** * @class ACE_Null_Semaphore * - * @brief Implement a do nothing <ACE_Semaphore>, i.e., all the methods are + * @brief Implement a do nothing ACE_Semaphore, i.e., all the methods are * no ops. * * Although the methods are no-ops, the return values are different for @@ -96,5 +98,7 @@ public: //ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_NULL_SEMAPHORE_H */ @@ -76,8 +76,12 @@ #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Timeout_Manager; +ACE_END_VERSIONED_NAMESPACE_DECL + // Here are all ACE-specific default constants, needed throughout ACE // and its applications. The values can be over written by user // specific values in config.h files. @@ -328,6 +332,9 @@ class ACE_Timeout_Manager; # include "ace/os_include/os_syslog.h" # endif /* !defined (ACE_WIN32) && !defined (ACE_LACKS_UNIX_SYSLOG) */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @namespace ACE_OS * @@ -336,7 +343,7 @@ class ACE_Timeout_Manager; * efficient system programs on Win32, POSIX and other versions * of UNIX, and various real-time operating systems. * - * This class encapsulates the differences between various OS + * This namespace encapsulates the differences between various OS * platforms. When porting ACE to a new platform, this class is * the place to focus on. Once this file is ported to a new * platform, pretty much everything else comes for "free." See @@ -347,14 +354,11 @@ class ACE_Timeout_Manager; */ namespace ACE_OS { - - - // = A set of wrappers for miscellaneous operations. - - } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_Dirent.cpp b/ace/OS_Dirent.cpp deleted file mode 100644 index a985c999068..00000000000 --- a/ace/OS_Dirent.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// $Id$ - -#include "ace/OS_Dirent.h" - -ACE_RCSID(ace, OS_Dirent, "$Id$") - diff --git a/ace/OS_Errno.cpp b/ace/OS_Errno.cpp index 7e1d6f93cc0..8170ef82466 100644 --- a/ace/OS_Errno.cpp +++ b/ace/OS_Errno.cpp @@ -20,6 +20,8 @@ ACE_RCSID(ace, OS_Errno, "$Id$") #include "ace/OS_Memory.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_CE_Errno *ACE_CE_Errno::instance_ = 0; DWORD ACE_CE_Errno::errno_key_ = 0xffffffff; @@ -39,4 +41,6 @@ ACE_CE_Errno::fini () ACE_CE_Errno::instance_ = 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */ diff --git a/ace/OS_Errno.h b/ace/OS_Errno.h index 82446047842..e92837af318 100644 --- a/ace/OS_Errno.h +++ b/ace/OS_Errno.h @@ -22,6 +22,8 @@ #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Errno_Guard * @@ -81,6 +83,8 @@ private: int error_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + // Inlining this class on debug builds with gcc on Solaris can cause // deadlocks during static initialization. #if defined (ACE_HAS_INLINED_OSCALLS) && \ diff --git a/ace/OS_Errno.inl b/ace/OS_Errno.inl index 9330c37deb4..2fe5e6c54e2 100644 --- a/ace/OS_Errno.inl +++ b/ace/OS_Errno.inl @@ -1,6 +1,9 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Errno_Guard::ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref, int error) @@ -60,3 +63,5 @@ ACE_Errno_Guard::operator!= (int error) { return this->error_ != error; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_Log_Msg_Attributes.h b/ace/OS_Log_Msg_Attributes.h index f86011147ea..5da968d0ba7 100644 --- a/ace/OS_Log_Msg_Attributes.h +++ b/ace/OS_Log_Msg_Attributes.h @@ -24,13 +24,18 @@ #include "ace/os_include/os_stdio.h" #include "ace/iosfwd.h" -/// The attributes required by ACE_Log_Msg. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** + * @class ACE_OS_Log_Msg_Attributes + * + * @brief The attributes required by ACE_Log_Msg. + * * When a new thread is created the TSS resources for the Log_Msg * class in the new thread may be inherited by the creator thread. * The base_attributes are encapsulated in this class to simplify their * manipulation and destruction. - * + * @par * The contents of the class must be made available to the OS layer, * because they are part of the thread descriptor. */ @@ -71,6 +76,8 @@ private: ACE_OS_Log_Msg_Attributes &operator= (const ACE_OS_Log_Msg_Attributes &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_Log_Msg_Attributes.inl b/ace/OS_Log_Msg_Attributes.inl index 3ece871ea06..29725ef4d7c 100644 --- a/ace/OS_Log_Msg_Attributes.inl +++ b/ace/OS_Log_Msg_Attributes.inl @@ -1,7 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_OS_Log_Msg_Attributes::ACE_OS_Log_Msg_Attributes (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_Memory.cpp b/ace/OS_Memory.cpp deleted file mode 100644 index 8a30926a8bd..00000000000 --- a/ace/OS_Memory.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// $Id$ - -#include "ace/OS_Memory.h" - -ACE_RCSID(ace, OS_Memory, "$Id$") - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/OS_Memory.inl" -#endif /* !ACE_HAS_INLINED_OS_CALLS */ - -#include "ace/os_include/os_stdlib.h" - diff --git a/ace/OS_Memory.h b/ace/OS_Memory.h index f11aca10679..b972a6f44c8 100644 --- a/ace/OS_Memory.h +++ b/ace/OS_Memory.h @@ -38,8 +38,9 @@ // // For completeness' sake, you should probably put // #define ACE_HAS_STRDUP_EMULATION -// too, so that you guarantee that strdup() calls your desired mallocator -// and not the system mallocator. +// #define ACE_HAS_WCSDUP_EMULATION +// too, so that you guarantee that strdup() and wcsdup() call your +// desired mallocator and not the system mallocator. // #if !defined (ACE_MALLOC_FUNC) # define ACE_MALLOC_FUNC ::malloc @@ -54,12 +55,16 @@ # define ACE_REALLOC_FUNC ::realloc #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_OLD_MALLOC) -typedef char *ACE_MALLOC_T; +typedef char * ACE_MALLOC_T; #else -typedef void *ACE_MALLOC_T; +typedef void * ACE_MALLOC_T; #endif /* ACE_HAS_OLD_MALLOC */ +ACE_END_VERSIONED_NAMESPACE_DECL + // ============================================================================ // ACE_NEW macros // @@ -254,13 +259,5 @@ typedef void *ACE_MALLOC_T; #include "ace/OS_NS_stdlib.h" -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/OS_Memory.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - #include /**/ "ace/post.h" #endif /* ACE_OS_MEMORY_H */ diff --git a/ace/OS_Memory.inl b/ace/OS_Memory.inl deleted file mode 100644 index 3c4912199de..00000000000 --- a/ace/OS_Memory.inl +++ /dev/null @@ -1,7 +0,0 @@ -// -*- C++ -*- -// $Id$ - -#if !defined (ACE_LACKS_SBRK) -# include "ace/os_include/os_unistd.h" -#endif /* !ACE_LACKS_SBRK */ - diff --git a/ace/OS_NS_Thread.cpp b/ace/OS_NS_Thread.cpp index 8240709353f..e3452744928 100644 --- a/ace/OS_NS_Thread.cpp +++ b/ace/OS_NS_Thread.cpp @@ -24,9 +24,9 @@ ACE_RCSID (ace, #include "ace/Guard_T.h" extern "C" void -ace_mutex_lock_cleanup_adapter (void *args) +ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME (void *args) { - ACE_OS::mutex_lock_cleanup (args); + ACE_VERSIONED_NAMESPACE_NAME::ACE_OS::mutex_lock_cleanup (args); } @@ -87,6 +87,8 @@ HANDLE WINAPI __IBMCPP__beginthreadex(void *stack, /*****************************************************************************/ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Thread_ID::to_string (char *thr_string) const { @@ -779,26 +781,40 @@ TSS_Cleanup_Instance::TSS_Cleanup_Instance (Purpose purpose) } } -TSS_Cleanup_Instance::~TSS_Cleanup_Instance() +TSS_Cleanup_Instance::~TSS_Cleanup_Instance (void) { - ACE_Guard<ACE_Thread_Mutex> guard(*mutex_); - if (ptr_ != 0) + // Variable to hold the mutex_ to delete outside the scope of the + // guard. + ACE_Thread_Mutex *del_mutex = 0; + + // scope the guard + { + ACE_Guard<ACE_Thread_Mutex> guard (*mutex_); + if (ptr_ != 0) + { + if (ACE_BIT_ENABLED (flags_, FLAG_DELETING)) + { + ACE_ASSERT(instance_ == 0); + ACE_ASSERT(reference_count_ == 0); + delete ptr_; + del_mutex = mutex_ ; + mutex_ = 0; + } + else + { + ACE_ASSERT (reference_count_ > 0); + --reference_count_; + if (reference_count_ == 0 && instance_ == NULL) + condition_->signal (); + } + } + }// end of guard scope + + if (del_mutex != 0) { - if (ACE_BIT_ENABLED (flags_,FLAG_DELETING)) - { - ACE_ASSERT(instance_ == 0); - ACE_ASSERT(reference_count_ == 0); - delete ptr_; - } - else - { - ACE_ASSERT (reference_count_ > 0); - --reference_count_; - if (reference_count_ == 0 && instance_ == NULL) - { - condition_->signal(); - } - } + delete condition_; + condition_ = 0; + delete del_mutex; } } @@ -909,7 +925,7 @@ ACE_TSS_Cleanup::thread_exit (void) extern "C" void ACE_TSS_Cleanup_keys_destroyer (void *tss_keys) { - delete reinterpret_cast <ACE_TSS_Keys *> (tss_keys); + delete static_cast <ACE_TSS_Keys *> (tss_keys); } ACE_TSS_Cleanup::ACE_TSS_Cleanup (void) @@ -3692,7 +3708,6 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, #elif defined (ACE_HAS_PTHREADS) && \ (!defined (ACE_LACKS_SETSCHED) || defined (ACE_TANDEM_T1248_PTHREADS) || \ defined (ACE_HAS_PTHREAD_SCHEDPARAM)) - ACE_UNUSED_ARG (id); if (sched_params.quantum () != ACE_Time_Value::zero) { // quantums not supported @@ -3713,7 +3728,7 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, # if defined(ACE_TANDEM_T1248_PTHREADS) || defined (ACE_HAS_PTHREAD_SCHEDPARAM) ACE_NOTSUP_RETURN (-1); # else /* ! ACE_TANDEM_T1248_PTHREADS */ - int result = ::sched_setscheduler (0, // this process + int result = ::sched_setscheduler (id == ACE_SELF ? 0 : id, sched_params.policy (), ¶m) == -1 ? -1 : 0; # if defined (DIGITAL_UNIX) @@ -3769,40 +3784,73 @@ ACE_OS::sched_params (const ACE_Sched_Params &sched_params, EtsSetTimeSlice (sched_params.quantum().msec()); # else - ACE_UNUSED_ARG (id); - if (sched_params.scope () != ACE_SCOPE_PROCESS - || sched_params.quantum () != ACE_Time_Value::zero) + if (sched_params.quantum () != ACE_Time_Value::zero) { - // Win32 only allows setting priority class (therefore, policy) - // at the process level. I don't know of a way to set the - // quantum. + // I don't know of a way to set the quantum on Win32. errno = EINVAL; return -1; } -// Setting the REALTIME_PRIORITY_CLASS on Windows is almost always -// a VERY BAD THING. This include guard will allow people -// to easily disable this feature in ACE. -#ifndef ACE_DISABLE_WIN32_INCREASE_PRIORITY - // Set the priority class of this process to the REALTIME process class - // _if_ the policy is ACE_SCHED_FIFO. Otherwise, set to NORMAL. - if (!::SetPriorityClass (::GetCurrentProcess (), - (sched_params.policy () == ACE_SCHED_FIFO || - sched_params.policy () == ACE_SCHED_RR) - ? REALTIME_PRIORITY_CLASS - : NORMAL_PRIORITY_CLASS)) + if (sched_params.scope () == ACE_SCOPE_THREAD) { - ACE_OS::set_errno_to_last_error (); - return -1; - } + + // Setting the REALTIME_PRIORITY_CLASS on Windows is almost always + // a VERY BAD THING. This include guard will allow people + // to easily disable this feature in ACE. +#ifndef ACE_DISABLE_WIN32_INCREASE_PRIORITY + // Set the priority class of this process to the REALTIME process class + // _if_ the policy is ACE_SCHED_FIFO. Otherwise, set to NORMAL. + if (!::SetPriorityClass (::GetCurrentProcess (), + (sched_params.policy () == ACE_SCHED_FIFO || + sched_params.policy () == ACE_SCHED_RR) + ? REALTIME_PRIORITY_CLASS + : NORMAL_PRIORITY_CLASS)) + { + ACE_OS::set_errno_to_last_error (); + return -1; + } #endif /* ACE_DISABLE_WIN32_INCREASE_PRIORITY */ # endif /* ACE_HAS_PHARLAP_RT */ - - // Set the thread priority on the current thread. - return ACE_OS::thr_setprio (sched_params.priority ()); - + // Now that we have set the priority class of the process, set the + // priority of the current thread to the desired value. + return ACE_OS::thr_setprio (sched_params.priority ()); + } + else if (sched_params.scope () == ACE_SCOPE_PROCESS) + { + HANDLE hProcess = ::OpenProcess (PROCESS_SET_INFORMATION, + FALSE, + id); + if (!hProcess) + { + ACE_OS::set_errno_to_last_error(); + return -1; + } + // There is no way for us to set the priority of the thread when we + // are setting the priority of a different process. So just ignore + // the priority argument when ACE_SCOPE_PROCESS is specified. + // Setting the priority class will automatically increase the base + // priority of all the threads within a process while maintaining the + // relative priorities of the threads within it. + if (!::SetPriorityClass (hProcess, + (sched_params.policy () == ACE_SCHED_FIFO || + sched_params.policy () == ACE_SCHED_RR) + ? REALTIME_PRIORITY_CLASS + : NORMAL_PRIORITY_CLASS)) + { + ACE_OS::set_errno_to_last_error (); + ::CloseHandle (hProcess); + return -1; + } + ::CloseHandle (hProcess); + return 0; + } + else + { + errno = EINVAL; + return -1; + } #elif defined (VXWORKS) || defined (ACE_PSOS) ACE_UNUSED_ARG (id); @@ -3981,19 +4029,19 @@ ACE_OS::thr_create (ACE_THR_FUNC func, #endif /* ! defined (ACE_NO_THREAD_ADAPTER) */ - ACE_Base_Thread_Adapter *thread_args; + ACE_Base_Thread_Adapter *thread_args = 0; if (thread_adapter == 0) #if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) ACE_NEW_RETURN (thread_args, ACE_OS_Thread_Adapter (func, args, - (ACE_THR_C_FUNC) ace_thread_adapter, + (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, ACE_OS_Object_Manager::seh_except_selector(), ACE_OS_Object_Manager::seh_except_handler()), -1); #else ACE_NEW_RETURN (thread_args, ACE_OS_Thread_Adapter (func, args, - (ACE_THR_C_FUNC) ace_thread_adapter), + (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME), -1); #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ @@ -4377,6 +4425,22 @@ ACE_OS::thr_create (ACE_THR_FUNC func, } # endif /* !ACE_LACKS_THREAD_PROCESS_SCOPING */ +# ifdef ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP + if (ACE_BIT_ENABLED (flags, THR_SUSPENDED)) + { + if (ACE_ADAPT_RETVAL(::pthread_attr_setcreatesuspend_np(&attr), result) != 0) + { + +# if defined (ACE_HAS_PTHREADS_DRAFT4) + ::pthread_attr_delete (&attr); +# else /* ACE_HAS_PTHREADS_DRAFT4 */ + ::pthread_attr_destroy (&attr); +# endif /* ACE_HAS_PTHREADS_DRAFT4 */ + return -1; + } + } +# endif /* !ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP */ + if (ACE_BIT_ENABLED (flags, THR_NEW_LWP)) { // Increment the number of LWPs by one to emulate the @@ -4787,9 +4851,9 @@ ACE_OS::thr_create (ACE_THR_FUNC func, return -1; else { - if (! thr_id_provided && thr_id) + if (! thr_id_provided && thr_id) { - if (*thr_id && (*thr_id)[0] == ACE_THR_ID_ALLOCATED) + if (*thr_id && (*thr_id)[0] == ACE_THR_ID_ALLOCATED) // *thr_id was allocated by the Thread_Manager. ::taskTcb // (int tid) returns the address of the WIND_TCB (task // control block). According to the ::taskSpawn() @@ -4797,12 +4861,12 @@ ACE_OS::thr_create (ACE_THR_FUNC func, // pStackBase, but is that of the current task? If so, it // might be a bit quicker than this extraction of the tcb // . . . - ACE_OS::strsncpy (*thr_id + 1, ::taskTcb (tid)->name, 10); + ACE_OS::strsncpy (*thr_id + 1, ::taskName (tid), 10); else // *thr_id was not allocated by the Thread_Manager. // Pass back the task name in the location pointed to // by thr_id. - *thr_id = ::taskTcb (tid)->name; + *thr_id = ::taskName (tid); } // else if the thr_id was provided, there's no need to overwrite // it with the same value (string). If thr_id is 0, then we can't @@ -4990,6 +5054,99 @@ ACE_OS::thr_key_detach (ACE_thread_key_t key, void *) } int +ACE_OS::thr_get_affinity (ACE_hthread_t thr_id, + size_t cpu_set_size, + cpu_set_t * cpu_mask) +{ +#if defined (ACE_HAS_PTHREAD_GETAFFINITY_NP) + // Handle of the thread, which is NPTL thread-id, normally a big number + if (::pthread_getaffinity_np (thr_id, + cpu_set_size, + cpu_mask) != 0) + { + return -1; + } + return 0; +#elif defined (ACE_HAS_2_PARAM_SCHED_GETAFFINITY) + // The process-id is expected as <thr_id>, which can be a thread-id of + // linux-thread, thus making binding to cpu of that particular thread only. + // If you are using this flag for NPTL-threads, however, please pass as a + // thr_id process id obtained by ACE_OS::getpid () + ACE_UNUSED_ARG (cpu_set_size); + if (::sched_getaffinity(thr_id, + cpu_mask) == -1) + { + return -1; + } + return 0; +#elif defined (ACE_HAS_SCHED_GETAFFINITY) + // The process-id is expected as <thr_id>, which can be a thread-id of + // linux-thread, thus making binding to cpu of that particular thread only. + // If you are using this flag for NPTL-threads, however, please pass as a + // thr_id process id obtained by ACE_OS::getpid () + if (::sched_getaffinity(thr_id, + cpu_set_size, + cpu_mask) == -1) + { + return -1; + } + return 0; +#else + ACE_UNUSED_ARG (thr_id); + ACE_UNUSED_ARG (cpu_set_size); + ACE_UNUSED_ARG (cpu_mask); + ACE_NOTSUP_RETURN (-1); +#endif +} + +int +ACE_OS::thr_set_affinity (ACE_hthread_t thr_id, + size_t cpu_set_size, + const cpu_set_t * cpu_mask) +{ +#if defined (ACE_HAS_PTHREAD_SETAFFINITY_NP) + if (::pthread_setaffinity_np (thr_id, + cpu_set_size, + cpu_mask) != 0) + { + return -1; + } + return 0; +#elif defined (ACE_HAS_2_PARAM_SCHED_SETAFFINITY) + // The process-id is expected as <thr_id>, which can be a thread-id of + // linux-thread, thus making binding to cpu of that particular thread only. + // If you are using this flag for NPTL-threads, however, please pass as a + // thr_id process id obtained by ACE_OS::getpid (), but whole process will bind your CPUs + // + ACE_UNUSED_ARG (cpu_set_size); + if (::sched_setaffinity (thr_id, + cpu_mask) == -1) + { + return -1; + } + return 0; +#elif defined (ACE_HAS_SCHED_SETAFFINITY) + // The process-id is expected as <thr_id>, which can be a thread-id of + // linux-thread, thus making binding to cpu of that particular thread only. + // If you are using this flag for NPTL-threads, however, please pass as a + // thr_id process id obtained by ACE_OS::getpid (), but whole process will bind your CPUs + // + if (::sched_setaffinity (thr_id, + cpu_set_size, + cpu_mask) == -1) + { + return -1; + } + return 0; +#else + ACE_UNUSED_ARG (thr_id); + ACE_UNUSED_ARG (cpu_set_size); + ACE_UNUSED_ARG (cpu_mask); + ACE_NOTSUP_RETURN (-1); +#endif +} + +int ACE_OS::thr_key_used (ACE_thread_key_t key) { #if defined (ACE_WIN32) || defined (ACE_HAS_TSS_EMULATION) || (defined (ACE_PSOS) && defined (ACE_PSOS_HAS_TSS)) @@ -5120,8 +5277,12 @@ ACE_OS::thr_keycreate (ACE_thread_key_t *key, else return -1; /* NOTREACHED */ -# else /* ACE_HAS_TSS_EMULATION */ +# elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) return ACE_OS::thr_keycreate_native (key, dest); +# else + ACE_UNUSED_ARG (key); + ACE_UNUSED_ARG (dest); + ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_TSS_EMULATION */ # else /* ACE_HAS_THREADS */ ACE_UNUSED_ARG (key); @@ -5184,8 +5345,11 @@ ACE_OS::thr_keyfree (ACE_thread_key_t key) return cleanup->free_key (key); } return -1; -# else /* ACE_HAS_TSS_EMULATION */ +# elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) return ACE_OS::thr_keyfree_native (key); +# else + ACE_UNUSED_ARG (key); + ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_TSS_EMULATION */ # else /* ACE_HAS_THREADS */ ACE_UNUSED_ARG (key); @@ -5254,7 +5418,7 @@ ACE_OS::thr_setspecific_native (ACE_OS_thread_key_t key, void *data) ACE_OSCALL_RETURN (::pthread_setspecific (key, data), int, -1); # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setspecific (key, data), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setspecific (key, data), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ @@ -5336,8 +5500,12 @@ ACE_OS::thr_setspecific (ACE_thread_key_t key, void *data) return -1; } return -1; +# elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) + return ACE_OS::thr_setspecific_native (key, data); # else /* ACE_HAS_TSS_EMULATION */ - return ACE_OS::thr_setspecific_native (key, data); + ACE_UNUSED_ARG (key); + ACE_UNUSED_ARG (data); + ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_TSS_EMULATION */ # else /* ACE_HAS_THREADS */ ACE_UNUSED_ARG (key); @@ -5386,8 +5554,11 @@ ACE_OS::unique_name (const void *object, length); } -#if defined (VXWORKS) +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_VXWORKS) && !defined (__RTP__) # include /**/ <usrLib.h> /* for ::sp() */ +# include /**/ <sysLib.h> /* for ::sysClkRateGet() */ // This global function can be used from the VxWorks shell to pass // arguments to a C main () function. @@ -5398,8 +5569,8 @@ ACE_OS::unique_name (const void *object, int spa (FUNCPTR entry, ...) { - static const unsigned int MAX_ARGS = 10; - static char *argv[MAX_ARGS]; + static const unsigned int ACE_MAX_ARGS = 10; + static char *argv[ACE_MAX_ARGS]; va_list pvar; unsigned int argc; @@ -5415,7 +5586,7 @@ spa (FUNCPTR entry, ...) // number of arguments would have to be passed. va_start (pvar, entry); - for (argc = 1; argc <= MAX_ARGS; ++argc) + for (argc = 1; argc <= ACE_MAX_ARGS; ++argc) { argv[argc] = va_arg (pvar, char *); @@ -5423,18 +5594,18 @@ spa (FUNCPTR entry, ...) break; } - if (argc > MAX_ARGS && argv[argc-1] != 0) + if (argc > ACE_MAX_ARGS && argv[argc-1] != 0) { // try to read another arg, and warn user if the limit was exceeded if (va_arg (pvar, char *) != 0) ACE_OS::fprintf (stderr, "spa(): number of arguments limited to %d\n", - MAX_ARGS); + ACE_MAX_ARGS); } else { // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (unsigned int i = argc; i <= MAX_ARGS; ++i) + for (unsigned int i = argc; i <= ACE_MAX_ARGS; ++i) argv[i] = 0; } @@ -5530,8 +5701,8 @@ int spae (FUNCPTR entry, ...) { static const int WINDSH_ARGS = 10; - static const int MAX_ARGS = 128; - static char* argv[MAX_ARGS] = { "ace_main", 0 }; + static const int ACE_MAX_ARGS = 128; + static char* argv[ACE_MAX_ARGS] = { "ace_main", 0 }; va_list pvar; int argc = 1; @@ -5545,12 +5716,12 @@ spae (FUNCPTR entry, ...) for (char* str = va_arg (pvar, char*); str != 0 && i < WINDSH_ARGS; str = va_arg (pvar, char*), ++i) { - add_to_argv(argc, argv, MAX_ARGS, str); + add_to_argv(argc, argv, ACE_MAX_ARGS, str); } // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (i = argc; i < MAX_ARGS; ++i) + for (i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; // The hard-coded options are what ::sp () uses, except for the @@ -5584,8 +5755,8 @@ int spaef (FUNCPTR entry, ...) { static const int WINDSH_ARGS = 10; - static const int MAX_ARGS = 128; - static char* argv[MAX_ARGS] = { "ace_main", 0 }; + static const int ACE_MAX_ARGS = 128; + static char* argv[ACE_MAX_ARGS] = { "ace_main", 0 }; va_list pvar; int argc = 1; @@ -5599,12 +5770,12 @@ spaef (FUNCPTR entry, ...) for (char* str = va_arg (pvar, char*); str != 0 && i < WINDSH_ARGS; str = va_arg (pvar, char*), ++i) { - add_to_argv(argc, argv, MAX_ARGS, str); + add_to_argv(argc, argv, ACE_MAX_ARGS, str); } // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (i = argc; i < MAX_ARGS; ++i) + for (i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; int ret = entry (argc, argv); @@ -5635,18 +5806,18 @@ _vx_call_entry(FUNCPTR entry, int argc, char* argv[]) int vx_execae (FUNCPTR entry, char* arg, int prio, int opt, int stacksz, ...) { - static const int MAX_ARGS = 128; - static char* argv[MAX_ARGS] = { "ace_main", 0 }; + static const int ACE_MAX_ARGS = 128; + static char* argv[ACE_MAX_ARGS] = { "ace_main", 0 }; int argc = 1; // Peel off arguments to run_main () and put into argv. if (arg) - add_to_argv(argc, argv, MAX_ARGS, arg); + add_to_argv(argc, argv, ACE_MAX_ARGS, arg); // fill unused argv slots with 0 to get rid of leftovers // from previous invocations - for (int i = argc; i < MAX_ARGS; ++i) + for (int i = argc; i < ACE_MAX_ARGS; ++i) argv[i] = 0; // The hard-coded options are what ::sp () uses, except for the @@ -5668,7 +5839,7 @@ vx_execae (FUNCPTR entry, char* arg, int prio, int opt, int stacksz, ...) // successful return ret > 0 ? _vx_call_rc : 255; } -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS && !__RTP__ */ #if defined (__DGUX) && defined (ACE_HAS_THREADS) && defined (_POSIX4A_DRAFT10_SOURCE) extern "C" int __d6_sigwait (sigset_t *set); diff --git a/ace/OS_NS_Thread.h b/ace/OS_NS_Thread.h index 745f5c730d1..9274b5212a7 100644 --- a/ace/OS_NS_Thread.h +++ b/ace/OS_NS_Thread.h @@ -29,6 +29,7 @@ # include "ace/Basic_Types.h" # include "ace/Default_Constants.h" # include "ace/os_include/os_pthread.h" +# include "ace/os_include/os_sched.h" # include "ace/Base_Thread_Adapter.h" # include "ace/os_include/sys/os_sem.h" # include "ace/os_include/os_semaphore.h" @@ -54,6 +55,8 @@ # include /**/ <sys/tspriocntl.h> # endif /* ACE_HAS_PRIOCNTL */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_PSOS) // Use pSOS semaphores, wrapped . . . typedef struct @@ -115,6 +118,8 @@ typedef DWORD ACE_OS_thread_key_t; # endif /* ! ACE_HAS_TSS_EMULATION */ # endif /* ACE_WIN32 */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if !defined (ACE_HAS_POSIX_SEM) && defined (ACE_USES_FIFO_SEM) extern "C" { @@ -150,6 +155,9 @@ extern "C" { # if defined (ACE_HAS_PTHREADS) // moved to pthread.h # elif defined (ACE_HAS_STHREADS) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Solaris threads, without PTHREADS. // Typedefs to help compatibility with Windows NT and Pthreads. typedef thread_t ACE_thread_t; @@ -181,6 +189,8 @@ struct ACE_Export ACE_mutexattr_t typedef ACE_thread_t ACE_hthread_t; typedef ACE_mutex_t ACE_thread_mutex_t; +ACE_END_VERSIONED_NAMESPACE_DECL + # define THR_CANCEL_DISABLE 0 # define THR_CANCEL_ENABLE 0 # define THR_CANCEL_DEFERRED 0 @@ -192,6 +202,8 @@ typedef ACE_mutex_t ACE_thread_mutex_t; # elif defined (ACE_PSOS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Some versions of pSOS provide native mutex support. For others, // implement ACE_thread_mutex_t and ACE_mutex_t using pSOS semaphores. // Either way, the types are all u_longs. @@ -233,6 +245,8 @@ typedef u_int ACE_OS_thread_key_t; typedef ACE_OS_thread_key_t ACE_thread_key_t; # endif /* ! ACE_HAS_TSS_EMULATION */ +ACE_END_VERSIONED_NAMESPACE_DECL + # define THR_CANCEL_DISABLE 0 /* thread can never be cancelled */ # define THR_CANCEL_ENABLE 0 /* thread can be cancelled */ # define THR_CANCEL_DEFERRED 0 /* cancellation deferred to cancellation point */ @@ -268,10 +282,12 @@ typedef u_int ACE_OS_thread_key_t; /* #define T_NOFPU 0x00000000 Not using FPU */ /* #define T_FPU 0x00000002 Using FPU bit */ -# elif defined (VXWORKS) +# elif defined (ACE_VXWORKS) # include /**/ <sysLib.h> // for sysClkRateGet() -# include /**/ <taskLib.h> -# include /**/ <taskHookLib.h> +# if !defined (__RTP__) +# include /**/ <taskLib.h> +# include /**/ <taskHookLib.h> +# endif // make sure these are included for VXWORKS. // @todo move these to a common place, perhaps the top of the file. @@ -290,7 +306,9 @@ typedef u_int ACE_OS_thread_key_t; // task options: the other options are either obsolete, internal, or for // Fortran or Ada support # define VX_UNBREAKABLE 0x0002 /* breakpoints ignored */ -# define VX_FP_TASK 0x0008 /* floating point coprocessor */ +# if !defined (VX_FP_TASK) +# define VX_FP_TASK 0x0008 /* floating point coprocessor */ +# endif # define VX_PRIVATE_ENV 0x0080 /* private environment support */ # define VX_NO_STACK_FILL 0x0100 /* do not stack fill for checkstack () */ @@ -317,6 +335,8 @@ typedef u_int ACE_OS_thread_key_t; # define USYNC_PROCESS 1 /* It's all global on VxWorks (without MMU option). */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + typedef SEM_ID ACE_mutex_t; // Implement ACE_thread_mutex_t with ACE_mutex_t because there's just // one process . . . @@ -346,12 +366,16 @@ typedef u_int ACE_OS_thread_key_t; typedef ACE_OS_thread_key_t ACE_thread_key_t; # endif /* ! ACE_HAS_TSS_EMULATION */ +ACE_END_VERSIONED_NAMESPACE_DECL + // Marker for ACE_Thread_Manager to indicate that it allocated // an ACE_thread_t. It is placed at the beginning of the ID. # define ACE_THR_ID_ALLOCATED '\022' # elif defined (ACE_HAS_WTHREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + typedef CRITICAL_SECTION ACE_thread_mutex_t; typedef struct @@ -396,6 +420,8 @@ public: # endif /* ACE_USES_WINCE_SEMA_SIMULATION */ # endif /* defined (ACE_WIN32) */ +ACE_END_VERSIONED_NAMESPACE_DECL + // These need to be different values, neither of which can be 0... # define USYNC_THREAD 1 # define USYNC_PROCESS 2 @@ -423,6 +449,9 @@ public: // takes care of it) unless we're on Windows. Win32 mutexes, semaphores, // and condition variables are not yet supported in PACE. # if defined (ACE_LACKS_COND_T) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_cond_t * @@ -481,10 +510,15 @@ struct ACE_Export ACE_mutexattr_t { int type; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + # endif /* ACE_LACKS_COND_T */ # if defined (ACE_LACKS_RWLOCK_T) && !defined (ACE_HAS_PTHREADS_UNIX98_EXT) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_rwlock_t * @@ -524,11 +558,18 @@ public: /// Condition for the upgrading reader ACE_cond_t waiting_important_writer_; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + # elif defined (ACE_HAS_PTHREADS_UNIX98_EXT) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef pthread_rwlock_t ACE_rwlock_t; +ACE_END_VERSIONED_NAMESPACE_DECL # elif defined (ACE_HAS_STHREADS) # include /**/ <synch.h> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef rwlock_t ACE_rwlock_t; +ACE_END_VERSIONED_NAMESPACE_DECL # endif /* ACE_LACKS_RWLOCK_T */ // Define some default thread priorities on all threaded platforms, if @@ -578,6 +619,9 @@ typedef rwlock_t ACE_rwlock_t; // and recursive_mutex_cond_relock() methods to maintain the expected // state when the wait finishes. # if defined (ACE_HAS_RECURSIVE_MUTEXES) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + typedef ACE_thread_mutex_t ACE_recursive_thread_mutex_t; # if defined (ACE_WIN32) // Windows has recursive mutexes, but doesn't have condition variables, @@ -593,7 +637,13 @@ struct ACE_recursive_mutex_state // No need for special handling; just need a type for method signatures. typedef int ACE_recursive_mutex_state; # endif /* ACE_WIN32 */ + +ACE_END_VERSIONED_NAMESPACE_DECL + # else + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_recursive_thread_mutex_t * @@ -628,6 +678,9 @@ struct ACE_recursive_mutex_state int nesting_level_; ACE_thread_t owner_id_; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + # endif /* ACE_HAS_RECURSIVE_MUTEXES */ # else /* !ACE_HAS_THREADS, i.e., the OS/platform doesn't support threading. */ @@ -694,6 +747,8 @@ struct ACE_recursive_mutex_state # define THR_SCOPE_SYSTEM 0 # endif /* ! THR_SCOPE_SYSTEM */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // These are dummies needed for class OS.h typedef int ACE_cond_t; struct ACE_Export ACE_condattr_t @@ -723,6 +778,8 @@ typedef unsigned int ACE_OS_thread_key_t; typedef ACE_OS_thread_key_t ACE_thread_key_t; # endif /* ! ACE_HAS_TSS_EMULATION */ +ACE_END_VERSIONED_NAMESPACE_DECL + // Ensure that ACE_THR_PRI_FIFO_DEF and ACE_THR_PRI_OTHER_DEF are // defined on non-threaded platforms, to support application source // code compatibility. ACE_THR_PRI_FIFO_DEF should be used by @@ -737,6 +794,8 @@ typedef unsigned int ACE_OS_thread_key_t; # endif /* ACE_HAS_THREADS ***********************************************/ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Thread_ID * @@ -793,14 +852,14 @@ private: typedef int ACE_Sched_Priority; # if !defined (ACE_DEFAULT_SYNCH_TYPE) -# if defined (VXWORKS) +# if defined (ACE_VXWORKS) // Types include these options: SEM_Q_PRIORITY, SEM_Q_FIFO, // SEM_DELETE_SAFE, and SEM_INVERSION_SAFE. SEM_Q_FIFO is // used as the default because that is VxWorks' default. # define ACE_DEFAULT_SYNCH_TYPE SEM_Q_FIFO # else # define ACE_DEFAULT_SYNCH_TYPE USYNC_THREAD -# endif /* VXWORKS */ +# endif /* ACE_VXWORKS */ #endif /* ! ACE_DEFAULT_SYNCH_TYPE */ // forward declaration @@ -896,7 +955,7 @@ public: * address on success. Returns 0 if local TSS had already been * setup for this thread. There is no corresponding tss_close () * because it is not needed. - * NOTE: tss_open () is called by ACE for threads that it spawns. + * @note tss_open () is called by ACE for threads that it spawns. * If your application spawns threads without using ACE, and it uses * ACE's TSS emulation, each of those threads should call tss_open * (). See the ace_thread_adapter () implementation for an example. @@ -1103,24 +1162,33 @@ private: # define ACE_KEY_INDEX(OBJ,KEY) u_int OBJ = KEY # endif /* ACE_HAS_NONSCALAR_THREAD_KEY_T */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# define ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ace_mutex_lock_cleanup_adapter) +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + + # if defined (ACE_HAS_THR_C_FUNC) // This is necessary to work around nasty problems with MVS C++. -extern "C" ACE_Export void ace_mutex_lock_cleanup_adapter (void *args); -# define ACE_PTHREAD_CLEANUP_PUSH(A) pthread_cleanup_push (ace_mutex_lock_cleanup_adapter, (void *) A); +extern "C" ACE_Export void ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME (void *args); +# define ACE_PTHREAD_CLEANUP_PUSH(A) pthread_cleanup_push (ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME, (void *) A); # define ACE_PTHREAD_CLEANUP_POP(A) pthread_cleanup_pop(A) # elif defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CLEANUP) // Though we are defining a extern "C" function to match the prototype of // pthread_cleanup_push, it is undone by the Solaris header file // /usr/include/pthread.h. So this macro generates a warning under Solaris // with SunCC. This is a bug in the Solaris header file. -extern "C" ACE_Export void ace_mutex_lock_cleanup_adapter (void *args); -# define ACE_PTHREAD_CLEANUP_PUSH(A) pthread_cleanup_push (ace_mutex_lock_cleanup_adapter, (void *) A); +extern "C" ACE_Export void ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME (void *args); +# define ACE_PTHREAD_CLEANUP_PUSH(A) pthread_cleanup_push (ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME, (void *) A); # define ACE_PTHREAD_CLEANUP_POP(A) pthread_cleanup_pop(A) # else # define ACE_PTHREAD_CLEANUP_PUSH(A) # define ACE_PTHREAD_CLEANUP_POP(A) # endif /* ACE_HAS_THR_C_FUNC */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if !defined (ACE_WIN32) // forward decl's class ACE_event_t; @@ -1661,7 +1729,40 @@ namespace ACE_OS { ACE_THR_FUNC_RETURN *status); /** - * @note the "inst" arge is deprecated. It will be ignored. + * Get the thread affinity + * + * @param thr_id For NPTL-threads, when ACE_HAS_PTHREAD_SETAFFINITY_NP + * defined, this is the thread-id. For linux-threads, when + * ACE_HAS_SCHED_SETAFFINITY defined, it expects a process-id. Since for + * linux-threads a thread is seen as a process, it does the job. + * @param cpu_set_size The size of the cpu_mask + * @param cpu_mask Is a bitmask of CPUs to bind to, e.g value 1 binds the + * thread to the "CPU 0", etc + */ + extern ACE_Export + int thr_get_affinity (ACE_hthread_t id, + size_t cpu_set_size, + cpu_set_t * cpu_mask); + + + /** + * Set the thread affinity + * + * @param thr_id For NPTL-threads, when ACE_HAS_PTHREAD_SETAFFINITY_NP + * defined, this is the thread-id. For linux-threads, when + * ACE_HAS_SCHED_SETAFFINITY defined, it expects a process-id. Since for + * linux-threads a thread is seen as a process, it does the job. + * @param cpu_set_size The size of the cpu_mask + * @param cpu_mask Is a bitmask of CPUs to bind to, e.g value 1 binds the + * thread to the "CPU 0", etc + */ + extern ACE_Export + int thr_set_affinity (ACE_hthread_t thr_id, + size_t cpu_set_size, + const cpu_set_t * cpu_mask); + + /** + * @note the "inst" arg is deprecated. It will be ignored. */ extern ACE_Export int thr_key_detach (ACE_thread_key_t key, void * inst); @@ -1823,6 +1924,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + #if !defined (ACE_WIN32) extern "C" @@ -1871,6 +1974,8 @@ extern "C" } ACE_eventdata_t; } +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_event_t * @@ -1907,10 +2012,14 @@ protected: #endif }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 */ #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_OS_Thread_Mutex_Guard * @@ -2003,6 +2112,8 @@ protected: const ACE_OS_Recursive_Thread_Mutex_Guard &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + // used in time and unistd # define ACE_OS_GUARD \ ACE_OS_Thread_Mutex_Guard ace_os_guard__ (*(ACE_thread_mutex_t *) \ diff --git a/ace/OS_NS_Thread.inl b/ace/OS_NS_Thread.inl index d81b0c88966..581e5166ee5 100644 --- a/ace/OS_NS_Thread.inl +++ b/ace/OS_NS_Thread.inl @@ -23,6 +23,8 @@ # include /**/ <sys/priocntl.h> #endif /* ACE_HAS_PRIOCNTL */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /*****************************************************************************/ #if defined (ACE_LACKS_COND_T) && defined (ACE_HAS_THREADS) @@ -42,7 +44,7 @@ ACE_INLINE void **& ACE_TSS_Emulation::tss_base () { -# if defined (VXWORKS) +# if defined (ACE_VXWORKS) return (void **&) taskIdCurrent->ACE_VXWORKS_SPARE; # elif defined (ACE_PSOS) // not supported @@ -51,7 +53,7 @@ ACE_TSS_Emulation::tss_base () # else // Uh oh. ACE_NOTSUP_RETURN (0); -# endif /* VXWORKS */ +# endif /* ACE_VXWORKS */ } # endif /* ! ACE_HAS_THREAD_SPECIFIC_STORAGE */ @@ -83,7 +85,7 @@ ACE_TSS_Emulation::ts_object (const ACE_thread_key_t key) t_getreg (0, PSOS_TASK_REG_TSS, &tss_base); return ((void **) tss_base)[key_index]; # else -# if defined (VXWORKS) +# if defined (ACE_VXWORKS) /* If someone wants tss_base make sure they get one. This gets used if someone spawns a VxWorks task directly, not through ACE. The allocated array will never be deleted! */ @@ -116,10 +118,10 @@ ACE_OS::thr_equal (ACE_thread_t t1, ACE_thread_t t2) { #if defined (ACE_HAS_PTHREADS) # if defined (pthread_equal) - // If it's a macro we can't say "::pthread_equal"... + // If it's a macro we can't say "pthread_equal"... return pthread_equal (t1, t2); # else - return ::pthread_equal (t1, t2); + return pthread_equal (t1, t2); # endif /* pthread_equal */ #elif defined (VXWORKS) return ! ACE_OS::strcmp (t1, t2); @@ -143,9 +145,9 @@ ACE_OS::condattr_destroy (ACE_condattr_t &attributes) # if defined (ACE_HAS_PTHREADS) # if defined (ACE_HAS_PTHREADS_DRAFT4) - ::pthread_condattr_delete (&attributes); + pthread_condattr_delete (&attributes); # else - ::pthread_condattr_destroy (&attributes); + pthread_condattr_destroy (&attributes); # endif /* ACE_HAS_PTHREADS_DRAFT4 */ # elif defined (ACE_HAS_STHREADS) @@ -173,20 +175,20 @@ ACE_OS::condattr_init (ACE_condattr_t &attributes, if ( # if defined (ACE_HAS_PTHREADS_DRAFT4) - ::pthread_condattr_create (&attributes) == 0 + pthread_condattr_create (&attributes) == 0 # elif defined (ACE_HAS_PTHREADS_STD) || defined (ACE_HAS_PTHREADS_DRAFT7) - ACE_ADAPT_RETVAL(::pthread_condattr_init (&attributes), result) == 0 + ACE_ADAPT_RETVAL (pthread_condattr_init (&attributes), result) == 0 # if defined (_POSIX_THREAD_PROCESS_SHARED) && !defined (ACE_LACKS_CONDATTR_PSHARED) - && ACE_ADAPT_RETVAL(::pthread_condattr_setpshared (&attributes, type), - result) == 0 + && ACE_ADAPT_RETVAL (pthread_condattr_setpshared (&attributes, type), + result) == 0 # endif /* _POSIX_THREAD_PROCESS_SHARED && ! ACE_LACKS_CONDATTR_PSHARED */ # else /* this is draft 6 */ - ::pthread_condattr_init (&attributes) == 0 + pthread_condattr_init (&attributes) == 0 # if !defined (ACE_LACKS_CONDATTR_PSHARED) - && ::pthread_condattr_setpshared (&attributes, type) == 0 + && pthread_condattr_setpshared (&attributes, type) == 0 # endif /* ACE_LACKS_CONDATTR_PSHARED */ # if defined (ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP) - && ::pthread_condattr_setkind_np (&attributes, type) == 0 + && pthread_condattr_setkind_np (&attributes, type) == 0 # endif /* ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP */ # endif /* ACE_HAS_PTHREADS_DRAFT4 */ ) @@ -229,10 +231,10 @@ ACE_OS::cond_broadcast (ACE_cond_t *cv) # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) # if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) - ACE_OSCALL_RETURN (::pthread_cond_broadcast (cv), int, -1); + ACE_OSCALL_RETURN (pthread_cond_broadcast (cv), int, -1); # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_broadcast (cv), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_broadcast (cv), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */ @@ -259,10 +261,10 @@ ACE_OS::cond_destroy (ACE_cond_t *cv) # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) # if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) - ACE_OSCALL_RETURN (::pthread_cond_destroy (cv), int, -1); + ACE_OSCALL_RETURN (pthread_cond_destroy (cv), int, -1); # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_destroy (cv), result), int, -1); + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_destroy (cv), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */ # elif defined (ACE_HAS_STHREADS) int result; @@ -293,11 +295,11 @@ ACE_OS::cond_init (ACE_cond_t *cv, if ( # if defined (ACE_HAS_PTHREADS_DRAFT4) - ::pthread_cond_init (cv, attributes) == 0 + pthread_cond_init (cv, attributes) == 0 # elif defined (ACE_HAS_PTHREADS_STD) || defined (ACE_HAS_PTHREADS_DRAFT7) - ACE_ADAPT_RETVAL(::pthread_cond_init (cv, &attributes), result) == 0 + ACE_ADAPT_RETVAL (pthread_cond_init (cv, &attributes), result) == 0 # else /* this is draft 6 */ - ::pthread_cond_init (cv, &attributes) == 0 + pthread_cond_init (cv, &attributes) == 0 # endif /* ACE_HAS_PTHREADS_DRAFT4 */ ) result = 0; @@ -351,10 +353,10 @@ ACE_OS::cond_signal (ACE_cond_t *cv) # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) # if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) - ACE_OSCALL_RETURN (::pthread_cond_signal (cv), int, -1); + ACE_OSCALL_RETURN (pthread_cond_signal (cv), int, -1); # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_signal (cv), result), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_signal (cv), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */ # elif defined (ACE_HAS_STHREADS) @@ -379,10 +381,10 @@ ACE_OS::cond_wait (ACE_cond_t *cv, # if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) # if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) - ACE_OSCALL_RETURN (::pthread_cond_wait (cv, external_mutex), int, -1); + ACE_OSCALL_RETURN (pthread_cond_wait (cv, external_mutex), int, -1); # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cond_wait (cv, external_mutex), result), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cond_wait (cv, external_mutex), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */ # elif defined (ACE_HAS_STHREADS) @@ -419,12 +421,12 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, # if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) if (timeout == 0) - ACE_OSCALL (::pthread_cond_wait (cv, external_mutex), + ACE_OSCALL (pthread_cond_wait (cv, external_mutex), int, -1, result); else { -# if defined (__Lynx__) +# if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR == 3) && (ACE_LYNXOS_MINOR == 0) // Note that we must convert between absolute time (which is // passed as a parameter) and relative time (which is what the // LynxOS pthread_cond_timedwait expects). This differs from 1003.4a @@ -432,20 +434,20 @@ ACE_OS::cond_timedwait (ACE_cond_t *cv, timespec_t relative_time = *timeout - ACE_OS::gettimeofday (); - ACE_OSCALL (::pthread_cond_timedwait (cv, external_mutex, + ACE_OSCALL (pthread_cond_timedwait (cv, external_mutex, &relative_time), int, -1, result); # else - ACE_OSCALL (::pthread_cond_timedwait (cv, external_mutex, + ACE_OSCALL (pthread_cond_timedwait (cv, external_mutex, (ACE_TIMESPEC_PTR) &ts), int, -1, result); -# endif /* __Lynx__ */ +# endif /* ACE_LYNXOS_MAJOR ... */ } # else ACE_OSCALL (ACE_ADAPT_RETVAL (timeout == 0 - ? ::pthread_cond_wait (cv, external_mutex) - : ::pthread_cond_timedwait (cv, external_mutex, + ? pthread_cond_wait (cv, external_mutex) + : pthread_cond_timedwait (cv, external_mutex, (ACE_TIMESPEC_PTR) &ts), result), int, -1, result); @@ -589,9 +591,26 @@ ACE_OS::recursive_mutex_cond_unlock (ACE_recursive_thread_mutex_t *m, // need to release the lock one fewer times than this thread has acquired // it. Remember how many times, and reacquire it that many more times when // the condition is signaled. + // + // For WinCE, the situation is a bit trickier. CE doesn't have + // RecursionCount, and LockCount is not an indicator of recursion on WinCE; + // instead, see when it's unlocked by watching the OwnerThread, which will + // change to something other than the current thread when it's been + // unlocked "enough" times. Note that checking for 0 (unlocked) is not + // sufficient. Another thread may acquire the lock between our unlock and + // checking the OwnerThread. So grab our thread ID value first, then + // compare to it in the loop condition. +# if defined (ACE_HAS_WINCE) + ACE_thread_t me = ACE_OS::thr_self (); +# endif /* ACE_HAS_WINCE */ + state.relock_count_ = 0; while (m->LockCount > 0 -# if !defined (ACE_HAS_WINCE) /* WinCE doesn't have RecursionCount */ +# if defined (ACE_HAS_WINCE) + // Although this is a thread ID, OwnerThread's type is HANDLE. + // Not sure if this is a problem, but it appears to work. + && m->OwnerThread == (HANDLE)me +# else && m->RecursionCount > 1 # endif ) @@ -1292,7 +1311,7 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw, int status; pthread_rwlockattr_t attr; pthread_rwlockattr_init (&attr); -# if !defined(ACE_LACKS_RWLOCKATTR_PSHARED) +# if !defined (ACE_LACKS_RWLOCKATTR_PSHARED) pthread_rwlockattr_setpshared (&attr, (type == USYNC_THREAD ? PTHREAD_PROCESS_PRIVATE : PTHREAD_PROCESS_SHARED)); @@ -1319,6 +1338,10 @@ ACE_OS::sema_destroy (ACE_sema_t *s) ACE_OS_TRACE ("ACE_OS::sema_destroy"); # if defined (ACE_HAS_POSIX_SEM) int result; +# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) + ACE_OS::mutex_destroy (&s->lock_); + ACE_OS::cond_destroy (&s->count_nonzero_); +# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT */ # if defined (ACE_LACKS_NAMED_POSIX_SEM) if (s->name_) { @@ -1406,11 +1429,31 @@ ACE_OS::sema_init (ACE_sema_t *s, { ACE_OS_TRACE ("ACE_OS::sema_init"); #if defined (ACE_HAS_POSIX_SEM) - ACE_UNUSED_ARG (arg); ACE_UNUSED_ARG (max); ACE_UNUSED_ARG (sa); s->name_ = 0; +# if defined (ACE_HAS_POSIX_SEM_TIMEOUT) + ACE_UNUSED_ARG (arg); +# else + int result = -1; + + if (ACE_OS::mutex_init (&s->lock_, type, name, + (ACE_mutexattr_t *) arg) == 0 + && ACE_OS::cond_init (&s->count_nonzero_, (short)type, name, arg) == 0 + && ACE_OS::mutex_lock (&s->lock_) == 0) + { + if (ACE_OS::mutex_unlock (&s->lock_) == 0) + result = 0; + } + + if (result == -1) + { + ACE_OS::mutex_destroy (&s->lock_); + ACE_OS::cond_destroy (&s->count_nonzero_); + return result; + } +# endif /* ACE_HAS_POSIX_SEM_TIMEOUT */ # if defined (ACE_LACKS_NAMED_POSIX_SEM) s->new_sema_ = 0; @@ -1540,7 +1583,7 @@ ACE_OS::sema_init (ACE_sema_t *s, ACE_stat fs; if (ACE_OS::stat (name, &fs)) return -1; - if (!S_ISFIFO(fs.st_mode)) + if (!S_ISFIFO (fs.st_mode)) { // existing file is not a FIFO errno = EEXIST; @@ -1565,23 +1608,23 @@ ACE_OS::sema_init (ACE_sema_t *s, if ((s->fd_[0] = ACE_OS::open (name, O_RDONLY | O_NONBLOCK)) == ACE_INVALID_HANDLE || (s->fd_[1] = ACE_OS::open (name, O_WRONLY | O_NONBLOCK)) == ACE_INVALID_HANDLE) - return(-1); + return (-1); /* turn off nonblocking for fd_[0] */ if ((flags = ACE_OS::fcntl (s->fd_[0], F_GETFL, 0)) < 0) - return(-1); + return (-1); flags &= ~O_NONBLOCK; if (ACE_OS::fcntl (s->fd_[0], F_SETFL, flags) < 0) - return(-1); + return (-1); //if (s->name_ && count) if (creator && count) { char c = 1; - for(u_int i=0; i<count ;++i) - if (ACE_OS::write (s->fd_[1], &c, sizeof(char)) != 1) - return(-1); + for (u_int i=0; i<count ;++i) + if (ACE_OS::write (s->fd_[1], &c, sizeof (char)) != 1) + return (-1); } // In the case of processscope semaphores we can already unlink the FIFO now that @@ -1595,7 +1638,7 @@ ACE_OS::sema_init (ACE_sema_t *s, ACE_OS::unlink (name); } - return(0); + return (0); #elif defined (ACE_HAS_THREADS) # if defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (name); @@ -1783,12 +1826,25 @@ ACE_OS::sema_post (ACE_sema_t *s) { ACE_OS_TRACE ("ACE_OS::sema_post"); # if defined (ACE_HAS_POSIX_SEM) +# if defined (ACE_HAS_POSIX_SEM_TIMEOUT) ACE_OSCALL_RETURN (::sem_post (s->sema_), int, -1); +# else + int result = -1; + + if (ACE_OS::mutex_lock (&s->lock_) == 0) + { + if (::sem_post (s->sema_) == 0) + result = ACE_OS::cond_signal (&s->count_nonzero_); + + ACE_OS::mutex_unlock (&s->lock_); + } + return result; +# endif /* ACE_HAS_POSIX_SEM_TIMEOUT */ # elif defined (ACE_USES_FIFO_SEM) char c = 1; - if (ACE_OS::write (s->fd_[1], &c, sizeof(char)) == sizeof(char)) - return(0); - return(-1); + if (ACE_OS::write (s->fd_[1], &c, sizeof (char)) == sizeof (char)) + return (0); + return (-1); # elif defined (ACE_HAS_THREADS) # if defined (ACE_HAS_STHREADS) int result; @@ -1881,13 +1937,13 @@ ACE_OS::sema_trywait (ACE_sema_t *s) /* turn on nonblocking for s->fd_[0] */ if ((flags = ACE_OS::fcntl (s->fd_[0], F_GETFL, 0)) < 0) - return(-1); + return (-1); flags |= O_NONBLOCK; if (ACE_OS::fcntl (s->fd_[0], F_SETFL, flags) < 0) - return(-1); + return (-1); // read sets errno to EAGAIN if no input - rc = ACE_OS::read (s->fd_[0], &c, sizeof(char)); + rc = ACE_OS::read (s->fd_[0], &c, sizeof (char)); /* turn off nonblocking for fd_[0] */ if ((flags = ACE_OS::fcntl (s->fd_[0], F_GETFL, 0)) >= 0) @@ -2011,9 +2067,9 @@ ACE_OS::sema_wait (ACE_sema_t *s) ACE_OSCALL_RETURN (::sem_wait (s->sema_), int, -1); # elif defined (ACE_USES_FIFO_SEM) char c; - if (ACE_OS::read (s->fd_[0], &c, sizeof(char)) == 1) - return(0); - return(-1); + if (ACE_OS::read (s->fd_[0], &c, sizeof (char)) == 1) + return (0); + return (-1); # elif defined (ACE_HAS_THREADS) # if defined (ACE_HAS_STHREADS) int result; @@ -2131,9 +2187,52 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) errno = ETIME; /* POSIX returns ETIMEDOUT but we need ETIME */ return rc; # else - ACE_UNUSED_ARG (s); - ACE_UNUSED_ARG (tv); - ACE_NOTSUP_RETURN (-1); + int result = 0; + bool expired = false; + ACE_Errno_Guard error (errno); + + ACE_PTHREAD_CLEANUP_PUSH (&s->lock_); + + if (ACE_OS::mutex_lock (&s->lock_) != 0) + result = -2; + else + { + bool finished = true; + do + { + result = ACE_OS::sema_trywait (s); + if (result == -1 && errno == EAGAIN) + expired = ACE_OS::gettimeofday () > tv; + else + expired = false; + + finished = result != -1 || expired || + (result == -1 && errno != EAGAIN); + if (!finished) + { + if (ACE_OS::cond_timedwait (&s->count_nonzero_, + &s->lock_, + &tv) == -1) + { + error = errno; + result = -1; + break; + } + } + } while (!finished); + + if (expired) + error = ETIME; + +# if defined (ACE_LACKS_COND_TIMEDWAIT_RESET) + tv = ACE_OS::gettimeofday (); +# endif /* ACE_LACKS_COND_TIMEDWAIT_RESET */ + } + + if (result != -2) + ACE_OS::mutex_unlock (&s->lock_); + ACE_PTHREAD_CLEANUP_POP (0); + return result < 0 ? -1 : result; # endif /* !ACE_HAS_POSIX_SEM_TIMEOUT */ # elif defined (ACE_USES_FIFO_SEM) int rc; @@ -2158,7 +2257,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) } // try to read the signal *but* do *not* block - if (rc == 1 && ACE_OS::sema_trywait(s) == 0) + if (rc == 1 && ACE_OS::sema_trywait (s) == 0) return (0); // we were woken for input but someone beat us to it @@ -2169,7 +2268,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // make sure errno is set right errno = ETIME; - return(-1); + return (-1); # elif defined (ACE_HAS_THREADS) # if defined (ACE_HAS_STHREADS) ACE_UNUSED_ARG (s); @@ -2319,14 +2418,14 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) // the system call expects). ACE_Time_Value relative_time (tv - ACE_OS::gettimeofday ()); - u_long ticks = relative_time.sec() * KC_TICKS2SEC + + u_long ticks = relative_time.sec () * KC_TICKS2SEC + relative_time.usec () * KC_TICKS2SEC / ACE_ONE_SECOND_IN_USECS; - if(ticks == 0) + if (ticks == 0) ACE_OSCALL_RETURN (::sm_p (s->sema_, SM_NOWAIT, 0), int, -1); //no timeout else ACE_OSCALL_RETURN (::sm_p (s->sema_, SM_WAIT, ticks), int, -1); -# elif defined (VXWORKS) +# elif defined (ACE_VXWORKS) // Note that we must convert between absolute time (which is // passed as a parameter) and relative time (which is what // the system call expects). @@ -2334,7 +2433,7 @@ ACE_OS::sema_wait (ACE_sema_t *s, ACE_Time_Value &tv) int ticks_per_sec = ::sysClkRateGet (); - int ticks = relative_time.sec() * ticks_per_sec + + int ticks = relative_time.sec () * ticks_per_sec + relative_time.usec () * ticks_per_sec / ACE_ONE_SECOND_IN_USECS; if (::semTake (s->sema_, ticks) == ERROR) { @@ -2451,7 +2550,7 @@ ACE_OS::sigwait (sigset_t *sset, int *sig) ACE_UNUSED_ARG (sset); ACE_NOTSUP_RETURN (-1); # elif defined (ACE_HAS_STHREADS) - # if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) + # if (_POSIX_C_SOURCE - 0 >= 199506L) || defined (_POSIX_PTHREAD_SEMANTICS) errno = ::sigwait (sset, sig); return errno == 0 ? *sig : -1; #else @@ -2473,20 +2572,20 @@ ACE_OS::sigwait (sigset_t *sset, int *sig) errno = ::_Psigwait (sset, sig); return errno == 0 ? *sig : -1; # else /* ! __Lynx __ && ! (DIGITAL_UNIX && __DECCXX_VER) */ -# if (defined (ACE_HAS_PTHREADS_DRAFT4) || (defined (ACE_HAS_PTHREADS_DRAFT6)) && !defined(ACE_HAS_FSU_PTHREADS)) || (defined (_UNICOS) && _UNICOS == 9) +# if (defined (ACE_HAS_PTHREADS_DRAFT4) || (defined (ACE_HAS_PTHREADS_DRAFT6)) && !defined (ACE_HAS_FSU_PTHREADS)) || (defined (_UNICOS) && _UNICOS == 9) # if defined (HPUX_10) *sig = cma_sigwait (sset); # else *sig = ::sigwait (sset); # endif /* HPUX_10 */ return *sig; -# elif defined(ACE_HAS_FSU_PTHREADS) +# elif defined (ACE_HAS_FSU_PTHREADS) return ::sigwait (sset, sig); -# elif defined(CYGWIN32) +# elif defined (CYGWIN32) // Cygwin has sigwait definition, but it is not implemented ACE_UNUSED_ARG (sset); ACE_NOTSUP_RETURN (-1); -# elif defined(ACE_TANDEM_T1248_PTHREADS) +# elif defined (ACE_TANDEM_T1248_PTHREADS) errno = ::spt_sigwait (sset, sig); return errno == 0 ? *sig : -1; # else /* this is draft 7 or std */ @@ -2535,12 +2634,24 @@ ACE_OS::thr_cancel (ACE_thread_t thr_id) #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) # if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) - ACE_OSCALL_RETURN (::pthread_cancel (thr_id), int, -1); +# ifdef pthread_cancel + // If it's a macro we can't say "pthread_cancel"... + ACE_OSCALL_RETURN (pthread_cancel (thr_id), int, -1); +# else + ACE_OSCALL_RETURN (pthread_cancel (thr_id), int, -1); +# endif /* pthread_cancel */ # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_cancel (thr_id), - result), - int, -1); +# ifdef pthread_cancel + // If it's a macro we can't say "pthread_cancel"... + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cancel (thr_id), + result), + int, -1); +# else + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_cancel (thr_id), + result), + int, -1); +# endif /* pthread_cancel */ # endif /* ACE_HAS_PTHREADS_DRAFT4 || ACE_HAS_PTHREADS_DRAFT6 */ # elif defined (VXWORKS) ACE_hthread_t tid; @@ -2565,10 +2676,10 @@ ACE_OS::thr_cmp (ACE_hthread_t t1, ACE_hthread_t t2) { #if defined (ACE_HAS_PTHREADS) # if defined (pthread_equal) - // If it's a macro we can't say "::pthread_equal"... + // If it's a macro we can't say "pthread_equal"... return pthread_equal (t1, t2); # else - return ::pthread_equal (t1, t2); + return pthread_equal (t1, t2); # endif /* pthread_equal */ #else /* For STHREADS, WTHREADS, and VXWORKS ... */ // Hum, Do we need to treat WTHREAD differently? @@ -2631,7 +2742,7 @@ ACE_OS::thr_getconcurrency (void) # if defined (ACE_HAS_STHREADS) return ::thr_getconcurrency (); # elif defined (ACE_HAS_PTHREADS) && defined (ACE_HAS_PTHREAD_GETCONCURRENCY) - return ::pthread_getconcurrency (); + return pthread_getconcurrency (); # else ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_STHREADS */ @@ -2651,7 +2762,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy) # if defined (ACE_HAS_PTHREADS_DRAFT4) int result; - result = ::pthread_getprio (ht_id); + result = pthread_getprio (ht_id); if (result != -1) { priority = result; @@ -2664,7 +2775,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy) pthread_attr_t attr; if (pthread_getschedattr (ht_id, &attr) == 0) { - priority = pthread_attr_getprio(&attr); + priority = pthread_attr_getprio (&attr); return 0; } return -1; @@ -2673,7 +2784,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy) struct sched_param param; int result; - ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_getschedparam (ht_id, &policy, ¶m), + ACE_OSCALL (ACE_ADAPT_RETVAL (pthread_getschedparam (ht_id, &policy, ¶m), result), int, -1, result); priority = param.sched_priority; @@ -2687,7 +2798,7 @@ ACE_OS::thr_getprio (ACE_hthread_t ht_id, int &priority, int &policy) priority = ::GetThreadPriority (ht_id); - DWORD priority_class = ::GetPriorityClass (::GetCurrentProcess()); + DWORD priority_class = ::GetPriorityClass (::GetCurrentProcess ()); if (priority_class == 0 && (error = ::GetLastError ()) != NO_ERROR) ACE_FAIL_RETURN (-1); @@ -2790,8 +2901,12 @@ ACE_OS::thr_getspecific (ACE_thread_key_t key, void **data) *data = ACE_TSS_Emulation::ts_object (key); return 0; } -# else /* ACE_HAS_TSS_EMULATION */ +# elif defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) return ACE_OS::thr_getspecific_native (key, data); +#else + ACE_UNUSED_ARG (key); + ACE_UNUSED_ARG (data); + ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_TSS_EMULATION */ #else ACE_UNUSED_ARG (key); @@ -2816,11 +2931,11 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle, int ace_result; # if defined (ACE_LACKS_NULL_PTHREAD_STATUS) void *temp; - ACE_OSCALL (::pthread_join (thr_handle, + ACE_OSCALL (pthread_join (thr_handle, status == 0 ? &temp : status), int, -1, ace_result); # else - ACE_OSCALL (::pthread_join (thr_handle, status), int, -1, ace_result); + ACE_OSCALL (pthread_join (thr_handle, status), int, -1, ace_result); # endif /* ACE_LACKS_NULL_PTHREAD_STATUS */ // Joinable threads need to be detached after joining on Pthreads // draft 4 (at least) to reclaim thread storage. @@ -2831,9 +2946,9 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle, // a junker to scribble on. ACE_thread_t junker; cma_handle_assign (&thr_handle, &junker); - ::pthread_detach (&junker); + pthread_detach (&junker); # else - ::pthread_detach (&thr_handle); + pthread_detach (&thr_handle); # endif /* HPUX_10 */ # endif /* ACE_HAS_PTHREADS_DRAFT4 */ @@ -2841,7 +2956,7 @@ ACE_OS::thr_join (ACE_hthread_t thr_handle, # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_join (thr_handle, status), result), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_join (thr_handle, status), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ # elif defined (ACE_HAS_WTHREADS) @@ -2891,14 +3006,14 @@ ACE_OS::thr_join (ACE_thread_t waiter_id, # if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_HAS_PTHREADS_DRAFT6) # if defined (ACE_LACKS_NULL_PTHREAD_STATUS) void *temp; - ACE_OSCALL_RETURN (::pthread_join (waiter_id, + ACE_OSCALL_RETURN (pthread_join (waiter_id, status == 0 ? &temp : status), int, -1); # else - ACE_OSCALL_RETURN (::pthread_join (waiter_id, status), int, -1); + ACE_OSCALL_RETURN (pthread_join (waiter_id, status), int, -1); # endif # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_join (waiter_id, status), result), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_join (waiter_id, status), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4, 6 */ # elif defined (ACE_HAS_WTHREADS) @@ -2930,13 +3045,13 @@ ACE_OS::thr_kill (ACE_thread_t thr_id, int signum) ACE_OS_TRACE ("ACE_OS::thr_kill"); #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) -# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined(ACE_LACKS_PTHREAD_KILL) +# if defined (ACE_HAS_PTHREADS_DRAFT4) || defined (ACE_LACKS_PTHREAD_KILL) ACE_UNUSED_ARG (signum); ACE_UNUSED_ARG (thr_id); ACE_NOTSUP_RETURN (-1); # else int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_kill (thr_id, signum), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_kill (thr_id, signum), result), int, -1); # endif /* ACE_HAS_PTHREADS_DRAFT4 */ @@ -3078,11 +3193,11 @@ ACE_OS::thr_setcancelstate (int new_state, int *old_state) *old_state = old; return 0; # elif defined (ACE_HAS_PTHREADS_DRAFT6) - ACE_UNUSED_ARG(old_state); + ACE_UNUSED_ARG (old_state); ACE_OSCALL_RETURN (pthread_setintr (new_state), int, -1); # else /* this is draft 7 or std */ int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setcancelstate (new_state, + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setcancelstate (new_state, old_state), result), int, -1); @@ -3115,17 +3230,17 @@ ACE_OS::thr_setcanceltype (int new_type, int *old_type) # if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) # if defined (ACE_HAS_PTHREADS_DRAFT4) int old; - old = pthread_setasynccancel(new_type); + old = pthread_setasynccancel (new_type); if (old == -1) return -1; *old_type = old; return 0; # elif defined (ACE_HAS_PTHREADS_DRAFT6) - ACE_UNUSED_ARG(old_type); + ACE_UNUSED_ARG (old_type); ACE_OSCALL_RETURN (pthread_setintrtype (new_type), int, -1); # else /* this is draft 7 or std */ int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setcanceltype (new_type, + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setcanceltype (new_type, old_type), result), int, -1); @@ -3154,9 +3269,9 @@ ACE_OS::thr_setconcurrency (int hint) int, -1); # elif defined (ACE_HAS_PTHREADS) && defined (ACE_HAS_PTHREAD_SETCONCURRENCY) int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setconcurrency (hint), - result), - int, -1); + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setconcurrency (hint), + result), + int, -1); # else ACE_UNUSED_ARG (hint); ACE_NOTSUP_RETURN (-1); @@ -3178,7 +3293,7 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy) # if defined (ACE_HAS_PTHREADS_DRAFT4) int result; - result = ::pthread_setprio (ht_id, priority); + result = pthread_setprio (ht_id, priority); return (result == -1 ? -1 : 0); # elif defined (ACE_HAS_PTHREADS_DRAFT6) pthread_attr_t attr; @@ -3197,7 +3312,7 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy) // pthread_getschedparam(). if (policy == -1) { - ACE_OSCALL (ACE_ADAPT_RETVAL (::pthread_getschedparam (ht_id, &policy, ¶m), + ACE_OSCALL (ACE_ADAPT_RETVAL (pthread_getschedparam (ht_id, &policy, ¶m), result), int, -1, result); if (result == -1) @@ -3206,7 +3321,7 @@ ACE_OS::thr_setprio (ACE_hthread_t ht_id, int priority, int policy) param.sched_priority = priority; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setschedparam (ht_id, + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_setschedparam (ht_id, policy, ¶m), result), @@ -3271,7 +3386,7 @@ ACE_OS::thr_sigsetmask (int how, // Draft 4 and 6 implementations will sometimes have a sigprocmask () that // modifies the calling thread's mask only. If this is not so for your // platform, define ACE_LACKS_PTHREAD_THR_SIGSETMASK. -# elif defined(ACE_HAS_PTHREADS_DRAFT4) || \ +# elif defined (ACE_HAS_PTHREADS_DRAFT4) || \ defined (ACE_HAS_PTHREADS_DRAFT6) || (defined (_UNICOS) && _UNICOS == 9) ACE_OSCALL_RETURN (::sigprocmask (how, nsm, osm), int, -1); # elif !defined (ACE_LACKS_PTHREAD_SIGMASK) @@ -3284,7 +3399,7 @@ ACE_OS::thr_sigsetmask (int how, /* Don't know if anyt platform actually needs this... */ // as far as I can tell, this is now pthread_sigaction() -- jwr int result; - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_sigaction (how, nsm, osm), + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (pthread_sigaction (how, nsm, osm), result), int, -1); #endif /* 0 */ @@ -3382,9 +3497,9 @@ ACE_OS::thr_testcancel (void) #if defined (ACE_HAS_THREADS) # if defined (ACE_HAS_PTHREADS) && !defined (ACE_LACKS_PTHREAD_CANCEL) #if defined(ACE_HAS_PTHREADS_DRAFT6) - ::pthread_testintr (); + pthread_testintr (); #else /* ACE_HAS_PTHREADS_DRAFT6 */ - ::pthread_testcancel (); + pthread_testcancel (); #endif /* !ACE_HAS_PTHREADS_DRAFT6 */ # elif defined (ACE_HAS_STHREADS) # elif defined (ACE_HAS_WTHREADS) @@ -3406,9 +3521,9 @@ ACE_OS::thr_yield (void) // Note - this is a POSIX.4 function - not a POSIX.1c function... ::sched_yield (); # elif defined (ACE_HAS_PTHREADS_DRAFT6) - ::pthread_yield (0); + pthread_yield (0); # else /* Draft 4 and 7 */ - ::pthread_yield (); + pthread_yield (); # endif /* ACE_HAS_PTHREADS_STD */ # elif defined (ACE_HAS_STHREADS) ::thr_yield (); @@ -3760,3 +3875,5 @@ ACE_Thread_ID::operator!= (const ACE_Thread_ID &rhs) const { return !(*this == rhs); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_arpa_inet.cpp b/ace/OS_NS_arpa_inet.cpp index 6d6ffaeb0ee..94c54edfe4f 100644 --- a/ace/OS_NS_arpa_inet.cpp +++ b/ace/OS_NS_arpa_inet.cpp @@ -9,6 +9,8 @@ ACE_RCSID(ace, OS_NS_arpa_inet, "$Id$") # include "ace/OS_NS_arpa_inet.inl" #endif /* ACE_HAS_INLINED_OS_CALLS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_OS::inet_aton (const char *host_name, struct in_addr *addr) { @@ -34,7 +36,7 @@ ACE_OS::inet_aton (const char *host_name, struct in_addr *addr) addr->s_addr = ip_addr; // Network byte ordered return 1; } -#elif defined (VXWORKS) +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x620) // inet_aton() returns OK (0) on success and ERROR (-1) on failure. // Must reset errno first. Refer to WindRiver SPR# 34949, SPR# 36026 ::errnoSet(0); @@ -66,3 +68,5 @@ ACE_OS::inet_ntoa (const struct in_addr addr) return addrstr; } #endif /* defined (ACE_PSOS) */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_arpa_inet.h b/ace/OS_NS_arpa_inet.h index b6032d61338..9b7a7028975 100644 --- a/ace/OS_NS_arpa_inet.h +++ b/ace/OS_NS_arpa_inet.h @@ -33,6 +33,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION @@ -62,6 +64,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_arpa_inet.inl b/ace/OS_NS_arpa_inet.inl index 31a6b9a3f34..b81b2c88059 100644 --- a/ace/OS_NS_arpa_inet.inl +++ b/ace/OS_NS_arpa_inet.inl @@ -5,6 +5,8 @@ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_stdio.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE unsigned long ACE_OS::inet_addr (const char *name) { @@ -119,3 +121,5 @@ ACE_OS::inet_pton (int family, const char *strptr, void *addrptr) ACE_NOTSUP_RETURN(-1); #endif /* ACE_HAS_IPV6 */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_ctype.h b/ace/OS_NS_ctype.h index e9c04c00311..cb1719ee9c6 100644 --- a/ace/OS_NS_ctype.h +++ b/ace/OS_NS_ctype.h @@ -32,8 +32,9 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS -{ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS { // these are non-standard names... @@ -111,6 +112,8 @@ namespace ACE_OS } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_ctype.inl b/ace/OS_NS_ctype.inl index e0235d5285d..dbda1f48c2b 100644 --- a/ace/OS_NS_ctype.inl +++ b/ace/OS_NS_ctype.inl @@ -1,9 +1,13 @@ // -*- C++ -*- +// // $Id$ #include "ace/os_include/os_ctype.h" #include "ace/os_include/os_wctype.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + ACE_INLINE int ACE_OS::ace_tolower (int c) { @@ -38,3 +42,5 @@ ACE_OS::ace_towupper (wint_t c) #endif } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_dirent.cpp b/ace/OS_NS_dirent.cpp index 57446ce5364..9b58d284683 100644 --- a/ace/OS_NS_dirent.cpp +++ b/ace/OS_NS_dirent.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_dirent.h" @@ -42,6 +41,8 @@ extern "C" # endif /* INVALID_SET_FILE_POINTER */ #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_OS::closedir_emulation (ACE_DIR *d) { @@ -121,7 +122,7 @@ ACE_OS::opendir_emulation (const ACE_TCHAR *filename) #endif /* WIN32 && ACE_LACKS_OPENDIR */ } -dirent * +struct ACE_DIRENT * ACE_OS::readdir_emulation (ACE_DIR *d) { #if defined (ACE_WIN32) && defined (ACE_LACKS_READDIR) @@ -152,8 +153,8 @@ ACE_OS::readdir_emulation (ACE_DIR *d) if (d->current_handle_ != INVALID_HANDLE_VALUE) { - d->dirent_ = (dirent *) - ACE_OS::malloc (sizeof (dirent)); + d->dirent_ = (ACE_DIRENT *) + ACE_OS::malloc (sizeof (ACE_DIRENT)); if (d->dirent_ != 0) { @@ -161,7 +162,7 @@ ACE_OS::readdir_emulation (ACE_DIR *d) ACE_OS::malloc ((ACE_OS::strlen (d->fdata_.cFileName) + 1) * sizeof (ACE_TCHAR)); ACE_OS::strcpy (d->dirent_->d_name, d->fdata_.cFileName); - d->dirent_->d_reclen = sizeof (dirent); + d->dirent_->d_reclen = sizeof (ACE_DIRENT); } return d->dirent_; @@ -176,10 +177,10 @@ ACE_OS::readdir_emulation (ACE_DIR *d) int ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, - dirent **namelist[], - int (*selector) (const dirent *entry), - int (*comparator) (const dirent **f1, - const dirent **f2)) + ACE_DIRENT **namelist[], + int (*selector) (const ACE_DIRENT *entry), + int (*comparator) (const ACE_DIRENT **f1, + const ACE_DIRENT **f2)) { ACE_DIR *dirp = ACE_OS::opendir (dirname); @@ -189,8 +190,8 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, else if (namelist == 0) return -1; - dirent **vector = 0; - dirent *dp; + ACE_DIRENT **vector = 0; + ACE_DIRENT *dp = 0; int arena_size = 0; int nfiles = 0; @@ -207,14 +208,14 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, // If we get here, we have a dirent that the user likes. if (nfiles == arena_size) { - dirent **newv; + ACE_DIRENT **newv = 0; if (arena_size == 0) arena_size = 10; else arena_size *= 2; - newv = (dirent **) ACE_OS::realloc (vector, - arena_size * sizeof (dirent *)); + newv = (ACE_DIRENT **) ACE_OS::realloc (vector, + arena_size * sizeof (ACE_DIRENT *)); if (newv == 0) { fail = 1; @@ -224,12 +225,12 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, } #if defined (ACE_LACKS_STRUCT_DIR) - dirent *newdp = (dirent *) ACE_OS::malloc (sizeof (dirent)); + ACE_DIRENT *newdp = (ACE_DIRENT *) ACE_OS::malloc (sizeof (ACE_DIRENT)); #else size_t dsize = - sizeof (dirent) + + sizeof (ACE_DIRENT) + ((ACE_OS::strlen (dp->d_name) + 1) * sizeof (ACE_TCHAR)); - dirent *newdp = (dirent *) ACE_OS::malloc (dsize); + ACE_DIRENT *newdp = (ACE_DIRENT *) ACE_OS::malloc (dsize); #endif /* ACE_LACKS_STRUCT_DIR */ if (newdp == 0) @@ -256,7 +257,7 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, ACE_OS::strcpy (newdp->d_name, dp->d_name); vector[nfiles++] = newdp; #else - vector[nfiles++] = (dirent *) ACE_OS::memcpy (newdp, dp, dsize); + vector[nfiles++] = (ACE_DIRENT *) ACE_OS::memcpy (newdp, dp, dsize); #endif /* ACE_LACKS_STRUCT_DIR */ } @@ -281,8 +282,10 @@ ACE_OS::scandir_emulation (const ACE_TCHAR *dirname, if (comparator) ACE_OS::qsort (*namelist, nfiles, - sizeof (dirent *), + sizeof (ACE_DIRENT *), (ACE_SCANDIR_COMPARATOR) comparator); return nfiles; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_dirent.h b/ace/OS_NS_dirent.h index c5bf0efd859..6def1696ac0 100644 --- a/ace/OS_NS_dirent.h +++ b/ace/OS_NS_dirent.h @@ -33,6 +33,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION @@ -42,22 +44,22 @@ namespace ACE_OS { ACE_DIR *opendir (const ACE_TCHAR *filename); ACE_NAMESPACE_INLINE_FUNCTION - dirent *readdir (ACE_DIR *); + struct ACE_DIRENT *readdir (ACE_DIR *); ACE_NAMESPACE_INLINE_FUNCTION int readdir_r (ACE_DIR *dirp, - struct dirent *entry, - struct dirent **result); + struct ACE_DIRENT *entry, + struct ACE_DIRENT **result); ACE_NAMESPACE_INLINE_FUNCTION void rewinddir (ACE_DIR *); ACE_NAMESPACE_INLINE_FUNCTION int scandir (const ACE_TCHAR *dirname, - struct dirent **namelist[], - int (*selector) (const struct dirent *filename), - int (*comparator) (const struct dirent **f1, - const struct dirent **f2)); + struct ACE_DIRENT **namelist[], + int (*selector) (const struct ACE_DIRENT *filename), + int (*comparator) (const struct ACE_DIRENT **f1, + const struct ACE_DIRENT **f2)); ACE_NAMESPACE_INLINE_FUNCTION void seekdir (ACE_DIR *, @@ -72,19 +74,21 @@ namespace ACE_OS { extern ACE_Export int scandir_emulation (const ACE_TCHAR *dirname, - dirent **namelist[], - int (*selector)(const dirent *entry), - int (*comparator)(const dirent **f1, - const dirent**f2)); + ACE_DIRENT **namelist[], + int (*selector)(const ACE_DIRENT *entry), + int (*comparator)(const ACE_DIRENT **f1, + const ACE_DIRENT**f2)); extern ACE_Export void closedir_emulation (ACE_DIR *); extern ACE_Export - dirent *readdir_emulation (ACE_DIR *); + struct ACE_DIRENT *readdir_emulation (ACE_DIR *); } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_dirent.inl b/ace/OS_NS_dirent.inl index 7d2b7bfb288..6864e7a949d 100644 --- a/ace/OS_NS_dirent.inl +++ b/ace/OS_NS_dirent.inl @@ -1,10 +1,16 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_Memory.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ + ACE_INLINE void -ACE_OS::closedir (ACE_DIR *d) +closedir (ACE_DIR *d) { #if defined (ACE_HAS_DIRENT) # if defined (ACE_PSOS) @@ -20,6 +26,8 @@ ACE_OS::closedir (ACE_DIR *d) ACE_OS::closedir_emulation (d); delete [] d->directory_name_; delete d; +# elif defined (ACE_HAS_WCLOSEDIR) && defined (ACE_USES_WCHAR) + ::wclosedir (d); # else /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */ ::closedir (d); # endif /* ACE_WIN32 && ACE_LACKS_CLOSEDIR */ @@ -31,13 +39,13 @@ ACE_OS::closedir (ACE_DIR *d) } ACE_INLINE ACE_DIR * -ACE_OS::opendir (const ACE_TCHAR *filename) +opendir (const ACE_TCHAR *filename) { #if defined (ACE_HAS_DIRENT) # if defined (ACE_PSOS) // The pointer to the <ACE_DIR> buffer *must* be passed to // <ACE_OS::closedir> to free it and avoid a memory leak. - ACE_DIR *dir; + ACE_DIR *dir = 0; u_long result; ACE_NEW_RETURN (dir, ACE_DIR, 0); result = ::open_dir (const_cast<ACE_TCHAR *> (filename), &dir->xdir); @@ -51,6 +59,8 @@ ACE_OS::opendir (const ACE_TCHAR *filename) # else /* ! ACE_PSOS */ # if defined (ACE_WIN32) && defined (ACE_LACKS_OPENDIR) return ::ACE_OS::opendir_emulation (filename); +# elif defined (ACE_HAS_WOPENDIR) && defined (ACE_USES_WCHAR) + return ::wopendir (filename); # elif defined (ACE_HAS_NONCONST_OPENDIR) return ::opendir (const_cast<char *> (filename)); # else /* ! ACE_WIN32 && ACE_LACKS_OPENDIR */ @@ -63,8 +73,9 @@ ACE_OS::opendir (const ACE_TCHAR *filename) #endif /* ACE_HAS_DIRENT */ } -ACE_INLINE struct dirent * -ACE_OS::readdir (ACE_DIR *d) +ACE_INLINE +struct ACE_DIRENT * +readdir (ACE_DIR *d) { #if defined (ACE_HAS_DIRENT) # if defined (ACE_PSOS) @@ -81,6 +92,8 @@ ACE_OS::readdir (ACE_DIR *d) # else /* ! ACE_PSOS */ # if defined (ACE_WIN32) && defined (ACE_LACKS_READDIR) return ACE_OS::readdir_emulation (d); +# elif defined (ACE_HAS_WREADDIR) && defined (ACE_USES_WCHAR) + return ::wreaddir (d); # else /* ACE_WIN32 && ACE_LACKS_READDIR */ return ::readdir (d); # endif /* ACE_WIN32 && ACE_LACKS_READDIR */ @@ -92,9 +105,9 @@ ACE_OS::readdir (ACE_DIR *d) } ACE_INLINE int -ACE_OS::readdir_r (ACE_DIR *dirp, - struct dirent *entry, - struct dirent **result) +readdir_r (ACE_DIR *dirp, + struct ACE_DIRENT *entry, + struct ACE_DIRENT **result) { #if !defined (ACE_HAS_REENTRANT_FUNCTIONS) ACE_UNUSED_ARG (entry); @@ -123,7 +136,7 @@ ACE_OS::readdir_r (ACE_DIR *dirp, *result = entry; return ::readdir_r (dirp, entry); #elif defined(__GNUC__) && defined (_AIX) - return ::readdir_r (dirp, entry, result); + return ::readdir_r (dirp, entry, result); # else // <result> had better not be 0! *result = ::readdir_r (dirp, entry); @@ -140,12 +153,14 @@ ACE_OS::readdir_r (ACE_DIR *dirp, } ACE_INLINE void -ACE_OS::rewinddir (ACE_DIR *d) +rewinddir (ACE_DIR *d) { #if defined (ACE_HAS_DIRENT) # if defined (ACE_LACKS_SEEKDIR) # if defined (ACE_LACKS_REWINDDIR) ACE_UNUSED_ARG (d); +# elif defined (ACE_HAS_WREWINDDIR) && defined (ACE_USES_WCHAR) + ::wrewinddir (d); # else /* ! defined (ACE_LACKS_REWINDDIR) */ ::rewinddir (d); # endif /* ! defined (ACE_LACKS_REWINDDIR) */ @@ -160,11 +175,11 @@ ACE_OS::rewinddir (ACE_DIR *d) } ACE_INLINE int -ACE_OS::scandir (const ACE_TCHAR *dirname, - struct dirent **namelist[], - int (*selector)(const struct dirent *), - int (*comparator) (const struct dirent **f1, - const struct dirent **f2)) +scandir (const ACE_TCHAR *dirname, + struct ACE_DIRENT **namelist[], + int (*selector)(const struct ACE_DIRENT *), + int (*comparator) (const struct ACE_DIRENT **f1, + const struct ACE_DIRENT **f2)) { #if defined (ACE_HAS_SCANDIR) return ::scandir (ACE_TEXT_TO_CHAR_IN (dirname), @@ -179,8 +194,9 @@ ACE_OS::scandir (const ACE_TCHAR *dirname, return ACE_OS::scandir_emulation (dirname, namelist, selector, comparator); #endif /* ACE_HAS_SCANDIR */ } + ACE_INLINE void -ACE_OS::seekdir (ACE_DIR *d, long loc) +seekdir (ACE_DIR *d, long loc) { #if defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_SEEKDIR) ::seekdir (d, loc); @@ -191,7 +207,7 @@ ACE_OS::seekdir (ACE_DIR *d, long loc) } ACE_INLINE long -ACE_OS::telldir (ACE_DIR *d) +telldir (ACE_DIR *d) { #if defined (ACE_HAS_DIRENT) && !defined (ACE_LACKS_TELLDIR) return ::telldir (d); @@ -200,3 +216,7 @@ ACE_OS::telldir (ACE_DIR *d) ACE_NOTSUP_RETURN (-1); #endif /* ! ACE_HAS_DIRENT || ACE_LACKS_TELLDIR */ } + +} + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_dlfcn.cpp b/ace/OS_NS_dlfcn.cpp index d0707dde1c2..67cae58a1fe 100644 --- a/ace/OS_NS_dlfcn.cpp +++ b/ace/OS_NS_dlfcn.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_dlfcn.h" diff --git a/ace/OS_NS_dlfcn.h b/ace/OS_NS_dlfcn.h index 6bcaac31488..ac92efbbe46 100644 --- a/ace/OS_NS_dlfcn.h +++ b/ace/OS_NS_dlfcn.h @@ -33,6 +33,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { //@{ @name A set of wrappers for explicit dynamic linking. @@ -53,6 +55,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_dlfcn.inl b/ace/OS_NS_dlfcn.inl index 542660d66d9..74a2159107c 100644 --- a/ace/OS_NS_dlfcn.inl +++ b/ace/OS_NS_dlfcn.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_macros.h" @@ -19,6 +20,8 @@ # include "ace/OS_NS_string.h" #endif /* ACE_USES_ASM_SYMBOL_IN_DLSYM */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::dlclose (ACE_SHLIB_HANDLE handle) { @@ -91,7 +94,7 @@ ACE_OS::dlerror (void) # else return const_cast <char *> (err); # endif /* ACE_USES_WCHAR */ -# elif defined (__hpux) || defined (VXWORKS) +# elif defined (__hpux) || defined (ACE_VXWORKS) ACE_OSCALL_RETURN (::strerror(errno), char *, 0); # elif defined (ACE_WIN32) static ACE_TCHAR buf[128]; @@ -112,32 +115,23 @@ ACE_OS::dlerror (void) # endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ } -# if defined (ACE_HAS_CHARPTR_DL) -typedef ACE_TCHAR * ACE_DL_TYPE; -# else -typedef const ACE_TCHAR * ACE_DL_TYPE; -# endif /* ACE_HAS_CHARPTR_DL */ - ACE_INLINE ACE_SHLIB_HANDLE ACE_OS::dlopen (const ACE_TCHAR *fname, int mode) { ACE_OS_TRACE ("ACE_OS::dlopen"); - // Get the correct OS type. - ACE_DL_TYPE filename = const_cast<ACE_DL_TYPE> (fname); - # if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) void *handle; # if defined (ACE_HAS_SGIDLADD) ACE_OSCALL - (::sgidladd (ACE_TEXT_TO_CHAR_IN (filename), mode), void *, 0, handle); + (::sgidladd (ACE_TEXT_TO_CHAR_IN (fname), mode), void *, 0, handle); # elif defined (_M_UNIX) ACE_OSCALL - (::_dlopen (ACE_TEXT_TO_CHAR_IN (filename), mode), void *, 0, handle); + (::_dlopen (ACE_TEXT_TO_CHAR_IN (fname), mode), void *, 0, handle); # else ACE_OSCALL - (::dlopen (ACE_TEXT_TO_CHAR_IN (filename), mode), void *, 0, handle); + (::dlopen (ACE_TEXT_TO_CHAR_IN (fname), mode), void *, 0, handle); # endif /* ACE_HAS_SGIDLADD */ # if !defined (ACE_HAS_AUTOMATIC_INIT_FINI) if (handle != 0) @@ -160,18 +154,18 @@ ACE_OS::dlopen (const ACE_TCHAR *fname, # elif defined (ACE_WIN32) ACE_UNUSED_ARG (mode); - ACE_WIN32CALL_RETURN (ACE_TEXT_LoadLibrary (filename), ACE_SHLIB_HANDLE, 0); + ACE_WIN32CALL_RETURN (ACE_TEXT_LoadLibrary (fname), ACE_SHLIB_HANDLE, 0); # elif defined (__hpux) # if defined(__GNUC__) || __cplusplus >= 199707L - ACE_OSCALL_RETURN (::shl_load(filename, mode, 0L), ACE_SHLIB_HANDLE, 0); + ACE_OSCALL_RETURN (::shl_load(fname, mode, 0L), ACE_SHLIB_HANDLE, 0); # else - ACE_OSCALL_RETURN (::cxxshl_load(filename, mode, 0L), ACE_SHLIB_HANDLE, 0); + ACE_OSCALL_RETURN (::cxxshl_load(fname, mode, 0L), ACE_SHLIB_HANDLE, 0); # endif /* aC++ vs. Hp C++ */ -# elif defined (VXWORKS) - MODULE* handle; +# elif defined (ACE_VXWORKS) && !defined (__RTP__) + MODULE* handle = 0; // Open readonly - ACE_HANDLE filehandle = ACE_OS::open (filename, + ACE_HANDLE filehandle = ACE_OS::open (fname, O_RDONLY, ACE_DEFAULT_FILE_PERMS); @@ -185,8 +179,8 @@ ACE_OS::dlopen (const ACE_TCHAR *fname, if ( (loaderror != 0) && (handle != 0) ) { // ouch something went wrong most likely unresolved externals - if (handle) - ::unldByModuleId ( handle, 0 ); + if (handle) + ::unldByModuleId ( handle, 0 ); handle = 0; } } @@ -197,7 +191,7 @@ ACE_OS::dlopen (const ACE_TCHAR *fname, } return handle; # else - ACE_UNUSED_ARG (filename); + ACE_UNUSED_ARG (fname); ACE_UNUSED_ARG (mode); ACE_NOTSUP_RETURN (0); # endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ @@ -257,7 +251,7 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle, ACE_OSCALL (::shl_findsym(&_handle, symbolname, TYPE_UNDEFINED, &value), int, -1, status); return status == 0 ? value : 0; -# elif defined (VXWORKS) +# elif defined (ACE_VXWORKS) && !defined (__RTP__) // For now we use the VxWorks global symbol table // which resolves the most recently loaded symbols .. which resolve mostly what we want.. @@ -277,3 +271,5 @@ ACE_OS::dlsym (ACE_SHLIB_HANDLE handle, # endif /* ACE_HAS_SVR4_DYNAMIC_LINKING */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_errno.h b/ace/OS_NS_errno.h index a3fcaabfb7c..740a176f706 100644 --- a/ace/OS_NS_errno.h +++ b/ace/OS_NS_errno.h @@ -33,6 +33,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION @@ -84,6 +86,8 @@ private: # define ACE_ERRNO_TYPE int #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_errno.inl b/ace/OS_NS_errno.inl index 63eaaba1c14..b8d82f3fd24 100644 --- a/ace/OS_NS_errno.inl +++ b/ace/OS_NS_errno.inl @@ -1,8 +1,11 @@ // -*- C++ -*- +// // $Id$ #include "ace/config-all.h" /* Need ACE_TRACE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::last_error (void) { @@ -94,3 +97,5 @@ ACE_CE_Errno::operator= (int x) } #endif /* ACE_HAS_WINCE_BROKEN_ERRNO */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_fcntl.cpp b/ace/OS_NS_fcntl.cpp index 8c69f8b8b51..d0b9e018776 100644 --- a/ace/OS_NS_fcntl.cpp +++ b/ace/OS_NS_fcntl.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_fcntl.h" @@ -14,6 +13,8 @@ ACE_RCSID(ace, OS_NS_fcntl, "$Id$") #include "ace/OS_NS_macros.h" #include "ace/Object_Manager_Base.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_HANDLE ACE_OS::open (const char *filename, int mode, @@ -264,3 +265,5 @@ ACE_OS::open (const wchar_t *filename, sa); #endif /* ACE_WIN32 */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_fcntl.h b/ace/OS_NS_fcntl.h index 08bb4230d73..ac48e0e13e1 100644 --- a/ace/OS_NS_fcntl.h +++ b/ace/OS_NS_fcntl.h @@ -34,6 +34,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION @@ -77,6 +79,8 @@ namespace ACE_OS { LPSECURITY_ATTRIBUTES sa = 0); } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_fcntl.inl b/ace/OS_NS_fcntl.inl index 0e541c90575..6714b0fe389 100644 --- a/ace/OS_NS_fcntl.inl +++ b/ace/OS_NS_fcntl.inl @@ -1,8 +1,11 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::fcntl (ACE_HANDLE handle, int cmd, long arg) { @@ -16,3 +19,5 @@ ACE_OS::fcntl (ACE_HANDLE handle, int cmd, long arg) ACE_OSCALL_RETURN (::fcntl (handle, cmd, arg), int, -1); # endif /* ACE_LACKS_FCNTL */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_math.cpp b/ace/OS_NS_math.cpp index dc009cad8ba..85e2e92c034 100644 --- a/ace/OS_NS_math.cpp +++ b/ace/OS_NS_math.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_math.h" diff --git a/ace/OS_NS_math.h b/ace/OS_NS_math.h index 370a65026f2..55ff1edc2e5 100644 --- a/ace/OS_NS_math.h +++ b/ace/OS_NS_math.h @@ -32,7 +32,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ /// This method computes the largest integral value not greater than x. ACE_NAMESPACE_INLINE_FUNCTION @@ -42,9 +45,10 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION double ceil (double x); - } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_math.inl b/ace/OS_NS_math.inl index 6a55a57480a..0637272006b 100644 --- a/ace/OS_NS_math.inl +++ b/ace/OS_NS_math.inl @@ -1,24 +1,35 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { ACE_INLINE double floor (double x) { // This method computes the largest integral value not greater than x. - return double (static_cast<long> (x)); + if(x > 0) + return static_cast<long> (x); + else if (static_cast<long> (x) == x) + return x; + else + return static_cast<long>(x) - 1; } ACE_INLINE double ceil (double x) { // This method computes the smallest integral value not less than x. - const double floor = ACE_OS::floor (x); - if (floor == x) - return floor; + if (x < 0) + return static_cast<long> (x); + else if (static_cast<long> (x) == x) + return x; else - return floor + 1; + return static_cast<long> (x) + 1; } } // ACE_OS namespace + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_netdb.cpp b/ace/OS_NS_netdb.cpp index 163c33208b4..23add1d1497 100644 --- a/ace/OS_NS_netdb.cpp +++ b/ace/OS_NS_netdb.cpp @@ -17,7 +17,9 @@ ACE_RCSID(ace, OS_NS_netdb, "$Id$") #include "ace/OS_NS_stropts.h" #include "ace/OS_NS_sys_socket.h" -#if defined (VXWORKS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) struct hostent * ACE_OS::gethostbyaddr (const char *addr, int length, int type) @@ -56,6 +58,10 @@ ACE_OS::gethostbyaddr (const char *addr, int length, int type) return &ret; } +#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYADDR */ + +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) + struct hostent * ACE_OS::gethostbyaddr_r (const char *addr, int length, int type, hostent *result, ACE_HOSTENT_DATA buffer, @@ -106,6 +112,10 @@ ACE_OS::gethostbyaddr_r (const char *addr, int length, int type, return result; } +#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYADDR */ + +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) + struct hostent * ACE_OS::gethostbyname (const char *name) { @@ -135,6 +145,10 @@ ACE_OS::gethostbyname (const char *name) return &ret; } +#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYNAME */ + +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) + struct hostent * ACE_OS::gethostbyname_r (const char *name, hostent *result, ACE_HOSTENT_DATA buffer, @@ -183,7 +197,9 @@ ACE_OS::gethostbyname_r (const char *name, hostent *result, return result; } -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS && ACE_LACKS_GETHOSTBYNAME*/ + +ACE_END_VERSIONED_NAMESPACE_DECL // Include if_arp so that getmacaddr can use the // arp structure. @@ -191,6 +207,8 @@ ACE_OS::gethostbyname_r (const char *name, hostent *result, # include /**/ <net/if_arp.h> #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_OS::getmacaddress (struct macaddr_node_t *node) { @@ -307,14 +325,14 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node) (struct sockaddr_in *)&(ar.arp_pa); ACE_OS::memset (&ar, - 0, - sizeof (struct arpreq)); + 0, + sizeof (struct arpreq)); psa->sin_family = AF_INET; ACE_OS::memcpy (&(psa->sin_addr), - *paddrs, - sizeof (struct in_addr)); + *paddrs, + sizeof (struct in_addr)); if (ACE_OS::ioctl (handle, SIOCGARP, @@ -367,9 +385,14 @@ ACE_OS::getmacaddress (struct macaddr_node_t *node) #endif } +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) # include "ace/OS_NS_Thread.h" # include "ace/Object_Manager_Base.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_OS::netdb_acquire (void) { @@ -385,4 +408,8 @@ ACE_OS::netdb_release (void) ACE_OS_Object_Manager::preallocated_object[ ACE_OS_Object_Manager::ACE_OS_MONITOR_LOCK]); } + +ACE_END_VERSIONED_NAMESPACE_DECL + # endif /* defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) */ + diff --git a/ace/OS_NS_netdb.h b/ace/OS_NS_netdb.h index f25d97c9426..ead7b769b3b 100644 --- a/ace/OS_NS_netdb.h +++ b/ace/OS_NS_netdb.h @@ -15,7 +15,7 @@ //============================================================================= #ifndef ACE_OS_NS_NETDB_H -# define ACE_OS_NS_NETDB_H +#define ACE_OS_NS_NETDB_H # include /**/ "ace/pre.h" @@ -33,22 +33,25 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL -#if defined (VXWORKS) - extern ACE_Export +namespace ACE_OS +{ + +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) + extern ACE_Export #else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ struct hostent *gethostbyaddr (const char *addr, int length, int type); -#if defined (VXWORKS) - extern ACE_Export +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR) + extern ACE_Export #else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ struct hostent *gethostbyaddr_r (const char *addr, int length, int type, @@ -56,37 +59,29 @@ namespace ACE_OS { ACE_HOSTENT_DATA buffer, int *h_errnop); -#if defined (VXWORKS) - extern ACE_Export +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) + extern ACE_Export #else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ struct hostent *gethostbyname (const char *name); -#if defined (VXWORKS) - extern ACE_Export +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME) + extern ACE_Export #else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ struct hostent *gethostbyname_r (const char *name, struct hostent *result, ACE_HOSTENT_DATA buffer, int *h_errnop); -#if defined (VXWORKS) - extern ACE_Export -#else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* VXWORKS */ struct hostent *getipnodebyaddr (const void *src, size_t len, int family); -#if defined (VXWORKS) - extern ACE_Export -#else ACE_NAMESPACE_INLINE_FUNCTION -#endif /* VXWORKS */ struct hostent *getipnodebyname (const char *name, int family, int flags = 0); @@ -98,7 +93,7 @@ namespace ACE_OS { unsigned char node[6]; }; - extern ACE_Export + extern ACE_Export int getmacaddress (struct macaddr_node_t *node); ACE_NAMESPACE_INLINE_FUNCTION @@ -128,15 +123,17 @@ namespace ACE_OS { ACE_SERVENT_DATA buf); # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) && defined (ACE_LACKS_NETDB_REENTRANT_FUNCTIONS) - extern ACE_Export + extern ACE_Export int netdb_acquire (void); - extern ACE_Export + extern ACE_Export int netdb_release (void); # endif /* defined (ACE_MT_SAFE) && ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */ } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_netdb.inl b/ace/OS_NS_netdb.inl index fed8aa4ebbb..e1caa25eb6d 100644 --- a/ace/OS_NS_netdb.inl +++ b/ace/OS_NS_netdb.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_macros.h" @@ -39,13 +40,15 @@ # endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ #endif /* ACE_LACKS_NETDB_REENTRANT_FUNCTIONS */ -#if !defined (VXWORKS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)) ACE_INLINE struct hostent * ACE_OS::gethostbyaddr (const char *addr, int length, int type) { ACE_OS_TRACE ("ACE_OS::gethostbyaddr"); -# if defined (ACE_PSOS) +# if defined (ACE_LACKS_GETHOSTBYADDR) ACE_UNUSED_ARG (addr); ACE_UNUSED_ARG (length); ACE_UNUSED_ARG (type); @@ -65,6 +68,10 @@ ACE_OS::gethostbyaddr (const char *addr, int length, int type) # endif /* ACE_HAS_NONCONST_GETBY */ } +#endif + +#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYADDR)) + ACE_INLINE struct hostent * ACE_OS::gethostbyaddr_r (const char *addr, int length, @@ -145,11 +152,15 @@ ACE_OS::gethostbyaddr_r (const char *addr, # endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */ } +#endif + +#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)) + ACE_INLINE struct hostent * ACE_OS::gethostbyname (const char *name) { ACE_OS_TRACE ("ACE_OS::gethostbyname"); -# if defined (ACE_PSOS) +# if defined (ACE_LACKS_GETHOSTBYNAME) ACE_UNUSED_ARG (name); ACE_NOTSUP_RETURN (0); # elif defined (ACE_HAS_NONCONST_GETBY) @@ -163,6 +174,10 @@ ACE_OS::gethostbyname (const char *name) # endif /* ACE_HAS_NONCONST_GETBY */ } +#endif + +#if !(defined (ACE_VXWORKS) && defined (ACE_LACKS_GETHOSTBYNAME)) + ACE_INLINE struct hostent * ACE_OS::gethostbyname_r (const char *name, struct hostent *result, @@ -170,7 +185,7 @@ ACE_OS::gethostbyname_r (const char *name, int *h_errnop) { ACE_OS_TRACE ("ACE_OS::gethostbyname_r"); -#if defined (ACE_PSOS) +#if defined (ACE_LACKS_GETHOSTBYNAME) ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (result); ACE_UNUSED_ARG (buffer); @@ -242,6 +257,8 @@ ACE_OS::gethostbyname_r (const char *name, # endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */ } +#endif + ACE_INLINE struct hostent * ACE_OS::getipnodebyaddr (const void *src, size_t len, int family) { @@ -310,12 +327,10 @@ ACE_OS::getipnodebyname (const char *name, int family, int flags) # endif /* ACE_PSOS */ } -#endif /* ! VXWORKS */ - ACE_INLINE struct protoent * ACE_OS::getprotobyname (const char *name) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) +#if defined (ACE_LACKS_GETPROTOBYNAME) ACE_UNUSED_ARG (name); ACE_NOTSUP_RETURN (0); #elif defined (ACE_HAS_NONCONST_GETBY) @@ -326,7 +341,7 @@ ACE_OS::getprotobyname (const char *name) ACE_SOCKCALL_RETURN (::getprotobyname (name), struct protoent *, 0); -#endif /* VXWORKS */ +#endif /* ACE_LACKS_GETPROTOBYNAME */ } ACE_INLINE struct protoent * @@ -334,7 +349,7 @@ ACE_OS::getprotobyname_r (const char *name, struct protoent *result, ACE_PROTOENT_DATA buffer) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) +#if defined (ACE_LACKS_GETPROTOBYNAME) ACE_UNUSED_ARG (name); ACE_UNUSED_ARG (result); ACE_UNUSED_ARG (buffer); @@ -387,13 +402,13 @@ ACE_OS::getprotobyname_r (const char *name, ACE_INLINE struct protoent * ACE_OS::getprotobynumber (int proto) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) +#if defined (ACE_LACKS_GETPROTOBYNUMBER) ACE_UNUSED_ARG (proto); ACE_NOTSUP_RETURN (0); #else ACE_SOCKCALL_RETURN (::getprotobynumber (proto), struct protoent *, 0); -#endif /* VXWORKS */ +#endif /* ACE_LACKS_GETPROTOBYNUMBER */ } ACE_INLINE struct protoent * @@ -401,7 +416,7 @@ ACE_OS::getprotobynumber_r (int proto, struct protoent *result, ACE_PROTOENT_DATA buffer) { -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) || (defined (ghs) && defined (__Chorus)) || defined (ACE_PSOS) +#if defined (ACE_LACKS_GETPROTOBYNUMBER) ACE_UNUSED_ARG (proto); ACE_UNUSED_ARG (result); ACE_UNUSED_ARG (buffer); @@ -526,3 +541,5 @@ ACE_OS::getservbyname_r (const char *svc, 0); #endif /* defined (ACE_HAS_REENTRANT_FUNCTIONS) && !defined (UNIXWARE) */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_poll.cpp b/ace/OS_NS_poll.cpp index c109c2f097e..5ffdc327eb7 100644 --- a/ace/OS_NS_poll.cpp +++ b/ace/OS_NS_poll.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_poll.h" diff --git a/ace/OS_NS_poll.h b/ace/OS_NS_poll.h index 43fe0a2f2fb..6d8f5c38346 100644 --- a/ace/OS_NS_poll.h +++ b/ace/OS_NS_poll.h @@ -33,9 +33,12 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; -namespace ACE_OS { +namespace ACE_OS +{ ACE_NAMESPACE_INLINE_FUNCTION int poll (struct pollfd *pollfds, @@ -49,6 +52,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_poll.inl b/ace/OS_NS_poll.inl index 8d808fbd6f5..ab1b2d8b54e 100644 --- a/ace/OS_NS_poll.inl +++ b/ace/OS_NS_poll.inl @@ -1,9 +1,12 @@ // -*- C++ -*- +// // $Id$ #include "ace/Time_Value.h" #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::poll (struct pollfd *pollfds, unsigned long len, @@ -38,3 +41,5 @@ ACE_OS::poll (struct pollfd *pollfds, ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_POLL */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_pwd.cpp b/ace/OS_NS_pwd.cpp index 61da06a1e7c..7888142f39f 100644 --- a/ace/OS_NS_pwd.cpp +++ b/ace/OS_NS_pwd.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_pwd.h" diff --git a/ace/OS_NS_pwd.h b/ace/OS_NS_pwd.h index 9c61269f00b..b8360dc3d1d 100644 --- a/ace/OS_NS_pwd.h +++ b/ace/OS_NS_pwd.h @@ -15,7 +15,7 @@ //============================================================================= #ifndef ACE_OS_NS_PWD_H -# define ACE_OS_NS_PWD_H +#define ACE_OS_NS_PWD_H # include /**/ "ace/pre.h" @@ -39,7 +39,10 @@ struct passwd; -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ //@{ @name A set of wrappers for password routines. @@ -64,6 +67,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_pwd.inl b/ace/OS_NS_pwd.inl index 62f5e1813f8..d25d3b2173c 100644 --- a/ace/OS_NS_pwd.inl +++ b/ace/OS_NS_pwd.inl @@ -1,8 +1,11 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Accessors to PWD file. ACE_INLINE void @@ -114,3 +117,5 @@ ACE_OS::setpwent (void) ::setpwent (); #endif /* ! ACE_LACKS_PWD_FUNCTIONS */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_regex.cpp b/ace/OS_NS_regex.cpp index 88fc9f3beb4..dfefedf5231 100644 --- a/ace/OS_NS_regex.cpp +++ b/ace/OS_NS_regex.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_regex.h" diff --git a/ace/OS_NS_regex.h b/ace/OS_NS_regex.h index ac311494088..434224af16e 100644 --- a/ace/OS_NS_regex.h +++ b/ace/OS_NS_regex.h @@ -32,7 +32,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ // non=standard.. //@{ @name A set of wrappers for regular expressions. @@ -48,6 +51,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_regex.inl b/ace/OS_NS_regex.inl index b1f445f0e67..884bd88c718 100644 --- a/ace/OS_NS_regex.inl +++ b/ace/OS_NS_regex.inl @@ -1,9 +1,12 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" #include "ace/os_include/os_regex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE char * ACE_OS::compile (const char *instring, char *expbuf, char *endbuf) { @@ -33,3 +36,4 @@ ACE_OS::step (const char *str, char *expbuf) #endif /* ACE_HAS_REGEX */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_signal.cpp b/ace/OS_NS_signal.cpp index 3dc5e1c56fe..ab65f204095 100644 --- a/ace/OS_NS_signal.cpp +++ b/ace/OS_NS_signal.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_signal.h" @@ -22,3 +21,6 @@ siginfo_t::siginfo_t (ACE_HANDLE *handles) { } #endif /* ACE_HAS_SIGINFO_T */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_signal.h b/ace/OS_NS_signal.h index 74351b3a192..116f86dd2a2 100644 --- a/ace/OS_NS_signal.h +++ b/ace/OS_NS_signal.h @@ -68,6 +68,25 @@ extern "C" } #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// This hack is needed to get around an odd and hard-to-reproduce problem +// with HP aC++. If struct sigaction is defined extern "C" and the sigaction +// function in namespace ACE_OS, the compiler sometimes gets confused. +// If we help it with this typedef, it's fine. User code should not use +// the ACE typedef - it will be removed without warning as soon as we can +// either drop support for the broken compilers or figure out how to reproduce +// it so it can be reported to HP and fixed. +// There's a similar hack in OS_TLI.h for struct t_optmgmt. +// Also see ChangeLog entries: +// Mon Jan 23 16:35:40 UTC 2006 Steve Huston <shuston@riverace.com> +// Mon Jan 23 22:08:56 UTC 2006 Steve Huston <shuston@riverace.com> +#if defined (__HP_aCC) && (__HP_aCC <= 36500) +typedef extern "C" struct sigaction ACE_SIGACTION; +#else +typedef struct sigaction ACE_SIGACTION; +#endif + namespace ACE_OS { //@{ @name A set of wrappers for Signals. @@ -83,8 +102,8 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int sigaction (int signum, - const struct sigaction *nsa, - struct sigaction *osa); + const ACE_SIGACTION *nsa, + ACE_SIGACTION *osa); ACE_NAMESPACE_INLINE_FUNCTION int sigaddset (sigset_t *s, @@ -120,6 +139,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_signal.inl b/ace/OS_NS_signal.inl index a2159ad2604..a56956e4aa0 100644 --- a/ace/OS_NS_signal.inl +++ b/ace/OS_NS_signal.inl @@ -1,28 +1,32 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_macros.h" #include "ace/OS_NS_errno.h" -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ ACE_INLINE int kill (pid_t pid, int signum) { ACE_OS_TRACE ("ACE_OS::kill"); -#if defined (ACE_WIN32) || defined (CHORUS) || defined (ACE_PSOS) +#if defined (ACE_LACKS_KILL) ACE_UNUSED_ARG (pid); ACE_UNUSED_ARG (signum); ACE_NOTSUP_RETURN (-1); #else ACE_OSCALL_RETURN (::kill (pid, signum), int, -1); -#endif /* ACE_WIN32 || CHORUS || ACE_PSOS */ +#endif /* ACE_LACKS_KILL */ } ACE_INLINE int pthread_sigmask (int how, const sigset_t *nsp, sigset_t *osp) { -#if defined (ACE_HAS_PTHREADS_STD) && !defined (ACE_LACKS_PTHREAD_SIGMASK) +#if defined (ACE_HAS_PTHREADS_STD) && !defined (ACE_LACKS_PTHREAD_SIGMASK) int result; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_sigmask (how, nsp, osp), result), @@ -37,7 +41,7 @@ pthread_sigmask (int how, const sigset_t *nsp, sigset_t *osp) } ACE_INLINE int -sigaction (int signum, const struct sigaction *nsa, struct sigaction *osa) +sigaction (int signum, const ACE_SIGACTION *nsa, ACE_SIGACTION *osa) { ACE_OS_TRACE ("ACE_OS::sigaction"); if (signum == 0) @@ -56,8 +60,7 @@ sigaction (int signum, const struct sigaction *nsa, struct sigaction *osa) else osa->sa_handler = ::signal (signum, nsa->sa_handler); return osa->sa_handler == SIG_ERR ? -1 : 0; -#elif defined (CHORUS) || defined (ACE_HAS_WINCE) || defined(ACE_PSOS) - ACE_UNUSED_ARG (signum); +#elif defined (ACE_LACKS_SIGACTION) ACE_UNUSED_ARG (nsa); ACE_UNUSED_ARG (osa); ACE_NOTSUP_RETURN (-1); @@ -271,3 +274,5 @@ sigsuspend (const sigset_t *sigset) } } /* end namespace ACE_OS */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_stdio.cpp b/ace/OS_NS_stdio.cpp index 6e3a45cd926..475abea4487 100644 --- a/ace/OS_NS_stdio.cpp +++ b/ace/OS_NS_stdio.cpp @@ -14,8 +14,10 @@ ACE_RCSID (ace, # if defined (ACE_WIN32) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL OSVERSIONINFO ACE_OS::win32_versioninfo_; HINSTANCE ACE_OS::win32_resource_module_; +ACE_END_VERSIONED_NAMESPACE_DECL # if defined (ACE_HAS_DLL) && (ACE_HAS_DLL == 1) && !defined (ACE_HAS_WINCE) // This function is called by the OS when the ACE DLL is loaded. We @@ -38,6 +40,8 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID) # endif /* ACE_HAS_DLL && ACE_HAS_DLL == 1 */ # endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_OS::ace_flock_t::dump (void) const { @@ -132,9 +136,9 @@ ACE_OS::fopen (const char *filename, if (fd != -1) { # if defined (__BORLANDC__) && !defined (ACE_USES_WCHAR) - FILE *fp = ::_fdopen (fd, const_cast<char *> (mode)); + FILE *fp = ::_fdopen (fd, const_cast<ACE_TCHAR *> (mode)); # elif defined (__BORLANDC__) && defined (ACE_USES_WCHAR) - FILE *fp = ::_wfdopen (fd, const_cast<wchar_t *> (mode)); + FILE *fp = ::_wfdopen (fd, const_cast<ACE_TCHAR *> (mode)); # elif defined (ACE_USES_WCHAR) FILE *fp = ::_wfdopen (fd, mode); # else @@ -390,3 +394,5 @@ ACE_OS::sprintf (wchar_t *buf, const wchar_t *format, ...) # endif /* XPG5 || ACE_HAS_DINKUM_STL */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_stdio.h b/ace/OS_NS_stdio.h index 45d4cc99c3c..450b7ce2ced 100644 --- a/ace/OS_NS_stdio.h +++ b/ace/OS_NS_stdio.h @@ -54,6 +54,8 @@ inline void __ace_clearerr(FILE *stream) # endif /* defined (clearerr) */ # endif /* !ACE_LACKS_CLEARERR */ +#if !defined (ACE_LACKS_CUSERID) && !defined(ACE_HAS_ALT_CUSERID) \ + && !defined(ACE_WIN32) && !defined (VXWORKS) /// Helper for the ACE_OS::cuserid() function /** * On some platforms cuserid is a macro. Defining ACE_OS::cuserid() @@ -68,8 +70,6 @@ inline void __ace_clearerr(FILE *stream) * probably need to move some of it off into some sort of emulation * function. */ -#if !defined (ACE_LACKS_CUSERID) && !defined(ACE_HAS_ALT_CUSERID) \ - && !defined(ACE_WIN32) && !defined (VXWORKS) inline char *ace_cuserid(char *user) { return cuserid(user); @@ -94,6 +94,8 @@ struct flock # endif /* ! VXWORKS */ # endif /* ACE_LACKS_FILELOCKS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { /** @@ -389,6 +391,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_stdio.inl b/ace/OS_NS_stdio.inl index 607d974d972..0f4a460723b 100644 --- a/ace/OS_NS_stdio.inl +++ b/ace/OS_NS_stdio.inl @@ -35,6 +35,8 @@ fileno (FILE *fp) /*****************************************************************************/ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) ACE_INLINE void ACE_OS::flock_adjust_params (ACE_OS::ace_flock_t *lock, @@ -132,7 +134,8 @@ ACE_OS::flock_init (ACE_OS::ace_flock_t *lock, ACE_HANDLE, ACE_INVALID_HANDLE, lock->handle_); - lock->lockname_ = ACE_OS::strdup (name); + if (lock->handle_ != ACE_INVALID_HANDLE) + lock->lockname_ = ACE_OS::strdup (name); return lock->handle_ == ACE_INVALID_HANDLE ? -1 : 0; } else @@ -492,7 +495,7 @@ ACE_INLINE char * ACE_OS::cuserid (char *user, size_t maxlen) { ACE_OS_TRACE ("ACE_OS::cuserid"); -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) ACE_UNUSED_ARG (maxlen); if (user == 0) { @@ -643,8 +646,10 @@ ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode) if (crt_handle != -1) { -# if defined(__BORLANDC__) /* VSB */ - file = ::_fdopen (crt_handle, (char *) mode); +# if defined(ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR) + file = ::_fdopen (crt_handle, const_cast<ACE_TCHAR *> (mode)); +# elif defined (ACE_HAS_NONCONST_FDOPEN) && defined (ACE_USES_WCHAR) + file = ::_wfdopen (crt_handle, const_cast<ACE_TCHAR *> (mode)); # elif defined (ACE_USES_WCHAR) file = ::_wfdopen (crt_handle, mode); # else @@ -743,7 +748,7 @@ ACE_OS::fopen (const wchar_t *filename, const ACE_TCHAR *mode) #else // Non-Windows doesn't use wchar_t file systems. ACE_OSCALL_RETURN - (::fopen (ACE_TEXT_TO_CHAR_IN (filename), + (::fopen (ACE_TEXT_TO_CHAR_IN (filename), ACE_TEXT_TO_CHAR_IN (mode)), FILE*, 0); #endif /* ACE_HAS_WINCE */ } @@ -951,7 +956,7 @@ ACE_OS::rename (const wchar_t *old_name, ACE_UNUSED_ARG (flags); ACE_OSCALL_RETURN (::_wrename (old_name, new_name), int, -1); # else /* ACE_LACKS_RENAME */ - return ACE_OS::rename (ACE_TEXT_TO_CHAR_IN (old_name), + return ACE_OS::rename (ACE_TEXT_TO_CHAR_IN (old_name), ACE_TEXT_TO_CHAR_IN (new_name), flags); # endif /* ACE_LACKS_RENAME */ } @@ -963,8 +968,9 @@ ACE_OS::rewind (FILE *fp) ACE_OS_TRACE ("ACE_OS::rewind"); ::rewind (fp); #else - // In WinCE, "FILE *" is actually a HANDLE. - ::SetFilePointer (fp, 0L, 0L, FILE_BEGIN); + // This isn't perfect since it doesn't reset EOF, but it's probably + // the closest we can get on WINCE. + (void) fseek (fp, 0L, SEEK_SET); #endif /* ACE_HAS_WINCE */ } @@ -980,8 +986,8 @@ ACE_OS::tempnam (const char *dir, const char *pfx) // pSOS only considers the directory prefix ACE_UNUSED_ARG (pfx); ACE_OSCALL_RETURN (::tmpnam (const_cast <char *> (dir)), char *, 0); -#elif (defined (ACE_WIN32) && ((defined (__BORLANDC__) && (__BORLANDC__ < 0x600)) || defined (__DMC__))) - ACE_OSCALL_RETURN (::_tempnam (const_cast <char *> (dir), const_cast<char *> (pfx)), char *, 0); +#elif defined (ACE_HAS_NONCONST_TEMPNAM) + ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::tempnam (const_cast <char *> (dir), const_cast<char *> (pfx)), char *, 0); #else /* ACE_LACKS_TEMPNAM */ ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::tempnam (dir, pfx), char *, 0); #endif /* ACE_LACKS_TEMPNAM */ @@ -996,14 +1002,14 @@ ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx) ACE_UNUSED_ARG (pfx); ACE_NOTSUP_RETURN (0); #elif defined(ACE_WIN32) -# if (defined (__BORLANDC__) && (__BORLANDC__ < 0x600)) || defined (__DMC__) +# if defined (ACE_HAS_NONCONST_TEMPNAM) ACE_OSCALL_RETURN (::_wtempnam (const_cast <wchar_t*> (dir), const_cast <wchar_t*> (pfx)), wchar_t *, 0); # else ACE_OSCALL_RETURN (::_wtempnam (dir, pfx), wchar_t *, 0); # endif // __BORLANDC__ #else // ACE_LACKS_TEMPNAM // No native wide-char support; convert to narrow and call the char* variant. - char *name = ACE_OS::tempnam (ACE_TEXT_TO_CHAR_IN (dir), + char *name = ACE_OS::tempnam (ACE_TEXT_TO_CHAR_IN (dir), ACE_TEXT_TO_CHAR_IN (pfx)); // ACE_OS::tempnam returns a pointer to a malloc()-allocated space. // Convert that string to wide-char and free() the original. @@ -1094,6 +1100,22 @@ ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_lis return vswprintf (buffer, maxlen, format, ap); +# elif defined (ACE_WIN32) + + int result = + ACE_SPRINTF_ADAPTER (::_vsnwprintf (buffer, maxlen, format, ap)); + + // Win32 doesn't regard a full buffer with no 0-terminate as an + // overrun. + if (result == static_cast<int> (maxlen)) + result = -1; + + // Win32 doesn't 0-terminate the string if it overruns maxlen. + if (result == -1) + buffer[maxlen-1] = '\0'; + + return result; + # else ACE_UNUSED_ARG (buffer); @@ -1176,3 +1198,5 @@ ACE_OS::default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES sa, #endif /* ACE_WIN32 */ #endif + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_stdlib.cpp b/ace/OS_NS_stdlib.cpp index 2bb6e1b1070..0da4241875c 100644 --- a/ace/OS_NS_stdlib.cpp +++ b/ace/OS_NS_stdlib.cpp @@ -25,11 +25,13 @@ ACE_RCSID (ace, # include "ace/OS_NS_fcntl.h" # include "ace/OS_NS_ctype.h" # include "ace/OS_NS_sys_time.h" -# if !defined (ACE_HAS_WINCE) && !defined (ACE_VXWORKS) && !defined (max) +# if !defined (ACE_HAS_WINCE) && !(defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x551)) && !defined (max) # include /**/ <limits> # endif #endif /* ACE_LACKS_MKSTEMP */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_EXIT_HOOK ACE_OS::exit_hook_ = 0; void * @@ -335,8 +337,10 @@ ACE_OS::realpath (const char *file_name, dest = rpath; } +#if !defined (ACE_LACKS_SYMLINKS) char expand_buf[PATH_MAX]; // Extra buffer needed to expand symbolic links int nlinks = 0; +#endif while (*file_name) { @@ -622,7 +626,7 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s) // greatly slowing down this mkstemp() implementation. It is more // practical to limit the search space to UTF-8 / ASCII characters // (i.e. 127 characters). -# if defined (ACE_HAS_WINCE) || defined (ACE_VXWORKS) || defined (max) +# if defined (ACE_HAS_WINCE) || (defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x551)) || defined (max) static float const MAX_VAL = static_cast<float> (127); #else static float const MAX_VAL = @@ -685,3 +689,5 @@ ACE_OS::mkstemp_emulation (ACE_TCHAR * s) return ACE_INVALID_HANDLE; } #endif /* ACE_LACKS_MKSTEMP */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_stdlib.h b/ace/OS_NS_stdlib.h index fd3a125790e..1209dce8cf4 100644 --- a/ace/OS_NS_stdlib.h +++ b/ace/OS_NS_stdlib.h @@ -50,6 +50,8 @@ extern "C" { } #endif /* ACE_WIN32 && _MSC_VER */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { /** @name Non-standard functions @@ -248,9 +250,10 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int system (const ACE_TCHAR *s); - } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + #include "ace/OS_NS_stdlib_base.inl" # if defined (ACE_HAS_INLINED_OSCALLS) diff --git a/ace/OS_NS_stdlib.inl b/ace/OS_NS_stdlib.inl index 92ac34984cc..6f6ca83c71f 100644 --- a/ace/OS_NS_stdlib.inl +++ b/ace/OS_NS_stdlib.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/config-all.h" /* Need ACE_TRACE */ @@ -16,6 +17,8 @@ # define ACE_WCHAR_STD_NAMESPACE ACE_STD_NAMESPACE #endif /* ACE_WCHAR_IN_STD_NAMESPACE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Doesn't need a macro since it *never* returns! ACE_INLINE void @@ -133,9 +136,6 @@ ACE_OS::getenv (const char *symbol) #if defined (ACE_LACKS_ENV) ACE_UNUSED_ARG (symbol); ACE_NOTSUP_RETURN (0); -#elif defined (ACE_PSOS) - ACE_UNUSED_ARG (symbol); - ACE_NOTSUP_RETURN (0); #else /* ACE_PSOS */ ACE_OSCALL_RETURN (::getenv (symbol), char *, 0); #endif /* ACE_LACKS_ENV */ @@ -260,7 +260,7 @@ ACE_OS::putenv (const char *string) // WinCE and pSOS don't have the concept of environment variables. ACE_UNUSED_ARG (string); ACE_NOTSUP_RETURN (-1); -#elif defined (ACE_LACKS_ENV) +#elif defined (ACE_LACKS_ENV) || defined (ACE_LACKS_PUTENV) ACE_UNUSED_ARG (string); ACE_NOTSUP_RETURN (0); #else /* ! ACE_HAS_WINCE && ! ACE_PSOS */ @@ -505,7 +505,7 @@ ACE_INLINE int ACE_OS::system (const ACE_TCHAR *s) { // ACE_OS_TRACE ("ACE_OS::system"); -#if defined (CHORUS) || defined (ACE_HAS_WINCE) || defined(ACE_PSOS) +#if defined (ACE_LACKS_SYSTEM) ACE_UNUSED_ARG (s); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_WIN32) && defined (ACE_USES_WCHAR) @@ -514,5 +514,7 @@ ACE_OS::system (const ACE_TCHAR *s) ACE_OSCALL_RETURN (::spt_system (s), int, -1); #else ACE_OSCALL_RETURN (::system (ACE_TEXT_TO_CHAR_IN (s)), int, -1); -#endif /* !CHORUS */ +#endif /* ACE_LACKS_SYSTEM */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_string.cpp b/ace/OS_NS_string.cpp index 15fa83612f1..e3ef64988b3 100644 --- a/ace/OS_NS_string.cpp +++ b/ace/OS_NS_string.cpp @@ -18,6 +18,8 @@ ACE_RCSID (ace, # include "ace/OS_NS_stdio.h" #endif /* ACE_LACKS_STRERROR */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if !defined (ACE_HAS_MEMCHR) const void * ACE_OS::memchr_emulation (const void *s, int c, size_t len) @@ -118,7 +120,7 @@ ACE_OS::strerror (int errnum) ACE_Errno_Guard g (errno); errno = 0; char *errmsg = ::strerror (errnum); - if (errno == EINVAL || ACE_OS::strlen (errmsg) == 0) + if (errno == EINVAL || errmsg == 0 || errmsg[0] == 0) { ACE_OS::sprintf (ret_errortext, "Unknown error %d", errnum); errmsg = ret_errortext; @@ -399,3 +401,6 @@ ACE_OS::strtok_r_emulation (wchar_t *s, return s ; } # endif /* ACE_LACKS_WCSTOK */ + + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_string.h b/ace/OS_NS_string.h index f6a3945d271..8751b39b89a 100644 --- a/ace/OS_NS_string.h +++ b/ace/OS_NS_string.h @@ -15,7 +15,7 @@ //============================================================================= #ifndef ACE_OS_NS_STRING_H -# define ACE_OS_NS_STRING_H +#define ACE_OS_NS_STRING_H # include /**/ "ace/pre.h" @@ -31,6 +31,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { /** @name Functions from <cstring> @@ -70,6 +72,7 @@ namespace ACE_OS { * On certain platforms this results in better performance. * This is determined and set via autoconf. */ + extern ACE_Export void *fast_memcpy (void *t, const void *s, size_t len); #endif @@ -97,7 +100,8 @@ namespace ACE_OS { /// Finds the first occurance of a character in a string (const wchar_t /// version). ACE_NAMESPACE_INLINE_FUNCTION - const wchar_t *strchr (const wchar_t *s, wint_t c); + + const wchar_t *strchr (const wchar_t *s, wchar_t c); /// Finds the first occurance of a character in a string (char version). ACE_NAMESPACE_INLINE_FUNCTION @@ -105,7 +109,8 @@ namespace ACE_OS { /// Finds the first occurance of a character in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - wchar_t *strchr (wchar_t *s, wint_t c); + + wchar_t *strchr (wchar_t *s, wchar_t c); /// Copies a string (char version). ACE_NAMESPACE_INLINE_FUNCTION @@ -126,10 +131,19 @@ namespace ACE_OS { size_t strcspn (const wchar_t *s, const wchar_t *reject); /// Returns a malloced duplicated string (char version). + //ACE_NAMESPACE_INLINE_FUNCTION extern ACE_Export char *strdup (const char *s); + /* + #if (defined (ACE_LACKS_STRDUP) && !defined(ACE_STRDUP_EQUIVALENT)) \ + || defined (ACE_HAS_STRDUP_EMULATION) + extern ACE_Export + char *strdup_emulation (const char *s); + #endif + */ /// Returns a malloced duplicated string (wchar_t version). + //ACE_NAMESPACE_INLINE_FUNCTION extern ACE_Export wchar_t *strdup (const wchar_t *s); @@ -173,6 +187,7 @@ namespace ACE_OS { /// Finds the first occurance of a character in an array (const wchar_t /// version). extern ACE_Export + const wchar_t *strnchr (const wchar_t *s, wint_t c, size_t len); /// Finds the first occurance of a character in an array (char version). @@ -181,6 +196,7 @@ namespace ACE_OS { /// Finds the first occurance of a character in an array (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION + wchar_t *strnchr (wchar_t *s, wint_t c, size_t len); /// Compares two arrays (char version). @@ -266,7 +282,8 @@ namespace ACE_OS { /// Finds the last occurance of a character in a string (const wchar_t /// version). ACE_NAMESPACE_INLINE_FUNCTION - const wchar_t *strrchr (const wchar_t *s, wint_t c); + + const wchar_t *strrchr (const wchar_t *s, wchar_t c); /// Finds the last occurance of a character in a string (char version). ACE_NAMESPACE_INLINE_FUNCTION @@ -274,7 +291,8 @@ namespace ACE_OS { /// Finds the last occurance of a character in a string (wchar_t version). ACE_NAMESPACE_INLINE_FUNCTION - wchar_t *strrchr (wchar_t *s, wint_t c); + + wchar_t *strrchr (wchar_t *s, wchar_t c); #if defined (ACE_LACKS_STRRCHR) /// Emulated strrchr (char version) - Finds the last occurance of a @@ -397,7 +415,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ -#include "ace/OS_NS_string_base.h" + +ACE_END_VERSIONED_NAMESPACE_DECL # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) diff --git a/ace/OS_NS_string.inl b/ace/OS_NS_string.inl index 38d465820e4..557dd7e0d27 100644 --- a/ace/OS_NS_string.inl +++ b/ace/OS_NS_string.inl @@ -7,6 +7,8 @@ #include "ace/OS_NS_wchar.h" #include "ace/os_include/os_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE const void * ACE_OS::memchr (const void *s, int c, size_t len) { @@ -80,7 +82,7 @@ ACE_OS::strchr (const char *s, int c) } ACE_INLINE const wchar_t * -ACE_OS::strchr (const wchar_t *s, wint_t c) +ACE_OS::strchr (const wchar_t *s, wchar_t c) { # if defined (ACE_LACKS_WCSCHR) return ACE_OS::wcschr_emulation (s, c); @@ -96,10 +98,10 @@ ACE_OS::strchr (char *s, int c) } ACE_INLINE wchar_t * -ACE_OS::strchr (wchar_t *s, wint_t c) +ACE_OS::strchr (wchar_t *s, wchar_t c) { return - const_cast<wchar_t *> (ACE_OS::strchr (static_cast<const wchar_t *> (s), + const_cast<wchar_t *> (ACE_OS::strchr (const_cast<const wchar_t *> (s), c)); } @@ -273,7 +275,7 @@ ACE_INLINE wchar_t * ACE_OS::strpbrk (wchar_t *s, const wchar_t *t) { return const_cast<wchar_t *> (ACE_OS::strpbrk ( - static_cast<const wchar_t *> (s), t)); + const_cast<const wchar_t *> (s), t)); } ACE_INLINE const char * @@ -287,12 +289,12 @@ ACE_OS::strrchr (const char *s, int c) } ACE_INLINE const wchar_t * -ACE_OS::strrchr (const wchar_t *s, wint_t c) +ACE_OS::strrchr (const wchar_t *s, wchar_t c) { #if defined (ACE_LACKS_WCSRCHR) return ACE_OS::wcsrchr_emulation (s, c); #else /* ! ACE_LACKS_WCSRCHR */ - return (const wchar_t *) ::wcsrchr (s, c); + return const_cast <const wchar_t *> (::wcsrchr (s, c)); #endif /* ! ACE_LACKS_WCSRCHR */ } @@ -307,10 +309,10 @@ ACE_OS::strrchr (char *s, int c) } ACE_INLINE wchar_t * -ACE_OS::strrchr (wchar_t *s, wint_t c) +ACE_OS::strrchr (wchar_t *s, wchar_t c) { return const_cast<wchar_t *> (ACE_OS::strrchr ( - static_cast<const wchar_t *> (s), c)); + const_cast<const wchar_t *> (s), c)); } ACE_INLINE size_t @@ -345,9 +347,9 @@ ACE_OS::strstr (const wchar_t *s, const wchar_t *t) # if defined (ACE_LACKS_WCSSTR) return ACE_OS::wcsstr_emulation (s, t); # elif defined (HPUX) - return (const wchar_t *) ::wcswcs (s, t); + return const_cast <const wchar_t *> (::wcswcs (s, t)); # else /* ACE_LACKS_WCSSTR */ - return (const wchar_t *) ::wcsstr (s, t); + return const_cast <const wchar_t *> (::wcsstr (s, t)); # endif /* ACE_LACKS_WCSSTR */ } @@ -414,3 +416,6 @@ ACE_OS::strtok_r (wchar_t *s, const wchar_t *tokens, wchar_t **lasts) # endif /* ACE_HAS_3_PARAM_WCSTOK */ #endif /* ACE_LACKS_WCSTOK */ } + + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_strings.cpp b/ace/OS_NS_strings.cpp index 67ca3a809b8..50c5630c9d2 100644 --- a/ace/OS_NS_strings.cpp +++ b/ace/OS_NS_strings.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_strings.h" @@ -13,6 +12,8 @@ ACE_RCSID(ace, OS_NS_strings, "$Id$") # include "ace/OS_NS_ctype.h" #endif /* ACE_LACKS_STRCASECMP */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_LACKS_STRCASECMP) int ACE_OS::strcasecmp_emulation (const char *s, const char *t) @@ -79,3 +80,5 @@ ACE_OS::strncasecmp_emulation (const char *s, return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_tolower (*scan2); } #endif /* ACE_LACKS_STRCASECMP */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_strings.h b/ace/OS_NS_strings.h index f52eb603661..e834afac831 100644 --- a/ace/OS_NS_strings.h +++ b/ace/OS_NS_strings.h @@ -15,7 +15,7 @@ //============================================================================= #ifndef ACE_OS_NS_STRINGS_H -# define ACE_OS_NS_STRINGS_H +#define ACE_OS_NS_STRINGS_H # include /**/ "ace/pre.h" @@ -33,9 +33,12 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; -namespace ACE_OS { +namespace ACE_OS +{ /// Compares two strings (case insensitive const char version). ACE_NAMESPACE_INLINE_FUNCTION @@ -65,6 +68,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_strings.inl b/ace/OS_NS_strings.inl index 115489ea9f5..4e5d0f40dc0 100644 --- a/ace/OS_NS_strings.inl +++ b/ace/OS_NS_strings.inl @@ -1,8 +1,11 @@ // -*- C++ -*- +// // $Id$ # include "ace/OS_NS_wchar.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::strcasecmp (const char *s, const char *t) { @@ -47,3 +50,4 @@ ACE_OS::strncasecmp (const wchar_t *s, const wchar_t *t, size_t len) #endif /* ACE_LACKS_WCSNICMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_stropts.cpp b/ace/OS_NS_stropts.cpp index a8f4710a1f7..f19056ec381 100644 --- a/ace/OS_NS_stropts.cpp +++ b/ace/OS_NS_stropts.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_stropts.h" @@ -9,6 +8,8 @@ ACE_RCSID(ace, OS_NS_stropts, "$Id$") # include "ace/OS_NS_stropts.inl" #endif /* ACE_HAS_INLINED_OS_CALLS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_OS::ioctl (ACE_HANDLE socket, unsigned long io_control_code, @@ -46,7 +47,7 @@ ACE_OS::ioctl (ACE_HANDLE socket, # endif /* ACE_HAS_WINSOCK2 */ } -#if !defined (ACE_HAS_WINCE) +#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) int ACE_OS::ioctl (ACE_HANDLE socket, unsigned long io_control_code, @@ -189,4 +190,6 @@ ACE_OS::ioctl (ACE_HANDLE socket, ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_WINSOCK2 */ } -#endif /* ACE_HAS_WINCE */ +#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_stropts.h b/ace/OS_NS_stropts.h index 9b1f6fc2f56..ce9a6ba23ba 100644 --- a/ace/OS_NS_stropts.h +++ b/ace/OS_NS_stropts.h @@ -15,7 +15,7 @@ //============================================================================= #ifndef ACE_OS_NS_STROPTS_H -# define ACE_OS_NS_STROPTS_H +#define ACE_OS_NS_STROPTS_H # include /**/ "ace/pre.h" @@ -38,6 +38,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) typedef WSAPROTOCOL_INFO ACE_Protocol_Info; @@ -113,7 +115,7 @@ namespace ACE_OS { void * = 0); /// QoS-enabled <ioctl>. - extern ACE_Export + extern ACE_Export int ioctl (ACE_HANDLE socket, unsigned long io_control_code, void *in_buffer_p, @@ -124,10 +126,10 @@ namespace ACE_OS { ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func); -#if !defined (ACE_HAS_WINCE) +#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) /// QoS-enabled <ioctl> when the I/O control code is either /// SIO_SET_QOS or SIO_GET_QOS. - extern ACE_Export + extern ACE_Export int ioctl (ACE_HANDLE socket, unsigned long io_control_code, ACE_QoS &ace_qos, @@ -136,7 +138,7 @@ namespace ACE_OS { unsigned long buffer = 0, ACE_OVERLAPPED *overlapped = 0, ACE_OVERLAPPED_COMPLETION_FUNC func = 0); -#endif /* ACE_HAS_WINCE */ +#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */ ACE_NAMESPACE_INLINE_FUNCTION int isastream (ACE_HANDLE handle); @@ -156,6 +158,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_stropts.inl b/ace/OS_NS_stropts.inl index 38663c67cba..59f1035074e 100644 --- a/ace/OS_NS_stropts.inl +++ b/ace/OS_NS_stropts.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/os_include/os_errno.h" @@ -8,6 +9,8 @@ #include "ace/OS_Memory.h" #include "ace/OS_QoS.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_LACKS_CONST_STRBUF_PTR) typedef struct strbuf *ACE_STRBUF_TYPE; #else @@ -111,7 +114,7 @@ ACE_OS::ioctl (ACE_HANDLE handle, #if defined (ACE_WIN32) ACE_SOCKET sock = (ACE_SOCKET) handle; ACE_SOCKCALL_RETURN (::ioctlsocket (sock, cmd, reinterpret_cast<unsigned long *> (val)), int, -1); -#elif defined (VXWORKS) +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x620) ACE_OSCALL_RETURN (::ioctl (handle, cmd, reinterpret_cast<int> (val)), int, -1); #elif defined (ACE_PSOS) @@ -196,3 +199,5 @@ ACE_OS::putpmsg (ACE_HANDLE handle, return ACE_OS::putmsg (handle, ctl, data, flags); #endif /* ACE_HAS_STREAM_PIPES */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_mman.cpp b/ace/OS_NS_sys_mman.cpp index 5a9c10ce148..5b1f5712186 100644 --- a/ace/OS_NS_sys_mman.cpp +++ b/ace/OS_NS_sys_mman.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_mman.h" diff --git a/ace/OS_NS_sys_mman.h b/ace/OS_NS_sys_mman.h index 1ce8939525f..6315c32bbff 100644 --- a/ace/OS_NS_sys_mman.h +++ b/ace/OS_NS_sys_mman.h @@ -35,7 +35,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ //@{ @name A set of wrappers for memory mapped files. ACE_NAMESPACE_INLINE_FUNCTION @@ -80,6 +83,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_mman.inl b/ace/OS_NS_sys_mman.inl index f199ee118c8..0379ca02468 100644 --- a/ace/OS_NS_sys_mman.inl +++ b/ace/OS_NS_sys_mman.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_fcntl.h" @@ -11,6 +12,8 @@ # include "ace/OS_NS_sys_stat.h" #endif /* __Lynx__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_VOIDPTR_MMAP) // Needed for some odd OS's (e.g., SGI). typedef void *ACE_MMAP_TYPE; @@ -326,3 +329,4 @@ ACE_OS::shm_unlink (const ACE_TCHAR *path) # endif /* ACE_HAS_SHM_OPEN */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_msg.cpp b/ace/OS_NS_sys_msg.cpp index 917121a8680..328f3ec6975 100644 --- a/ace/OS_NS_sys_msg.cpp +++ b/ace/OS_NS_sys_msg.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_msg.h" diff --git a/ace/OS_NS_sys_msg.h b/ace/OS_NS_sys_msg.h index 37b4743d43b..4dcd9be5461 100644 --- a/ace/OS_NS_sys_msg.h +++ b/ace/OS_NS_sys_msg.h @@ -33,6 +33,8 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { //@{ @name A set of wrappers for System V message queues. @@ -61,6 +63,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_msg.inl b/ace/OS_NS_sys_msg.inl index 7f71a4a75cc..129b4c389c1 100644 --- a/ace/OS_NS_sys_msg.inl +++ b/ace/OS_NS_sys_msg.inl @@ -1,8 +1,11 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::msgctl (int msqid, int cmd, struct msqid_ds *val) { @@ -71,3 +74,5 @@ ACE_OS::msgsnd (int int_id, const void *buf, size_t len, int flags) ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_SYSV_IPC */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_resource.cpp b/ace/OS_NS_sys_resource.cpp index 3499e4bfc5c..44a1e9584c0 100644 --- a/ace/OS_NS_sys_resource.cpp +++ b/ace/OS_NS_sys_resource.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_resource.h" diff --git a/ace/OS_NS_sys_resource.h b/ace/OS_NS_sys_resource.h index 7486dd2a1c7..3c73ad0ab9d 100644 --- a/ace/OS_NS_sys_resource.h +++ b/ace/OS_NS_sys_resource.h @@ -33,7 +33,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ ACE_NAMESPACE_INLINE_FUNCTION int getrlimit (int resource, @@ -50,6 +53,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_resource.inl b/ace/OS_NS_sys_resource.inl index ea6fc92849d..50d696b2059 100644 --- a/ace/OS_NS_sys_resource.inl +++ b/ace/OS_NS_sys_resource.inl @@ -1,9 +1,12 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::getrlimit (int resource, struct rlimit *rl) { @@ -52,8 +55,8 @@ ACE_OS::getrusage (int who, struct rusage *ru) # endif /* ACE_HAS_RUSAGE_WHO_ENUM */ # endif /* ACE_WIN32 */ #else - who = who; - ru = ru; + ACE_UNUSED_ARG (who); + ACE_UNUSED_ARG (ru); ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_SYSCALL_GETRUSAGE */ } @@ -76,9 +79,9 @@ ACE_OS::setrlimit (int resource, const struct rlimit *rl) ), int, -1); # else ACE_OSCALL_RETURN (::setrlimit ((ACE_HAS_RLIMIT_RESOURCE_ENUM) resource, - resource, + rl ), int, -1); -# endif /* ACE_HAS_NONCONST_SETRLIMIT */ +# endif /* ACE_HAS_NONCONST_SETRLIMIT */ # else /* ACE_HAS_RLIMIT_RESOURCE_ENUM */ # if defined (ACE_HAS_NONCONST_SETRLIMIT) ACE_OSCALL_RETURN (::setrlimit (resource, const_cast<struct rlimit *>(rl) @@ -86,7 +89,8 @@ ACE_OS::setrlimit (int resource, const struct rlimit *rl) # else ACE_OSCALL_RETURN (::setrlimit (resource, rl), int, -1); # endif /* ACE_HAS_NONCONST_SETRLIMIT */ -# endif /* ACE_HAS_RLIMIT_RESOURCE_ENUM */ +# endif /* ACE_HAS_RLIMIT_RESOURCE_ENUM */ #endif /* ACE_LACKS_RLIMIT */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_select.cpp b/ace/OS_NS_sys_select.cpp index fb2bc11b1b2..eafd1f2caae 100644 --- a/ace/OS_NS_sys_select.cpp +++ b/ace/OS_NS_sys_select.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_select.h" diff --git a/ace/OS_NS_sys_select.h b/ace/OS_NS_sys_select.h index 1a33c485e56..443d594ae09 100644 --- a/ace/OS_NS_sys_select.h +++ b/ace/OS_NS_sys_select.h @@ -40,10 +40,12 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -class ACE_Time_Value; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL -namespace ACE_OS { +class ACE_Time_Value; +namespace ACE_OS +{ // Should be moved to cpp or inl. ACE_NAMESPACE_INLINE_FUNCTION int select (int width, @@ -61,6 +63,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_select.inl b/ace/OS_NS_sys_select.inl index a46dc4bc800..11d1fba8cae 100644 --- a/ace/OS_NS_sys_select.inl +++ b/ace/OS_NS_sys_select.inl @@ -1,10 +1,13 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_macros.h" #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // It would be really cool to add another version of select that would // function like the one we're defending against below! ACE_INLINE int @@ -16,7 +19,7 @@ ACE_OS::select (int width, #if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL) // We must defend against non-conformity! timeval copy; - timeval *timep; + timeval *timep = 0; if (timeout != 0) { @@ -76,3 +79,4 @@ ACE_OS::select (int width, #undef ___ACE_TIMEOUT } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_shm.cpp b/ace/OS_NS_sys_shm.cpp index 5feb509e5db..16b10605b82 100644 --- a/ace/OS_NS_sys_shm.cpp +++ b/ace/OS_NS_sys_shm.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_shm.h" diff --git a/ace/OS_NS_sys_shm.h b/ace/OS_NS_sys_shm.h index de1214a9bb1..df39efdfd60 100644 --- a/ace/OS_NS_sys_shm.h +++ b/ace/OS_NS_sys_shm.h @@ -33,12 +33,15 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ //@{ @name A set of wrappers for System V shared memory. ACE_NAMESPACE_INLINE_FUNCTION void *shmat (int int_id, - void *shmaddr, + const void *shmaddr, int shmflg); ACE_NAMESPACE_INLINE_FUNCTION @@ -47,7 +50,7 @@ namespace ACE_OS { struct shmid_ds *buf); ACE_NAMESPACE_INLINE_FUNCTION - int shmdt (void *shmaddr); + int shmdt (const void *shmaddr); ACE_NAMESPACE_INLINE_FUNCTION int shmget (key_t key, @@ -57,6 +60,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_shm.inl b/ace/OS_NS_sys_shm.inl index 1df7d9c7764..ef7fef59847 100644 --- a/ace/OS_NS_sys_shm.inl +++ b/ace/OS_NS_sys_shm.inl @@ -1,14 +1,21 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE void * -ACE_OS::shmat (int int_id, void *shmaddr, int shmflg) +ACE_OS::shmat (int int_id, const void *shmaddr, int shmflg) { ACE_OS_TRACE ("ACE_OS::shmat"); #if defined (ACE_HAS_SYSV_IPC) - ACE_OSCALL_RETURN (::shmat (int_id, static_cast <char *> (shmaddr), shmflg), void *, (void *) -1); +# if defined (ACE_HAS_CHARPTR_SHMAT) + ACE_OSCALL_RETURN (::shmat (int_id, static_cast <char*> (const_cast <void *>(shmaddr)), shmflg), void *, (void *) -1); +# else + ACE_OSCALL_RETURN (::shmat (int_id, shmaddr, shmflg), void *, (void *) -1); +# endif /* ACE_HAS_CHARPTR_SHMAT */ #else ACE_UNUSED_ARG (int_id); ACE_UNUSED_ARG (shmaddr); @@ -34,11 +41,16 @@ ACE_OS::shmctl (int int_id, int cmd, struct shmid_ds *buf) } ACE_INLINE int -ACE_OS::shmdt (void *shmaddr) +ACE_OS::shmdt (const void *shmaddr) { ACE_OS_TRACE ("ACE_OS::shmdt"); #if defined (ACE_HAS_SYSV_IPC) - ACE_OSCALL_RETURN (::shmdt ((char *) shmaddr), int, -1); +# if defined (ACE_HAS_CHARPTR_SHMDT) + ACE_OSCALL_RETURN (::shmdt ( + static_cast <char*> (const_cast <void *>(shmaddr))), int, -1); +# else + ACE_OSCALL_RETURN (::shmdt (shmaddr), int, -1); +# endif /* ACE_HAS_CHARPTR_SHMDT */ #else ACE_UNUSED_ARG (shmaddr); @@ -60,3 +72,5 @@ ACE_OS::shmget (key_t key, size_t size, int flags) ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_SYSV_IPC */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_socket.cpp b/ace/OS_NS_sys_socket.cpp index 78ea8a5fcfd..f0ff6acc5d7 100644 --- a/ace/OS_NS_sys_socket.cpp +++ b/ace/OS_NS_sys_socket.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_socket.h" @@ -9,11 +8,13 @@ ACE_RCSID(ace, OS_NS_sys_socket, "$Id$") # include "ace/OS_NS_sys_socket.inl" #endif /* ACE_HAS_INLINED_OS_CALLS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) int ACE_OS::socket_initialized_; #endif /* ACE_WIN32 */ -#if !defined (ACE_HAS_WINCE) +#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) ACE_HANDLE ACE_OS::accept (ACE_HANDLE handle, struct sockaddr *addr, @@ -94,7 +95,7 @@ ACE_OS::join_leaf (ACE_HANDLE socket, ACE_NOTSUP_RETURN (ACE_INVALID_HANDLE); # endif /* ACE_HAS_WINSOCK2 */ } -#endif // ACE_HAS_WINCE +#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */ int ACE_OS::socket_init (int version_high, int version_low) @@ -157,3 +158,4 @@ ACE_OS::socket_fini (void) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_socket.h b/ace/OS_NS_sys_socket.h index c984c30758a..6c1103e0052 100644 --- a/ace/OS_NS_sys_socket.h +++ b/ace/OS_NS_sys_socket.h @@ -60,10 +60,13 @@ #define ACE_SHUTDOWN_BOTH 2 #endif /* SD_BOTH */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Accept_QoS_Params; class ACE_QoS_Params; -namespace ACE_OS { +namespace ACE_OS +{ # if defined (ACE_WIN32) /// Keeps track of whether we've already initialized WinSock... @@ -77,7 +80,7 @@ namespace ACE_OS { struct sockaddr *addr, int *addrlen); -#if !defined (ACE_HAS_WINCE) +#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) /** * QoS-enabled <accept>, which passes <qos_params> to <accept>. If * the OS platform doesn't support QoS-enabled <accept> then the @@ -88,7 +91,7 @@ namespace ACE_OS { struct sockaddr *addr, int *addrlen, const ACE_Accept_QoS_Params &qos_params); -#endif // ACE_HAS_WINCE +#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */ ACE_NAMESPACE_INLINE_FUNCTION int bind (ACE_HANDLE s, @@ -105,7 +108,7 @@ namespace ACE_OS { struct sockaddr *addr, int addrlen); -#if !defined (ACE_HAS_WINCE) +#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) /** * QoS-enabled <connect>, which passes <qos_params> to <connect>. * If the OS platform doesn't support QoS-enabled <connect> then the @@ -116,7 +119,7 @@ namespace ACE_OS { const sockaddr *addr, int addrlen, const ACE_QoS_Params &qos_params); -#endif // ACE_HAS_WINCE +#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */ /// Retrieve information about available transport protocols /// installed on the local machine. Windows specific... @@ -141,14 +144,14 @@ namespace ACE_OS { char *optval, int *optlen); -#if !defined (ACE_HAS_WINCE) +#if !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) /// Joins a leaf node into a QoS-enabled multi-point session. extern ACE_Export ACE_HANDLE join_leaf (ACE_HANDLE socket, const sockaddr *name, int namelen, const ACE_QoS_Params &qos_params); -#endif // ACE_HAS_WINCE +#endif /* !(defined (ACE_HAS_WINCE) && (UNDER_CE < 500)) */ ACE_NAMESPACE_INLINE_FUNCTION int listen (ACE_HANDLE handle, @@ -285,6 +288,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_socket.inl b/ace/OS_NS_sys_socket.inl index 801e6858d02..b7b3c8d3151 100644 --- a/ace/OS_NS_sys_socket.inl +++ b/ace/OS_NS_sys_socket.inl @@ -15,6 +15,8 @@ #include "ace/OS_NS_string.h" #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_VOIDPTR_SOCKOPT) typedef void *ACE_SOCKOPT_TYPE1; #elif defined (ACE_HAS_CHARPTR_SOCKOPT) @@ -76,7 +78,7 @@ ACE_OS::accept (ACE_HANDLE handle, addr = (sockaddr *) &fake_addr; *addrlen = sizeof fake_addr; } -# endif /* VXWORKS */ +# endif /* ACE_HAS_BROKEN_ACCEPT_ADDR */ ACE_HANDLE ace_result = ::accept ((ACE_SOCKET) handle, addr, (ACE_SOCKET_LEN *) addrlen); @@ -635,7 +637,7 @@ ACE_OS::sendto (ACE_HANDLE handle, int addrlen) { ACE_OS_TRACE ("ACE_OS::sendto"); -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) ACE_SOCKCALL_RETURN (::sendto ((ACE_SOCKET) handle, const_cast <char *> (buf), len, @@ -671,7 +673,7 @@ ACE_OS::sendto (ACE_HANDLE handle, addrlen), ssize_t, -1); # endif /* ACE_WIN32 */ -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ } ACE_INLINE ssize_t @@ -847,13 +849,22 @@ ACE_OS::setsockopt (ACE_HANDLE handle, } #endif /*ACE_HAS_WINSOCK2*/ - ACE_SOCKCALL_RETURN (::setsockopt ((ACE_SOCKET) handle, - level, - optname, - (ACE_SOCKOPT_TYPE1) optval, - optlen), - int, - -1); + int result; + ACE_SOCKCALL (::setsockopt ((ACE_SOCKET) handle, + level, + optname, + (ACE_SOCKOPT_TYPE1) optval, + optlen), + int, + -1, + result); +#if defined (WSAEOPNOTSUPP) + if (result == -1 && errno == WSAEOPNOTSUPP) +#else + if (result == -1) +#endif /* WSAEOPNOTSUPP */ + errno = ENOTSUP; + return result; } ACE_INLINE int @@ -954,3 +965,5 @@ ACE_OS::if_freenameindex (struct if_nameindex *ptr) ::if_freenameindex (ptr); } #endif /* __linux__ && ACE_HAS_IPV6 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_stat.cpp b/ace/OS_NS_sys_stat.cpp index fa50a6b040d..a372f414075 100644 --- a/ace/OS_NS_sys_stat.cpp +++ b/ace/OS_NS_sys_stat.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_stat.h" diff --git a/ace/OS_NS_sys_stat.h b/ace/OS_NS_sys_stat.h index fbb7312cb78..dfae190203e 100644 --- a/ace/OS_NS_sys_stat.h +++ b/ace/OS_NS_sys_stat.h @@ -34,13 +34,16 @@ #endif #define ACE_EXPORT_MACRO ACE_Export +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE) && !defined (__BORLANDC__) && !defined(__IBMCPP__) typedef struct _stat ACE_stat; # else typedef struct stat ACE_stat; # endif /* ACE_WIN32 */ -namespace ACE_OS { +namespace ACE_OS +{ ACE_NAMESPACE_INLINE_FUNCTION ACE_HANDLE creat (const ACE_TCHAR *filename, @@ -50,11 +53,10 @@ namespace ACE_OS { // non-standard ACE_NAMESPACE_INLINE_FUNCTION - long filesize (ACE_HANDLE handle); + off_t filesize (ACE_HANDLE handle); ACE_NAMESPACE_INLINE_FUNCTION - long filesize (const ACE_TCHAR *handle); - + off_t filesize (const ACE_TCHAR *handle); //@} @@ -93,6 +95,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_stat.inl b/ace/OS_NS_sys_stat.inl index 382863a2f59..6ae9a7a435d 100644 --- a/ace/OS_NS_sys_stat.inl +++ b/ace/OS_NS_sys_stat.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_unistd.h" @@ -6,7 +7,10 @@ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_macros.h" -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ ACE_INLINE ACE_HANDLE creat (const ACE_TCHAR *filename, mode_t mode) @@ -18,11 +22,7 @@ namespace ACE_OS { ACE_OSCALL_RETURN(::create_f((char *)filename, 1024, S_IRUSR | S_IWUSR | S_IXUSR), ACE_HANDLE, ACE_INVALID_HANDLE); -#elif defined(ACE_PSOS_TM) - ACE_UNUSED_ARG (filename); - ACE_UNUSED_ARG (mode); - ACE_NOTSUP_RETURN (-1); -#elif defined(ACE_PSOS) +#elif defined(ACE_PSOS_TM) || defined (ACE_PSOS) ACE_UNUSED_ARG (filename); ACE_UNUSED_ARG (mode); ACE_NOTSUP_RETURN (-1); @@ -111,19 +111,19 @@ namespace ACE_OS { // This function returns the number of bytes in the file referenced by // FD. - ACE_INLINE long + ACE_INLINE off_t filesize (ACE_HANDLE handle) { ACE_OS_TRACE ("ACE_OS::filesize"); #if defined (ACE_WIN32) - ACE_WIN32CALL_RETURN (::GetFileSize (handle, 0), long, -1); + ACE_WIN32CALL_RETURN (::GetFileSize (handle, 0), off_t, -1); #else /* !ACE_WIN32 */ ACE_stat sb; - return ACE_OS::fstat (handle, &sb) == -1 ? -1 : (long) sb.st_size; + return ACE_OS::fstat (handle, &sb) == -1 ? -1 : sb.st_size; #endif /* ACE_WIN32 */ } - ACE_INLINE long + ACE_INLINE off_t filesize (const ACE_TCHAR *filename) { ACE_OS_TRACE ("ACE_OS::filesize"); @@ -131,7 +131,7 @@ namespace ACE_OS { ACE_HANDLE h = ACE_OS::open (filename, O_RDONLY); if (h != ACE_INVALID_HANDLE) { - long size = ACE_OS::filesize (h); + off_t size = ACE_OS::filesize (h); ACE_OS::close (h); return size; } @@ -209,7 +209,7 @@ namespace ACE_OS { #elif defined (ACE_WIN32) && defined (__IBMCPP__) && (__IBMCPP__ >= 400) ACE_UNUSED_ARG (mode); - ACE_OSCALL_RETURN (::_mkdir ((char *) path), int, -1); + ACE_OSCALL_RETURN (::_mkdir (const_cast <char *> (path)), int, -1); #elif defined (ACE_HAS_WINCE) ACE_UNUSED_ARG (mode); ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreateDirectory (ACE_TEXT_TO_TCHAR_IN (path), 0), @@ -347,7 +347,7 @@ namespace ACE_OS { # if defined (ACE_LACKS_UMASK) ACE_UNUSED_ARG (cmask); ACE_NOTSUP_RETURN ((mode_t)-1); -# elif defined (ACE_WIN32) +# elif defined (ACE_WIN32) && !defined (__BORLANDC__) ACE_OSCALL_RETURN (::_umask (cmask), mode_t, -1); # else return ::umask (cmask); // This call shouldn't fail... @@ -355,3 +355,5 @@ namespace ACE_OS { } } // ACE_OS namespace + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_time.cpp b/ace/OS_NS_sys_time.cpp index 2109fa005e0..be0a28d76b7 100644 --- a/ace/OS_NS_sys_time.cpp +++ b/ace/OS_NS_sys_time.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_time.h" diff --git a/ace/OS_NS_sys_time.h b/ace/OS_NS_sys_time.h index 23be37b8d29..2bbcb30415f 100644 --- a/ace/OS_NS_sys_time.h +++ b/ace/OS_NS_sys_time.h @@ -33,7 +33,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ #if defined (ACE_WIN32) && defined (_WIN32_WCE) // Something is a bit brain-damaged here and I'm not sure what... this code // compiled before the OS reorg for ACE 5.4. Since then it hasn't - eVC @@ -43,13 +46,17 @@ namespace ACE_OS { // - Steve Huston, 23-Aug-2004 extern "C++" { #endif + ACE_NAMESPACE_INLINE_FUNCTION ACE_Time_Value gettimeofday (void); + #if defined (ACE_WIN32) && defined (_WIN32_WCE) } #endif } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_time.inl b/ace/OS_NS_sys_time.inl index 6aec9b145dc..59f513aebcb 100644 --- a/ace/OS_NS_sys_time.inl +++ b/ace/OS_NS_sys_time.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/os_include/sys/os_time.h" @@ -8,6 +9,8 @@ # include "ace/OS_NS_time.h" #endif /* VXWORKS || CHORUS || ACE_PSOS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) && defined (_WIN32_WCE) // Something is a bit brain-damaged here and I'm not sure what... this code // compiled before the OS reorg for ACE 5.4. Since then it hasn't - eVC @@ -80,7 +83,7 @@ ACE_OS::gettimeofday (void) #endif /* 0 */ #if !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32) if (result == -1) - return -1; + return ACE_Time_Value (-1); else return ACE_Time_Value (tv); #endif // !defined (ACE_HAS_WINCE)&& !defined (ACE_WIN32) @@ -89,3 +92,5 @@ ACE_OS::gettimeofday (void) #if defined (ACE_WIN32) && defined (_WIN32_WCE) } #endif + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_uio.cpp b/ace/OS_NS_sys_uio.cpp index 5b7563dc7fd..708ea5701a3 100644 --- a/ace/OS_NS_sys_uio.cpp +++ b/ace/OS_NS_sys_uio.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_uio.h" @@ -13,6 +12,8 @@ ACE_RCSID(ace, OS_NS_sys_uio, "$Id$") #include "ace/OS_NS_string.h" #include "ace/OS_NS_unistd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_LACKS_READV) // "Fake" readv for operating systems without it. Note that this is @@ -125,3 +126,5 @@ ACE_OS::writev_emulation (ACE_HANDLE handle, const iovec *iov, int n) return bytes_sent; } # endif /* ACE_LACKS_WRITEV */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_uio.h b/ace/OS_NS_sys_uio.h index 2978b95501f..597a06919d9 100644 --- a/ace/OS_NS_sys_uio.h +++ b/ace/OS_NS_sys_uio.h @@ -33,7 +33,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ ACE_NAMESPACE_INLINE_FUNCTION ssize_t readv (ACE_HANDLE handle, @@ -63,6 +66,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_uio.inl b/ace/OS_NS_sys_uio.inl index c216e9d0a8f..b8d112bba84 100644 --- a/ace/OS_NS_sys_uio.inl +++ b/ace/OS_NS_sys_uio.inl @@ -4,6 +4,8 @@ #include "ace/os_include/os_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ssize_t ACE_OS::readv (ACE_HANDLE handle, const iovec *iov, @@ -16,11 +18,11 @@ ACE_OS::readv (ACE_HANDLE handle, -1); #else /* ACE_LACKS_READV */ #if defined (ACE_HAS_NONCONST_READV) - ACE_OSCALL_RETURN (::readv (handle, - const_cast<iovec *>(iov), + ACE_OSCALL_RETURN (::readv (handle, + const_cast<iovec *>(iov), iovlen), ssize_t, -1); #else - ACE_OSCALL_RETURN (::readv (handle, + ACE_OSCALL_RETURN (::readv (handle, iov, iovlen), ssize_t, -1); #endif /* ACE_HAS_NONCONST_READV */ @@ -49,3 +51,5 @@ ACE_OS::writev (ACE_HANDLE handle, #endif /* ACE_HAS_NONCONST_WRITEV */ #endif /* ACE_LACKS_WRITEV */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_utsname.cpp b/ace/OS_NS_sys_utsname.cpp index be9c24a089c..ea4e96c1348 100644 --- a/ace/OS_NS_sys_utsname.cpp +++ b/ace/OS_NS_sys_utsname.cpp @@ -1,32 +1,27 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_utsname.h" ACE_RCSID(ace, OS_NS_sys_utsname, "$Id$") -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/OS_NS_sys_utsname.inl" -#endif /* ACE_HAS_INLINED_OS_CALLS */ - #include "ace/OS_NS_string.h" #include "ace/OS_NS_stdio.h" #include "ace/OS_NS_unistd.h" -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_UNAME) // for sysBspRev(), sysModel() -# include /**/ <sysLib.h> -#endif /* VXWORKS */ +# include /**/ <sysLib.h> +#endif /* ACE_VXWORKS && ACE_LACKS_UNAME */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL -#if defined (ACE_WIN32) || defined (VXWORKS) || defined (CHORUS) || defined (ACE_PSOS) -// Don't inline on those platforms because this function contains -// string literals, and some compilers, e.g., g++, don't handle those -// efficiently in unused inline functions. int ACE_OS::uname (ACE_utsname *name) { ACE_OS_TRACE ("ACE_OS::uname"); -# if defined (ACE_WIN32) +#if !defined (ACE_LACKS_UNAME) + ACE_OSCALL_RETURN (::uname (name), int, -1); +#elif defined (ACE_WIN32) size_t maxnamelen = sizeof name->nodename; ACE_OS::strcpy (name->sysname, ACE_LIB_TEXT ("Win32")); @@ -138,6 +133,20 @@ ACE_OS::uname (ACE_utsname *name) sinfo.wProcessorLevel); break; # endif +# if defined PROCESSOR_ARCHITECTURE_AMD64 + case PROCESSOR_ARCHITECTURE_AMD64: + ACE_OS::strcpy (processor, ACE_LIB_TEXT ("x64")); + ACE_OS::sprintf (subtype, ACE_LIB_TEXT ("%d"), + sinfo.wProcessorLevel); + break; +# endif +# if defined PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 + case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: + ACE_OS::strcpy (processor, ACE_LIB_TEXT ("WOW64")); + ACE_OS::sprintf (subtype, ACE_LIB_TEXT ("%d"), + sinfo.wProcessorLevel); + break; +# endif # if defined PROCESSOR_ARCHITECTURE_ARM case PROCESSOR_ARCHITECTURE_ARM: ACE_OS::strcpy (processor, ACE_LIB_TEXT ("ARM")); @@ -205,7 +214,7 @@ ACE_OS::uname (ACE_utsname *name) return ACE_OS::hostname (name->nodename, maxnamelen); # endif /* ACE_LACKS_HOSTNAME */ -# elif defined (VXWORKS) +#elif defined (ACE_VXWORKS) size_t maxnamelen = sizeof name->nodename; ACE_OS::strcpy (name->sysname, "VxWorks"); ACE_OS::strcpy (name->release, "???"); @@ -213,7 +222,7 @@ ACE_OS::uname (ACE_utsname *name) ACE_OS::strcpy (name->machine, sysModel ()); return ACE_OS::hostname (name->nodename, maxnamelen); -# elif defined (CHORUS) +#elif defined (CHORUS) size_t maxnamelen = sizeof name->nodename; ACE_OS::strcpy (name->sysname, "CHORUS/ClassiX"); ACE_OS::strcpy (name->release, "???"); @@ -230,7 +239,18 @@ ACE_OS::uname (ACE_utsname *name) ACE_OS::strcpy (name->release, "???"); ACE_OS::strcpy (name->version, buf); ACE_OS::strcpy (name->machine, "PPC 405"); // a bit of a hack - +#elif defined (INTEGRITY) + if(!name) { + errno = EFAULT; + return -1; + } + strcpy(name->sysname,"INTEGRITY"); + int status = gethostname(name->nodename,_SYS_NMLN); + strcpy(name->release,"4.0"); + strcpy(name->version,"4.0.9"); + strcpy(name->machine,"a standard name"); + return status; #endif /* ACE_WIN32 */ } -#endif /* ACE_WIN32 || VXWORKS */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_sys_utsname.h b/ace/OS_NS_sys_utsname.h index b65268a37f4..968c9ee28a8 100644 --- a/ace/OS_NS_sys_utsname.h +++ b/ace/OS_NS_sys_utsname.h @@ -39,6 +39,7 @@ # if !defined (_SYS_NMLN) # define _SYS_NMLN SYS_NMLN # endif /* _SYS_NMLN */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL struct ACE_utsname { ACE_TCHAR sysname[_SYS_NMLN]; @@ -47,29 +48,24 @@ struct ACE_utsname ACE_TCHAR version[_SYS_NMLN]; ACE_TCHAR machine[_SYS_NMLN]; }; +ACE_END_VERSIONED_NAMESPACE_DECL # else # include "ace/os_include/sys/os_utsname.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef struct utsname ACE_utsname; +ACE_END_VERSIONED_NAMESPACE_DECL # endif /* ACE_LACKS_UTSNAME_T */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { -#if !defined (ACE_WIN32) && !defined (VXWORKS) && !defined (CHORUS) && !defined (ACE_PSOS) - ACE_NAMESPACE_INLINE_FUNCTION -#else extern ACE_Export -#endif /* ! ACE_WIN32 && ! VXWORKS && ! CHORUS */ int uname (ACE_utsname *name); } /* namespace ACE_OS */ -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/OS_NS_sys_utsname.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ +ACE_END_VERSIONED_NAMESPACE_DECL # include /**/ "ace/post.h" #endif /* ACE_OS_NS_SYS_UTSNAME_H */ diff --git a/ace/OS_NS_sys_utsname.inl b/ace/OS_NS_sys_utsname.inl deleted file mode 100644 index eb660f2cad6..00000000000 --- a/ace/OS_NS_sys_utsname.inl +++ /dev/null @@ -1,33 +0,0 @@ -// -*- C++ -*- -// -// $Id$ - -#include "ace/os_include/os_errno.h" - -namespace ACE_OS -{ -#if !defined (ACE_WIN32) && !defined (VXWORKS) && !defined (CHORUS) && !defined (ACE_PSOS) -// Don't inline on those platforms because this function contains -// string literals, and some compilers, e.g., g++, don't handle those -// efficiently in unused inline functions. - ACE_INLINE int - uname (ACE_utsname *name) - { -#if defined (INTEGRITY) - if(!name) { - errno = EFAULT; - return -1; - } - strcpy(name->sysname,"INTEGRITY"); - int status = gethostname(name->nodename,_SYS_NMLN); - strcpy(name->release,"4.0"); - strcpy(name->version,"4.0.9"); - strcpy(name->machine,"a standard name"); - return status; -#else - ACE_OS_TRACE ("ACE_OS::uname"); - ACE_OSCALL_RETURN (::uname (name), int, -1); -#endif - } -#endif /* ! ACE_WIN32 && ! VXWORKS && ! CHORUS */ -} // namespace ACE_OS diff --git a/ace/OS_NS_sys_wait.cpp b/ace/OS_NS_sys_wait.cpp index 0a1b8ee4d50..0e0e6abcbe1 100644 --- a/ace/OS_NS_sys_wait.cpp +++ b/ace/OS_NS_sys_wait.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_sys_wait.h" diff --git a/ace/OS_NS_sys_wait.h b/ace/OS_NS_sys_wait.h index 5fccad22916..58113c7d5b1 100644 --- a/ace/OS_NS_sys_wait.h +++ b/ace/OS_NS_sys_wait.h @@ -33,20 +33,23 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL - /// Calls OS <::wait> function, so it's only portable to UNIX/POSIX +namespace ACE_OS +{ + + /// Calls OS @c ::wait function, so it's only portable to UNIX/POSIX /// platforms. ACE_NAMESPACE_INLINE_FUNCTION pid_t wait (int * = 0); /** - * Calls <::WaitForSingleObject> on Win32 and <ACE::waitpid> - * otherwise. Returns the passed in <pid_t> on success and -1 on + * Calls @c ::WaitForSingleObject on Win32 and ACE::waitpid () + * otherwise. Returns the passed in @a pid_t on success and -1 on * failure. - * On Win32, <pid> is ignored if the <handle> is not equal to 0. - * Passing the process <handle> is prefer on Win32 because using - * <pid> to wait on the project doesn't always work correctly + * On Win32, @a pid is ignored if the @a handle is not equal to 0. + * Passing the process @a handle is prefer on Win32 because using + * @a pid to wait on the project doesn't always work correctly * if the waited process has already terminated. */ ACE_NAMESPACE_INLINE_FUNCTION @@ -56,11 +59,11 @@ namespace ACE_OS { ACE_HANDLE handle = 0); /** - * Calls <::waitpid> on UNIX/POSIX platforms and <::await> on - * Chorus. Does not work on Vxworks, or pSoS. - * On Win32, <pid> is ignored if the <handle> is not equal to 0. - * Passing the process <handle> is prefer on Win32 because using - * <pid> to wait on the project doesn't always work correctly + * Calls @c ::waitpid on UNIX/POSIX platforms and @c ::await on + * Chorus. Does not work on Vxworks 5.5.x, or pSoS. + * On Win32, @a pid is ignored if the @a handle is not equal to 0. + * Passing the process @a handle is prefer on Win32 because using + * @a pid to wait on the project doesn't always work correctly * if the waited process has already terminated. */ ACE_NAMESPACE_INLINE_FUNCTION @@ -71,6 +74,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_sys_wait.inl b/ace/OS_NS_sys_wait.inl index 85afcb961ce..d8d3247cbcf 100644 --- a/ace/OS_NS_sys_wait.inl +++ b/ace/OS_NS_sys_wait.inl @@ -1,9 +1,12 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE pid_t ACE_OS::wait (int *status) { @@ -109,4 +112,4 @@ ACE_OS::wait (pid_t pid, handle); } - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_time.cpp b/ace/OS_NS_time.cpp index 1ff3be39f7f..70b783c7fac 100644 --- a/ace/OS_NS_time.cpp +++ b/ace/OS_NS_time.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_time.h" @@ -18,26 +17,42 @@ ACE_RCSID(ace, OS_NS_time, "$Id$") #if defined (ACE_HAS_WINCE) # include "ace/OS_NS_stdio.h" /* Need ACE_OS::sprintf() */ -const ACE_TCHAR *ACE_OS::day_of_week_name[7] = - {ACE_LIB_TEXT ("Sun"), - ACE_LIB_TEXT ("Mon"), - ACE_LIB_TEXT ("Tue"), - ACE_LIB_TEXT ("Wed"), - ACE_LIB_TEXT ("Thu"), - ACE_LIB_TEXT ("Fri"), - ACE_LIB_TEXT ("Sat")}; - -const ACE_TCHAR *ACE_OS::month_name[12] = - {ACE_LIB_TEXT ("Jan"), ACE_LIB_TEXT ("Feb"), - ACE_LIB_TEXT ("Mar"), ACE_LIB_TEXT ("Apr"), - ACE_LIB_TEXT ("May"), ACE_LIB_TEXT ("Jun"), - ACE_LIB_TEXT ("Jul"), ACE_LIB_TEXT ("Aug"), - ACE_LIB_TEXT ("Sep"), ACE_LIB_TEXT ("Oct"), - ACE_LIB_TEXT ("Nov"), ACE_LIB_TEXT ("Dec") }; - -static const ACE_TCHAR *ACE_OS_CTIME_R_FMTSTR = ACE_LIB_TEXT ("%3s %3s %02d %02d:%02d:%02d %04d\n"); + +namespace +{ + ACE_TCHAR const * const ACE_OS_day_of_week_name[] = + { + ACE_LIB_TEXT ("Sun"), + ACE_LIB_TEXT ("Mon"), + ACE_LIB_TEXT ("Tue"), + ACE_LIB_TEXT ("Wed"), + ACE_LIB_TEXT ("Thu"), + ACE_LIB_TEXT ("Fri"), + ACE_LIB_TEXT ("Sat") + }; + + ACE_TCHAR const * const ACE_OS_month_name[] = + { + ACE_LIB_TEXT ("Jan"), + ACE_LIB_TEXT ("Feb"), + ACE_LIB_TEXT ("Mar"), + ACE_LIB_TEXT ("Apr"), + ACE_LIB_TEXT ("May"), + ACE_LIB_TEXT ("Jun"), + ACE_LIB_TEXT ("Jul"), + ACE_LIB_TEXT ("Aug"), + ACE_LIB_TEXT ("Sep"), + ACE_LIB_TEXT ("Oct"), + ACE_LIB_TEXT ("Nov"), + ACE_LIB_TEXT ("Dec") + }; + + static ACE_TCHAR const ACE_OS_CTIME_R_FMTSTR[] = ACE_LIB_TEXT ("%3s %3s %02d %02d:%02d:%02d %04d\n"); +} /* end blank namespace */ #endif /* ACE_HAS_WINCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_PSOS) // bit masks and shifts for prying info out of the pSOS time encoding @@ -237,8 +252,8 @@ ACE_OS::ctime_r (const time_t *clock, ACE_TCHAR *buf, int buflen) FileTimeToLocalFileTime (&file_time, &localtime); FileTimeToSystemTime (&localtime, &systime); ACE_OS::sprintf (buf, ACE_OS_CTIME_R_FMTSTR, - ACE_OS::day_of_week_name[systime.wDayOfWeek], - ACE_OS::month_name[systime.wMonth - 1], + ACE_OS_day_of_week_name[systime.wDayOfWeek], + ACE_OS_month_name[systime.wMonth - 1], systime.wDay, systime.wHour, systime.wMinute, @@ -447,7 +462,7 @@ ACE_OS::localtime_r (const time_t *t, struct tm *res) res->tm_mday = systime.wDay; res->tm_min = systime.wMinute; - res->tm_mon = systime.wMonth; + res->tm_mon = systime.wMonth - 1; res->tm_sec = systime.wSecond; res->tm_wday = systime.wDayOfWeek; res->tm_yday = __mon_yday[iLeap][systime.wMonth] + systime.wDay; @@ -791,3 +806,5 @@ ACE_OS::strptime_getnum (char *buf, } # endif /* ACE_LACKS_NATIVE_STRPTIME */ #endif /* ACE_HAS_STRPTIME */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_time.h b/ace/OS_NS_time.h index a9a4186a928..a0be9688f7a 100644 --- a/ace/OS_NS_time.h +++ b/ace/OS_NS_time.h @@ -40,6 +40,8 @@ # undef asctime_r # endif /* ACE_HAS_BROKEN_R_ROUTINES */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Type-safe, and unsigned. static const ACE_UINT32 ACE_U_ONE_SECOND_IN_MSECS = 1000U; static const ACE_UINT32 ACE_U_ONE_SECOND_IN_USECS = 1000000U; @@ -154,14 +156,14 @@ inline long ace_timezone() #elif defined (ACE_HAS_TIMEZONE_GETTIMEOFDAY) // The XPG/POSIX specification does not require gettimeofday to // set the timezone struct (it leaves the behavior of passing a - // non-null struct undefined). + // non-null struct undefined). long result = 0; struct timeval time; struct timezone zone; ACE_UNUSED_ARG (result); ACE_OSCALL (::gettimeofday (&time, &zone), int, -1, result); return zone.tz_minuteswest * 60; -#else +#else ACE_NOTSUP_RETURN (0); #endif } @@ -213,7 +215,6 @@ typedef long long ACE_hrtime_t; # endif /* ! ACE_HAS_HI_RES_TIMER || ACE_LACKS_LONGLONG_T */ # endif /* ACE_WIN32 */ - # if defined (ACE_HRTIME_T_IS_BASIC_TYPE) # define ACE_HRTIME_CONVERSION(VAL) (VAL) # define ACE_HRTIME_TO_U64(VAL) ACE_U_LongLong(VAL) @@ -222,14 +223,8 @@ typedef long long ACE_hrtime_t; # define ACE_HRTIME_TO_U64(VAL) (VAL) # endif - -namespace ACE_OS { - -# if defined (ACE_HAS_WINCE) - /// Supporting data for ctime and ctime_r functions on WinCE. - const ACE_TCHAR *day_of_week_name[]; - const ACE_TCHAR *month_name[]; -# endif /* ACE_HAS_WINCE */ +namespace ACE_OS +{ # if defined (CHORUS) && !defined (CHORUS_4) // We must format this code as follows to avoid confusing OSE. @@ -265,7 +260,7 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int clock_settime (clockid_t, - const struct timespec *); + const struct timespec *); ACE_NAMESPACE_INLINE_FUNCTION ACE_TCHAR *ctime (const time_t *t); @@ -356,6 +351,19 @@ namespace ACE_OS { //@} } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) \ + && ACE_HAS_VERSIONED_NAMESPACE == 1) \ + && defined (ghs) \ + && defined (ACE_HAS_PENTIUM) \ + && !defined (ACE_WIN32) +#define ACE_GETHRTIME_NAME ACE_PREPROC_CONCATENATE(ACE_,ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _gethrtime)) +#else +# define ACE_GETHRTIME_NAME ACE_gethrtime +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_time.inl b/ace/OS_NS_time.inl index b9243532d15..fbce238b080 100644 --- a/ace/OS_NS_time.inl +++ b/ace/OS_NS_time.inl @@ -1,4 +1,5 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_string.h" @@ -8,6 +9,8 @@ #include "ace/OS_NS_sys_time.h" //#include "ace/TSS_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE char * ACE_OS::asctime (const struct tm *t) { @@ -223,7 +226,7 @@ ACE_OS::difftime (time_t t1, time_t t0) #endif /* ! ACE_LACKS_DIFFTIME */ #if defined (ghs) && defined (ACE_HAS_PENTIUM) && !defined (ACE_WIN32) - extern "C" ACE_hrtime_t ACE_gethrtime (); + extern "C" ACE_hrtime_t ACE_GETHRTIME_NAME (); #endif /* ghs && ACE_HAS_PENTIUM */ ACE_INLINE ACE_hrtime_t @@ -244,7 +247,7 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) #elif defined (ghs) && defined (ACE_HAS_PENTIUM) && !defined (ACE_WIN32) ACE_UNUSED_ARG (op); // Use .obj/gethrtime.o, which was compiled with g++. - return ACE_gethrtime (); + return ACE_GETHRTIME_NAME (); #elif (defined(__KCC) || defined (__GNUG__) || defined (__INTEL_COMPILER)) && !defined (ACE_WIN32) && !defined(ACE_VXWORKS) && defined (ACE_HAS_PENTIUM) ACE_UNUSED_ARG (op); # if defined (ACE_LACKS_LONGLONG_T) @@ -364,7 +367,12 @@ ACE_OS::gethrtime (const ACE_HRTimer_Op op) ACE_UNUSED_ARG (op); struct timespec ts; - ACE_OS::clock_gettime (CLOCK_REALTIME, &ts); + ACE_OS::clock_gettime ( +#if defined (ACE_HAS_CLOCK_GETTIME_MONOTONIC) + CLOCK_MONOTONIC, +#endif /* !ACE_HAS_CLOCK_GETTIME_MONOTONIC */ + CLOCK_REALTIME, + &ts); // Carefully create the return value to avoid arithmetic overflow // if ACE_hrtime_t is ACE_U_LongLong. @@ -483,13 +491,8 @@ ACE_OS::nanosleep (const struct timespec *requested, ACE_UNUSED_ARG (remaining); // Convert into seconds and microseconds. -# if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) - ACE_Time_Value tv (static_cast<long>(requested->tv_sec), + ACE_Time_Value tv (requested->tv_sec, requested->tv_nsec / 1000); -# else - ACE_Time_Value tv (requested->ts_sec, - requested->ts_nsec / 1000); -# endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ return ACE_OS::sleep (tv); #endif /* ACE_HAS_CLOCK_GETTIME */ } @@ -562,3 +565,5 @@ ACE_OS::tzset (void) # endif /* ACE_HAS_WINCE && !VXWORKS && !ACE_PSOS && !__rtems__ && !ACE_HAS_DINKUM_STL */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_unistd.cpp b/ace/OS_NS_unistd.cpp index 5bddc627589..a35c40065f7 100644 --- a/ace/OS_NS_unistd.cpp +++ b/ace/OS_NS_unistd.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_NS_unistd.h" @@ -17,11 +16,7 @@ ACE_RCSID(ace, OS_NS_unistd, "$Id$") #include "ace/OS_NS_Thread.h" #include "ace/Object_Manager_Base.h" #include "ace/os_include/sys/os_pstat.h" - -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) -// for sysctl(), used by ACE_OS::num_processors() -#include <sys/sysctl.h> -#endif +#include "ace/os_include/sys/os_sysctl.h" #if defined (ACE_NEEDS_FTRUNCATE) extern "C" int @@ -39,6 +34,8 @@ ftruncate (ACE_HANDLE handle, long len) /*****************************************************************************/ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_OS::argv_to_string (ACE_TCHAR **argv, ACE_TCHAR *&buf, @@ -301,17 +298,17 @@ ACE_OS::num_processors (void) #if defined (ACE_HAS_PHARLAP) return 1; -#elif defined (ACE_WIN32) || defined (ACE_WIN64) +#elif defined (ACE_WIN32) SYSTEM_INFO sys_info; ::GetSystemInfo (&sys_info); return sys_info.dwNumberOfProcessors; -#elif defined (linux) || defined (sun) || defined (DIGITAL_UNIX) || defined (CYGWIN32) +#elif defined (_SC_NPROCESSORS_CONF) return ::sysconf (_SC_NPROCESSORS_CONF); -#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) +#elif defined (ACE_HAS_SYSCTL) int num_processors; int mib[2] = { CTL_HW, HW_NCPU }; size_t len = sizeof (num_processors); - + sysctl(mib, 2, &num_processors, &len, NULL, 0); return num_processors; #else @@ -326,25 +323,25 @@ ACE_OS::num_processors_online (void) #if defined (ACE_HAS_PHARLAP) return 1; -#elif defined (ACE_WIN32) || defined (ACE_WIN64) +#elif defined (ACE_WIN32) SYSTEM_INFO sys_info; ::GetSystemInfo (&sys_info); return sys_info.dwNumberOfProcessors; -#elif defined (linux) || defined (sun) || defined (DIGITAL_UNIX) || defined (CYGWIN32) +#elif defined (_SC_NPROCESSORS_ONLN) return ::sysconf (_SC_NPROCESSORS_ONLN); +#elif defined (ACE_HAS_SYSCTL) + int num_processors; + int mib[2] = { CTL_HW, HW_NCPU }; + size_t len = sizeof (num_processors); + + sysctl(mib, 2, &num_processors, &len, NULL, 0); + return num_processors; #elif defined (__hpux) struct pst_dynamic psd; if (::pstat_getdynamic (&psd, sizeof (psd), (size_t) 1, 0) != -1) return psd.psd_proc_cnt; else return -1; -#elif defined(__FreeBSD__) || defined (__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) - int num_processors; - int mib[2] = { CTL_HW, HW_NCPU }; - size_t len = sizeof (num_processors); - - sysctl(mib, 2, &num_processors, &len, NULL, 0); - return num_processors; #else ACE_NOTSUP_RETURN (-1); #endif @@ -647,3 +644,4 @@ ACE_OS::write_n (ACE_HANDLE handle, return bytes_transferred; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_unistd.h b/ace/OS_NS_unistd.h index 1e4d5cb16eb..484b0760b28 100644 --- a/ace/OS_NS_unistd.h +++ b/ace/OS_NS_unistd.h @@ -41,7 +41,10 @@ extern "C" ACE_Export int ftruncate (ACE_HANDLE handle, long len); #endif /* ACE_NEEDS_FTRUNCATE */ -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ ACE_NAMESPACE_INLINE_FUNCTION int access (const char *path, int amode); @@ -53,7 +56,7 @@ namespace ACE_OS { unsigned int alarm (u_int secs); ACE_NAMESPACE_INLINE_FUNCTION - int allocation_granularity (void); + long allocation_granularity (void); // used by ARGV::argv_to_string() and ACE_OS::fork_exec() extern ACE_Export @@ -142,6 +145,9 @@ namespace ACE_OS { gid_t getgid (void); ACE_NAMESPACE_INLINE_FUNCTION + gid_t getegid (void); + + ACE_NAMESPACE_INLINE_FUNCTION int getopt (int argc, char *const *argv, const char *optstring); @@ -161,6 +167,9 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION uid_t getuid (void); + ACE_NAMESPACE_INLINE_FUNCTION + uid_t geteuid (void); + // should call gethostname() ACE_NAMESPACE_INLINE_FUNCTION int hostname (char *name, @@ -242,12 +251,15 @@ namespace ACE_OS { size_t bufsiz); ACE_NAMESPACE_INLINE_FUNCTION - void *sbrk (int brk); + void *sbrk (ptrdiff_t brk); ACE_NAMESPACE_INLINE_FUNCTION int setgid (gid_t); ACE_NAMESPACE_INLINE_FUNCTION + int setegid (gid_t); + + ACE_NAMESPACE_INLINE_FUNCTION int setpgid (pid_t pid, pid_t pgid); ACE_NAMESPACE_INLINE_FUNCTION @@ -263,6 +275,9 @@ namespace ACE_OS { int setuid (uid_t); ACE_NAMESPACE_INLINE_FUNCTION + int seteuid (uid_t); + + ACE_NAMESPACE_INLINE_FUNCTION int sleep (u_int seconds); ACE_NAMESPACE_INLINE_FUNCTION @@ -291,12 +306,12 @@ namespace ACE_OS { int truncate (const ACE_TCHAR *filename, off_t length); ACE_NAMESPACE_INLINE_FUNCTION - u_int ualarm (u_int usecs, - u_int interval = 0); + u_long ualarm (u_long usecs, + u_long interval = 0); ACE_NAMESPACE_INLINE_FUNCTION - u_int ualarm (const ACE_Time_Value &tv, - const ACE_Time_Value &tv_interval = ACE_Time_Value::zero); + u_long ualarm (const ACE_Time_Value &tv, + const ACE_Time_Value &tv_interval = ACE_Time_Value::zero); ACE_NAMESPACE_INLINE_FUNCTION int unlink (const char *path); @@ -330,6 +345,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_unistd.inl b/ace/OS_NS_unistd.inl index e26afd6076b..1e73cc50320 100644 --- a/ace/OS_NS_unistd.inl +++ b/ace/OS_NS_unistd.inl @@ -9,6 +9,7 @@ #include "ace/OS_NS_fcntl.h" #include "ace/Default_Constants.h" #include "ace/OS_Memory.h" +#include "ace/Truncate.h" #if defined (ACE_HAS_CLOCK_GETTIME) # include "ace/os_include/os_time.h" @@ -18,16 +19,25 @@ # include "ace/OS_NS_stdio.h" #endif /* ACE_LACKS_ACCESS */ -#if defined (VXWORKS) || defined (ACE_HAS_WINCE) +#if defined (ACE_VXWORKS) || defined (ACE_HAS_WINCE) # include "ace/os_include/os_unistd.h" +# if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) +# if defined (__RTP__) +# include "ace/os_include/os_strings.h" +# else +# include "ace/os_include/os_string.h" +# endif +# endif #endif /* VXWORKS || ACE_HAS_WINCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_OS::access (const char *path, int amode) { ACE_OS_TRACE ("ACE_OS::access"); #if defined (ACE_LACKS_ACCESS) -# if defined (ACE_HAS_WINCE) || defined (VXWORKS) +# if defined (ACE_HAS_WINCE) || defined (ACE_VXWORKS) // @@ WINCE: There should be a Win32 API that can do this. // Hard coded read access here. ACE_UNUSED_ARG (amode); @@ -66,13 +76,12 @@ ACE_INLINE u_int ACE_OS::alarm (u_int secs) { ACE_OS_TRACE ("ACE_OS::alarm"); -#if defined (ACE_WIN32) || defined (VXWORKS) || defined (CHORUS) || defined (ACE_PSOS) +#if defined (ACE_LACKS_ALARM) ACE_UNUSED_ARG (secs); - ACE_NOTSUP_RETURN (0); #else return ::alarm (secs); -#endif /* ACE_WIN32 || VXWORKS || CHORUS || ACE_PSOS */ +#endif /* ACE_LACKS_ALARM */ } ACE_INLINE long @@ -93,13 +102,13 @@ ACE_OS::getpagesize (void) #endif /* ACE_WIN32 */ } -ACE_INLINE int +ACE_INLINE long ACE_OS::allocation_granularity (void) { #if defined (ACE_WIN32) SYSTEM_INFO sys_info; ::GetSystemInfo (&sys_info); - return (int) sys_info.dwAllocationGranularity; + return sys_info.dwAllocationGranularity; #else return ACE_OS::getpagesize (); #endif /* ACE_WIN32 */ @@ -249,7 +258,7 @@ ACE_OS::dup (ACE_HANDLE handle) else ACE_FAIL_RETURN (ACE_INVALID_HANDLE); /* NOTREACHED */ -#elif defined (VXWORKS) || defined (ACE_PSOS) +#elif defined (ACE_LACKS_DUP) ACE_UNUSED_ARG (handle); ACE_NOTSUP_RETURN (-1); #elif defined (ACE_HAS_WINCE) @@ -296,7 +305,12 @@ ACE_OS::execv (const char *path, # elif defined (__MINGW32__) return ::_execv (path, (char *const *) argv); # else - return ::_execv (path, (const char *const *) argv); + // Why this odd-looking code? If execv() returns at all, it's an error. + // Windows defines this as returning an intptr_t rather than a simple int, + // and the conversion triggers compile warnings. So just return -1 if + // the call returns. + ::_execv (path, (const char *const *) argv); + return -1; # endif /* __BORLANDC__ */ #else ACE_OSCALL_RETURN (::execv (path, argv), int, -1); @@ -327,7 +341,12 @@ ACE_OS::execve (const char *path, # elif defined (__MINGW32__) return ::_execve (path, (char *const *) argv, (char *const *) envp); # else - return ::_execve (path, (const char *const *) argv, (const char *const *) envp); + // Why this odd-looking code? If execv() returns at all, it's an error. + // Windows defines this as returning an intptr_t rather than a simple int, + // and the conversion triggers compile warnings. So just return -1 if + // the call returns. + ::_execve (path, (const char *const *) argv, (const char *const *) envp); + return -1; # endif /* __BORLANDC__ */ #else ACE_OSCALL_RETURN (::execve (path, argv, envp), int, -1); @@ -356,7 +375,12 @@ ACE_OS::execvp (const char *file, # elif defined (__MINGW32__) return ::_execvp (file, (char *const *) argv); # else - return ::_execvp (file, (const char *const *) argv); + // Why this odd-looking code? If execv() returns at all, it's an error. + // Windows defines this as returning an intptr_t rather than a simple int, + // and the conversion triggers compile warnings. So just return -1 if + // the call returns. + ::_execvp (file, (const char *const *) argv); + return -1; # endif /* __BORLANDC__ */ #else ACE_OSCALL_RETURN (::execvp (file, argv), int, -1); @@ -529,28 +553,36 @@ ACE_INLINE gid_t ACE_OS::getgid (void) { ACE_OS_TRACE ("ACE_OS::getgid"); -#if defined (VXWORKS) || defined (ACE_PSOS) || defined (INTEGRITY) - // getgid() is not supported: just one user anyways - return 0; -# elif defined (ACE_WIN32) || defined (CHORUS) +#if defined (ACE_LACKS_GETGID) + ACE_NOTSUP_RETURN (static_cast<gid_t> (-1)); +# else + ACE_OSCALL_RETURN (::getgid (), gid_t, static_cast<gid_t> (-1)); +# endif /* ACE_LACKS_GETGID */ +} + +ACE_INLINE gid_t +ACE_OS::getegid (void) +{ + ACE_OS_TRACE ("ACE_OS::getegid"); +#if defined (ACE_LACKS_GETEGID) ACE_NOTSUP_RETURN (static_cast<gid_t> (-1)); # else - ACE_OSCALL_RETURN (::getgid (), gid_t, (gid_t) -1); -# endif /* VXWORKS || ACE_PSOS */ + ACE_OSCALL_RETURN (::getegid (), gid_t, static_cast<gid_t> (-1)); +# endif /* ACE_LACKS_GETEGID */ } ACE_INLINE int ACE_OS::getopt (int argc, char *const *argv, const char *optstring) { ACE_OS_TRACE ("ACE_OS::getopt"); -#if defined (VXWORKS) || defined (ACE_PSOS) || defined (INTEGRITY) || defined (ACE_WIN32) +#if defined (ACE_LACKS_GETOPT) ACE_UNUSED_ARG (argc); ACE_UNUSED_ARG (argv); ACE_UNUSED_ARG (optstring); ACE_NOTSUP_RETURN (-1); # else ACE_OSCALL_RETURN (::getopt (argc, argv, optstring), int, -1); -# endif /* VXWORKS */ +# endif /* ACE_LACKS_GETOPT */ } ACE_INLINE pid_t @@ -560,10 +592,6 @@ ACE_OS::getpgid (pid_t pid) #if defined (ACE_LACKS_GETPGID) ACE_UNUSED_ARG (pid); ACE_NOTSUP_RETURN (-1); -#elif defined (VXWORKS) || defined (ACE_PSOS) - // getpgid() is not supported, only one process anyway. - ACE_UNUSED_ARG (pid); - return 0; #elif defined (linux) && __GLIBC__ > 1 && __GLIBC_MINOR__ >= 0 // getpgid() is from SVR4, which appears to be the reason why GLIBC // doesn't enable its prototype by default. @@ -572,7 +600,7 @@ ACE_OS::getpgid (pid_t pid) ACE_OSCALL_RETURN (::__getpgid (pid), pid_t, -1); #else ACE_OSCALL_RETURN (::getpgid (pid), pid_t, -1); -#endif /* ACE_WIN32 */ +#endif /* ACE_LACKS_GETPGID */ } ACE_INLINE pid_t @@ -581,9 +609,8 @@ ACE_OS::getpid (void) // ACE_OS_TRACE ("ACE_OS::getpid"); #if defined (ACE_WIN32) return ::GetCurrentProcessId (); -#elif defined (VXWORKS) || defined (ACE_PSOS) - // getpid() is not supported: just one process anyways - return 0; +#elif defined (ACE_LACKS_GETPID) + ACE_NOTSUP_RETURN (-1); #elif defined (CHORUS) return (pid_t) (::agetId ()); #else @@ -597,9 +624,6 @@ ACE_OS::getppid (void) ACE_OS_TRACE ("ACE_OS::getppid"); #if defined (ACE_LACKS_GETPPID) ACE_NOTSUP_RETURN (-1); -#elif defined (VXWORKS) || defined (ACE_PSOS) - // getppid() is not supported, only one process anyway. - return 0; #else ACE_OSCALL_RETURN (::getppid (), pid_t, -1); #endif /* ACE_LACKS_GETPPID */ @@ -609,14 +633,22 @@ ACE_INLINE uid_t ACE_OS::getuid (void) { ACE_OS_TRACE ("ACE_OS::getuid"); -#if defined (VXWORKS) || defined (ACE_PSOS) || defined (INTEGRITY) - // getuid() is not supported: just one user anyways - return 0; -# elif defined (ACE_WIN32) || defined (CHORUS) +#if defined (ACE_LACKS_GETUID) ACE_NOTSUP_RETURN (static_cast<uid_t> (-1)); # else - ACE_OSCALL_RETURN (::getuid (), uid_t, (uid_t) -1); -# endif /* VXWORKS || ACE_PSOS */ + ACE_OSCALL_RETURN (::getuid (), uid_t, static_cast<uid_t> (-1)); +# endif /* ACE_LACKS_GETUID*/ +} + +ACE_INLINE uid_t +ACE_OS::geteuid (void) +{ + ACE_OS_TRACE ("ACE_OS::geteuid"); +#if defined (ACE_LACKS_GETEUID) + ACE_NOTSUP_RETURN (static_cast<uid_t> (-1)); +# else + ACE_OSCALL_RETURN (::geteuid (), uid_t, (uid_t) -1); +# endif /* ACE_LACKS_GETEUID */ } ACE_INLINE int @@ -635,10 +667,10 @@ ACE_OS::hostname (char name[], size_t maxnamelen) ACE_UNUSED_ARG (maxnamelen); ACE_NOTSUP_RETURN (-1); # endif /* ACE_HAS_PHARLAP_RT */ -#elif defined (VXWORKS) || defined (ACE_HAS_WINCE) +#elif defined (ACE_VXWORKS) || defined (ACE_HAS_WINCE) ACE_OSCALL_RETURN (::gethostname (name, maxnamelen), int, -1); #elif defined (ACE_WIN32) - if (::gethostname (name, maxnamelen) == 0) + if (::gethostname (name, ACE_Utils::Truncate (maxnamelen)) == 0) { return 0; } @@ -702,7 +734,7 @@ ACE_OS::isatty (int handle) # else ACE_OS_TRACE ("ACE_OS::isatty"); ACE_OSCALL_RETURN (::isatty (handle), int, -1); -# endif /* defined (ACE_LACKS_ISATTY) */ +# endif /* ACE_LACKS_ISATTY */ } #if defined (ACE_WIN32) @@ -840,7 +872,7 @@ ACE_OS::read (ACE_HANDLE handle, void *buf, size_t len) ssize_t result; # if defined (ACE_HAS_CHARPTR_SOCKOPT) - ACE_OSCALL (::read (handle, (char *) buf, len), ssize_t, -1, result); + ACE_OSCALL (::read (handle, static_cast <char *> (buf), len), ssize_t, -1, result); # else ACE_OSCALL (::read (handle, buf, len), ssize_t, -1, result); # endif /* ACE_HAS_CHARPTR_SOCKOPT */ @@ -902,39 +934,24 @@ ACE_OS::readlink (const char *path, char *buf, size_t bufsiz) # endif /* ACE_LACKS_READLINK */ } -#if !defined (ACE_WIN32) - ACE_INLINE int ACE_OS::pipe (ACE_HANDLE fds[]) { ACE_OS_TRACE ("ACE_OS::pipe"); -# if defined (VXWORKS) || defined (ACE_PSOS) || defined (INTEGRITY) +# if defined (ACE_LACKS_PIPE) ACE_UNUSED_ARG (fds); ACE_NOTSUP_RETURN (-1); -# else - ACE_OSCALL_RETURN (::pipe (fds), int, -1); -# endif /* VXWORKS || ACE_PSOS */ -} - -#else /* ACE_WIN32 */ - -ACE_INLINE int -ACE_OS::pipe (ACE_HANDLE fds[]) -{ -# if !defined (ACE_HAS_WINCE) && !defined (__IBMCPP__) - ACE_OS_TRACE ("ACE_OS::pipe"); +# elif defined (ACE_WIN32) ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::CreatePipe (&fds[0], &fds[1], 0, 0), ace_result_), int, -1); # else - ACE_NOTSUP_RETURN (-1); -# endif /* ACE_HAS_WINCE && !__IBMCPP__ */ + ACE_OSCALL_RETURN (::pipe (fds), int, -1); +# endif /* ACE_LACKS_PIPE */ } -#endif /* !ACE_WIN32 */ - ACE_INLINE void * -ACE_OS::sbrk (int brk) +ACE_OS::sbrk (ptrdiff_t brk) { #if defined (ACE_LACKS_SBRK) ACE_UNUSED_ARG (brk); @@ -948,16 +965,24 @@ ACE_INLINE int ACE_OS::setgid (gid_t gid) { ACE_OS_TRACE ("ACE_OS::setgid"); -#if defined (VXWORKS) || defined (ACE_PSOS) || defined (INTEGRITY) - // setgid() is not supported: just one user anyways - ACE_UNUSED_ARG (gid); - return 0; -# elif defined (ACE_WIN32) || defined (CHORUS) +#if defined (ACE_LACKS_SETGID) ACE_UNUSED_ARG (gid); ACE_NOTSUP_RETURN (-1); # else ACE_OSCALL_RETURN (::setgid (gid), int, -1); -# endif /* VXWORKS || ACE_PSOS */ +# endif /* ACE_LACKS_SETGID */ +} + +ACE_INLINE int +ACE_OS::setegid (gid_t gid) +{ + ACE_OS_TRACE ("ACE_OS::setegid"); +#if defined (ACE_LACKS_SETEGID) + ACE_UNUSED_ARG (gid); + ACE_NOTSUP_RETURN (-1); +# else + ACE_OSCALL_RETURN (::setegid (gid), int, -1); +# endif /* ACE_LACKS_SETEGID */ } ACE_INLINE int @@ -968,11 +993,6 @@ ACE_OS::setpgid (pid_t pid, pid_t pgid) ACE_UNUSED_ARG (pid); ACE_UNUSED_ARG (pgid); ACE_NOTSUP_RETURN (-1); -#elif defined (VXWORKS) || defined (ACE_PSOS) - // <setpgid> is not supported, only one process anyway. - ACE_UNUSED_ARG (pid); - ACE_UNUSED_ARG (pgid); - return 0; #else ACE_OSCALL_RETURN (::setpgid (pid, pgid), int, -1); #endif /* ACE_LACKS_SETPGID */ @@ -986,14 +1006,9 @@ ACE_OS::setregid (gid_t rgid, gid_t egid) ACE_UNUSED_ARG (rgid); ACE_UNUSED_ARG (egid); ACE_NOTSUP_RETURN (-1); -#elif defined (VXWORKS) || defined (ACE_PSOS) - // <setregid> is not supported, only one process anyway. - ACE_UNUSED_ARG (rgid); - ACE_UNUSED_ARG (egid); - return 0; #else ACE_OSCALL_RETURN (::setregid (rgid, egid), int, -1); -#endif /* ACE_WIN32 */ +#endif /* ACE_LACKS_SETREGID */ } ACE_INLINE int @@ -1004,11 +1019,6 @@ ACE_OS::setreuid (uid_t ruid, uid_t euid) ACE_UNUSED_ARG (ruid); ACE_UNUSED_ARG (euid); ACE_NOTSUP_RETURN (-1); -#elif defined (VXWORKS) || defined (ACE_PSOS) - // <setpgid> is not supported, only one process anyway. - ACE_UNUSED_ARG (ruid); - ACE_UNUSED_ARG (euid); - return 0; #else ACE_OSCALL_RETURN (::setreuid (ruid, euid), int, -1); #endif /* ACE_LACKS_SETREUID */ @@ -1020,9 +1030,6 @@ ACE_OS::setsid (void) ACE_OS_TRACE ("ACE_OS::setsid"); #if defined (ACE_LACKS_SETSID) ACE_NOTSUP_RETURN (-1); -#elif defined (VXWORKS) || defined (ACE_PSOS) - // <setsid> is not supported, only one process anyway. - return 0; #else ACE_OSCALL_RETURN (::setsid (), int, -1); # endif /* ACE_LACKS_SETSID */ @@ -1032,16 +1039,24 @@ ACE_INLINE int ACE_OS::setuid (uid_t uid) { ACE_OS_TRACE ("ACE_OS::setuid"); -#if defined (VXWORKS) || defined (ACE_PSOS) || defined (INTEGRITY) - // setuid() is not supported: just one user anyways - ACE_UNUSED_ARG (uid); - return 0; -# elif defined (ACE_WIN32) || defined(CHORUS) +#if defined (ACE_LACKS_SETUID) ACE_UNUSED_ARG (uid); ACE_NOTSUP_RETURN (-1); # else ACE_OSCALL_RETURN (::setuid (uid), int, -1); -# endif /* VXWORKS || ACE_PSOS */ +# endif /* ACE_LACKS_SETUID */ +} + +ACE_INLINE int +ACE_OS::seteuid (uid_t uid) +{ + ACE_OS_TRACE ("ACE_OS::seteuid"); +#if defined (ACE_LACKS_SETEUID) + ACE_UNUSED_ARG (uid); + ACE_NOTSUP_RETURN (-1); +# else + ACE_OSCALL_RETURN (::seteuid (uid), int, -1); +# endif /* ACE_LACKS_SETEUID */ } ACE_INLINE int @@ -1131,12 +1146,12 @@ ACE_INLINE long ACE_OS::sysconf (int name) { ACE_OS_TRACE ("ACE_OS::sysconf"); -#if defined (ACE_WIN32) || defined (VXWORKS) || defined (ACE_PSOS) || defined (INTEGRITY) +#if defined (ACE_LACKS_SYSCONF) ACE_UNUSED_ARG (name); ACE_NOTSUP_RETURN (-1); #else ACE_OSCALL_RETURN (::sysconf (name), long, -1); -#endif /* ACE_WIN32 || VXWORKS || ACE_PSOS */ +#endif /* ACE_LACKS_SYSCONF */ } ACE_INLINE long @@ -1190,8 +1205,8 @@ ACE_OS::truncate (const ACE_TCHAR *filename, #endif /* ACE_WIN32 */ } -ACE_INLINE u_int -ACE_OS::ualarm (u_int usecs, u_int interval) +ACE_INLINE u_long +ACE_OS::ualarm (u_long usecs, u_long interval) { ACE_OS_TRACE ("ACE_OS::ualarm"); @@ -1207,15 +1222,15 @@ ACE_OS::ualarm (u_int usecs, u_int interval) #endif /* ACE_HAS_UALARM */ } -ACE_INLINE u_int +ACE_INLINE u_long ACE_OS::ualarm (const ACE_Time_Value &tv, const ACE_Time_Value &tv_interval) { ACE_OS_TRACE ("ACE_OS::ualarm"); #if defined (ACE_HAS_UALARM) - u_int usecs = (tv.sec () * ACE_ONE_SECOND_IN_USECS) + tv.usec (); - u_int interval = (tv_interval.sec () * ACE_ONE_SECOND_IN_USECS) + tv_interval.usec (); + u_long usecs = (tv.sec () * ACE_ONE_SECOND_IN_USECS) + tv.usec (); + u_long interval = (tv_interval.sec () * ACE_ONE_SECOND_IN_USECS) + tv_interval.usec (); return ::ualarm (usecs, interval); #elif !defined (ACE_LACKS_UNIX_SIGNALS) ACE_UNUSED_ARG (tv_interval); @@ -1295,9 +1310,9 @@ ACE_OS::write (ACE_HANDLE handle, const void *buf, size_t nbyte) # endif /* defined (ACE_PSOS_LACKS_PHILE) */ #else # if defined (ACE_PSOS) - ACE_OSCALL_RETURN (::write_f(handle, (void *) buf, nbyte), ssize_t, -1); + ACE_OSCALL_RETURN (::write_f(handle, const_cast <void *> (buf), nbyte), ssize_t, -1); # elif defined (ACE_HAS_CHARPTR_SOCKOPT) - ACE_OSCALL_RETURN (::write (handle, (char *) buf, nbyte), ssize_t, -1); + ACE_OSCALL_RETURN (::write (handle, static_cast <char *> (const_cast <void *> (buf)), nbyte), ssize_t, -1); # else ACE_OSCALL_RETURN (::write (handle, buf, nbyte), ssize_t, -1); # endif /* ACE_PSOS */ @@ -1324,3 +1339,5 @@ ACE_OS::write (ACE_HANDLE handle, return ACE_OS::write (handle, buf, nbyte); #endif /* ACE_WIN32 */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_unistd_T.inl b/ace/OS_NS_unistd_T.inl index b56eb16a3c4..2b386231e29 100644 --- a/ace/OS_NS_unistd_T.inl +++ b/ace/OS_NS_unistd_T.inl @@ -6,6 +6,7 @@ #include "ace/Default_Constants.h" #include "ace/os_include/os_errno.h" #include "ace/OS_Memory.h" +#include "ace/OS_NS_string.h" template <typename CHAR_TYPE> int ACE_OS::string_to_argv (CHAR_TYPE *buf, diff --git a/ace/OS_NS_wchar.cpp b/ace/OS_NS_wchar.cpp index b92b8d1f562..b6701492a67 100644 --- a/ace/OS_NS_wchar.cpp +++ b/ace/OS_NS_wchar.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ # include "ace/OS_NS_wchar.h" @@ -49,7 +48,10 @@ ACE_RCSID(ace, OS_NS_wchar_t, "$Id$") * SUCH DAMAGE. */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_LACKS_WCSCAT) + wchar_t * ACE_OS::wcscat_emulation (wchar_t *destination, const wchar_t *source) @@ -371,3 +373,4 @@ ACE_OS::wcsstr_emulation (const wchar_t *string, } #endif /* ACE_LACKS_WCSSTR */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_NS_wchar.h b/ace/OS_NS_wchar.h index d886dbcbdab..4568629183a 100644 --- a/ace/OS_NS_wchar.h +++ b/ace/OS_NS_wchar.h @@ -36,7 +36,10 @@ #endif #define ACE_EXPORT_MACRO ACE_Export -namespace ACE_OS { +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE_OS +{ ACE_NAMESPACE_INLINE_FUNCTION wint_t fgetwc (FILE* fp); @@ -175,6 +178,8 @@ namespace ACE_OS { } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_NS_wchar.inl b/ace/OS_NS_wchar.inl index e7c44bd8b8f..19cddfcb413 100644 --- a/ace/OS_NS_wchar.inl +++ b/ace/OS_NS_wchar.inl @@ -1,6 +1,10 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + + ACE_INLINE wint_t ACE_OS::fgetwc (FILE* fp) { @@ -77,3 +81,4 @@ ACE_OS::ungetwc (wint_t c, FILE* fp) # endif /* ACE_LACKS_FGETWC */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_QoS.cpp b/ace/OS_QoS.cpp index 8240231b9c5..0b2c23f11c6 100644 --- a/ace/OS_QoS.cpp +++ b/ace/OS_QoS.cpp @@ -13,6 +13,8 @@ #include "ace/OS_QoS.h" #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Flow_Spec::ACE_Flow_Spec (unsigned long token_rate, unsigned long token_bucket_size, unsigned long peak_bandwidth, @@ -470,3 +472,5 @@ ACE_Accept_QoS_Params::callback_data (unsigned long cd) { this->callback_data_ = cd; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_QoS.h b/ace/OS_QoS.h index 7a58dec9a6c..c8df7c58eec 100644 --- a/ace/OS_QoS.h +++ b/ace/OS_QoS.h @@ -5,9 +5,9 @@ * @file OS_QoS.h * * $Id$ - * + * * @brief Contains OS specific data structures for QoS networking. - * + * * @author Craig Rodrigues <crodrigu@bbn.com> */ //============================================================================= @@ -25,6 +25,8 @@ #include "ace/os_include/sys/os_uio.h" #include "ace/OS_NS_stropts.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 != 0) #if defined (ACE_HAS_WINSOCK2_GQOS) typedef SERVICETYPE ACE_SERVICE_TYPE; @@ -384,6 +386,7 @@ private: unsigned long callback_data_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ACE_OS_QOS_H */ diff --git a/ace/OS_String.cpp b/ace/OS_String.cpp deleted file mode 100644 index d8db2e3c296..00000000000 --- a/ace/OS_String.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/** - * @file OS_String.cpp - * - * $Id$ - * - * @brief Contains definitions for class ACE_OS_String. - */ -//============================================================================= - -#include "ace/OS_String.h" -#include "ace/OS_Memory.h" - -ACE_RCSID (ace, OS_String, "$Id$") - -#if !defined (ACE_HAS_INLINED_OSCALLS) -# include "ace/OS_String.inl" -#endif /* ACE_HAS_INLINED_OS_CALLS */ - -#if defined (ACE_LACKS_WCSDUP_PROTOTYPE) -extern "C" wchar_t *wcsdup __P ((__const wchar_t *__s)); -#endif /* ACE_LACKS_WCSDUP_PROTOTYPE */ - diff --git a/ace/OS_String.h b/ace/OS_String.h index 891722ca45d..510d1a412a3 100644 --- a/ace/OS_String.h +++ b/ace/OS_String.h @@ -28,13 +28,5 @@ #include "ace/OS_NS_wchar.h" #include "ace/OS_NS_ctype.h" -# if defined (ACE_HAS_INLINED_OSCALLS) -# if defined (ACE_INLINE) -# undef ACE_INLINE -# endif /* ACE_INLINE */ -# define ACE_INLINE inline -# include "ace/OS_String.inl" -# endif /* ACE_HAS_INLINED_OSCALLS */ - #include /**/ "ace/post.h" #endif /* ACE_OS_STRING_H */ diff --git a/ace/OS_String.inl b/ace/OS_String.inl deleted file mode 100644 index 64b6ef0150d..00000000000 --- a/ace/OS_String.inl +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -//============================================================================= -/** - * @file OS_String.inl - * - * $Id$ - * - * @brief Contains inline definitions for class ACE_OS_String. - */ -//============================================================================= - -#include "ace/os_include/os_stdlib.h" -#include "ace/os_include/os_string.h" -#include "ace/os_include/os_strings.h" -#include "ace/os_include/os_ctype.h" - - - diff --git a/ace/OS_TLI.h b/ace/OS_TLI.h index 130c276904e..e81b00d6074 100644 --- a/ace/OS_TLI.h +++ b/ace/OS_TLI.h @@ -147,6 +147,25 @@ extern "C" { # endif /* ACE_HAS_XTI || ACE_HAS_TLI */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// This hack is needed to get around an odd and hard-to-reproduce problem +// with HP aC++. If struct sigaction is defined extern "C" and the sigaction +// function in namespace ACE_OS, the compiler sometimes gets confused. +// If we help it with this typedef, it's fine. User code should not use +// the ACE typedef - it will be removed without warning as soon as we can +// either drop support for the broken compilers or figure out how to reproduce +// it so it can be reported to HP and fixed. +// There's a similar hack in OS_TLI.h for struct t_optmgmt. +// Also see ChangeLog entries: +// Mon Jan 23 16:35:40 UTC 2006 Steve Huston <shuston@riverace.com> +// Mon Jan 23 22:08:56 UTC 2006 Steve Huston <shuston@riverace.com> +#if defined (__HP_aCC) && (__HP_aCC <= 36500) +typedef extern "C" struct t_optmgmt ACE_TOPTMGMT; +#else +typedef struct t_optmgmt ACE_TOPTMGMT; +#endif + /** * @namespace ACE_OS * @@ -214,8 +233,8 @@ namespace ACE_OS ACE_NAMESPACE_INLINE_FUNCTION int t_optmgmt (ACE_HANDLE handle, - struct t_optmgmt *req, - struct t_optmgmt *ret); + ACE_TOPTMGMT *req, + ACE_TOPTMGMT *ret); ACE_NAMESPACE_INLINE_FUNCTION int t_rcv (ACE_HANDLE fildes, @@ -260,6 +279,8 @@ namespace ACE_OS } /* namespace ACE_OS */ +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/OS_TLI.inl b/ace/OS_TLI.inl index 307a53f6fa0..563ba8311db 100644 --- a/ace/OS_TLI.inl +++ b/ace/OS_TLI.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_OS { ACE_INLINE int @@ -228,7 +231,7 @@ t_open (char *path, int oflag, struct t_info *info) } ACE_INLINE int -t_optmgmt (ACE_HANDLE handle, struct t_optmgmt *req, struct t_optmgmt *ret) +t_optmgmt (ACE_HANDLE handle, ACE_TOPTMGMT *req, ACE_TOPTMGMT *ret) { #if defined (ACE_HAS_TLI) ACE_OSCALL_RETURN (::t_optmgmt (handle, req, ret), int, -1); @@ -383,3 +386,5 @@ t_unbind (ACE_HANDLE handle) } } /* end namespace ACE_OS */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_Thread_Adapter.cpp b/ace/OS_Thread_Adapter.cpp index 1f7e94a2890..1bdeacc24ee 100644 --- a/ace/OS_Thread_Adapter.cpp +++ b/ace/OS_Thread_Adapter.cpp @@ -11,6 +11,8 @@ ACE_RCSID (ace, #include "ace/Global_Macros.h" #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_OS_Thread_Adapter::ACE_OS_Thread_Adapter ( ACE_THR_FUNC user_func , void *arg @@ -171,3 +173,5 @@ ACE_OS_Thread_Adapter::invoke (void) return status; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/OS_Thread_Adapter.h b/ace/OS_Thread_Adapter.h index 73ad99989e6..3776339b2a7 100644 --- a/ace/OS_Thread_Adapter.h +++ b/ace/OS_Thread_Adapter.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +22,8 @@ #include "ace/ACE_export.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_OS_Thread_Adapter * @@ -42,7 +45,7 @@ public: /// Constructor. ACE_OS_Thread_Adapter (ACE_THR_FUNC user_func, void *arg, - ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ace_thread_adapter + ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) , ACE_SEH_EXCEPT_HANDLER selector = 0 , ACE_SEH_EXCEPT_HANDLER handler = 0 @@ -56,15 +59,14 @@ public: */ virtual ACE_THR_FUNC_RETURN invoke (void); -private: - /// Ensure that this object must be allocated on the heap. +protected: + + /// Ensure that this object is allocated on the heap. ~ACE_OS_Thread_Adapter (void); -private: - /// Friend declaration to avoid compiler warning: only defines a private - /// destructor and has no friends. - friend class ACE_Thread_Adapter_Has_Private_Destructor; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_THREAD_ADAPTER_H */ diff --git a/ace/OS_main.cpp b/ace/OS_main.cpp index 5d8c43ac716..79e8413bea9 100644 --- a/ace/OS_main.cpp +++ b/ace/OS_main.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/OS_main.h" @@ -26,7 +25,7 @@ ACE_RCSID(ace, OS_main, "$Id$") # if !defined (ACE_WIN32) -# if !defined (ACE_VXWORKS) +# if !(defined (ACE_VXWORKS) && !defined (__RTP__)) /* forward declaration */ extern int ace_main_i (int, char *[]); # endif @@ -70,7 +69,9 @@ ACE_MAIN () /* user's entry point, e.g., "main" w/out argc, argv */ # endif /* ACE_PSOSIM */ -# if defined (ACE_VXWORKS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +# if defined (ACE_VXWORKS) && !defined (__RTP__) ace_main_proc_ptr vx_ace_main_i_ptr = 0; int ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */ @@ -78,7 +79,7 @@ int ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */ ACE_MAIN_OBJECT_MANAGER return vx_ace_main_i_ptr ? (*vx_ace_main_i_ptr) (argc, argv) : (-1); /* what the user calls "main" */ } -# else /* !ACE_VXWORKS */ +# else /* !ACE_VXWORKS && !__RTP__ */ int ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */ { ACE_MAIN_OBJECT_MANAGER @@ -86,8 +87,12 @@ int ace_os_main_i (int argc, char *argv[]) /* user's entry point, e.g., main */ } # endif +ACE_END_VERSIONED_NAMESPACE_DECL + # elif !defined (ACE_HAS_WINCE) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) int ACE_Main_Base::run (int argc, ACE_TCHAR *argv[]) { @@ -114,6 +119,8 @@ ace_os_main_i (ACE_Main_Base &mbase, int argc, char *argv[]) /* user's entry poi } # endif /* ACE_WIN32 && ACE_USES_WCHAR */ +ACE_END_VERSIONED_NAMESPACE_DECL + # else /* ACE_HAS_WINCE */ // CE only gets a command line string; no argv. So we need to convert it @@ -122,6 +129,8 @@ ace_os_main_i (ACE_Main_Base &mbase, int argc, char *argv[]) /* user's entry poi # include "ace/ACE.h" # include "ace/ARGV.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_Main_Base::run (HINSTANCE, HINSTANCE, LPWSTR lpCmdLine, @@ -137,6 +146,8 @@ int ACE_Main_Base::run (HINSTANCE, ACE::fini (); return i; } +ACE_END_VERSIONED_NAMESPACE_DECL # endif /* !ACE_HAS_WINCE */ + # endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */ diff --git a/ace/OS_main.h b/ace/OS_main.h index a47e4b069e2..58e02261a03 100644 --- a/ace/OS_main.h +++ b/ace/OS_main.h @@ -67,7 +67,9 @@ || (defined (ACE_PSOS) && defined (ACE_PSOS_LACKS_ARGC_ARGV)) # define main \ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ ace_os_main_i (int, char *[]); \ +ACE_END_VERSIONED_NAMESPACE_DECL \ ACE_MAIN () /* user's entry point, e.g., "main" w/out argc, argv */ \ { \ ace_os_main_i (argc, argv); /* what the user calls "main" */ \ @@ -75,14 +77,16 @@ ACE_MAIN () /* user's entry point, e.g., "main" w/out argc, argv */ \ int \ ace_main_i -# elif defined (ACE_VXWORKS) +# elif defined (ACE_VXWORKS) && !defined (__RTP__) typedef int (*ace_main_proc_ptr)(int, char *[]); extern ace_main_proc_ptr vx_ace_main_i_ptr; # define main \ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ ace_os_main_i (int, char *[]); \ +ACE_END_VERSIONED_NAMESPACE_DECL \ int ace_main_i(int, char *[]); \ int \ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \ @@ -96,7 +100,9 @@ ace_main_i # elif !defined (ACE_WIN32) # define main \ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ ace_os_main_i (int, char *[]); \ +ACE_END_VERSIONED_NAMESPACE_DECL \ int \ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., main */ \ { \ @@ -108,6 +114,9 @@ ace_main_i # elif !defined (ACE_HAS_WINCE) # if defined (ACE_WIN32) && defined (ACE_USES_WCHAR) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Main_Base { public: @@ -115,6 +124,8 @@ public: virtual int run_i (int, ACE_TCHAR *[]) = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # define wmain \ ace_wmain_i (int, ACE_TCHAR *[]); \ ACE_Export int ace_os_wmain_i (ACE_Main_Base&, int, ACE_TCHAR *[]); \ @@ -134,6 +145,8 @@ ace_wmain_i # else /* ! (ACE_WIN32 && ACE_USES_WCHAR) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Main_Base { public: @@ -141,14 +154,18 @@ public: virtual int run_i (int, char *[]) = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # define main \ ace_main_i (int, char *[]); \ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL \ ACE_Export int ace_os_main_i (ACE_Main_Base&, int, char *[]); \ class ACE_Main : public ACE_Main_Base {int run_i (int, char *[]);}; \ inline int ACE_Main::run_i (int argc, char *argv[]) \ { \ return ace_main_i (argc, argv); \ } \ +ACE_END_VERSIONED_NAMESPACE_DECL \ int \ ACE_MAIN (int argc, char *argv[]) /* user's entry point, e.g., wmain */ \ { \ @@ -162,6 +179,8 @@ ace_main_i # else /* ACE_HAS_WINCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Main_Base { public: @@ -169,6 +188,8 @@ public: virtual int run_i (int, ACE_TCHAR *[]) = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_TMAIN) // Use WinMain on CE; others give warning/error. # undef ACE_TMAIN # endif // ACE_TMAIN diff --git a/ace/Obchunk.cpp b/ace/Obchunk.cpp index 60a7f9b7a37..0d1de440fcb 100644 --- a/ace/Obchunk.cpp +++ b/ace/Obchunk.cpp @@ -8,6 +8,8 @@ ACE_RCSID(ace, Obchunk, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Obchunk) void @@ -30,3 +32,5 @@ ACE_Obchunk::ACE_Obchunk (size_t size) next_ (0) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Obchunk.h b/ace/Obchunk.h index d901c030dd2..9690c39f9d1 100644 --- a/ace/Obchunk.h +++ b/ace/Obchunk.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file Obchunk.h @@ -20,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Obchunk * @@ -64,6 +67,8 @@ public: char contents_[4]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Obchunk.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Obchunk.inl b/ace/Obchunk.inl index bffb7626155..4853b0e12aa 100644 --- a/ace/Obchunk.inl +++ b/ace/Obchunk.inl @@ -1,7 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Obchunk::~ACE_Obchunk (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp index 73327e35002..21782c40821 100644 --- a/ace/Object_Manager.cpp +++ b/ace/Object_Manager.cpp @@ -49,6 +49,8 @@ ACE_RCSID(ace, Object_Manager, "$Id$") # define ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS #endif /* ACE_APPLICATION_PREALLOCATED_ARRAY_DELETIONS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Singleton pointer. ACE_Object_Manager *ACE_Object_Manager::instance_ = 0; @@ -86,7 +88,7 @@ void *ACE_Object_Manager::preallocated_array[ preallocated_array[ID] = array_p;\ } # define ACE_DELETE_PREALLOCATED_OBJECT(TYPE, ID)\ - ace_cleanup_destroyer (\ + ACE_CLEANUP_DESTROYER_NAME (\ (ACE_Cleanup_Adapter<TYPE> *) preallocated_object[ID], 0);\ preallocated_object[ID] = 0; # define ACE_DELETE_PREALLOCATED_ARRAY(TYPE, ID, COUNT)\ @@ -112,13 +114,6 @@ private: ACE_Static_Svc_Descriptor ace_svc_desc_ACE_Service_Manager; }; -// We can't use the ACE_SVC_FACTORY_DECLARE macro here because this -// needs to be in the ACE_Export context rather than the -// ACE_Svc_Export context. -//extern "C" ACE_Export -//ACE_Service_Object * -//_make_ACE_Service_Manager (ACE_Service_Object_Exterminator *); - ACE_Object_Manager_Preallocations::ACE_Object_Manager_Preallocations (void) { ACE_STATIC_SVC_DEFINE (ACE_Service_Manager_initializer, @@ -854,30 +849,4 @@ ACE_Static_Object_Lock::cleanup_lock (void) } #endif /* ACE_HAS_THREADS */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - template class ACE_Cleanup_Adapter<ACE_Null_Mutex>; - template class ACE_Cleanup_Adapter<ACE_Mutex>; - template class ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex>; - template class ACE_Cleanup_Adapter<ACE_Thread_Mutex>; - template class ACE_Managed_Object<ACE_Null_Mutex>; - template class ACE_Managed_Object<ACE_Mutex>; - template class ACE_Managed_Object<ACE_Recursive_Thread_Mutex>; - template class ACE_Managed_Object<ACE_Thread_Mutex>; -# endif /* ACE_MT_SAFE */ - template class ACE_Cleanup_Adapter<ACE_SYNCH_RW_MUTEX>; - template class ACE_Managed_Object<ACE_SYNCH_RW_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# pragma instantiate ACE_Cleanup_Adapter<ACE_Null_Mutex> -# pragma instantiate ACE_Cleanup_Adapter<ACE_Mutex> -# pragma instantiate ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex> -# pragma instantiate ACE_Cleanup_Adapter<ACE_Thread_Mutex> -# pragma instantiate ACE_Managed_Object<ACE_Null_Mutex> -# pragma instantiate ACE_Managed_Object<ACE_Mutex> -# pragma instantiate ACE_Managed_Object<ACE_Recursive_Thread_Mutex> -# pragma instantiate ACE_Managed_Object<ACE_Thread_Mutex> -# endif /* ACE_MT_SAFE */ -# pragma instantiate ACE_Cleanup_Adapter<ACE_SYNCH_RW_MUTEX> -# pragma instantiate ACE_Managed_Object<ACE_SYNCH_RW_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Object_Manager.h b/ace/Object_Manager.h index 0144bb203ca..293864096b3 100644 --- a/ace/Object_Manager.h +++ b/ace/Object_Manager.h @@ -24,20 +24,32 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. class ACE_Object_Manager_Preallocations; class ACE_Sig_Adapter; class ACE_Sig_Set; + +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Mutex; class ACE_Null_Mutex; class ACE_Thread_Mutex; class ACE_Recursive_Thread_Mutex; class ACE_RW_Thread_Mutex; +ACE_END_VERSIONED_NAMESPACE_DECL + # include "ace/Recursive_Thread_Mutex.h" #endif /* ACE_MT_SAFE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // only used by ACE_OS_Object_Manager::ctor # if defined (ACE_WIN32) // Default WIN32 structured exception handler. @@ -334,14 +346,14 @@ public: // use by ACE_Singleton _only_. /** - * Accesses an <ACE_Null_Mutex> to be used for construction of + * Accesses an ACE_Null_Mutex to be used for construction of * <ACE_Singletons>. Returns 0, and the lock in the argument, on * success; returns -1 on failure. */ static int get_singleton_lock (ACE_Null_Mutex *&); /** - * Accesses a non-recursive <ACE_Thread_Mutex> to be used for + * Accesses a non-recursive ACE_Thread_Mutex to be used for * construction of <ACE_Singletons>. Returns 0, and the lock in the * argument, on success; returns -1 on failure. */ @@ -355,7 +367,7 @@ public: static int get_singleton_lock (ACE_Mutex *&); /** - * Accesses a recursive <ACE_Recursive_Thread_Mutex> to be used for + * Accesses a recursive ACE_Recursive_Thread_Mutex to be used for * construction of <ACE_Singletons>. Returns 0, and the lock in the * argument, on success; returns -1 on failure. */ @@ -423,6 +435,7 @@ private: ACE_Object_Manager &operator= (const ACE_Object_Manager &); }; +ACE_END_VERSIONED_NAMESPACE_DECL #include "ace/Static_Object_Lock.h" @@ -436,10 +449,10 @@ private: // We can't use the ACE_SVC_FACTORY_DECLARE macro here because this // needs to be in the ACE_Export context rather than the // ACE_Svc_Export context. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Service_Object; -extern "C" ACE_Export -ACE_Service_Object * -_make_ACE_Service_Manager (ACE_Service_Object_Exterminator *); +ACE_END_VERSIONED_NAMESPACE_DECL +ACE_FACTORY_DECLARE (ACE, ACE_Service_Manager) #endif /* ! ACE_LACKS_ACE_SVCCONF */ diff --git a/ace/Object_Manager.inl b/ace/Object_Manager.inl index 19ba4079a9c..bb95a485fdc 100644 --- a/ace/Object_Manager.inl +++ b/ace/Object_Manager.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Object_Manager::at_exit (ACE_Cleanup *object, @@ -8,7 +11,7 @@ ACE_Object_Manager::at_exit (ACE_Cleanup *object, { return ACE_Object_Manager::instance ()->at_exit_i ( object, - (ACE_CLEANUP_FUNC) ace_cleanup_destroyer, + (ACE_CLEANUP_FUNC) ACE_CLEANUP_DESTROYER_NAME, param); } @@ -33,3 +36,5 @@ ACE_Object_Manager::default_mask (void) return *reinterpret_cast<ACE_Sig_Set *> (ACE_OS_Object_Manager::default_mask ()); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Object_Manager_Base.cpp b/ace/Object_Manager_Base.cpp index 720e362e922..185ab58d5be 100644 --- a/ace/Object_Manager_Base.cpp +++ b/ace/Object_Manager_Base.cpp @@ -1,4 +1,3 @@ -// -*- C++ -*- // $Id$ #include "ace/Object_Manager_Base.h" @@ -11,6 +10,8 @@ ACE_RCSID(ace, Object_Manager_Base, "$Id$") #include "ace/OS_NS_signal.h" #include "ace/OS_NS_stdio.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) int ACE_SEH_Default_Exception_Selector (void *) { @@ -501,3 +502,5 @@ ACE_OS_Object_Manager_Manager::~ACE_OS_Object_Manager_Manager (void) static ACE_OS_Object_Manager_Manager ACE_OS_Object_Manager_Manager_instance; #endif /* ! ACE_HAS_NONSTATIC_OBJECT_MANAGER */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Object_Manager_Base.h b/ace/Object_Manager_Base.h index 4188e008835..83f5d91354c 100644 --- a/ace/Object_Manager_Base.h +++ b/ace/Object_Manager_Base.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -29,6 +29,8 @@ #include "ace/os_include/sys/os_types.h" #include "ace/os_include/os_signal.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Object_Manager; class ACE_OS_Object_Manager_Manager; class ACE_TSS_Cleanup; @@ -248,5 +250,7 @@ public: friend void ACE_OS_Object_Manager_Internal_Exit_Hook (); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_OBJECT_MANAGER_BASE_H */ diff --git a/ace/Obstack.cpp b/ace/Obstack.cpp index d794f1263fe..792a398ba8a 100644 --- a/ace/Obstack.cpp +++ b/ace/Obstack.cpp @@ -4,8 +4,12 @@ ACE_RCSID(ace, Obstack, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Obstack_T<char>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Obstack_T<char> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Obstack.h b/ace/Obstack.h index 6312ecb7fc1..511f7715f69 100644 --- a/ace/Obstack.h +++ b/ace/Obstack.h @@ -19,9 +19,13 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_SINGLETON_DECLARATION (ACE_Obstack_T <char>;) typedef ACE_Obstack_T<char> ACE_Obstack; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_OBSTACK_H */ diff --git a/ace/Obstack_T.cpp b/ace/Obstack_T.cpp index e6baeb61e41..f7b781eee21 100644 --- a/ace/Obstack_T.cpp +++ b/ace/Obstack_T.cpp @@ -15,6 +15,8 @@ #include "ace/Obstack_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Obstack_T) template <class CHAR> void @@ -201,4 +203,6 @@ ACE_Obstack_T<CHAR>::release (void) this->curr_->block_ = this->curr_->cur_ = this->curr_->contents_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_OBSTACK_T_CPP */ diff --git a/ace/Obstack_T.h b/ace/Obstack_T.h index d070b011bea..3e24ab31925 100644 --- a/ace/Obstack_T.h +++ b/ace/Obstack_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,12 +22,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// #include "ace/Basic_Types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Allocator; /** - * @class ACE_Obstack + * @class ACE_Obstack_T * * @brief Define a simple "mark and release" memory allocation utility. * @@ -116,6 +116,8 @@ protected: class ACE_Obchunk *curr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Obstack_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Obstack_T.inl b/ace/Obstack_T.inl index 57e049ef1ea..92c90cd44d9 100644 --- a/ace/Obstack_T.inl +++ b/ace/Obstack_T.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class CHAR> ACE_INLINE size_t ACE_Obstack_T<CHAR>::length () const { @@ -29,3 +33,5 @@ ACE_Obstack_T<CHAR>::freeze (void) this->curr_->block_ = this->curr_->cur_; return retv; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/PI_Malloc.cpp b/ace/PI_Malloc.cpp index fbe0d925e6f..6486bdb22eb 100644 --- a/ace/PI_Malloc.cpp +++ b/ace/PI_Malloc.cpp @@ -17,6 +17,8 @@ ACE_RCSID (ace, #include "ace/Process_Mutex.h" #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_PI_Control_Block::ACE_Malloc_Header::dump (void) const { @@ -157,20 +159,7 @@ ACE_PI_Control_Block::ACE_Name_Node::dump (void) const #endif /* ACE_HAS_DUMP */ } - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Malloc_Header>; -template class ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Name_Node>; -template class ACE_Based_Pointer_Basic<char>; -template class ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Malloc_Header>; -template class ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Name_Node>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Malloc_Header> -#pragma instantiate ACE_Based_Pointer_Basic<ACE_PI_Control_Block::ACE_Name_Node> -#pragma instantiate ACE_Based_Pointer_Basic<char> -#pragma instantiate ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Malloc_Header> -#pragma instantiate ACE_Based_Pointer<ACE_PI_Control_Block::ACE_Name_Node> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1*/ diff --git a/ace/PI_Malloc.h b/ace/PI_Malloc.h index 6306b76708c..07b830e3607 100644 --- a/ace/PI_Malloc.h +++ b/ace/PI_Malloc.h @@ -16,12 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -32,11 +27,13 @@ #include "ace/Malloc.h" #include "ace/Based_Pointer_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // prepare for position independent malloc /** * @class ACE_PI_Control_Block * - * @brief This information is stored in memory allocated by the <Memory_Pool>. + * @brief This information is stored in memory allocated by the Memory_Pool. * * This class implements the control block structure that can be * used in a "position indepent" fashion, i.e., you don't need to @@ -44,7 +41,7 @@ * processes sharing the memory. The tradoff of this flexibility * is more expensive malloc/free operations. */ -class ACE_Memory_Export ACE_PI_Control_Block +class ACE_Export ACE_PI_Control_Block { public: class ACE_Malloc_Header; @@ -57,11 +54,11 @@ public: /** * @class ACE_Malloc_Header * - * @brief This is the control block header. It's used by <ACE_Malloc> + * @brief This is the control block header. It's used by ACE_Malloc * to keep track of each chunk of data when it's in the free * list or in use. */ - class ACE_Memory_Export ACE_Malloc_Header + class ACE_Export ACE_Malloc_Header { public: ACE_Malloc_Header (void); @@ -86,20 +83,24 @@ public: void dump (void) const; private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Malloc_Header &)) + + // Disallow copy construction and assignment. + ACE_Malloc_Header (ACE_Malloc_Header const &); + void operator= (ACE_Malloc_Header const &); + }; /** * @class ACE_Name_Node * - * @brief This class supports "named memory regions" within <ACE_Malloc>. + * @brief This class supports "named memory regions" within ACE_Malloc. * * Internally, the named memory regions are stored as a - * doubly-linked list within the <Memory_Pool>. This makes + * doubly-linked list within the Memory_Pool. This makes * it easy to iterate over the items in the list in both FIFO * and LIFO order. */ - class ACE_Memory_Export ACE_Name_Node + class ACE_Export ACE_Name_Node { public: // = Initialization methods. @@ -145,7 +146,9 @@ public: void dump (void) const; private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Name_Node &)) + + // Disallow assignment. + void operator= (const ACE_Name_Node &); }; /// Print out a bunch of size info for debugging. @@ -192,9 +195,13 @@ public: void dump (void) const; private: - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Control_Block &)) + + // Disallow assignment. + void operator= (const ACE_Control_Block &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/PI_Malloc.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/PI_Malloc.inl b/ace/PI_Malloc.inl index b082b523618..1cb78d466e1 100644 --- a/ace/PI_Malloc.inl +++ b/ace/PI_Malloc.inl @@ -1,6 +1,11 @@ +// -*- C++ -*- +// // $Id$ #if (ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_PI_Control_Block::ACE_Name_Node::~ACE_Name_Node (void) { @@ -21,5 +26,8 @@ ACE_PI_Control_Block::ACE_Name_Node::init_ptr new ((void *) ptr) NAME_NODE_PTR (base_addr, 0); *ptr = init; } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS == 1 */ diff --git a/ace/POSIX_Asynch_IO.cpp b/ace/POSIX_Asynch_IO.cpp index 9013b577e33..48943aaa544 100644 --- a/ace/POSIX_Asynch_IO.cpp +++ b/ace/POSIX_Asynch_IO.cpp @@ -19,6 +19,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + size_t ACE_POSIX_Asynch_Result::bytes_transferred (void) const { @@ -118,9 +120,7 @@ ACE_POSIX_Asynch_Result::ACE_POSIX_Asynch_Result u_long offset_high, int priority, int signal_number) - : ACE_Asynch_Result_Impl (), - aiocb (), - handler_proxy_ (handler_proxy), + : handler_proxy_ (handler_proxy), act_ (act), bytes_transferred_ (0), success_ (0), @@ -206,8 +206,7 @@ ACE_POSIX_Asynch_Operation::~ACE_POSIX_Asynch_Operation (void) } ACE_POSIX_Asynch_Operation::ACE_POSIX_Asynch_Operation (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - posix_proactor_ (posix_proactor), + : posix_proactor_ (posix_proactor), handle_ (ACE_INVALID_HANDLE) { } @@ -241,9 +240,7 @@ ACE_POSIX_Asynch_Read_Stream_Result::ACE_POSIX_Asynch_Read_Stream_Result ACE_HANDLE event, int priority, int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Stream_Result_Impl (), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block) { @@ -285,9 +282,7 @@ ACE_POSIX_Asynch_Read_Stream_Result::~ACE_POSIX_Asynch_Read_Stream_Result (void) // ************************************************************ ACE_POSIX_Asynch_Read_Stream::ACE_POSIX_Asynch_Read_Stream (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Stream_Impl (), - ACE_POSIX_Asynch_Operation (posix_proactor) + : ACE_POSIX_Asynch_Operation (posix_proactor) { } @@ -322,7 +317,7 @@ ACE_POSIX_Asynch_Read_Stream::read (ACE_Message_Block &message_block, signal_number), -1); - int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::READ); + int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ); if (return_val == -1) delete result; @@ -362,9 +357,7 @@ ACE_POSIX_Asynch_Write_Stream_Result::ACE_POSIX_Asynch_Write_Stream_Result ACE_HANDLE event, int priority, int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Stream_Result_Impl (), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block) { @@ -407,9 +400,7 @@ ACE_POSIX_Asynch_Write_Stream_Result::~ACE_POSIX_Asynch_Write_Stream_Result (voi // ********************************************************************* ACE_POSIX_Asynch_Write_Stream::ACE_POSIX_Asynch_Write_Stream (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Stream_Impl (), - ACE_POSIX_Asynch_Operation (posix_proactor) + : ACE_POSIX_Asynch_Operation (posix_proactor) { } @@ -444,7 +435,7 @@ ACE_POSIX_Asynch_Write_Stream::write (ACE_Message_Block &message_block, signal_number), -1); - int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::WRITE); + int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE); if (return_val == -1) delete result; @@ -468,10 +459,7 @@ ACE_POSIX_Asynch_Read_File_Result::ACE_POSIX_Asynch_Read_File_Result ACE_HANDLE event, int priority, int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Stream_Result_Impl (), - ACE_Asynch_Read_File_Result_Impl (), - ACE_POSIX_Asynch_Read_Stream_Result (handler_proxy, + : ACE_POSIX_Asynch_Read_Stream_Result (handler_proxy, handle, message_block, bytes_to_read, @@ -521,10 +509,7 @@ ACE_POSIX_Asynch_Read_File_Result::~ACE_POSIX_Asynch_Read_File_Result (void) // ********************************************************************* ACE_POSIX_Asynch_Read_File::ACE_POSIX_Asynch_Read_File (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Stream_Impl (), - ACE_Asynch_Read_File_Impl (), - ACE_POSIX_Asynch_Read_Stream (posix_proactor) + : ACE_POSIX_Asynch_Read_Stream (posix_proactor) { } @@ -563,7 +548,7 @@ ACE_POSIX_Asynch_Read_File::read (ACE_Message_Block &message_block, signal_number), -1); - int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::READ); + int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ); if (return_val == -1) delete result; @@ -601,10 +586,7 @@ ACE_POSIX_Asynch_Write_File_Result::ACE_POSIX_Asynch_Write_File_Result ACE_HANDLE event, int priority, int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Stream_Result_Impl (), - ACE_Asynch_Write_File_Result_Impl (), - ACE_POSIX_Asynch_Write_Stream_Result (handler_proxy, + : ACE_POSIX_Asynch_Write_Stream_Result (handler_proxy, handle, message_block, bytes_to_write, @@ -654,10 +636,7 @@ ACE_POSIX_Asynch_Write_File_Result::~ACE_POSIX_Asynch_Write_File_Result (void) // ********************************************************************* ACE_POSIX_Asynch_Write_File::ACE_POSIX_Asynch_Write_File (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Stream_Impl (), - ACE_Asynch_Write_File_Impl (), - ACE_POSIX_Asynch_Write_Stream (posix_proactor) + : ACE_POSIX_Asynch_Write_Stream (posix_proactor) { } @@ -696,7 +675,7 @@ ACE_POSIX_Asynch_Write_File::write (ACE_Message_Block &message_block, signal_number), -1); - int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::WRITE); + int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE); if (return_val == -1) delete result; @@ -759,9 +738,7 @@ ACE_POSIX_Asynch_Accept_Result::ACE_POSIX_Asynch_Accept_Result int priority, int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Accept_Result_Impl (), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), message_block_ (message_block), listen_handle_ (listen_handle) @@ -801,9 +778,7 @@ ACE_POSIX_Asynch_Accept_Result::~ACE_POSIX_Asynch_Accept_Result (void) // ********************************************************************* ACE_POSIX_Asynch_Accept::ACE_POSIX_Asynch_Accept (ACE_POSIX_Proactor * posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Accept_Impl (), - ACE_POSIX_Asynch_Operation (posix_proactor), + : ACE_POSIX_Asynch_Operation (posix_proactor), flg_open_ (false) { } @@ -1180,10 +1155,7 @@ ACE_POSIX_Asynch_Connect_Result::ACE_POSIX_Asynch_Connect_Result ACE_HANDLE event, int priority, int signal_number) - - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Connect_Result_Impl (), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number) { this->aio_fildes = connect_handle; @@ -1218,9 +1190,7 @@ ACE_POSIX_Asynch_Connect_Result::~ACE_POSIX_Asynch_Connect_Result (void) // ********************************************************************* ACE_POSIX_Asynch_Connect::ACE_POSIX_Asynch_Connect (ACE_POSIX_Proactor * posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Connect_Impl (), - ACE_POSIX_Asynch_Operation (posix_proactor), + : ACE_POSIX_Asynch_Operation (posix_proactor), flg_open_ (false) { } @@ -1697,10 +1667,7 @@ ACE_POSIX_Asynch_Transmit_File_Result::ACE_POSIX_Asynch_Transmit_File_Result ACE_HANDLE event, int priority, int signal_number) - - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Transmit_File_Result_Impl (), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, offset, offset_high, priority, signal_number), socket_ (socket), header_and_trailer_ (header_and_trailer), @@ -2087,9 +2054,7 @@ ACE_POSIX_Asynch_Transmit_Handler::initiate_read_file (void) // ********************************************************************* ACE_POSIX_Asynch_Transmit_File::ACE_POSIX_Asynch_Transmit_File (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Transmit_File_Impl (), - ACE_POSIX_Asynch_Operation (posix_proactor) + : ACE_POSIX_Asynch_Operation (posix_proactor) { } @@ -2152,8 +2117,8 @@ ACE_POSIX_Asynch_Transmit_File::transmit_file (ACE_HANDLE file, ACE_POSIX_Asynch_Transmit_Handler *transmit_handler = 0; ACE_NEW_RETURN (transmit_handler, - ::ACE_POSIX_Asynch_Transmit_Handler (this->posix_proactor (), - result), + ACE_POSIX_Asynch_Transmit_Handler (this->posix_proactor (), + result), -1); ssize_t return_val = transmit_handler->transmit (); @@ -2228,10 +2193,7 @@ ACE_POSIX_Asynch_Read_Dgram_Result::ACE_POSIX_Asynch_Read_Dgram_Result ACE_HANDLE event, int priority, int signal_number) - - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Read_Dgram_Result_Impl(), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_read_ (bytes_to_read), message_block_ (message_block), @@ -2313,10 +2275,7 @@ ACE_POSIX_Asynch_Write_Dgram_Result::ACE_POSIX_Asynch_Write_Dgram_Result ACE_HANDLE event, int priority, int signal_number) - - : ACE_Asynch_Result_Impl (), - ACE_Asynch_Write_Dgram_Result_Impl(), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), bytes_to_write_ (bytes_to_write), message_block_ (message_block), @@ -2390,7 +2349,7 @@ ACE_POSIX_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, signal_number), -1); - int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::READ); + int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_READ); if (return_val == -1) delete result; @@ -2398,9 +2357,7 @@ ACE_POSIX_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, } ACE_POSIX_Asynch_Read_Dgram::ACE_POSIX_Asynch_Read_Dgram (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Read_Dgram_Impl (), - ACE_POSIX_Asynch_Operation (posix_proactor) + : ACE_POSIX_Asynch_Operation (posix_proactor) { } @@ -2441,7 +2398,7 @@ ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, signal_number), -1); - int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::WRITE); + int return_val = proactor->start_aio (result, ACE_POSIX_Proactor::ACE_OPCODE_WRITE); if (return_val == -1) delete result; @@ -2450,50 +2407,10 @@ ACE_POSIX_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, ACE_POSIX_Asynch_Write_Dgram::ACE_POSIX_Asynch_Write_Dgram (ACE_POSIX_Proactor *posix_proactor) - : ACE_Asynch_Operation_Impl (), - ACE_Asynch_Write_Dgram_Impl (), - ACE_POSIX_Asynch_Operation (posix_proactor) + : ACE_POSIX_Asynch_Operation (posix_proactor) { } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Unbounded_Queue<ACE_POSIX_Asynch_Accept_Result *>; -template class ACE_Node<ACE_POSIX_Asynch_Accept_Result *>; -template class ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Accept_Result *>; - -template class ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *>; -template class ACE_Node<ACE_POSIX_Asynch_Result *>; -template class ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Result *>; - -template class ACE_Map_Entry<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Const_Iterator_Base<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Const_Iterator<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Unbounded_Queue<ACE_POSIX_Asynch_Accept_Result *> -#pragma instantiate ACE_Node<ACE_POSIX_Asynch_Accept_Result *> -#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Accept_Result *> - -#pragma instantiate ACE_Unbounded_Queue<ACE_POSIX_Asynch_Result *> -#pragma instantiate ACE_Node<ACE_POSIX_Asynch_Result *> -#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_POSIX_Asynch_Result *> - -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Const_Iterator_Base<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Const_Iterator<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_POSIX_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> - - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_AIO_CALLS */ diff --git a/ace/POSIX_Asynch_IO.h b/ace/POSIX_Asynch_IO.h index e25219070c4..57eb53e169c 100644 --- a/ace/POSIX_Asynch_IO.h +++ b/ace/POSIX_Asynch_IO.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -40,6 +40,8 @@ #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations class ACE_POSIX_Proactor; class ACE_Proactor_Impl; @@ -1296,5 +1298,7 @@ protected: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_AIO_CALLS */ #endif /* ACE_POSIX_ASYNCH_IO_H */ diff --git a/ace/POSIX_CB_Proactor.cpp b/ace/POSIX_CB_Proactor.cpp index 0c4df22b45e..708fdcf8b5d 100644 --- a/ace/POSIX_CB_Proactor.cpp +++ b/ace/POSIX_CB_Proactor.cpp @@ -7,12 +7,13 @@ #include "ace/Task_T.h" #include "ace/Log_Msg.h" #include "ace/Object_Manager.h" - +#include "ace/OS_NS_sys_time.h" ACE_RCSID (ace, POSIX_CB_Proactor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_POSIX_CB_Proactor::ACE_POSIX_CB_Proactor (size_t max_aio_operations) : ACE_POSIX_AIOCB_Proactor (max_aio_operations, @@ -178,4 +179,6 @@ ACE_POSIX_CB_Proactor::handle_events_i (u_long milli_seconds) return ret_aio + ret_que > 0 ? 1 : 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_AIO_CALLS && !__Lynx__ && !__FreeBSD__ */ diff --git a/ace/POSIX_CB_Proactor.h b/ace/POSIX_CB_Proactor.h index 6021b32a04f..5328d5b1cac 100644 --- a/ace/POSIX_CB_Proactor.h +++ b/ace/POSIX_CB_Proactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,10 +27,12 @@ #include "ace/POSIX_Proactor.h" -#if defined(AIX) || defined(sun) || defined(__APPLE__) +#if defined(AIX) || defined(sun) || defined(__APPLE__) || defined (ACE_VXWORKS) typedef union sigval sigval_t; #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_POSIX_CB_Proactor * @@ -92,5 +94,7 @@ protected: ACE_SYNCH_SEMAPHORE sema_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_AIO_CALLS && !__Lynx__ && !__FreeBSD__ */ #endif /* ACE_POSIX_CB_PROACTOR_H*/ diff --git a/ace/POSIX_Proactor.cpp b/ace/POSIX_Proactor.cpp index f6bd0c26f86..1664200ecf6 100644 --- a/ace/POSIX_Proactor.cpp +++ b/ace/POSIX_Proactor.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ // $Id$ #include "ace/POSIX_Proactor.h" @@ -27,6 +26,9 @@ #endif /* sun */ // ********************************************************************* + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_POSIX_Wakeup_Completion * @@ -34,7 +36,7 @@ * ACE_Proactor interface to wake up all the threads blocking * for completions. */ -class ACE_Export ACE_POSIX_Wakeup_Completion : public ACE_POSIX_Asynch_Result +class ACE_POSIX_Wakeup_Completion : public ACE_POSIX_Asynch_Result { public: /// Constructor. @@ -506,7 +508,7 @@ ACE_POSIX_Proactor::create_asynch_timer int priority, int signal_number) { - ACE_Asynch_Result_Impl *implementation; + ACE_POSIX_Asynch_Timer *implementation; ACE_NEW_RETURN (implementation, ACE_POSIX_Asynch_Timer (handler_proxy, act, @@ -624,7 +626,7 @@ ACE_POSIX_Proactor::get_impl_type (void) * message block to another <accept>, we update <wr_ptr> and put * it in its initial position. */ -class ACE_Export ACE_AIOCB_Notify_Pipe_Manager : public ACE_Handler +class ACE_AIOCB_Notify_Pipe_Manager : public ACE_Handler { public: /// Constructor. You need the posix proactor because you need to call @@ -1317,11 +1319,11 @@ ACE_POSIX_AIOCB_Proactor::start_aio (ACE_POSIX_Asynch_Result *result, // Save operation code in the aiocb switch (op) { - case ACE_POSIX_Proactor::READ: + case ACE_POSIX_Proactor::ACE_OPCODE_READ: result->aio_lio_opcode = LIO_READ; break; - case ACE_POSIX_Proactor::WRITE: + case ACE_POSIX_Proactor::ACE_OPCODE_WRITE: result->aio_lio_opcode = LIO_WRITE; break; @@ -1698,7 +1700,7 @@ ACE_POSIX_Proactor::Proactor_Type ACE_POSIX_SIG_Proactor::get_impl_type (void) { return PROACTOR_SIG; -} +} int ACE_POSIX_SIG_Proactor::handle_events (ACE_Time_Value &wait_time) @@ -2003,8 +2005,7 @@ ACE_POSIX_Asynch_Timer::ACE_POSIX_Asynch_Timer ACE_HANDLE event, int priority, int signal_number) - : ACE_Asynch_Result_Impl (), - ACE_POSIX_Asynch_Result + : ACE_POSIX_Asynch_Result (handler_proxy, act, event, 0, 0, priority, signal_number), time_ (tv) { @@ -2057,5 +2058,6 @@ ACE_POSIX_Wakeup_Completion::complete (size_t /* bytes_transferred */, handler->handle_wakeup (); } +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_AIO_CALLS */ diff --git a/ace/POSIX_Proactor.h b/ace/POSIX_Proactor.h index 0bacb0ee2db..e56a2f28409 100644 --- a/ace/POSIX_Proactor.h +++ b/ace/POSIX_Proactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -36,6 +36,8 @@ #define ACE_AIO_MAX_SIZE 2048 #define ACE_AIO_DEFAULT_SIZE 1024 +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_POSIX_Proactor * @@ -92,8 +94,8 @@ public: }; enum Opcode { - READ = 1, - WRITE = 2 + ACE_OPCODE_READ = 1, + ACE_OPCODE_WRITE = 2 }; virtual Proactor_Type get_impl_type (void); @@ -105,7 +107,7 @@ public: virtual int close (void); /** - * Dispatch a single set of events. If <wait_time> elapses before + * Dispatch a single set of events. If @a wait_time elapses before * any events occur, return 0. Return 1 on success i.e., when a * completion is dispatched, non-zero (-1) on errors and errno is * set accordingly. @@ -114,8 +116,7 @@ public: /** * Block indefinitely until at least one event is dispatched. - * Dispatch a single set of events. If <wait_time> elapses before - * any events occur, return 0. Return 1 on success i.e., when a + * Dispatch a single set of events.Return 1 on success i.e., when a * completion is dispatched, non-zero (-1) on errors and errno is * set accordingly. */ @@ -649,6 +650,8 @@ protected: ACE_Time_Value time_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/POSIX_Proactor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/POSIX_Proactor.inl b/ace/POSIX_Proactor.inl index eb358c0b8ae..ae5f727c2a8 100644 --- a/ace/POSIX_Proactor.inl +++ b/ace/POSIX_Proactor.inl @@ -2,8 +2,12 @@ // // $Id$ -ACE_INLINE +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE ACE_Asynch_Pseudo_Task& ACE_POSIX_Proactor::get_asynch_pseudo_task (void) { return this->pseudo_task_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Pagefile_Memory_Pool.cpp b/ace/Pagefile_Memory_Pool.cpp index 365140b6ed1..125dd041f9e 100644 --- a/ace/Pagefile_Memory_Pool.cpp +++ b/ace/Pagefile_Memory_Pool.cpp @@ -29,10 +29,13 @@ ACE_RCSID(ace, Pagefile_Memory_Pool, "$Id$") #else //if !defined (ACE_HAS_WINCE) #define ACE_MAP_FILE(_hnd, _access, _offHigh, _offLow, _nBytes, _baseAdd)\ MapViewOfFile (_hnd, _access, _offHigh, _offLow, _nBytes) -#endif /* !defined (ACE_HAS_WINCE) */ +#endif /* !ACE_HAS_WINCE */ -ACE_Pagefile_Memory_Pool_Options::ACE_Pagefile_Memory_Pool_Options (void *base_addr, - size_t max_size) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Pagefile_Memory_Pool_Options::ACE_Pagefile_Memory_Pool_Options ( + void *base_addr, + size_t max_size) : base_addr_ (base_addr), max_size_ (max_size) { @@ -66,7 +69,7 @@ ACE_Pagefile_Memory_Pool::ACE_Pagefile_Memory_Pool (const ACE_TCHAR *backing_sto { this->local_cb_.req_base_ = 0; this->local_cb_.mapped_base_ = 0; - this->local_cb_.sh_.max_size_ = + this->local_cb_.sh_.max_size_ = this->round_to_chunk_size (page_size_) ; this->local_cb_.sh_.mapped_size_ = 0; this->local_cb_.sh_.free_offset_ = @@ -376,5 +379,7 @@ ACE_Pagefile_Memory_Pool::map (int &first_time, return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 */ diff --git a/ace/Pagefile_Memory_Pool.h b/ace/Pagefile_Memory_Pool.h index 472e1a8731d..eab04d23849 100644 --- a/ace/Pagefile_Memory_Pool.h +++ b/ace/Pagefile_Memory_Pool.h @@ -16,12 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -32,6 +27,8 @@ #include "ace/ACE.h" #include "ace/os_include/sys/os_mman.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Pagefile_Memory_Pool_Options * @@ -40,12 +37,13 @@ * This should be a nested class, but that breaks too many * compilers. */ -class ACE_Memory_Export ACE_Pagefile_Memory_Pool_Options +class ACE_Export ACE_Pagefile_Memory_Pool_Options { public: /// Initialization method. - ACE_Pagefile_Memory_Pool_Options (void *base_addr = ACE_DEFAULT_PAGEFILE_POOL_BASE, - size_t max_size = ACE_DEFAULT_PAGEFILE_POOL_SIZE); + ACE_Pagefile_Memory_Pool_Options ( + void *base_addr = ACE_DEFAULT_PAGEFILE_POOL_BASE, + size_t max_size = ACE_DEFAULT_PAGEFILE_POOL_SIZE); /// Base address of the memory-mapped backing store. void *base_addr_; @@ -60,7 +58,7 @@ public: * @brief Make a memory pool that is based on "anonymous" memory * regions allocated from the Win32 page file. */ -class ACE_Memory_Export ACE_Pagefile_Memory_Pool +class ACE_Export ACE_Pagefile_Memory_Pool { public: typedef ACE_Pagefile_Memory_Pool_Options OPTIONS; @@ -191,6 +189,8 @@ private: ACE_TCHAR backing_store_name_[MAXPATHLEN]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 */ #if defined (__ACE_INLINE__) diff --git a/ace/Pagefile_Memory_Pool.inl b/ace/Pagefile_Memory_Pool.inl index db8d7a00aa4..cf54da23f29 100644 --- a/ace/Pagefile_Memory_Pool.inl +++ b/ace/Pagefile_Memory_Pool.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #if defined (ACE_WIN32) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE size_t ACE_Pagefile_Memory_Pool::round_to_chunk_size (size_t nbytes) { @@ -45,4 +48,7 @@ ACE_Pagefile_Memory_Pool::base_addr (void) const { return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 */ diff --git a/ace/Pair.cpp b/ace/Pair.cpp deleted file mode 100644 index fce14f96302..00000000000 --- a/ace/Pair.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// Pair.cpp -// -// = AUTHOR -// Irfan Pyarali -// -// ============================================================================ - -#include "ace/Pair_T.h" - -ACE_RCSID(ace, Pair, "$Id$") - diff --git a/ace/Pair.h b/ace/Pair.h index b4a865c35f4..be0a78a87d9 100644 --- a/ace/Pair.h +++ b/ace/Pair.h @@ -6,6 +6,8 @@ * * $Id$ * + * ACE_Pair<> convenience header. + * * @author Irfan Pyarali */ //============================================================================= diff --git a/ace/Pair_T.cpp b/ace/Pair_T.cpp index eb4e10b33ac..fd38f8236ef 100644 --- a/ace/Pair_T.cpp +++ b/ace/Pair_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_PAIR_T_C -#define ACE_PAIR_T_C +#ifndef ACE_PAIR_T_CPP +#define ACE_PAIR_T_CPP #include "ace/Pair_T.h" @@ -13,6 +13,4 @@ #include "ace/Pair_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Pair_T, "$Id$") - -#endif /* ACE_PAIR_T_C */ +#endif /* ACE_PAIR_T_CPP */ diff --git a/ace/Pair_T.h b/ace/Pair_T.h index 37147794fd9..8c8c89f5c2e 100644 --- a/ace/Pair_T.h +++ b/ace/Pair_T.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Pair * @@ -109,6 +111,8 @@ protected: T2 &second_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Pair_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Pair_T.inl b/ace/Pair_T.inl index dafbb222cca..4ce4a4acae4 100644 --- a/ace/Pair_T.inl +++ b/ace/Pair_T.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T1, class T2> ACE_INLINE ACE_Pair<T1, T2>::ACE_Pair (const T1 &t1, const T2 &t2) @@ -84,3 +86,5 @@ ACE_Reference_Pair<T1, T2>::operator== (const ACE_Reference_Pair<T1, T2> &rhs) c return (this->first_ == rhs.first_ && this->second_ == rhs.second_); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp index 7a599303ae0..e442c5e4b65 100644 --- a/ace/Parse_Node.cpp +++ b/ace/Parse_Node.cpp @@ -15,12 +15,13 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_Stream_Node) // Provide the class hierarchy that defines the parse tree of Service // Nodes. - void ACE_Stream_Node::dump (void) const { @@ -36,7 +37,7 @@ ACE_Stream_Node::apply (int & yyerrno) if (ACE_Service_Config::initialize (this->node_->record (), this->node_->parameters ()) == -1) - yyerrno++; + ++yyerrno; if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, @@ -182,7 +183,7 @@ ACE_Suspend_Node::apply (int & yyerrno) ACE_TRACE ("ACE_Suspend_Node::apply"); if (ACE_Service_Config::suspend (this->name ()) == -1) - yyerrno++; + ++yyerrno; if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, @@ -196,7 +197,7 @@ ACE_Resume_Node::apply (int & yyerrno) { ACE_TRACE ("ACE_Resume_Node::apply"); if (ACE_Service_Config::resume (this->name ()) == -1) - yyerrno++; + ++yyerrno; if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, @@ -230,7 +231,7 @@ ACE_Remove_Node::apply (int & yyerrno) { ACE_TRACE ("ACE_Remove_Node::apply"); if (ACE_Service_Config::remove (this->name ()) == -1) - yyerrno++; + ++yyerrno; if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, @@ -261,7 +262,7 @@ ACE_Dynamic_Node::apply (int & yyerrno) if (ACE_Service_Config::initialize (this->record (), this->parameters ()) == -1) - yyerrno++; + ++yyerrno; if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, @@ -307,7 +308,7 @@ const ACE_Service_Type * ACE_Static_Node::record (void) const { ACE_TRACE ("ACE_Static_Node::record"); - ACE_Service_Type *sr; + ACE_Service_Type *sr = 0; if (ACE_Service_Repository::instance()->find (this->name (), @@ -330,7 +331,7 @@ ACE_Static_Node::apply (int & yyerrno) ACE_TRACE ("ACE_Static_Node::apply"); if (ACE_Service_Config::initialize (this->name (), this->parameters ()) == -1) - yyerrno++; + ++yyerrno; if (ACE::debug ()) ACE_DEBUG ((LM_DEBUG, @@ -357,6 +358,7 @@ ACE_Location_Node::dump (void) const ACE_Location_Node::ACE_Location_Node (void) : pathname_ (0), + dll_ (), symbol_ (0) { ACE_TRACE ("ACE_Location_Node::ACE_Location_Node"); @@ -410,14 +412,6 @@ ACE_Location_Node::open_dll (int & yyerrno) { ++yyerrno; -#ifndef ACE_NLOGGING - ACE_TCHAR *errmsg = this->dll_.error (); - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_DLL::open failed for %s: %s\n"), - this->pathname (), - errmsg ? errmsg : ACE_LIB_TEXT ("no error reported"))); -#endif /* ACE_NLOGGING */ - return -1; } @@ -493,13 +487,73 @@ ACE_Function_Node::dump (void) const ACE_Function_Node::ACE_Function_Node (const ACE_TCHAR *path, const ACE_TCHAR *func_name) - : function_name_ (ACE::strnew (func_name)) + : function_name_ (make_func_name (func_name)) { ACE_TRACE ("ACE_Function_Node::ACE_Function_Node"); this->pathname (ACE::strnew (path)); this->must_delete_ = 1; } +ACE_TCHAR * +ACE_Function_Node::make_func_name (ACE_TCHAR const * func_name) +{ + // Preprocessor symbols will not be expanded if they are + // stringified. Force the preprocessor to expand them during the + // argument prescan by calling a macro that itself calls another + // that performs the actual stringification. +#if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1 +# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING_IMPL(NAME) #NAME +# define ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING(NAME) ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING_IMPL(NAME) +# define ACE_VERSIONED_NAMESPACE_NAME_STRING ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING(ACE_VERSIONED_NAMESPACE_NAME) + + // Check if function is using the ACE naming convention. If so, + // it is likely that the ACE factory function macros + // (e.g. ACE_FACTORY_DECLARE) were used to declare and define it, so + // mangle the function name to include the ACE versioned namespace + // name as is done in the ACE macros. Otherwise, leave the function + // name as is. + + static ACE_TCHAR const make_prefix[] = ACE_LIB_TEXT ("_make_"); + static size_t const make_prefix_len = + sizeof (make_prefix) / sizeof (make_prefix[0]) - 1; + + if (ACE_OS::strncmp (make_prefix, func_name, make_prefix_len) == 0) + { + static ACE_TCHAR const versioned_namespace_name[] = + ACE_LIB_TEXT (ACE_VERSIONED_NAMESPACE_NAME_STRING) ACE_LIB_TEXT("_") ; + + // Null terminator included in versioned_namespace_name_len since + // it is static constant. + static size_t const versioned_namespace_name_len = + sizeof (versioned_namespace_name) + / sizeof (versioned_namespace_name[0]); // - 1; + + size_t const len = + ACE_OS::strlen (func_name) + + versioned_namespace_name_len; + // + 1; // Null terminator. + + ACE_TCHAR * mangled_func_name; + ACE_NEW_RETURN (mangled_func_name, + ACE_TCHAR[len], + 0); + + ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> safe (mangled_func_name); + + ACE_OS::snprintf (mangled_func_name, + len, + ACE_LIB_TEXT ("%s%s%s"), + make_prefix, + versioned_namespace_name, + func_name + make_prefix_len); + + return safe.release (); + } +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + + return ACE::strnew (func_name); +} + void * ACE_Function_Node::symbol (int & yyerrno, ACE_Service_Object_Exterminator *gobbler) @@ -544,7 +598,7 @@ ACE_Function_Node::symbol (int & yyerrno, if (this->symbol_ == 0) { - yyerrno++; + ++yyerrno; ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), this->function_name_), @@ -654,7 +708,7 @@ ACE_Static_Function_Node::symbol (int & yyerrno, if (this->symbol_ == 0) { - yyerrno++; + ++yyerrno; ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("no static service registered for function %s\n"), @@ -668,7 +722,7 @@ ACE_Static_Function_Node::symbol (int & yyerrno, if (this->symbol_ == 0) { - yyerrno++; + ++yyerrno; ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), this->function_name_), @@ -684,4 +738,6 @@ ACE_Static_Function_Node::~ACE_Static_Function_Node (void) delete[] const_cast<ACE_TCHAR *> (this->function_name_); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Parse_Node.h b/ace/Parse_Node.h index 5e4116e1ccf..acb07deadc8 100644 --- a/ace/Parse_Node.h +++ b/ace/Parse_Node.h @@ -26,6 +26,7 @@ #include "ace/DLL.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /// Forward declarations. class ACE_Service_Config; @@ -38,6 +39,8 @@ class ACE_Service_Type; * tree of Service Nodes. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Parse_Node { @@ -70,6 +73,8 @@ private: * @brief Suspend a Service Node. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Suspend_Node : public ACE_Parse_Node { @@ -92,6 +97,8 @@ public: * @brief Resume a Service Node. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Resume_Node : public ACE_Parse_Node { @@ -114,6 +121,8 @@ public: * @brief Remove a Service Node. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Remove_Node : public ACE_Parse_Node { @@ -136,6 +145,8 @@ public: * @brief Handle a statically linked node. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Static_Node : public ACE_Parse_Node { @@ -164,6 +175,8 @@ private: * @brief Handle a dynamically linked node. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Dynamic_Node : public ACE_Static_Node { @@ -191,6 +204,8 @@ private: * @brief Handle a Stream. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Stream_Node : public ACE_Parse_Node { @@ -218,6 +233,8 @@ private: * @brief Keep track of where a shared library is located. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Location_Node { @@ -265,6 +282,8 @@ protected: * @brief Keeps track of the symbol name for a shared object. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Object_Node : public ACE_Location_Node { @@ -291,6 +310,8 @@ private: * @brief Keeps track of the symbol name of for a shared function. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Function_Node : public ACE_Location_Node { @@ -307,6 +328,28 @@ public: ACE_ALLOC_HOOK_DECLARE; private: + + /// Return mangled function name that takes into account ACE + /// versioned namespace. + /** + * This function embeds the ACE versioned namespace name into the + * original function name if versioned namespace support has been + * enabled and the original function name conforms to the ACE + * Service Object factory function naming conventions. For example + * "@c _make_Foo" becomes "@c make_ACE_5_4_7_Foo". + * @par + * If versioned namespace support is disabled or the factory + * function name does conform to ACE conventions, no mangling will + * occur and the verbatim function name is returned. + * + * @return Function name that takes into account versioned namespace + * name. Caller is responsible for calling operator + * delete[] or ACE::strdelete() on the returned string. + */ + ACE_TCHAR * make_func_name (ACE_TCHAR const * func_name); + +private: + /// Name of the function that we're parsing. const ACE_TCHAR *function_name_; }; @@ -317,6 +360,8 @@ private: * @brief I forget why this is here... ;-) * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Dummy_Node : public ACE_Parse_Node { @@ -345,6 +390,8 @@ private: * application. * * @note This class is only meant for INTERNAL use by ACE. + * + * @internal */ class ACE_Static_Function_Node : public ACE_Location_Node { @@ -369,6 +416,8 @@ private: /// program. extern ACE_Service_Config *ace_this_svc; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ #include /**/ "ace/post.h" diff --git a/ace/Ping_Socket.cpp b/ace/Ping_Socket.cpp index 9d1254a1bc3..23bff4cb52a 100644 --- a/ace/Ping_Socket.cpp +++ b/ace/Ping_Socket.cpp @@ -19,8 +19,12 @@ ACE_RCSID (ace, Ping_Socket, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_Ping_Socket) +ACE_END_VERSIONED_NAMESPACE_DECL + //--------------------------------------------------------------------------- // Better to arrange some os_include/netinet/ip.h and // os_include/netinet/icmp.h files ? @@ -74,6 +78,8 @@ struct icmp #endif /* #if ! defined (ACE_WIN32) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int const ICMP_MIN = 8; // Minimal size of ICMP packet, header only int const ICMP_DATA_LENGTH = 56; // For ICMP data with Echo request ACE_Time_Value const ACE_Ping_Socket::time_default_ (0, 500000); @@ -362,4 +368,6 @@ ACE_Ping_Socket::make_echo_check (ACE_INET_Addr & remote_addr, return this->receive_echo_reply (timeout); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_ICMP_SUPPORT == 1 */ diff --git a/ace/Ping_Socket.h b/ace/Ping_Socket.h index 943cd8d55a8..dc473495f67 100644 --- a/ace/Ping_Socket.h +++ b/ace/Ping_Socket.h @@ -26,6 +26,8 @@ #include "ace/ICMP_Socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_INET_Addr; /** @@ -104,6 +106,8 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/Ping_Socket.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Ping_Socket.inl b/ace/Ping_Socket.inl index 27507dacdce..c331b21cea7 100644 --- a/ace/Ping_Socket.inl +++ b/ace/Ping_Socket.inl @@ -2,8 +2,12 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE char * ACE_Ping_Socket::icmp_recv_buff (void) { return this->icmp_recv_buff_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Pipe.cpp b/ace/Pipe.cpp index 9a94c458130..3d91ce9ecce 100644 --- a/ace/Pipe.cpp +++ b/ace/Pipe.cpp @@ -19,6 +19,8 @@ ACE_RCSID(ace, Pipe, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Pipe::dump (void) const { @@ -44,9 +46,14 @@ ACE_Pipe::open (int buffer_size) ACE_SOCK_Stream reader; ACE_SOCK_Stream writer; int result = 0; +# if defined (ACE_WIN32) + ACE_INET_Addr local_any (static_cast<u_short> (0), ACE_LOCALHOST); +# else + ACE_Addr local_any = ACE_Addr::sap_any; +# endif /* ACE_WIN32 */ // Bind listener to any port and then find out what the port was. - if (acceptor.open (ACE_Addr::sap_any) == -1 + if (acceptor.open (local_any) == -1 || acceptor.get_local_addr (my_addr) == -1) result = -1; else @@ -333,3 +340,5 @@ ACE_Pipe::recv (size_t n, ...) const va_end (argp); return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Pipe.h b/ace/Pipe.h index f8f103dd9f0..7f208615da9 100644 --- a/ace/Pipe.h +++ b/ace/Pipe.h @@ -26,6 +26,8 @@ #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_unistd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. class ACE_Message_Block; class ACE_Time_Value; @@ -37,7 +39,7 @@ class ACE_Time_Value; * * This class is designed to work with select()-based demuxers, such * as the ACE_Select_Reactor, which is why it uses sockets on Windows - * rather than Win32 pipes (which aren't select()'able). + * rather than Win32 pipes (which aren't select()'able). */ class ACE_Export ACE_Pipe { @@ -152,6 +154,8 @@ private: ACE_HANDLE handles_[2]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Pipe.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Pipe.inl b/ace/Pipe.inl index c5e31cc7061..17b532ed632 100644 --- a/ace/Pipe.inl +++ b/ace/Pipe.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Global_Macros.h" #include "ace/ACE.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Pipe::~ACE_Pipe (void) { @@ -42,17 +45,17 @@ ACE_Pipe::sendv_n (const iovec iov[], int n) const ACE_INLINE ssize_t ACE_Pipe::send_n (const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout, - size_t *bytes_transferred) + const ACE_Time_Value *timeout, + size_t *bytes_transferred) { ACE_TRACE ("ACE_Pipe::send_n"); - ACE_UNUSED_ARG (timeout); #if defined (ACE_WIN32) return ACE::send_n (this->write_handle (), message_block, timeout, bytes_transferred); #else + ACE_UNUSED_ARG (timeout); return ACE::write_n (this->write_handle (), message_block, bytes_transferred); @@ -124,9 +127,9 @@ ACE_Pipe::send (const void *buf, size_t n) const { ACE_TRACE ("ACE_Pipe::send"); #if defined (ACE_WIN32) - return ACE_OS::send (this->write_handle (), (const char *) buf, n); + return ACE_OS::send (this->write_handle (), static_cast <const char *> (buf), n); #else - return ACE_OS::write (this->write_handle (), (const char *) buf, n); + return ACE_OS::write (this->write_handle (), static_cast <const char *> (buf), n); #endif /* ACE_WIN32 */ } @@ -135,9 +138,9 @@ ACE_Pipe::recv (void *buf, size_t n) const { ACE_TRACE ("ACE_Pipe::recv"); #if defined (ACE_WIN32) - return ACE_OS::recv (this->read_handle (), (char *) buf, n); + return ACE_OS::recv (this->read_handle (), static_cast <char *> (buf), n); #else - return ACE_OS::read (this->read_handle (), (char *) buf, n); + return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n); #endif /* ACE_WIN32 */ } @@ -165,19 +168,21 @@ ACE_Pipe::recv (iovec iov[], int n) const ACE_INLINE ssize_t ACE_Pipe::send (const void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const + ACE_OVERLAPPED *overlapped) const { ACE_TRACE ("ACE_Pipe::send"); return ACE_OS::write (this->write_handle (), - (const char *) buf, n, + static_cast <const char *> (buf), n, overlapped); } ACE_INLINE ssize_t ACE_Pipe::recv (void *buf, size_t n, - ACE_OVERLAPPED *overlapped) const + ACE_OVERLAPPED *overlapped) const { ACE_TRACE ("ACE_Pipe::recv"); - return ACE_OS::read (this->read_handle (), (char *) buf, n, + return ACE_OS::read (this->read_handle (), static_cast <char *> (buf), n, overlapped); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Priority_Reactor.cpp b/ace/Priority_Reactor.cpp index 8a996fdf79e..b618c72265f 100644 --- a/ace/Priority_Reactor.cpp +++ b/ace/Priority_Reactor.cpp @@ -5,6 +5,8 @@ ACE_RCSID(ace, Priority_Reactor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + typedef ACE_Unbounded_Queue_Iterator<ACE_Event_Tuple> QUEUE_ITERATOR; // Its iterator. @@ -177,20 +179,4 @@ ACE_Priority_Reactor::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Unbounded_Queue<ACE_Event_Tuple>; -template class ACE_Unbounded_Queue_Iterator<ACE_Event_Tuple>; -template class ACE_Node<ACE_Event_Tuple>; -template class ACE_Cached_Allocator<ACE_Node<ACE_Event_Tuple>, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<ACE_Node<ACE_Event_Tuple> >,ACE_SYNCH_NULL_MUTEX>; -template class ACE_Free_List<ACE_Cached_Mem_Pool_Node<ACE_Node<ACE_Event_Tuple> > >; -template class ACE_Cached_Mem_Pool_Node<ACE_Node<ACE_Event_Tuple> >; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Unbounded_Queue<ACE_Event_Tuple> -#pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_Event_Tuple> -#pragma instantiate ACE_Node<ACE_Event_Tuple> -#pragma instantiate ACE_Cached_Allocator<ACE_Node<ACE_Event_Tuple>, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Locked_Free_List<ACE_Cached_Mem_Pool_Node<ACE_Node<ACE_Event_Tuple> >,ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Free_List<ACE_Cached_Mem_Pool_Node<ACE_Node<ACE_Event_Tuple> > > -#pragma instantiate ACE_Cached_Mem_Pool_Node<ACE_Node<ACE_Event_Tuple> > -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Priority_Reactor.h b/ace/Priority_Reactor.h index dde598daa9e..24a04166d88 100644 --- a/ace/Priority_Reactor.h +++ b/ace/Priority_Reactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -14,12 +14,7 @@ #define ACE_PRIORITY_REACTOR_H #include /**/ "ace/pre.h" -#ifdef ACE_REACTOR_BUILD_DLL -# include "ace/ACE_Reactor_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Reactor_Export ACE_Export -#endif /* ACE_REACTOR_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -28,6 +23,8 @@ #include "ace/Select_Reactor.h" #include "ace/Unbounded_Queue.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Priority_Reactor * @@ -37,7 +34,7 @@ * Select_Reactor by taking advantage of the priority method on * ACE_Event_Handler. */ -class ACE_Reactor_Export ACE_Priority_Reactor : public ACE_Select_Reactor +class ACE_Export ACE_Priority_Reactor : public ACE_Select_Reactor { public: // = Initialization and termination methods. @@ -96,5 +93,7 @@ private: ACE_Priority_Reactor &operator = (const ACE_Priority_Reactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_PRIORITY_REACTOR_H */ diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp index c8012d7727b..17579d8a2f2 100644 --- a/ace/Proactor.cpp +++ b/ace/Proactor.cpp @@ -38,6 +38,8 @@ ACE_RCSID (ace, #include "ace/Auto_Event.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /// Process-wide ACE_Proactor. ACE_Proactor *ACE_Proactor::proactor_ = 0; @@ -136,7 +138,7 @@ ACE_Proactor_Timer_Handler::svc (void) if (absolute_time > cur_time) relative_time = absolute_time - cur_time; else - relative_time = 0; + relative_time = ACE_Time_Value::zero; // Block for relative time. result = this->timer_event_.wait (&relative_time, 0); @@ -235,7 +237,8 @@ ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &, auto_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer); // Post a completion. - if (asynch_timer->post_completion (this->proactor_->implementation ()) == -1) + if (-1 == safe_asynch_timer->post_completion + (this->proactor_->implementation ())) ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("Failure in dealing with timers: ") ACE_LIB_TEXT ("PostQueuedCompletionStatus failed\n")), @@ -1106,95 +1109,15 @@ ACE_Proactor::implementation (ACE_Proactor_Impl *implementation) this->implementation_ = implementation; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Timer_Queue_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Queue_Iterator_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_List_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_List_Iterator_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Node_T<ACE_Handler *>; -template class ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Handler *> *>; -template class ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Handler *> *>; -template class ACE_Node <ACE_Timer_Node_T<ACE_Handler *> *>; -template class ACE_Free_List<ACE_Timer_Node_T<ACE_Handler *> >; -template class ACE_Locked_Free_List<ACE_Timer_Node_T<ACE_Handler *>, ACE_Null_Mutex>; -template class ACE_Timer_Heap_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Heap_Iterator_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Wheel_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Wheel_Iterator_T<ACE_Handler *, - ACE_Proactor_Handle_Timeout_Upcall, - ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Timer_Queue_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Queue_Iterator_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_List_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_List_Iterator_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Node_T<ACE_Handler *> -#pragma instantiate ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Handler *> *> -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Handler *> *> -#pragma instantiate ACE_Node <ACE_Timer_Node_T<ACE_Handler *> *> -#pragma instantiate ACE_Free_List<ACE_Timer_Node_T<ACE_Handler *> > -#pragma instantiate ACE_Locked_Free_List<ACE_Timer_Node_T<ACE_Handler *>,\ - ACE_Null_Mutex> -#pragma instantiate ACE_Timer_Heap_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Heap_Iterator_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Wheel_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Wheel_Iterator_T<ACE_Handler *,\ - ACE_Proactor_Handle_Timeout_Upcall,\ - ACE_SYNCH_RECURSIVE_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Framework_Component_T<ACE_Proactor>; -# if defined (ACE_LACKS_AUTO_PTR) \ - || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \ - && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)) -template class ACE_Auto_Basic_Ptr<ACE_Asynch_Result_Impl>; -# endif /* ACE_LACKS_AUTO_PTR */ -template class auto_ptr<ACE_Asynch_Result_Impl>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Framework_Component_T<ACE_Proactor> -# if defined (ACE_LACKS_AUTO_PTR) \ - || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \ - && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)) -#pragma instantiate ACE_Auto_Basic_Ptr<ACE_Asynch_Result_Impl> -# endif /* ACE_LACKS_AUTO_PTR */ -#pragma instanstiate auto_ptr<ACE_Asynch_Result_Impl> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #else /* !ACE_WIN32 || !ACE_HAS_AIO_CALLS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Proactor * -ACE_Proactor::instance (size_t threads) +ACE_Proactor::instance (size_t /* threads */) { - ACE_UNUSED_ARG (threads); return 0; } @@ -1236,4 +1159,6 @@ ACE_Proactor::event_loop_done (void) return sig_atomic_t (1); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 || ACE_HAS_AIO_CALLS*/ diff --git a/ace/Proactor.h b/ace/Proactor.h index 8ed6aa83a02..2b5f6f750d1 100644 --- a/ace/Proactor.h +++ b/ace/Proactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -37,6 +37,8 @@ # include "ace/Timer_Heap.h" # include "ace/Timer_Wheel.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. class ACE_Proactor_Impl; class ACE_Proactor_Timer_Handler; @@ -44,12 +46,12 @@ class ACE_Proactor_Timer_Handler; /** * @class ACE_Proactor_Handle_Timeout_Upcall * - * @brief Functor for <ACE_Timer_Queue>. + * @brief Functor for ACE_Timer_Queue. * * This class implements the functor required by the Timer * Queue to call <handle_timeout> on ACE_Handlers. */ -class ACE_Export ACE_Proactor_Handle_Timeout_Upcall +class ACE_Proactor_Handle_Timeout_Upcall { /// Type def for the timer queue. @@ -185,8 +187,8 @@ public: int delete_implementation = 0, TIMER_QUEUE *tq = 0); - /// Virtual destruction. - virtual ~ACE_Proactor (void); + /// Destruction. + ~ACE_Proactor (void); /// Get pointer to a process-wide <ACE_Proactor>. <threads> should /// be part of another method. @@ -238,7 +240,7 @@ public: static int reset_event_loop (void); /** - * The singleton proactor is used by the <ACE_Service_Config>. + * The singleton proactor is used by the ACE_Service_Config. * Therefore, we must check for the reconfiguration request and * handle it after handling an event. */ @@ -252,7 +254,7 @@ public: * If @arg delete_implementation was specified to the @c open() method, * the implementation object is also deleted. */ - virtual int close (void); + int close (void); /** * You can add a hook to various run_event methods and the hook will @@ -269,7 +271,7 @@ public: * <ACE_Proactor::handle_events> * method returns -1 or the <end_proactor_event_loop> method is invoked. */ - virtual int proactor_run_event_loop (PROACTOR_EVENT_HOOK = 0); + int proactor_run_event_loop (PROACTOR_EVENT_HOOK = 0); /** * Run the event loop until the <ACE_Proactor::handle_events> @@ -278,28 +280,28 @@ public: * or the <ACE_Time_Value> * expires, in which case a 0 is returned. */ - virtual int proactor_run_event_loop (ACE_Time_Value &tv, - PROACTOR_EVENT_HOOK = 0); + int proactor_run_event_loop (ACE_Time_Value &tv, + PROACTOR_EVENT_HOOK = 0); /** * Instruct the ACE_Proactor to terminate its event loop * and notifies the ACE_Proactor so that it can wake up * and close down gracefully. */ - virtual int proactor_end_event_loop (void); + int proactor_end_event_loop (void); /// Report if the ACE_Proactor event loop is finished. - virtual int proactor_event_loop_done (void); + int proactor_event_loop_done (void); /// Resets the <ACE_Proactor::end_event_loop_> static so that the /// <run_event_loop> method can be restarted. - virtual int proactor_reset_event_loop (void); + int proactor_reset_event_loop (void); /// This method adds the <handle> to the I/O completion port. This /// function is a no-op function for Unix systems and returns 0; - virtual int register_handle (ACE_HANDLE handle, - const void *completion_key); + int register_handle (ACE_HANDLE handle, + const void *completion_key); // = Timer management. /** @@ -313,28 +315,28 @@ public: * with accidentally deleting the wrong timer. Returns -1 on * failure (which is guaranteed never to be a valid <timer_id>). */ - virtual long schedule_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &time); + long schedule_timer (ACE_Handler &handler, + const void *act, + const ACE_Time_Value &time); - virtual long schedule_repeating_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &interval); + long schedule_repeating_timer (ACE_Handler &handler, + const void *act, + const ACE_Time_Value &interval); // Same as above except <interval> it is used to reschedule the // <handler> automatically. /// This combines the above two methods into one. Mostly for backward /// compatibility. - virtual long schedule_timer (ACE_Handler &handler, - const void *act, - const ACE_Time_Value &time, - const ACE_Time_Value &interval); + long schedule_timer (ACE_Handler &handler, + const void *act, + const ACE_Time_Value &time, + const ACE_Time_Value &interval); /// Cancel all timers associated with this <handler>. Returns number /// of timers cancelled. - virtual int cancel_timer (ACE_Handler &handler, - int dont_call_handle_close = 1); + int cancel_timer (ACE_Handler &handler, + int dont_call_handle_close = 1); /** * Cancel the single <ACE_Handler> that matches the <timer_id> value @@ -345,9 +347,9 @@ public: * Returns 1 if cancellation succeeded and 0 if the <timer_id> * wasn't found. */ - virtual int cancel_timer (long timer_id, - const void **act = 0, - int dont_call_handle_close = 1); + int cancel_timer (long timer_id, + const void **act = 0, + int dont_call_handle_close = 1); /** * Dispatch a single set of events, waiting up to a specified time limit @@ -359,14 +361,14 @@ public: * Returns 1 when a completion is dispatched. On error, returns -1 * and sets errno accordingly. */ - virtual int handle_events (ACE_Time_Value &wait_time); + int handle_events (ACE_Time_Value &wait_time); /** * Block indefinitely until at least one event is dispatched. * @return Returns 1 when a completion is dispatched. On error, returns -1 * and sets errno accordingly. */ - virtual int handle_events (void); + int handle_events (void); /// Add wakeup dispatch threads (reinit). int wake_up_dispatch_threads (void); @@ -391,10 +393,10 @@ public: * It is a no-op in POSIX platforms and it returns * ACE_INVALID_HANDLE. */ - virtual ACE_HANDLE get_handle (void) const; + ACE_HANDLE get_handle (void) const; /// Get the implementation class. - virtual ACE_Proactor_Impl *implementation (void) const; + ACE_Proactor_Impl *implementation (void) const; // = Factory methods for the operations @@ -403,37 +405,37 @@ public: /// Create the correct implementation class for doing /// Asynch_Read_Stream. - virtual ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void); + ACE_Asynch_Read_Stream_Impl *create_asynch_read_stream (void); /// Create the correct implementation class for doing /// Asynch_Write_Stream. - virtual ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void); + ACE_Asynch_Write_Stream_Impl *create_asynch_write_stream (void); /// Create the correct implementation class for doing /// Asynch_Read_File. - virtual ACE_Asynch_Read_File_Impl *create_asynch_read_file (void); + ACE_Asynch_Read_File_Impl *create_asynch_read_file (void); /// Create the correct implementation class for doing /// Asynch_Write_File. - virtual ACE_Asynch_Write_File_Impl *create_asynch_write_file (void); + ACE_Asynch_Write_File_Impl *create_asynch_write_file (void); /// Create the correct implementation class for doing Asynch_Accept. - virtual ACE_Asynch_Accept_Impl *create_asynch_accept (void); + ACE_Asynch_Accept_Impl *create_asynch_accept (void); /// Create the correct implementation class for doing Asynch_Connect. - virtual ACE_Asynch_Connect_Impl *create_asynch_connect (void); + ACE_Asynch_Connect_Impl *create_asynch_connect (void); /// Create the correct implementation class for doing /// Asynch_Transmit_File. - virtual ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void); + ACE_Asynch_Transmit_File_Impl *create_asynch_transmit_file (void); /// Create the correct implementation class for doing /// Asynch_Read_Dgram. - virtual ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void); + ACE_Asynch_Read_Dgram_Impl *create_asynch_read_dgram (void); /// Create the correct implementation class for doing /// Asynch_Write_Dgram. - virtual ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void); + ACE_Asynch_Write_Dgram_Impl *create_asynch_write_dgram (void); // = Factory methods for the results @@ -442,7 +444,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Read_Stream::Result class. - virtual ACE_Asynch_Read_Stream_Result_Impl * + ACE_Asynch_Read_Stream_Result_Impl * create_asynch_read_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, @@ -454,7 +456,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Write_Stream::Result. - virtual ACE_Asynch_Write_Stream_Result_Impl * + ACE_Asynch_Write_Stream_Result_Impl * create_asynch_write_stream_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, @@ -466,7 +468,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Read_File::Result. - virtual ACE_Asynch_Read_File_Result_Impl * + ACE_Asynch_Read_File_Result_Impl * create_asynch_read_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, @@ -480,7 +482,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Write_File::Result. - virtual ACE_Asynch_Write_File_Result_Impl * + ACE_Asynch_Write_File_Result_Impl * create_asynch_write_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block &message_block, @@ -494,7 +496,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Read_Dgram::Result. - virtual ACE_Asynch_Read_Dgram_Result_Impl * + ACE_Asynch_Read_Dgram_Result_Impl * create_asynch_read_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, @@ -508,7 +510,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Write_Dgram::Result. - virtual ACE_Asynch_Write_Dgram_Result_Impl * + ACE_Asynch_Write_Dgram_Result_Impl * create_asynch_write_dgram_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE handle, ACE_Message_Block *message_block, @@ -520,7 +522,7 @@ public: int signal_number = ACE_SIGRTMIN); /// Create the correct implementation class for ACE_Asynch_Accept::Result. - virtual ACE_Asynch_Accept_Result_Impl * + ACE_Asynch_Accept_Result_Impl * create_asynch_accept_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE listen_handle, ACE_HANDLE accept_handle, @@ -532,7 +534,7 @@ public: int signal_number = ACE_SIGRTMIN); /// Create the correct implementation class for ACE_Asynch_Connect::Result - virtual ACE_Asynch_Connect_Result_Impl * + ACE_Asynch_Connect_Result_Impl * create_asynch_connect_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE connect_handle, const void* act, @@ -542,7 +544,7 @@ public: /// Create the correct implementation class for /// ACE_Asynch_Transmit_File::Result. - virtual ACE_Asynch_Transmit_File_Result_Impl * + ACE_Asynch_Transmit_File_Result_Impl * create_asynch_transmit_file_result (ACE_Handler::Proxy_Ptr &handler_proxy, ACE_HANDLE socket, ACE_HANDLE file, @@ -564,7 +566,7 @@ public: * Timer object with a meaningful signal number, choosing the * largest signal number from the signal mask of the Proactor. */ - virtual ACE_Asynch_Result_Impl * + ACE_Asynch_Result_Impl * create_asynch_timer (ACE_Handler::Proxy_Ptr &handler_proxy, const void *act, const ACE_Time_Value &tv, @@ -586,10 +588,10 @@ protected: * threads can wake up. This is used in conjunction with the * <proactor_run_event_loop>. */ - virtual int proactor_post_wakeup_completions (int how_many); + int proactor_post_wakeup_completions (int how_many); /// Set the implementation class. - virtual void implementation (ACE_Proactor_Impl *implementation); + void implementation (ACE_Proactor_Impl *implementation); /// Delegation/implementation class that all methods will be /// forwarded to. @@ -633,6 +635,8 @@ private: ACE_Proactor &operator= (const ACE_Proactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (__ACE_INLINE__) # include "ace/Proactor.inl" # endif /* __ACE_INLINE__ */ @@ -642,6 +646,8 @@ private: # include "ace/os_include/os_stddef.h" # include "ace/os_include/os_signal.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; class ACE_Export ACE_Proactor @@ -650,8 +656,9 @@ public: class Timer_Queue {}; ACE_Proactor (size_t /* number_of_threads */ = 0, Timer_Queue * /* tq */ = 0) {} - virtual int handle_events (void) { return -1; } - virtual int handle_events (ACE_Time_Value &) { return -1; } + ~ACE_Proactor (void) {} + int handle_events (void) { return -1; } + int handle_events (ACE_Time_Value &) { return -1; } /// Placeholder to enable compilation on non-Win32 platforms static ACE_Proactor *instance (size_t threads = 0); @@ -675,6 +682,8 @@ public: static sig_atomic_t event_loop_done (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 && !ACE_HAS_WINCE || ACE_HAS_AIO_CALLS*/ #include /**/ "ace/post.h" diff --git a/ace/Proactor.inl b/ace/Proactor.inl index c4c29697efc..37b887c14d6 100644 --- a/ace/Proactor.inl +++ b/ace/Proactor.inl @@ -1,11 +1,14 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Proactor::run_event_loop (void) { ACE_TRACE ("ACE_Proactor::run_event_loop"); - ACE_Proactor *p = ACE_Proactor::instance (); + ACE_Proactor * const p = ACE_Proactor::instance (); if (p == 0) return -1; @@ -17,12 +20,12 @@ ACE_INLINE int ACE_Proactor::run_event_loop (ACE_Time_Value &tv) { ACE_TRACE ("ACE_Proactor::run_event_loop (tv)"); - ACE_Proactor *p = ACE_Proactor::instance (); + ACE_Proactor * const p = ACE_Proactor::instance (); if (p == 0) return -1; - return p->proactor_run_event_loop + return p->proactor_run_event_loop (tv, ACE_Proactor::check_reconfiguration); } @@ -30,7 +33,7 @@ ACE_INLINE int ACE_Proactor::reset_event_loop(void) { ACE_TRACE ("ACE_Proactor::reset_event_loop"); - ACE_Proactor *p = ACE_Proactor::instance (); + ACE_Proactor * const p = ACE_Proactor::instance (); if (p == 0) return -1; @@ -42,7 +45,7 @@ ACE_INLINE int ACE_Proactor::end_event_loop (void) { ACE_TRACE ("ACE_Proactor::end_event_loop"); - ACE_Proactor *p = ACE_Proactor::instance (); + ACE_Proactor * const p = ACE_Proactor::instance (); if (p == 0) return -1; @@ -54,7 +57,7 @@ ACE_INLINE int ACE_Proactor::event_loop_done (void) { ACE_TRACE ("ACE_Proactor::event_loop_done"); - ACE_Proactor *p = ACE_Proactor::instance (); + ACE_Proactor * const p = ACE_Proactor::instance (); if (p == 0) return -1; @@ -66,10 +69,12 @@ ACE_INLINE int ACE_Proactor::post_wakeup_completions (int how_many) { ACE_TRACE ("ACE_Proactor::post_wakeup_completions"); - ACE_Proactor *p = ACE_Proactor::instance (); + ACE_Proactor * const p = ACE_Proactor::instance (); if (p == 0) return -1; return p->proactor_post_wakeup_completions (how_many); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Proactor_Impl.cpp b/ace/Proactor_Impl.cpp index 9d8a3b08377..0ab848c5920 100644 --- a/ace/Proactor_Impl.cpp +++ b/ace/Proactor_Impl.cpp @@ -3,15 +3,19 @@ #include "ace/Proactor_Impl.h" ACE_RCSID (ace, - Proactor_Impl, - "$Id$") + Proactor_Impl, + "$Id$") #if ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) // This only works on Win32 platforms and on Unix platforms supporting // aio calls. -ACE_Proactor_Impl::~ACE_Proactor_Impl() +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Proactor_Impl::~ACE_Proactor_Impl (void) { } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif diff --git a/ace/Proactor_Impl.h b/ace/Proactor_Impl.h index 262d3e66da3..847bc694a10 100644 --- a/ace/Proactor_Impl.h +++ b/ace/Proactor_Impl.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,6 +26,8 @@ #include "ace/Reactor.h" #include "ace/Countdown_Time.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Proactor_Impl * @@ -47,13 +49,13 @@ public: /// Close the IO completion port. virtual int close (void) = 0; - /// This method adds the <handle> to the I/O completion port. This + /// This method adds the @a handle to the I/O completion port. This /// function is a no-op function for Unix systems. virtual int register_handle (ACE_HANDLE handle, - const void *completion_key) = 0; + const void *completion_key) = 0; /** - * Dispatch a single set of events. If <wait_time> elapses before + * Dispatch a single set of events. If @a wait_time elapses before * any events occur, return 0. Return 1 on success i.e., when a * completion is dispatched, non-zero (-1) on errors and errno is * set accordingly. @@ -249,13 +251,15 @@ public: int signal_number = 0) = 0; /** - * Post <how_many> completions to the completion port so that all + * Post @a how_many completions to the completion port so that all * threads can wake up. This is used in conjunction with the * <run_event_loop>. */ virtual int post_wakeup_completions (int how_many) = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* (ACE_WIN32 && ACE_HAS_WINCE) || ACE_HAS_AIO_CALLS */ #include /**/ "ace/post.h" #endif /* ACE_PROACTOR_IMPL_H */ diff --git a/ace/Process.cpp b/ace/Process.cpp index c505feaa874..dcf34f36c16 100644 --- a/ace/Process.cpp +++ b/ace/Process.cpp @@ -31,6 +31,7 @@ sigchld_nop (int, siginfo_t *, ucontext_t *) #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Process::ACE_Process (void) : @@ -1111,10 +1112,6 @@ ACE_Process_Options::passed_handles (ACE_Handle_Set &set) const return 1; } -ACE_Managed_Process::ACE_Managed_Process (void) -{ -} - ACE_Managed_Process::~ACE_Managed_Process (void) { } @@ -1124,3 +1121,5 @@ ACE_Managed_Process::unmanage (void) { delete this; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process.h b/ace/Process.h index d273d6d9cb7..6c057bd2ed7 100644 --- a/ace/Process.h +++ b/ace/Process.h @@ -15,12 +15,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -30,6 +25,8 @@ #include "ace/Global_Macros.h" #include "ace/os_include/sys/os_types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration class ACE_Time_Value; @@ -52,7 +49,7 @@ class ACE_Time_Value; * then, the <spawn> is using the <execvp> which searches for the * program file in the PATH variable. */ -class ACE_Threads_Export ACE_Process_Options +class ACE_Export ACE_Process_Options { public: enum @@ -438,7 +435,7 @@ protected: * then, the <spawn> is using the <execvp> which searches for the * program file in the PATH variable. */ -class ACE_Threads_Export ACE_Process +class ACE_Export ACE_Process { public: friend class ACE_Process_Manager; @@ -457,9 +454,11 @@ public: virtual int prepare (ACE_Process_Options &options); /** - * Launch a new process as described by @a options. Returns the - * process id of the newly spawned child on success or -1 on - * failure. + * Launch a new process as described by @a options. On success, + * returns 1 if the option avoid_zombies is set, else returns the + * process id of the newly spawned child. Returns -1 on + * failure. This will be fixed in the future versions of ACE when + * the process id of the child will be returned regardless of the option. */ virtual pid_t spawn (ACE_Process_Options &options); @@ -496,7 +495,7 @@ public: * If <status> != 0, it points to an integer where the function * stores the child's exit status. * - * NOTE: on UNIX platforms this function uses <ualarm>, i.e., it + * @note On UNIX platforms this function uses <ualarm>, i.e., it * overwrites any existing alarm. In addition, it steals all * <SIGCHLD>s during the timeout period, which will break another * <ACE_Process_Manager> in the same process that's expecting @@ -548,6 +547,12 @@ public: PROCESS_INFORMATION process_info (void); #endif /* ACE_WIN32 */ +private: + + // Disallow copying and assignment since we don't support this (yet). + ACE_Process (const ACE_Process &); + void operator= (const ACE_Process &); + protected: /// Set this process' <exit_code_>. ACE_Process_Manager uses this /// method to set the <exit_code_> after successfully waiting for @@ -567,9 +572,6 @@ protected: /// Handle duplicates made for the child process. ACE_Handle_Set dup_handles_; - // = Disallow copying and assignment since we don't support this (yet). - ACE_UNIMPLEMENTED_FUNC (ACE_Process (const ACE_Process &)) - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Process &)) }; @@ -582,22 +584,22 @@ protected: * @arg unmanage() method that deletes the instance. * This class is only valid for use as a dynamically-allocated object! */ -class ACE_Threads_Export ACE_Managed_Process : public ACE_Process +class ACE_Export ACE_Managed_Process : public ACE_Process { public: - ACE_Managed_Process (); /// Cleanup by deleting @c this. virtual void unmanage (void); -private: +protected: + /// Make sure that we're allocated dynamically! virtual ~ACE_Managed_Process (void); - /// Keep G++ happy... - friend class ace_dewarn_gplusplus; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Process.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Process.inl b/ace/Process.inl index b8a0d721a7b..5af3893100f 100644 --- a/ace/Process.inl +++ b/ace/Process.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/ACE.h" @@ -7,6 +8,8 @@ #include "ace/OS_NS_pwd.h" #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) ACE_INLINE PROCESS_INFORMATION @@ -375,35 +378,33 @@ ACE_Process_Options::process_name (void) // under CE. They are not empty on most other platforms. ACE_INLINE int -ACE_Process_Options::setenv (ACE_TCHAR *envp[]) +ACE_Process_Options::setenv (ACE_TCHAR * /* envp */[]) { - ACE_UNUSED_ARG (envp); return -1; } ACE_INLINE int -ACE_Process_Options::setenv (const ACE_TCHAR *format, ...) +ACE_Process_Options::setenv (const ACE_TCHAR * /* format */, ...) { return -1; } ACE_INLINE int -ACE_Process_Options::setenv (const ACE_TCHAR *variable_name, - const ACE_TCHAR *format, +ACE_Process_Options::setenv (const ACE_TCHAR * /* variable_name */, + const ACE_TCHAR * /* format */, ...) { return -1; } ACE_INLINE int -ACE_Process_Options::set_handles (ACE_HANDLE std_in, - ACE_HANDLE std_out, - ACE_HANDLE std_err) +ACE_Process_Options::set_handles (ACE_HANDLE /* std_in */, + ACE_HANDLE /* std_out */, + ACE_HANDLE /* std_err */) { - ACE_UNUSED_ARG (std_in); - ACE_UNUSED_ARG (std_out); - ACE_UNUSED_ARG (std_err); return -1; } #endif /* ACE_HAS_WINCE */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp index bcadb08c49e..f476fc04a10 100644 --- a/ace/Process_Manager.cpp +++ b/ace/Process_Manager.cpp @@ -32,6 +32,8 @@ ACE_Process_Manager_cleanup (void *instance, void *arg) } #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Process_Manager::cleanup (void *, void *) { @@ -417,14 +419,15 @@ ACE_Process_Manager::register_handler (ACE_Event_Handler *eh, // Create a new process. pid_t -ACE_Process_Manager::spawn (ACE_Process_Options &options) +ACE_Process_Manager::spawn (ACE_Process_Options &options, + ACE_Event_Handler *event_handler) { ACE_Process *process; ACE_NEW_RETURN (process, ACE_Managed_Process, ACE_INVALID_PID); - pid_t pid = spawn (process, options); + pid_t pid = spawn (process, options, event_handler); if (pid == ACE_INVALID_PID || pid == 0) delete process; @@ -435,7 +438,8 @@ ACE_Process_Manager::spawn (ACE_Process_Options &options) pid_t ACE_Process_Manager::spawn (ACE_Process *process, - ACE_Process_Options &options) + ACE_Process_Options &options, + ACE_Event_Handler *event_handler) { ACE_TRACE ("ACE_Process_Manager::spawn"); @@ -448,7 +452,7 @@ ACE_Process_Manager::spawn (ACE_Process *process, ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); - if (this->append_proc (process) == -1) + if (this->append_proc (process, event_handler) == -1) // bad news: spawned, but not registered in table. return ACE_INVALID_PID; @@ -460,7 +464,8 @@ ACE_Process_Manager::spawn (ACE_Process *process, int ACE_Process_Manager::spawn_n (size_t n, ACE_Process_Options &options, - pid_t *child_pids) + pid_t *child_pids, + ACE_Event_Handler *event_handler) { ACE_TRACE ("ACE_Process_Manager::spawn_n"); @@ -474,7 +479,7 @@ ACE_Process_Manager::spawn_n (size_t n, i < n; i++) { - pid_t pid = this->spawn (options); + pid_t pid = this->spawn (options, event_handler); if (pid == ACE_INVALID_PID || pid == 0) // We're in the child or something's gone wrong. return pid; @@ -489,7 +494,8 @@ ACE_Process_Manager::spawn_n (size_t n, // Must be called with locks held. int -ACE_Process_Manager::append_proc (ACE_Process *proc) +ACE_Process_Manager::append_proc (ACE_Process *proc, + ACE_Event_Handler *event_handler) { ACE_TRACE ("ACE_Process_Manager::append_proc"); @@ -508,7 +514,7 @@ ACE_Process_Manager::append_proc (ACE_Process *proc) this->process_table_[this->current_count_]; proc_desc.process_ = proc; - proc_desc.exit_notify_ = 0; + proc_desc.exit_notify_ = event_handler; #if defined (ACE_WIN32) // If we have a Reactor, then we're supposed to reap Processes @@ -528,7 +534,8 @@ ACE_Process_Manager::append_proc (ACE_Process *proc) // allow them to be inserted twice). int -ACE_Process_Manager::insert_proc (ACE_Process *proc) +ACE_Process_Manager::insert_proc (ACE_Process *proc, + ACE_Event_Handler *event_handler) { ACE_TRACE ("ACE_Process_Manager::insert_proc"); @@ -537,7 +544,7 @@ ACE_Process_Manager::insert_proc (ACE_Process *proc) if (this->find_proc (proc->getpid ()) != -1) return -1; - return this->append_proc (proc); + return this->append_proc (proc, event_handler); } // Remove a process from the pool. @@ -645,6 +652,46 @@ ACE_Process_Manager::terminate (pid_t pid, return ACE_OS::kill (pid, sig); } + +int +ACE_Process_Manager::set_scheduler (const ACE_Sched_Params & params, + pid_t pid) +{ + ACE_TRACE ("ACE_Process_Manager::sched_setscheduler"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, this->lock_, -1)); + + // Check to see if the process identified by the given pid is managed by + // this instance of ACE_Process_Manager. + ssize_t i = this->find_proc (pid); + + if (i == -1) + // set "no such process" error + return ACE_INVALID_PID; + + return ACE_OS::sched_params (params, pid); +} + +int +ACE_Process_Manager::set_scheduler_all (const ACE_Sched_Params & params) +{ + ACE_TRACE ("ACE_Process_Manager::setscheduler_all"); + + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, this->lock_, -1)); + pid_t pid; + for (size_t i = 0; i < this->current_count_; ++i) + { + pid = this->process_table_[i].process_->getpid (); + if (ACE_OS::sched_params (params, pid) != 0) + return -1; + } + return 0; + +} + + // Locate the index in the table associated with <pid>. Must be // called with the lock held. @@ -767,7 +814,7 @@ ACE_Process_Manager::wait (pid_t pid, { // Wait for any Process spawned by this Process_Manager. #if defined (ACE_WIN32) - HANDLE *handles; + HANDLE *handles = 0; ACE_NEW_RETURN (handles, HANDLE[this->current_count_], @@ -977,3 +1024,5 @@ ACE_Process_Manager::notify_proc_handler (size_t i, return 0; } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process_Manager.h b/ace/Process_Manager.h index 6a122b7b395..7bfcc545dcd 100644 --- a/ace/Process_Manager.h +++ b/ace/Process_Manager.h @@ -15,13 +15,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ - +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -35,6 +29,8 @@ # include "ace/Recursive_Thread_Mutex.h" #endif /* ACE_HAS_THREADS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Reactor; /** @@ -43,7 +39,7 @@ class ACE_Reactor; * @brief Information describing each process that's controlled by an * \<ACE_Process_Manager\>. */ -class ACE_Threads_Export ACE_Process_Descriptor +class ACE_Export ACE_Process_Descriptor { private: friend class ACE_Process_Manager; @@ -97,8 +93,8 @@ private: * <Process> exits, or when any <Process> without a specific * <Event_Handler> exits. When a <Process> exits, the * appropriate <Event_Handler>'s <handle_input> is called; the - * <ACE_HANDLE> passed is either the Process' HANDLE (on Win32), - * or its pid cast to an <ACE_HANDLE> (on unix). + * ACE_HANDLE passed is either the Process' HANDLE (on Win32), + * or its pid cast to an ACE_HANDLE (on unix). * It is also possible to call the <Process_Manager::wait> * functions even though the <Process_Manager> is registered with * a <Reactor>. @@ -125,7 +121,7 @@ private: * + The <handle_input> method collects all available exit * statuses. */ -class ACE_Threads_Export ACE_Process_Manager : protected ACE_Event_Handler +class ACE_Export ACE_Process_Manager : protected ACE_Event_Handler { public: friend class ACE_Process_Control; @@ -142,7 +138,7 @@ public: * needed. If a non-NULL <reactor> is provided, this * <ACE_Process_Manager> uses it to notify an application when a * process it controls exits. By default, however, we don't use an - * <ACE_Reactor>. + * ACE_Reactor. */ ACE_Process_Manager (size_t size = ACE_Process_Manager::DEFAULT_SIZE, ACE_Reactor *reactor = 0); @@ -153,7 +149,7 @@ public: * needed. If a non-NULL <reactor> is provided, this * <ACE_Process_Manager> uses it to notify an application when a * process it controls exits. By default, however, we don't use an - * <ACE_Reactor>. + * ACE_Reactor. */ int open (size_t size = DEFAULT_SIZE, ACE_Reactor *r = 0); @@ -183,30 +179,38 @@ public: // = Process creation methods. /** - * Create a new process by passing <options> to <proc.spawn>. On - * success, returns the process id of the child that was created. + * Create a new process by passing <options> to <proc.spawn>. + * Register <event_handler> to be called back when the process exits. + * + * On success, returns the process id of the child that was created. * On failure, returns ACE_INVALID_PID. */ pid_t spawn (ACE_Process *proc, - ACE_Process_Options &options); + ACE_Process_Options &options, + ACE_Event_Handler *event_handler = 0); /** - * Create a new process by passing <options> to - * <ACE_Process::spawn>. On success, returns the process id of the - * child that was created. On failure, returns ACE_INVALID_PID. + * Create a new process by passing <options> to <ACE_Process::spawn>. + * Register <event_handler> to be called back when the process exits. + * + * On success, returns the process id of the child that was created. + * On failure, returns ACE_INVALID_PID. */ - pid_t spawn (ACE_Process_Options &options); + pid_t spawn (ACE_Process_Options &options, + ACE_Event_Handler *event_handler = 0); /** * Create <n> new processes by passing <options> to * <ACE_Process::spawn>, which is called <n> times. If <child_pids> * is non-0 it is expected to be an array of <n> <pid_t>'s, which * are filled in with the process ids of each newly created process. + * Register <event_handler> to be called back when each process exits. * Returns 0 on success and -1 on failure. */ int spawn_n (size_t n, ACE_Process_Options &options, - pid_t *child_pids = 0); + pid_t *child_pids = 0, + ACE_Event_Handler *event_Handler = 0); // = Process synchronization operations. @@ -248,6 +252,7 @@ public: ACE_exitcode *status = 0); /** + * @deprecated * Reap the result of a single process by calling <ACE_OS::waitpid>, * therefore, this method is not portable to Win32. If the child is * successfully reaped, <remove> is called automatically. This @@ -263,6 +268,11 @@ public: * Register an Event_Handler to be called back when the specified * process exits. If pid == ACE_INVALID_PID this handler is called * when any process with no specific handler exits. + * + * @note In multi-threaded applications, there is a race condition + * if a process exits between the time it is spawned and when its + * handler is registered. To avoid this, register the handler at + * the time the process is spawned. */ int register_handler (ACE_Event_Handler *event_handler, pid_t pid = ACE_INVALID_PID); @@ -292,6 +302,22 @@ public: /// Return the number of managed Processes. size_t managed (void) const; + /** + * Sets the scheduling parameters for the <Process> managed by + * <ACE_Process_Manager> identified by pid by passing <params>, <pid> to + * <ACE_OS::sched_params>. Returns 0 on success, -1 on failure, and + * ACE_INVALID_PID when given pid is not managed by + * <ACE_Process_Manager>. + */ + int set_scheduler (const ACE_Sched_Params ¶ms, + pid_t pid); + + /** + * Sets the scheduling parameters for all the <Process>es managed by + * <ACE_Process_Manager> by passing <params> to + * <ACE_OS::sched_params>. Returns 0 on success, -1 on failure. + */ + int set_scheduler_all (const ACE_Sched_Params &); /// Dump the state of an object. void dump (void) const; @@ -357,14 +383,18 @@ private: /// Insert a process in the table (checks for duplicates). Omitting /// the process handle won't work on Win32... - int insert_proc (ACE_Process *process); + /// Register <event_handler> to be called back when the process exits. + int insert_proc (ACE_Process *process, + ACE_Event_Handler *event_handler = 0); /** * Append information about a process, i.e., its <process_id> in the * <process_table_>. Each entry is added at the end, growing the * table if necessary. + * Register <event_handler> to be called back when the process exits. */ - int append_proc (ACE_Process *process); + int append_proc (ACE_Process *process, + ACE_Event_Handler *event_handler = 0); /// Actually removes the process at index <n> from the table. This method /// must be called with locks held. @@ -402,6 +432,8 @@ private: #endif /* ACE_HAS_THREADS */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Process_Manager.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Process_Manager.inl b/ace/Process_Manager.inl index c6ee1f25260..248acd4c8e0 100644 --- a/ace/Process_Manager.inl +++ b/ace/Process_Manager.inl @@ -1,8 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE size_t ACE_Process_Manager::managed (void) const { return current_count_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process_Mutex.cpp b/ace/Process_Mutex.cpp index 0810ec1af50..6078bfdbc68 100644 --- a/ace/Process_Mutex.cpp +++ b/ace/Process_Mutex.cpp @@ -13,6 +13,8 @@ ACE_RCSID(ace, Process_Mutex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Process_Mutex) void @@ -84,17 +86,4 @@ ACE_Process_Mutex::~ACE_Process_Mutex (void) { } -// -// These are instantiated both with and without ACE_HAS_THREADS. -// -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Guard<ACE_Process_Mutex>; -template class ACE_Malloc_Lock_Adapter_T<ACE_Process_Mutex>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Guard<ACE_Process_Mutex> -#pragma instantiate ACE_Malloc_Lock_Adapter_T<ACE_Process_Mutex> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process_Mutex.h b/ace/Process_Mutex.h index 262525f7bed..604d7ee0c80 100644 --- a/ace/Process_Mutex.h +++ b/ace/Process_Mutex.h @@ -1,4 +1,5 @@ // -*- C++ -*- + //============================================================================= /** * @file Process_Mutex.h @@ -36,6 +37,8 @@ # include "ace/Mutex.h" #endif /* ACE_HAS_SYSV_IPC && !ACE_USES_MUTEX_FOR_PROCESS_MUTEX */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations class ACE_Time_Value; @@ -199,6 +202,8 @@ private: #endif /* _ACE_USE_SV_SEM */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Process_Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Process_Mutex.inl b/ace/Process_Mutex.inl index bf2c8c29ef6..6c19e8d6757 100644 --- a/ace/Process_Mutex.inl +++ b/ace/Process_Mutex.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if !defined (_ACE_USE_SV_SEM) ACE_INLINE const ACE_mutex_t & ACE_Process_Mutex::lock (void) const @@ -111,3 +114,5 @@ ACE_Process_Mutex::tryacquire_write_upgrade (void) { return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process_Semaphore.cpp b/ace/Process_Semaphore.cpp index 7e3bdb7f90c..1ac13b44065 100644 --- a/ace/Process_Semaphore.cpp +++ b/ace/Process_Semaphore.cpp @@ -12,6 +12,8 @@ ACE_RCSID(ace, Process_Semaphore, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Process_Semaphore::dump (void) const { @@ -40,10 +42,10 @@ ACE_Process_Semaphore::ACE_Process_Semaphore (u_int count, // ACE_TRACE ("ACE_Process_Semaphore::ACE_Process_Semaphore"); } -ACE_Process_Semaphore::~ACE_Process_Semaphore (void) -{ - // ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore"); -} +// ACE_Process_Semaphore::~ACE_Process_Semaphore (void) +// { +// // ACE_TRACE ("ACE_Process_Semaphore::~ACE_Process_Semaphore"); +// } // Explicitly destroy the semaphore. @@ -111,3 +113,4 @@ ACE_Malloc_Lock_Adapter_T<ACE_Process_Semaphore>::operator () (const ACE_TCHAR * return p; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Process_Semaphore.h b/ace/Process_Semaphore.h index 295c79d5ce0..d9b813b4d4d 100644 --- a/ace/Process_Semaphore.h +++ b/ace/Process_Semaphore.h @@ -18,13 +18,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ - +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -36,13 +30,15 @@ # include "ace/Semaphore.h" #endif /* !(ACE_WIN32 || ACE_HAS_POSIX_SEM || ACE_PSOS) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Process_Semaphore * * @brief Wrapper for Dijkstra style general semaphores that work * across processes. */ -class ACE_Threads_Export ACE_Process_Semaphore +class ACE_Export ACE_Process_Semaphore { public: /// Initialize the semaphore, with an initial value of @a count and a @@ -57,7 +53,7 @@ public: * If you want to remove the semaphore, you must call the <remove> * method explicitly. */ - ~ACE_Process_Semaphore (void); + // ~ACE_Process_Semaphore (void); /** * Explicitly destroy the semaphore. Note that only one thread @@ -155,12 +151,15 @@ template <class T> class ACE_Malloc_Lock_Adapter_T; * the standard form used by other lock strategy classes. */ template<> -class ACE_Threads_Export ACE_Malloc_Lock_Adapter_T<ACE_Process_Semaphore> +class ACE_Export ACE_Malloc_Lock_Adapter_T<ACE_Process_Semaphore> { public: ACE_Process_Semaphore * operator () (const ACE_TCHAR *name); }; +ACE_END_VERSIONED_NAMESPACE_DECL + + #if defined (__ACE_INLINE__) #include "ace/Process_Semaphore.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Process_Semaphore.inl b/ace/Process_Semaphore.inl index 8470291233c..98c29c9b9b6 100644 --- a/ace/Process_Semaphore.inl +++ b/ace/Process_Semaphore.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) || defined (ACE_HAS_POSIX_SEM) || defined (ACE_PSOS) ACE_INLINE const ACE_sema_t & ACE_Process_Semaphore::lock (void) const @@ -59,3 +62,5 @@ ACE_Process_Semaphore::tryacquire_write_upgrade (void) { return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Profile_Timer.cpp b/ace/Profile_Timer.cpp index c3fe6f5e0d6..1198d64de05 100644 --- a/ace/Profile_Timer.cpp +++ b/ace/Profile_Timer.cpp @@ -11,12 +11,15 @@ ACE_RCSID(ace, Profile_Timer, "$Id$") -ACE_ALLOC_HOOK_DEFINE(ACE_Profile_Timer) - #if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32) #include "ace/OS_NS_stdio.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_Profile_Timer) + + void ACE_Profile_Timer::dump (void) const { @@ -261,8 +264,12 @@ ACE_Profile_Timer::elapsed_time (ACE_Elapsed_Time &et) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #elif defined (ACE_WIN32) /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Profile_Timer::dump (void) const { @@ -338,10 +345,16 @@ ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage) ACE_TRACE ("ACE_Profile_Timer::elapsed_rusage"); # if defined (ACE_HAS_GETRUSAGE) - usage.ru_utime = - this->end_usage_.ru_utime - this->begin_usage_.ru_utime; - usage.ru_stime = - this->end_usage_.ru_stime - this->begin_usage_.ru_stime; + // Use ACE_Time_Value's as intermediate because the type of ru_utime can + // be multiple types and using the - operator is not safe when this are + // 64bit FILETIMEs on Windows + ACE_Time_Value end_ru_utime (this->end_usage_.ru_utime); + ACE_Time_Value begin_ru_utime (this->begin_usage_.ru_utime); + usage.ru_utime = end_ru_utime - begin_ru_utime; + + ACE_Time_Value end_ru_stime (this->end_usage_.ru_stime); + ACE_Time_Value begin_ru_stime (this->begin_usage_.ru_stime); + usage.ru_stime = end_ru_stime - begin_ru_stime; # else /* ACE_HAS_GETRUSAGE */ usage = 0; # endif /* ACE_HAS_GETRUSAGE */ @@ -367,8 +380,12 @@ ACE_Profile_Timer::subtract (timeval &tdiff, timeval &t1, timeval &t0) } # endif /* ACE_HAS_GETRUSAGE */ +ACE_END_VERSIONED_NAMESPACE_DECL + #else +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Profile_Timer::dump (void) const { @@ -424,5 +441,7 @@ ACE_Profile_Timer::elapsed_rusage (ACE_Profile_Timer::Rusage &usage) usage = 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) && !defined (ACE_WIN32) */ diff --git a/ace/Profile_Timer.h b/ace/Profile_Timer.h index e7475a0c586..3740d99002c 100644 --- a/ace/Profile_Timer.h +++ b/ace/Profile_Timer.h @@ -23,6 +23,8 @@ #include "ace/High_Res_Timer.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Profile_Timer * @@ -130,6 +132,8 @@ private: #endif /* ACE_WIN32 || !ACE_HAS_PRUSAGE_T && !ACE_HAS_GETRUSAGE */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/Profile_Timer.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Profile_Timer.inl b/ace/Profile_Timer.inl index 6256ad61868..6ef5aa45af3 100644 --- a/ace/Profile_Timer.inl +++ b/ace/Profile_Timer.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_sys_time.h" @@ -8,9 +9,10 @@ #if (defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE)) && !defined (ACE_WIN32) # if defined (ACE_HAS_PRUSAGE_T) - # include "ace/OS_NS_stropts.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Profile_Timer::start (void) { @@ -29,7 +31,13 @@ ACE_Profile_Timer::stop (void) PIOCUSAGE, &this->end_usage_); } + +ACE_END_VERSIONED_NAMESPACE_DECL + # elif defined (ACE_HAS_GETRUSAGE) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Profile_Timer::start (void) { @@ -52,10 +60,14 @@ ACE_Profile_Timer::stop (void) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + # endif /* ACE_HAS_PRUSAGE_T */ #elif defined (ACE_WIN32) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Profile_Timer::~ACE_Profile_Timer (void) { @@ -85,8 +97,12 @@ ACE_Profile_Timer::stop (void) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #else +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Profile_Timer::start (void) { @@ -108,4 +124,6 @@ ACE_Profile_Timer::~ACE_Profile_Timer (void) { } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* defined (ACE_HAS_PRUSAGE_T) || defined (ACE_HAS_GETRUSAGE) */ diff --git a/ace/QoS/QoS_Decorator.cpp b/ace/QoS/QoS_Decorator.cpp index 5db08066010..90cc748e856 100644 --- a/ace/QoS/QoS_Decorator.cpp +++ b/ace/QoS/QoS_Decorator.cpp @@ -3,7 +3,9 @@ #include "QoS_Decorator.h" -ACE_RCSID(ace, QoS_Decorator, "$Id $") +ACE_RCSID(ace, QoS_Decorator, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_QOS_DECORATOR) @@ -159,3 +161,5 @@ ACE_QoS_Event_Handler::handle_input (ACE_HANDLE fd) { return this->decorator_base_->handle_qos (fd); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QoS/QoS_Decorator.h b/ace/QoS/QoS_Decorator.h index cf062216ec4..512912e7c3b 100644 --- a/ace/QoS/QoS_Decorator.h +++ b/ace/QoS/QoS_Decorator.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,7 +26,7 @@ #include "SOCK_Dgram_Mcast_QoS.h" #include "ACE_QoS_Export.h" -ACE_RCSID(QOS_Decorator, QOS_Decorator, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_QoS_Decorator_Base @@ -173,5 +173,7 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* QOS_DECORATOR_H */ diff --git a/ace/QoS/QoS_Manager.cpp b/ace/QoS/QoS_Manager.cpp index 7e698b0cad2..27fa39ab560 100644 --- a/ace/QoS/QoS_Manager.cpp +++ b/ace/QoS/QoS_Manager.cpp @@ -4,7 +4,9 @@ #include "QoS_Manager.h" #include "ace/Log_Msg.h" -ACE_RCSID(ace, QoS_Manager, "$Id $") +ACE_RCSID(ace, QoS_Manager, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_QOS_MANAGER) @@ -36,12 +38,4 @@ ACE_QoS_Manager::qos_session_set (void) return this->qos_session_set_; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Node<ACE_QoS_Session *>; -template class ACE_Unbounded_Set<ACE_QoS_Session *>; -template class ACE_Unbounded_Set_Iterator<ACE_QoS_Session *>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Node<ACE_QoS_Session *> -#pragma instantiate ACE_Unbounded_Set<ACE_QoS_Session *> -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_QoS_Session *> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QoS/QoS_Manager.h b/ace/QoS/QoS_Manager.h index 1c1bce7df53..8a0b52c9943 100644 --- a/ace/QoS/QoS_Manager.h +++ b/ace/QoS/QoS_Manager.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,6 +26,9 @@ #include "ACE_QoS_Export.h" #include "QoS_Session.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_QoS_Manager * @@ -65,5 +68,7 @@ private: ACE_QOS_SESSION_SET qos_session_set_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_QOS_MANAGER_H */ diff --git a/ace/QoS/QoS_Session.h b/ace/QoS/QoS_Session.h index 780a80b5a80..3e08bbc69ce 100644 --- a/ace/QoS/QoS_Session.h +++ b/ace/QoS/QoS_Session.h @@ -23,6 +23,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_SOCK; class ACE_QoS_Manager; @@ -175,5 +177,7 @@ protected: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_QOS_SESSION_H */ diff --git a/ace/QoS/QoS_Session_Factory.cpp b/ace/QoS/QoS_Session_Factory.cpp index bb72c0f492f..89a8fbcc913 100644 --- a/ace/QoS/QoS_Session_Factory.cpp +++ b/ace/QoS/QoS_Session_Factory.cpp @@ -7,6 +7,8 @@ ACE_RCSID(ace, QoS_Session_Factory, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_QoS_Session_Factory) #if defined(ACE_HAS_RAPI) @@ -99,3 +101,5 @@ ACE_QoS_Session_Factory::remove_session (ACE_QoS_Session *qos_session) return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QoS/QoS_Session_Factory.h b/ace/QoS/QoS_Session_Factory.h index 2e80e338d3e..0559dce4220 100644 --- a/ace/QoS/QoS_Session_Factory.h +++ b/ace/QoS/QoS_Session_Factory.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #include "ace/Containers_T.h" #include "ACE_QoS_Export.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declare this, so the factory uses only references to this. class ACE_QoS_Session; @@ -88,5 +90,7 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_QOS_SESSION_FACTORY_H */ diff --git a/ace/QoS/QoS_Session_Impl.cpp b/ace/QoS/QoS_Session_Impl.cpp index 6ed1ae63587..09014ae50c2 100644 --- a/ace/QoS/QoS_Session_Impl.cpp +++ b/ace/QoS/QoS_Session_Impl.cpp @@ -13,41 +13,39 @@ ACE_RCSID(ace, QoS_Session_Impl, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_QoS_Session_Impl) +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_HAS_RAPI) #include "rapi_err.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_RAPI_Session::rsvp_error = 0; // Call back function used by RAPI to report RSVP events. This // function translates the RAPI QoS parameters into the more generic // ACE_QoS parameters for the underlying RAPI session. int -rsvp_callback (rapi_sid_t sid, +rsvp_callback (rapi_sid_t /* sid */, rapi_eventinfo_t eventype, - int style_id, + int /* style_id */, int errcode, int errvalue, sockaddr * errnode, - u_char errflags, - int filter_spec_no, - rapi_filter_t *filter_spec_list, + u_char /* errflags */, + int /* filter_spec_no */, + rapi_filter_t * /* filter_spec_list */, int flow_spec_no, rapi_flowspec_t *flow_spec_list, - int ad_spec_no, - rapi_adspec_t *ad_spec_list, + int /* ad_spec_no */, + rapi_adspec_t * /* ad_spec_list */, void *args ) { - ACE_UNUSED_ARG (sid); - ACE_UNUSED_ARG (style_id); - ACE_UNUSED_ARG (filter_spec_no); - ACE_UNUSED_ARG (filter_spec_list); - ACE_UNUSED_ARG (ad_spec_no); - ACE_UNUSED_ARG (ad_spec_list); - ACE_UNUSED_ARG (errflags); - if (args == 0) ACE_DEBUG ((LM_DEBUG, "Argument in the call back function is null\n\n")); @@ -56,7 +54,7 @@ rsvp_callback (rapi_sid_t sid, qos_flowspecx_t *csxp = 0; - if(!flow_spec_list) + if (!flow_spec_list) { ACE_DEBUG ((LM_DEBUG, "(%N|%l) Null flow_spec_list\n")); @@ -313,12 +311,10 @@ ACE_RAPI_Session::rsvp_event_type (ACE_QoS_Session::RSVP_Event_Type event_type) } int -ACE_RAPI_Session::qos (ACE_SOCK *socket, - ACE_QoS_Manager *qos_manager, +ACE_RAPI_Session::qos (ACE_SOCK * /* socket */, + ACE_QoS_Manager * /* qos_manager */, const ACE_QoS &ace_qos) { - ACE_UNUSED_ARG (socket); - ACE_UNUSED_ARG (qos_manager); // If sender : call sending_qos () // If receiver : call receiving_qos () @@ -631,8 +627,12 @@ ACE_RAPI_Session::init_flowspec_simplified(const ACE_Flow_Spec &flow_spec) return flowsp; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_RAPI */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // This is a GQoS session ID generator. int ACE_GQoS_Session::GQoS_session_id = 0; @@ -720,3 +720,5 @@ ACE_GQoS_Session::rsvp_event_type (ACE_QoS_Session::RSVP_Event_Type event_type) { this->rsvp_event_type_ = event_type; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QoS/QoS_Session_Impl.h b/ace/QoS/QoS_Session_Impl.h index 5b2ac9e829d..193c537a74c 100644 --- a/ace/QoS/QoS_Session_Impl.h +++ b/ace/QoS/QoS_Session_Impl.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,6 +27,8 @@ #define DEFAULT_SOURCE_SENDER_PORT 10001 +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_RAPI_Session * @@ -146,8 +148,12 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_RAPI */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_GQoS_Session * @@ -249,6 +255,8 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "QoS_Session_Impl.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/QoS/QoS_Session_Impl.i b/ace/QoS/QoS_Session_Impl.i index fe701b32aa2..b3971b46d52 100644 --- a/ace/QoS/QoS_Session_Impl.i +++ b/ace/QoS/QoS_Session_Impl.i @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// QoS_Session_Impl.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if defined (ACE_HAS_RAPI) @@ -224,3 +225,5 @@ ACE_GQoS_Session::version (void) { return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp b/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp index 1b6ef84a413..408d5f22a62 100644 --- a/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp +++ b/ace/QoS/SOCK_Dgram_Mcast_QoS.cpp @@ -23,6 +23,7 @@ ACE_RCSID (QoS, SOCK_Dgram_Mcast_QoS, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram_Mcast_QoS) @@ -252,3 +253,5 @@ ACE_SOCK_Dgram_Mcast_QoS::subscribe (const ACE_INET_Addr &mcast_addr, return 0; } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QoS/SOCK_Dgram_Mcast_QoS.h b/ace/QoS/SOCK_Dgram_Mcast_QoS.h index 5da29c71d4b..032bbe22f11 100644 --- a/ace/QoS/SOCK_Dgram_Mcast_QoS.h +++ b/ace/QoS/SOCK_Dgram_Mcast_QoS.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SOCK_Dgram_Mcast_QoS * @@ -130,6 +132,8 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "SOCK_Dgram_Mcast_QoS.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/QoS/SOCK_Dgram_Mcast_QoS.i b/ace/QoS/SOCK_Dgram_Mcast_QoS.i index 5bf7c57a5ac..9e2347669c5 100644 --- a/ace/QoS/SOCK_Dgram_Mcast_QoS.i +++ b/ace/QoS/SOCK_Dgram_Mcast_QoS.i @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_SOCK_Dgram_Mcast_QoS::~ACE_SOCK_Dgram_Mcast_QoS (void) { @@ -50,3 +53,5 @@ ACE_SOCK_Dgram_Mcast_QoS::qos_manager (void) { return this->qos_manager_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QtReactor.cpp b/ace/QtReactor.cpp index 10f66e42021..a6983ab9463 100644 --- a/ace/QtReactor.cpp +++ b/ace/QtReactor.cpp @@ -1,5 +1,9 @@ //$Id$ + #include "ace/QtReactor.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_QtReactor) // Must be called with lock held @@ -149,7 +153,7 @@ ACE_QtReactor::read_event (int p_handle) ACE_Reactor_Mask mask = 0; mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); if ( -1 != mask ) - set_enable_flag_by_mask ( 1, handle, mask); + set_enable_flag_by_mask ( 1, handle, mask); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ } @@ -178,7 +182,7 @@ ACE_QtReactor::write_event (int p_handle) ACE_Reactor_Mask mask = 0; mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); if ( -1 != mask ) - set_enable_flag_by_mask ( 1, handle, mask); + set_enable_flag_by_mask ( 1, handle, mask); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ } @@ -208,7 +212,7 @@ ACE_QtReactor::exception_event (int p_handle) ACE_Reactor_Mask mask = 0; mask = mask_ops( handle, mask, ACE_Reactor::GET_MASK ); if ( -1 != mask ) - set_enable_flag_by_mask ( 1, handle, mask); + set_enable_flag_by_mask ( 1, handle, mask); #endif /* ACE_QTREACTOR_CLEAR_PENDING_EVENTS */ } @@ -588,8 +592,9 @@ ACE_QtReactor::QtWaitForMultipleEvents (int width, // mbrudka: who needs wait_for_multiple_events? It seems it's cargo load now! int -ACE_QtReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, - ACE_Time_Value *max_wait_time) +ACE_QtReactor::wait_for_multiple_events ( + ACE_Select_Reactor_Handle_Set &handle_set, + ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_QtReactor::wait_for_multiple_events"); @@ -621,16 +626,4 @@ ACE_QtReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_s // Timed out or input available } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Map_Entry<ACE_HANDLE, QSocketNotifier *>; -template class ACE_Map_Manager<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex>; -template class ACE_Map_Iterator<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, QSocketNotifier *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/QtReactor.h b/ace/QtReactor.h index f15e45bcbf6..c3ccb82f7f3 100644 --- a/ace/QtReactor.h +++ b/ace/QtReactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,24 +13,26 @@ #ifndef ACE_QTREACTOR_H #define ACE_QTREACTOR_H -#include /**/ "ace/pre.h" +#include /**/ "ace/pre.h" -#include "ace/Select_Reactor.h" #include "ace/ACE_QtReactor_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Select_Reactor.h" #include "ace/Map_Manager.h" -// Qttoolkit specific includes. +// QT toolkit specific includes. #include /**/ <qapplication.h> #include /**/ <qobject.h> #include /**/ <qsocketnotifier.h> #include /**/ <qtimer.h> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_QtReactor * @@ -79,7 +81,9 @@ * it is not clear if the leak is introduced by QtReactor, or rather incorrect * memory management in QtReactor_Test. */ -class ACE_QtReactor_Export ACE_QtReactor : public QObject, public ACE_Select_Reactor +class ACE_QtReactor_Export ACE_QtReactor + : public QObject, + public ACE_Select_Reactor { Q_OBJECT @@ -212,5 +216,7 @@ private slots: void timeout_event (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_QTREACTOR_H */ diff --git a/ace/RB_Tree.cpp b/ace/RB_Tree.cpp index 909d8f386e5..a93b6967145 100644 --- a/ace/RB_Tree.cpp +++ b/ace/RB_Tree.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_RB_TREE_C -#define ACE_RB_TREE_C +#ifndef ACE_RB_TREE_CPP +#define ACE_RB_TREE_CPP #include "ace/Global_Macros.h" #include "ace/RB_Tree.h" @@ -17,9 +17,7 @@ #include "ace/Log_Msg.h" -ACE_RCSID (ace, - RB_Tree, - "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Constructor. @@ -544,12 +542,12 @@ void ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::delete_children_i { this->delete_children_i (parent->left ()); this->delete_children_i (parent->right ()); - ACE_DES_FREE_TEMPLATE2 + ACE_DES_FREE_TEMPLATE2 (parent->left (), this->allocator_->free, ACE_RB_Tree_Node, EXT_ID, INT_ID); - ACE_DES_FREE_TEMPLATE2 + ACE_DES_FREE_TEMPLATE2 (parent->right (), this->allocator_->free, ACE_RB_Tree_Node, @@ -645,7 +643,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, // The right subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; - ACE_NEW_MALLOC_RETURN + ACE_NEW_MALLOC_RETURN (tmp, (reinterpret_cast<ACE_RB_Tree_Node<EXT_ID, INT_ID>*> (this->allocator_->malloc (sizeof (*tmp)))), @@ -679,7 +677,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, { // The left subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; - ACE_NEW_MALLOC_RETURN + ACE_NEW_MALLOC_RETURN (tmp, (reinterpret_cast<ACE_RB_Tree_Node<EXT_ID, INT_ID>*> (this->allocator_->malloc (sizeof (*tmp)))), @@ -703,7 +701,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, { // The tree is empty: insert at the root and color the root // black. - ACE_NEW_MALLOC_RETURN + ACE_NEW_MALLOC_RETURN (this->root_, (reinterpret_cast<ACE_RB_Tree_Node<EXT_ID, INT_ID>*> (this->allocator_->malloc (sizeof (ACE_RB_Tree_Node<EXT_ID, INT_ID>)))), @@ -712,8 +710,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, this->root_->color (ACE_RB_Tree_Node_Base::BLACK); ++current_size_; return &this->root_->item (); - } - return 0; + } } // Inserts a *copy* of the key and the item into the tree: both the @@ -762,7 +759,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, { // The right subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; - ACE_NEW_MALLOC_RETURN + ACE_NEW_MALLOC_RETURN (tmp, (reinterpret_cast<ACE_RB_Tree_Node<EXT_ID, INT_ID>*> (this->allocator_->malloc (sizeof (*tmp)))), @@ -796,7 +793,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, { // The left subtree is empty: insert new node there. ACE_RB_Tree_Node<EXT_ID, INT_ID> *tmp = 0; - ACE_NEW_MALLOC_RETURN + ACE_NEW_MALLOC_RETURN (tmp, (reinterpret_cast<ACE_RB_Tree_Node<EXT_ID, INT_ID>*> (this->allocator_->malloc (sizeof (*tmp)))), @@ -818,7 +815,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::insert_i (const EXT_ID &k, else { // The tree is empty: insert at the root and color the root black. - ACE_NEW_MALLOC_RETURN + ACE_NEW_MALLOC_RETURN (this->root_, (reinterpret_cast<ACE_RB_Tree_Node<EXT_ID, INT_ID>*> (this->allocator_->malloc (sizeof (ACE_RB_Tree_Node<EXT_ID, INT_ID>)))), @@ -1199,5 +1196,6 @@ ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::~ACE_RB_Tr ACE_TRACE ("ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::~ACE_RB_Tree_Reverse_Iterator"); } +ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* !defined (ACE_RB_TREE_C) */ +#endif /* !ACE_RB_TREE_CPP */ diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h index fa6b88726cb..5c63d0b51ee 100644 --- a/ace/RB_Tree.h +++ b/ace/RB_Tree.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> class ACE_RB_Tree_Iterator_Base; @@ -151,9 +153,9 @@ protected: * a future version of ACE. Please migrate your code * to the appropriate public methods indicated in the * method deprecation comments. - * This class uses an <ACE_Allocator> to allocate memory. The + * This class uses an ACE_Allocator to allocate memory. The * user can make this a persistent class by providing an - * <ACE_Allocator> with a persistable memory pool. + * ACE_Allocator with a persistable memory pool. * * <b> Requirements and Performance Characteristics</b> * - Internal Structure: @@ -223,7 +225,7 @@ public: // = insertion, removal, and search methods. /** - * Associate <ext_id> with <int_id>. If <ext_id> is already in the + * Associate @a ext_id with @a int_id. If @a ext_id is already in the * tree then the <ACE_RB_Tree_Node> is not changed. Returns 0 if a * new entry is bound successfully, returns 1 if an attempt is made * to bind an existing entry, and returns -1 if failures occur. @@ -242,8 +244,8 @@ public: /** - * Associate <ext_id> with <int_id> if and only if <ext_id> is not - * in the tree. If <ext_id> is already in the tree then the <int_id> + * Associate @a ext_id with @a int_id if and only if @a ext_id is not + * in the tree. If @a ext_id is already in the tree then the @a int_id * parameter is assigned the existing value in the tree. Returns 0 * if a new entry is bound successfully, returns 1 if an attempt is * made to bind an existing entry, and returns -1 if failures occur. @@ -261,7 +263,7 @@ public: ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry); /** - * Reassociate <ext_id> with <int_id>. If <ext_id> is not in the + * Reassociate @a ext_id with @a int_id. If @a ext_id is not in the * tree then behaves just like <bind>. Returns 0 if a new entry is * bound successfully, returns 1 if an existing entry was rebound, * and returns -1 if failures occur. @@ -279,9 +281,9 @@ public: ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry); /** - * Associate <ext_id> with <int_id>. If <ext_id> is not in the tree + * Associate @a ext_id with @a int_id. If @a ext_id is not in the tree * then behaves just like <bind>. Otherwise, store the old value of - * <int_id> into the "out" parameter and rebind the new parameters. + * @a int_id into the "out" parameter and rebind the new parameters. * Returns 0 if a new entry is bound successfully, returns 1 if an * existing entry was rebound, and returns -1 if failures occur. */ @@ -300,9 +302,9 @@ public: ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry); /** - * Associate <ext_id> with <int_id>. If <ext_id> is not in the tree + * Associate @a ext_id with @a int_id. If @a ext_id is not in the tree * then behaves just like <bind>. Otherwise, store the old values - * of <ext_id> and <int_id> into the "out" parameters and rebind the + * of @a ext_id and @a int_id into the "out" parameters and rebind the * new parameters. This is very useful if you need to have an * atomic way of updating <ACE_RB_Tree_Nodes> and you also need * full control over memory allocation. Returns 0 if a new entry is @@ -325,24 +327,24 @@ public: INT_ID &old_int_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry); - /// Locate <ext_id> and pass out parameter via <int_id>. If found, + /// Locate @a ext_id and pass out parameter via @a int_id. If found, /// return 0, returns -1 if not found. int find (const EXT_ID &ext_id, INT_ID &int_id); - /// Locate <ext_id> and pass out parameter via <entry>. If found, + /// Locate @a ext_id and pass out parameter via <entry>. If found, /// return 0, returns -1 if not found. int find (const EXT_ID &ext_id, ACE_RB_Tree_Node<EXT_ID, INT_ID> *&entry); /** - * Unbind (remove) the <ext_id> from the tree. Don't return the - * <int_id> to the caller (this is useful for collections where the - * <int_id>s are *not* dynamically allocated...) + * Unbind (remove) the @a ext_id from the tree. Don't return the + * @a int_id to the caller (this is useful for collections where the + * @c int_ids are *not* dynamically allocated...) */ int unbind (const EXT_ID &ext_id); - /// Break any association of <ext_id>. Returns the value of <int_id> + /// Break any association of @a ext_id. Returns the value of @a int_id /// in case the caller needs to deallocate memory. int unbind (const EXT_ID &ext_id, INT_ID &int_id); @@ -370,8 +372,8 @@ public: * possible to acquire the lock explicitly, which can be useful in * some cases if you instantiate the <ACE_Atomic_Op> with an * <ACE_Recursive_Mutex> or <ACE_Process_Mutex>, or if you need to - * guard the state of an iterator. NOTE: the right name would be - * <lock>, but HP/C++ will choke on that! + * guard the state of an iterator. + * @note The right name would be <lock>, but HP/C++ will choke on that! */ ACE_LOCK &mutex (void); @@ -408,7 +410,7 @@ public: * * @deprecated signature will change to become * int find (const EXT_ID &ext_id); which will return - * 0 if the <ext_id> is in the tree, otherwise -1. + * 0 if the @a ext_id is in the tree, otherwise -1. */ INT_ID* find (const EXT_ID &k); @@ -418,7 +420,7 @@ public: * for copy construction. The default implementation also requires that * the key type support well defined < semantics. This method returns a * pointer to the inserted item copy, or 0 if an error occurred. - * NOTE: if an identical key already exists in the tree, no new item + * @note If an identical key already exists in the tree, no new item * is created, and the returned pointer addresses the existing item * associated with the existing key. * @deprecated @@ -522,7 +524,7 @@ protected: * for copy construction. The default implementation also requires that * the key type support well defined < semantics. This method returns a * pointer to the inserted item copy, or 0 if an error occurred. - * NOTE: if an identical key already exists in the tree, no new item + * @note If an identical key already exists in the tree, no new item * is created, and the returned pointer addresses the existing item * associated with the existing key. */ @@ -880,6 +882,8 @@ public: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/RB_Tree.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/RB_Tree.inl b/ace/RB_Tree.inl index cad46c4cbc3..ba41725319c 100644 --- a/ace/RB_Tree.inl +++ b/ace/RB_Tree.inl @@ -6,6 +6,8 @@ #include "ace/Malloc_Base.h" #include "ace/Log_Msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ///////////////////////////////////////////////////// // template class ACE_RB_Tree_Node<EXT_ID, INT_ID> // ///////////////////////////////////////////////////// @@ -653,7 +655,7 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::find (const EXT_ID &k) this->lock_, reinterpret_cast<INT_ID*> (0L)); - ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry; + ACE_RB_Tree_Node<EXT_ID, INT_ID> *entry = 0; int result = this->find_i (k, entry); return (result == 0) ? &(entry->item ()) : 0; } @@ -1151,3 +1153,5 @@ ACE_RB_Tree_Reverse_Iterator<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::next (ACE_ return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/README b/ace/README index 64a40549f41..748e5164c84 100644 --- a/ace/README +++ b/ace/README @@ -153,6 +153,7 @@ ACE_THREAD_MANAGER_USES_SAFE_SPAWN Disable the "check before lock" feature macro avoids a potential race condition on platforms with aggressive read/write reordering. +ACE_HAS_CPU_SET_T Platform delivers cpu_set_t. ACE_HAS_PRIOCNTL OS has priocntl (2). ACE_HAS_RECURSIVE_MUTEXES Mutexes are inherently recursive (e.g., Win32) @@ -225,10 +226,6 @@ ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR ACE_HAS_BROKEN_ACCEPT_ADDR Platform can't correctly deal with a NULL addr to accept() (e.g, VxWorks). -ACE_HAS_BROKEN_NAMESPACES Compiler/platform doesn't - support namespaces (or the - support is not fully - implemented.) ACE_HAS_BROKEN_CONDITIONAL_STRING_CASTS Compiler can't handle const char * as rvalue in conditional operator. ACE_HAS_BROKEN_CONVERSIONS Compiler can't handle calls @@ -260,12 +257,6 @@ ACE_HAS_BROKEN_T_ERROR Compiler/platform has the wrong prototype for t_error(), i.e., t_error(char *) rather than t_error(const char *). -ACE_HAS_BROKEN_TIMESPEC_MEMBERS platform define struct - timespec members as ts_sec and - ts_nsec instead of tv_sec and - tv_nsec. This is highly - non-portable. Currently only - FreeBSD 2.1.x uses it. ACE_HAS_BSTRING Platform has <bstring.h> (which contains bzero() prototype) @@ -283,7 +274,9 @@ ACE_HAS_CHARPTR_SPRINTF sprintf() returns char * rather than int (e.g., SunOS 4.x) ACE_HAS_CLOCK_GETTIME Platform supports POSIX.1b - clock_gettime () + clock_gettime () at least for clock-id CLOCK_REALTIME +ACE_HAS_CLOCK_GETTIME_MONOTONIC Platform supports POSIX.1b + clock_gettime () with the clock-id CLOCK_MONOTONIC ACE_HAS_CLOCK_SETTIME Platform supports POSIX.1b clock_settime () ACE_HAS_CONFLICTING_XTI_MACROS OS's XTI header file defines some @@ -484,11 +477,6 @@ ACE_HAS_POSIX_SEM_TIMEOUT Platform supports timed wait operation on POSIX realtime semaphores. ACE_HAS_POSIX_TIME Platform supports the POSIX struct timespec type -ACE_HAS_PREDEFINED_THREAD_CANCELLED_MACRO - LynxOS defines THREAD_CANCELLED macro - in system headers. This macro must be - undefined to avoid compilation errors - in TAO code. ACE_HAS_PROC_FS Platform supports the /proc file system and defines tid_t in <sys/procfs.h> @@ -513,6 +501,8 @@ ACE_HAS_PTHREADS_STD Platform supports POSIX.1c-1995 threads Pthreads). ACE_HAS_PTHREADS_UNIX98_EXT Platform has the UNIX98 extensions to Pthreads (rwlocks) +ACE_HAS_PTHREAD_ATTR_SETCREATESUSPEND_NP Platform has + pthread_attr_setcreatesuspend_np(). ACE_HAS_PTHREAD_CONDATTR_SETKIND_NP Platform has pthread_condattr_setkind_np(). ACE_HAS_PTHREAD_MUTEXATTR_SETKIND_NP Platform has pthread_mutexattr_setkind_np(). @@ -575,11 +565,13 @@ ACE_HAS_SIG_ATOMIC_T Compiler/platform defines the sig_atomic_t typedef ACE_HAS_SIG_C_FUNC Compiler requires extern "C" functions for signals. -ACE_HAS_SIN_LEN Platform supports new BSD - inet_addr len field. ACE_HAS_SIZET_SOCKET_LEN OS/compiler uses size_t * rather than int * for socket lengths +ACE_HAS_SOCKADDR_IN_SIN_LEN Platform has sin_len member in struct + sockaddr_in. +ACE_HAS_SOCKADDR_IN6_SIN_LEN Platform has sin6_len member in struct + sockaddr_in6. ACE_HAS_SOCKADDR_MSG_NAME Platform requires (struct sockaddr *) for msg_name field of struct msghdr. @@ -600,9 +592,14 @@ ACE_HAS_STANDARD_CPP_LIBRARY Platform/compiler supports Standard C++ Library ACE_HAS_STRBUF_T Compiler/platform supports struct strbuf -ACE_HAS_STRDUP_EMULATION Platform/compiler lacks - strdup() (e.g., VxWorks, - Chorus, WinCE) +ACE_HAS_STRDUP_EMULATION Use ACE's strdup() emulation (even + if platform has a native strdup()). + This is useful if you need control + over what memory allocator is used. +ACE_HAS_WCSDUP_EMULATION Use ACE's wcsdup() emulation (even + if platform has a native wcsdup()). + This is useful if you need control + over what memory allocator is used. ACE_HAS_STRNLEN Platform supports strnlen(3). ACE_HAS_STREAMS Platform supports STREAMS ACE_HAS_STREAM_PIPES Platform supports STREAM pipes @@ -716,15 +713,21 @@ ACE_HAS_UNION_WAIT The wait() system call takes a ACE_HAS_UNIXWARE_SVR4_SIGNAL_T Has inconsistent SVR4 signal stuff, but not the same as the other platforms -ACE_HAS_USING_KEYWORD Compiler supports the new - using keyword for C++ - namespaces. ACE_HAS_VALGRIND Running with valgrind ACE_HAS_VERBOSE_NOTSUP Prints out console message in ACE_NOTSUP. Useful for tracking down origin of ACE_NOTSUP. - +ACE_HAS_VERSIONED_NAMESPACE Wrap all library code within a + "versioned namespace" to + prevent symbol conflicts with + other versions of ACE shared + libraries in third party + libraries. Default namespace + name may be overridden by + defining preprocessor symbol + ACE_VERSIONED_NAMESPACE_NAME + to desired name. ACE_LACKS_INTMAX_T Platform lacks the intmax_t type ACE_LACKS_UINTMAX_T Platform lacks the uintmax_t type. ACE_LACKS_INTPTR_T Platform lacks the intptr_t type @@ -970,6 +973,7 @@ ACE_LACKS_NEW_H OS doesn't have, or we don't want to use, new.h. ACE_LACKS_NULL_PTHREAD_STATUS OS requires non-null status pointer for ::pthread_join (). +ACE_LACKS_NUMERIC_LIMITS Platform lacks std::numeric_limits<>. ACE_LACKS_PERFECT_MULTICAST_FILTERING Platform lacks IGMPv3 "perfect" filtering of multicast dgrams at the socket level. If == 1, ACE_SOCK_Dgram_Mcast will bind @@ -990,7 +994,7 @@ ACE_LACKS_PUTENV_PROTOTYPE Platform/compiler lacks the LynxOS) ACE_LACKS_PWD_REENTRANT_FUNCTIONS Platform lacks getpwnam_r() methods (e.g., SGI 6.2). -ACE_LACKS_SID Platform lacks setsid +ACE_LACKS_SID Platform lacks setsid() ACE_LACKS_QSORT Compiler/platform lacks the standard C library qsort() function @@ -1043,14 +1047,14 @@ ACE_LACKS_SIGSET Platform lacks signal sets (e.g., Chorus and Win32) ACE_LACKS_NATIVE_STRPTIME Platform/compiler lacks the strptime() function. -ACE_LACKS_STRRCHR Platform/compiler lacks - strrchr () function. -ACE_LACKS_WCSRCHR Platform/compiler lacks wcsrchr () - function +ACE_LACKS_STRCHR Platform/compiler lacks strchr() +ACE_LACKS_WCSCHR Platform/compiler lacks wcschr() +ACE_LACKS_STRDUP Platform/compiler lacks strdup() +ACE_LACKS_WCSDUP Platform/compiler lacks wcsdup() +ACE_LACKS_STRRCHR Platform/compiler lacks strrchr() +ACE_LACKS_WCSRCHR Platform/compiler lacks wcsrchr() ACE_LACKS_SWAB Platform/compiler lacks swab () function. -ACE_LACKS_SYSTIME_H <time.h> doesn't automatically - #include /**/ <sys/time.h> ACE_LACKS_SYS_MSG_H Platform lacks sys/msg.h (e.g., Chorus and VxWorks) ACE_LACKS_SYS_PARAM_H Platform lacks <sys/param.h> @@ -1130,6 +1134,7 @@ ACE_LACKS_UNSIGNEDLONGLONG_T Compiler/platform does not long datatype. ACE_LACKS_UTSNAME_T Platform lacks struct utsname (e.g., Win32 and VxWorks) +ACE_LACKS_UNAME Platform lacks uname calls ACE_LACKS_WAIT The platform lacks wait ACE_LACKS_WILDCARD_BIND The bind() call will not select the port if it's 0. diff --git a/ace/RW_Mutex.cpp b/ace/RW_Mutex.cpp index cde11394329..54a9b17047d 100644 --- a/ace/RW_Mutex.cpp +++ b/ace/RW_Mutex.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file RW_Mutex.cpp * @@ -21,6 +20,8 @@ ACE_RCSID(ace, RW_Mutex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_RW_Mutex::dump (void) const { @@ -49,4 +50,6 @@ ACE_RW_Mutex::~ACE_RW_Mutex (void) this->remove (); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/RW_Mutex.h b/ace/RW_Mutex.h index fe20c589b25..1e920cf3a65 100644 --- a/ace/RW_Mutex.h +++ b/ace/RW_Mutex.h @@ -28,6 +28,8 @@ #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_RW_Mutex * @@ -126,6 +128,8 @@ private: ACE_RW_Mutex (const ACE_RW_Mutex &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/RW_Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/RW_Mutex.inl b/ace/RW_Mutex.inl index 4d5fb16be2c..47b95a3bb94 100644 --- a/ace/RW_Mutex.inl +++ b/ace/RW_Mutex.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE const ACE_rwlock_t & ACE_RW_Mutex::lock (void) const { @@ -76,3 +79,5 @@ ACE_RW_Mutex::release (void) // ACE_TRACE ("ACE_RW_Mutex::release"); return ACE_OS::rw_unlock (&this->lock_); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/RW_Process_Mutex.cpp b/ace/RW_Process_Mutex.cpp index a0d0b15a2af..f16bf535182 100644 --- a/ace/RW_Process_Mutex.cpp +++ b/ace/RW_Process_Mutex.cpp @@ -16,6 +16,8 @@ ACE_RCSID(ace, RW_Process_Mutex, "$Id$") #include "ace/OS_NS_fcntl.h" #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_RW_Process_Mutex) const ACE_TCHAR * @@ -27,7 +29,7 @@ ACE_RW_Process_Mutex::unique_name (void) ACE_RW_Process_Mutex::ACE_RW_Process_Mutex (const ACE_TCHAR *name, int flags, - mode_t mode ) + mode_t mode ) : lock_ (name ? name : this->unique_name (), flags, mode) { // ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); @@ -49,17 +51,4 @@ ACE_RW_Process_Mutex::dump (void) const #endif /* ACE_HAS_DUMP */ } -// -// These are instantiated both with and without ACE_HAS_THREADS. -// -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -// template class ACE_Guard<ACE_RW_Process_Mutex>; -template class ACE_Malloc_Lock_Adapter_T<ACE_RW_Process_Mutex>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -// #pragma instantiate ACE_Guard<ACE_RW_Process_Mutex> -#pragma instantiate ACE_Malloc_Lock_Adapter_T<ACE_RW_Process_Mutex> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/RW_Process_Mutex.h b/ace/RW_Process_Mutex.h index cee7a1a6cb5..a34b6f9f404 100644 --- a/ace/RW_Process_Mutex.h +++ b/ace/RW_Process_Mutex.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// //============================================================================= /** * @file RW_Process_Mutex.h @@ -23,6 +24,8 @@ #include "ace/Default_Constants.h" #include "ace/OS_NS_fcntl.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_RW_Process_Mutex * @@ -33,16 +36,16 @@ * used between separate processes, rather than threads in the * same process. This isn't a limitation of ACE, it's simply * the file lock semantics on UNIX and Win32. - * \todo For systems with pthread_rwlockattr_setpshared one + * \todo For systems with pthread_rwlockattr_setpshared one * may consider using them to make the mutex faster. */ -class ACE_Threads_Export ACE_RW_Process_Mutex +class ACE_Export ACE_RW_Process_Mutex { public: /// Create a readers/writer <Process_Mutex>, passing in the optional - /// <name>, <flags> and <mode> \sa ACE_File_Lock. - /// If not specified, a name is generated and flags and mode are set - /// to default platform values. + /// <name>, <flags> and <mode> \sa ACE_File_Lock. + /// If not specified, a name is generated and flags and mode are set + /// to default platform values. #if defined (ACE_WIN32) ACE_RW_Process_Mutex (const ACE_TCHAR *name = 0, int flags = O_CREAT|O_RDWR, @@ -50,7 +53,7 @@ public: #else ACE_RW_Process_Mutex (const ACE_TCHAR *name = 0, int flags = O_CREAT|O_RDWR, - mode_t mode = S_IRUSR | S_IWUSR ); + mode_t mode = S_IRUSR | S_IWUSR ); #endif /* ACE_WIN32 */ ~ACE_RW_Process_Mutex (void); @@ -120,6 +123,8 @@ private: ACE_File_Lock lock_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/RW_Process_Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/RW_Process_Mutex.inl b/ace/RW_Process_Mutex.inl index cc59bb9fc17..e3bced0449c 100644 --- a/ace/RW_Process_Mutex.inl +++ b/ace/RW_Process_Mutex.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Explicitly destroy the mutex. ACE_INLINE int ACE_RW_Process_Mutex::remove (void) @@ -70,3 +73,5 @@ ACE_RW_Process_Mutex::lock (void) const // ACE_TRACE ("ACE_RW_Process_Mutex::lock"); return this->lock_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/RW_Thread_Mutex.cpp b/ace/RW_Thread_Mutex.cpp index 1f6ae3153eb..bc1c9ecb44f 100644 --- a/ace/RW_Thread_Mutex.cpp +++ b/ace/RW_Thread_Mutex.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file RW_Thread_Mutex.cpp * @@ -21,6 +20,8 @@ ACE_RCSID(ace, RW_Thread_Mutex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_RW_Thread_Mutex) ACE_RW_Thread_Mutex::ACE_RW_Thread_Mutex (const ACE_TCHAR *name, @@ -39,16 +40,6 @@ ACE_RW_Thread_Mutex::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -// These are only instantiated with ACE_HAS_THREADS. -template class ACE_Guard<ACE_RW_Thread_Mutex>; -template class ACE_Read_Guard<ACE_RW_Thread_Mutex>; -template class ACE_Write_Guard<ACE_RW_Thread_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -// These are only instantiated with ACE_HAS_THREADS. -#pragma instantiate ACE_Guard<ACE_RW_Thread_Mutex> -#pragma instantiate ACE_Read_Guard<ACE_RW_Thread_Mutex> -#pragma instantiate ACE_Write_Guard<ACE_RW_Thread_Mutex> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_THREADS */ diff --git a/ace/RW_Thread_Mutex.h b/ace/RW_Thread_Mutex.h index 171006ad11a..9f5f43f93c4 100644 --- a/ace/RW_Thread_Mutex.h +++ b/ace/RW_Thread_Mutex.h @@ -29,6 +29,8 @@ #include "ace/RW_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_RW_Thread_Mutex * @@ -60,6 +62,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/RW_Thread_Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/RW_Thread_Mutex.inl b/ace/RW_Thread_Mutex.inl index 82b4beb7f15..9f4d315df4a 100644 --- a/ace/RW_Thread_Mutex.inl +++ b/ace/RW_Thread_Mutex.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_RW_Thread_Mutex::tryacquire_write_upgrade (void) { @@ -12,3 +15,5 @@ ACE_INLINE ACE_RW_Thread_Mutex::~ACE_RW_Thread_Mutex (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor.cpp b/ace/Reactor.cpp index d7fd9abd919..4921135bd3a 100644 --- a/ace/Reactor.cpp +++ b/ace/Reactor.cpp @@ -2,7 +2,6 @@ #include "ace/Reactor.h" - //#if !defined (ACE_HAS_WINCE) # if !defined (ACE_LACKS_ACE_SVCCONF) # include "ace/Service_Config.h" @@ -60,6 +59,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Reactor) ACE_Reactor::ACE_Reactor (ACE_Reactor_Impl *impl, @@ -327,8 +328,6 @@ ACE_Reactor::run_alertable_reactor_event_loop (ACE_Time_Value &tv, else if (result <= 0) return result; } - - ACE_NOTREACHED (return 0;) } int @@ -944,8 +943,4 @@ ACE_Reactor::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Framework_Component_T<ACE_Reactor>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Framework_Component_T<ACE_Reactor> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor.h b/ace/Reactor.h index a4055932def..1875482644e 100644 --- a/ace/Reactor.h +++ b/ace/Reactor.h @@ -30,6 +30,8 @@ // Event_Handler.h contains the definition of ACE_Reactor_Mask #include "ace/Event_Handler.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Reactor_Impl; class ACE_Handle_Set; class ACE_Sig_Action; @@ -38,7 +40,7 @@ class ACE_Sig_Set; /* * Hook to specialize the Reactor implementation with the concrete - * Reactor type, for exmaple, select, thread pool reactor known + * Reactor type, for exmaple, select, thread pool reactor known * at compile time. */ //@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK @@ -48,7 +50,7 @@ class ACE_Sig_Set; * * @brief The responsibility of this class is to forward all methods to * its delegation/implementation class, e.g., - * <ACE_Select_Reactor> or <ACE_WFMO_Reactor>. + * ACE_Select_Reactor or ACE_WFMO_Reactor. */ class ACE_Export ACE_Reactor : public ACE_Reactor_Timer_Interface { @@ -78,11 +80,11 @@ public: */ typedef int (*REACTOR_EVENT_HOOK)(ACE_Reactor *); - /// Get pointer to a process-wide <ACE_Reactor>. + /// Get pointer to a process-wide ACE_Reactor. static ACE_Reactor *instance (void); /** - * Set pointer to a process-wide <ACE_Reactor> and return existing + * Set pointer to a process-wide ACE_Reactor and return existing * pointer. If <delete_reactor> != 0 then we'll delete the Reactor * at destruction time. */ @@ -162,7 +164,7 @@ public: static void reset_event_loop (void); /** - * The singleton reactor is used by the <ACE_Service_Config>. + * The singleton reactor is used by the ACE_Service_Config. * Therefore, we must check for the reconfiguration request and * handle it after handling an event. */ @@ -211,9 +213,9 @@ public: virtual void reset_reactor_event_loop (void); /** - * Create the Reactor using <implementation>. The flag - * <delete_implementation> tells the Reactor whether or not to - * delete the <implementation> on destruction. + * Create the Reactor using @a implementation. The flag + * @a delete_implementation tells the Reactor whether or not to + * delete the @a implementation on destruction. */ ACE_Reactor (ACE_Reactor_Impl *implementation = 0, int delete_implementation = 0); @@ -226,8 +228,8 @@ public: virtual ~ACE_Reactor (void); /** - * Initialize the <ACE_Reactor> to manage <max_number_of_handles>. - * If <restart> is non-0 then the <ACE_Reactor>'s <handle_events> + * Initialize the ACE_Reactor to manage <max_number_of_handles>. + * If <restart> is non-0 then the ACE_Reactor's <handle_events> * method will be restarted automatically when <EINTR> occurs. If * <signal_handler> or <timer_queue> are non-0 they are used as the * signal handler and timer queue, respectively. @@ -271,7 +273,7 @@ public: * application wishes to handle events for some fixed amount of * time. * - * Returns the total number of timers and I/O <ACE_Event_Handler>s + * Returns the total number of timers and I/O ACE_Event_Handlers * that were dispatched, 0 if the <max_wait_time> elapsed without * dispatching any handlers, or -1 if an error occurs. * @@ -382,12 +384,12 @@ public: /** * Register handler for signals. * - * Register <new_sh> to handle the signal <signum> using the - * <new_disp>. Returns the <old_sh> that was previously registered - * (if any), along with the <old_disp> of the signal handler. + * Register @a new_sh to handle the signal @a signum using the + * @a new_disp. Returns the @a old_sh that was previously registered + * (if any), along with the @a old_disp of the signal handler. * - * Reactor will call ACE_Event_Handler::add_reference() on <new_sh> - * and ACE_Event_Handler::remove_reference() on <old_sh>. + * Reactor will call ACE_Event_Handler::add_reference() on @a new_sh + * and ACE_Event_Handler::remove_reference() on @a old_sh. */ virtual int register_handler (int signum, ACE_Event_Handler *new_sh, @@ -546,16 +548,19 @@ public: * @see cancel_timer() * @see reset_timer_interval() * - * @param event_handler event handler to schedule on reactor - * @param arg argument passed to the handle_timeout() method of event_handler - * @param delay time interval after which the timer will expire - * @param interval time interval after which the timer will be automatically rescheduled + * @param event_handler Event handler to schedule on reactor + * @param arg Argument passed to the handle_timeout() method of + * event_handler + * @param delay Time interval after which the timer will expire + * @param interval Time interval after which the timer will be automatically + * rescheduled * @return -1 on failure, a timer_id value on success */ virtual long schedule_timer (ACE_Event_Handler *event_handler, const void *arg, const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); + const ACE_Time_Value &interval = + ACE_Time_Value::zero); /** * Reset recurring timer interval. @@ -574,12 +579,12 @@ public: /** * Cancel timer. * - * Cancel timer associated with <timer_id> that was returned from + * Cancel timer associated with @a timer_id that was returned from * the schedule_timer() method. If arg is non-NULL then it will be * set to point to the ``magic cookie'' argument passed in when the * handler was registered. This makes it possible to free up the * memory and avoid memory leaks. Returns 1 if cancellation - * succeeded and 0 if the <timer_id> wasn't found. + * succeeded and 0 if the @a timer_id wasn't found. * * On successful cancellation, ACE_Event_Handler::handle_close() * will be called with <ACE_Event_Handler::TIMER_MASK>. @@ -619,8 +624,8 @@ public: virtual int schedule_wakeup (ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added); - /// Add <masks_to_be_added> to the <handle>'s entry. <event_handler> - /// associated with <handle> must already have been registered. + /// Add @a masks_to_be_added to the @a handle's entry. <event_handler> + /// associated with @a handle must already have been registered. /// Note that this call does not cause the Reactor to re-examine /// its set of handlers - the new masks will be noticed the next /// time the Reactor waits for activity. If there is no other @@ -715,13 +720,14 @@ public: * be called. */ virtual int purge_pending_notifications (ACE_Event_Handler *eh, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + ACE_Reactor_Mask = + ACE_Event_Handler::ALL_EVENTS_MASK); // = Assorted helper methods. /** - * Return the Event_Handler associated with <handle>. Return 0 if - * <handle> is not registered. + * Return the Event_Handler associated with @a handle. Return 0 if + * @a handle is not registered. * * Reactor will call ACE_Event_Handler::add_reference() on the * handler before returning it. @@ -729,12 +735,12 @@ public: virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle); /** - * Check to see if <handle> is associated with a valid Event_Handler - * bound to <mask>. Return the <event_handler> associated with this - * <handler> if <event_handler> != 0. + * Check to see if @a handle is associated with a valid Event_Handler + * bound to @a mask. Return the @c event_handler associated with this + * @a handler if @a event_handler != 0. * * Reactor will call ACE_Event_Handler::add_reference() on the - * handler before returning it if <event_handler> != 0. + * handler before returning it if @a event_handler != 0. */ virtual int handler (ACE_HANDLE handle, ACE_Reactor_Mask mask, @@ -743,7 +749,7 @@ public: /** * Check to see if @a signum is associated with a valid Event_Handler * bound to a signal. Return the <event_handler> associated with - * this <handler> if <event_handler> != 0. + * this <handler> if @a event_handler != 0. */ virtual int handler (int signum, ACE_Event_Handler **event_handler = 0); @@ -784,13 +790,13 @@ public: // = Low-level wait_set mask manipulation methods. /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the - /// <event_handler> and <mask>. + /// @a event_handler and @a mask. virtual int mask_ops (ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops); - /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the <handle> - /// and <mask>. + /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the @a handle + /// and @a mask. virtual int mask_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, int ops); @@ -841,7 +847,7 @@ protected: /// the implementation instance int delete_implementation_; - /// Pointer to a process-wide <ACE_Reactor> singleton. + /// Pointer to a process-wide ACE_Reactor singleton. static ACE_Reactor *reactor_; /// Must delete the <reactor_> singleton if non-0. @@ -852,6 +858,9 @@ protected: ACE_Reactor &operator = (const ACE_Reactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + + #if defined (__ACE_INLINE__) #include "ace/Reactor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Reactor.inl b/ace/Reactor.inl index 49132e29733..9b1344465ba 100644 --- a/ace/Reactor.inl +++ b/ace/Reactor.inl @@ -7,10 +7,12 @@ /* * Hook to specialize the Reactor with the concrete implementation - * known at compile time. + * known at compile time. */ //@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Reactor::run_event_loop (void) { @@ -95,3 +97,5 @@ ACE_Reactor::event_loop_done (void) ACE_TRACE ("ACE_Reactor::event_loop_done"); return ACE_Reactor::instance ()->reactor_event_loop_done (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Impl.cpp b/ace/Reactor_Impl.cpp index 556d25c4ee5..96411b8b0c6 100644 --- a/ace/Reactor_Impl.cpp +++ b/ace/Reactor_Impl.cpp @@ -3,9 +3,13 @@ #include "ace/Reactor_Impl.h" ACE_RCSID (ace, - Reactor_Impl, - "$Id$") + Reactor_Impl, + "$Id$") -ACE_Reactor_Impl::~ACE_Reactor_Impl() +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Reactor_Impl::~ACE_Reactor_Impl (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Impl.h b/ace/Reactor_Impl.h index cfe7e943828..51cca18517e 100644 --- a/ace/Reactor_Impl.h +++ b/ace/Reactor_Impl.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,6 +27,8 @@ #include "ace/Event_Handler.h" #include "ace/Countdown_Time.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decls class ACE_Handle_Set; class ACE_Reactor_Impl; @@ -108,7 +110,7 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. Returns the number of notifications + * ACE_Event_Handler object. Returns the number of notifications * purged. Returns -1 on error. */ virtual int purge_pending_notifications (ACE_Event_Handler * = 0, @@ -150,7 +152,7 @@ public: /// Set a user-specified timer queue. virtual int timer_queue (ACE_Timer_Queue *tq) = 0; - /// Return the current <ACE_Timer_Queue>. + /// Return the current ACE_Timer_Queue. virtual ACE_Timer_Queue *timer_queue (void) const = 0; /// Close down and release all resources. @@ -177,7 +179,7 @@ public: * application wishes to handle events for some fixed amount of * time. * - * Returns the total number of <ACE_Event_Handler>s that were + * Returns the total number of ACE_Event_Handlers that were * dispatched, 0 if the <max_wait_time> elapsed without dispatching * any handlers, or -1 if an error occurs. * @@ -467,7 +469,7 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. Returns the number of notifications + * ACE_Event_Handler object. Returns the number of notifications * purged. Returns -1 on error. */ virtual int purge_pending_notifications (ACE_Event_Handler * = 0, @@ -561,5 +563,7 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_REACTOR_IMPL_H */ diff --git a/ace/Reactor_Notification_Strategy.cpp b/ace/Reactor_Notification_Strategy.cpp index c902f30b929..a029e2c10c2 100644 --- a/ace/Reactor_Notification_Strategy.cpp +++ b/ace/Reactor_Notification_Strategy.cpp @@ -7,9 +7,12 @@ ACE_RCSID(ace, Reactor_Notification_Strategy, "$Id$") -ACE_Reactor_Notification_Strategy::ACE_Reactor_Notification_Strategy (ACE_Reactor *reactor, - ACE_Event_Handler *eh, - ACE_Reactor_Mask mask) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_Reactor_Notification_Strategy::ACE_Reactor_Notification_Strategy ( + ACE_Reactor *reactor, + ACE_Event_Handler *eh, + ACE_Reactor_Mask mask) : ACE_Notification_Strategy (eh, mask), reactor_ (reactor) { @@ -31,3 +34,5 @@ ACE_Reactor_Notification_Strategy::notify (ACE_Event_Handler *eh, { return this->reactor_->notify (eh, mask); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Notification_Strategy.h b/ace/Reactor_Notification_Strategy.h index 4a38f37ec25..5d38f5609a6 100644 --- a/ace/Reactor_Notification_Strategy.h +++ b/ace/Reactor_Notification_Strategy.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -11,6 +11,7 @@ //============================================================================= #ifndef ACE_REACTOR_NOTIFICATION_STRATEGY_H #define ACE_REACTOR_NOTIFICATION_STRATEGY_H + #include /**/ "ace/pre.h" #include "ace/Notification_Strategy.h" @@ -19,12 +20,14 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Reactor_Notification_Strategy * * @brief Used to notify an ACE_Reactor * - * Integrates the <ACE_Message_Queue> notification into the + * Integrates the ACE_Message_Queue notification into the * <ACE_Reactor::notify> method. */ class ACE_Export ACE_Reactor_Notification_Strategy : public ACE_Notification_Strategy @@ -53,9 +56,12 @@ protected: ACE_Reactor *reactor_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Reactor_Notification_Strategy.inl" #endif /* __ACE_INLINE __ */ #include /**/ "ace/post.h" + #endif /*ACE_REACTOR_NOTIFICATION_STRATEGY_H */ diff --git a/ace/Reactor_Notification_Strategy.inl b/ace/Reactor_Notification_Strategy.inl index 260ec1d960a..328c2687a77 100644 --- a/ace/Reactor_Notification_Strategy.inl +++ b/ace/Reactor_Notification_Strategy.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Reactor * ACE_Reactor_Notification_Strategy::reactor (void) { @@ -12,3 +15,5 @@ ACE_Reactor_Notification_Strategy::reactor (ACE_Reactor *r) { this->reactor_ = r; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Timer_Interface.cpp b/ace/Reactor_Timer_Interface.cpp index ea457c207a9..6c07f21ac86 100644 --- a/ace/Reactor_Timer_Interface.cpp +++ b/ace/Reactor_Timer_Interface.cpp @@ -6,6 +6,11 @@ ACE_RCSID (ace, Reactor_Timer_Interface, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Reactor_Timer_Interface::~ACE_Reactor_Timer_Interface() { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Timer_Interface.h b/ace/Reactor_Timer_Interface.h index 91638c9c2bd..d370a128df2 100644 --- a/ace/Reactor_Timer_Interface.h +++ b/ace/Reactor_Timer_Interface.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Event_Handler; /** @@ -51,6 +53,8 @@ public: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_REACTOR_TIMER_INTERFACE_H */ diff --git a/ace/Reactor_Token_T.cpp b/ace/Reactor_Token_T.cpp index ede9bba4a1f..358b0b14f65 100644 --- a/ace/Reactor_Token_T.cpp +++ b/ace/Reactor_Token_T.cpp @@ -3,9 +3,7 @@ #include "ace/Log_Msg.h" #include "ace/Reactor_Token_T.h" -ACE_RCSID (ace, - Reactor_Token_T, - "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class ACE_TOKEN_TYPE> void ACE_Reactor_Token_T<ACE_TOKEN_TYPE>::dump (void) const @@ -68,3 +66,5 @@ ACE_Reactor_Token_T<ACE_TOKEN_TYPE>::sleep_hook (void) ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("sleep_hook failed"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Reactor_Token_T.h b/ace/Reactor_Token_T.h index 8d71bbb420f..9ed4c671d52 100644 --- a/ace/Reactor_Token_T.h +++ b/ace/Reactor_Token_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -18,6 +18,7 @@ #include "ace/Reactor_Impl.h" #include "ace/Token.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Reactor_Token_T @@ -53,10 +54,12 @@ template <class ACE_TOKEN_TYPE> class ACE_Reactor_Token_T : public ACE_TOKEN_TYPE { public: - // *** After ACE 5.5.1, change ACE_Token::FIFO to ACE_TOKEN_TYPE::FIFO. - // **** This is only like this to work around MSVC 6 problems. + /** + * @todo After ACE 5.5.1, change ACE_Token::FIFO to ACE_TOKEN_TYPE::FIFO. + * This is only like this to work around MSVC 6 problems. + */ ACE_Reactor_Token_T (ACE_Reactor_Impl &r, - int s_queue = ACE_Token::FIFO); + int s_queue = ACE_Token::FIFO); ACE_Reactor_Token_T (int s_queue = ACE_Token::FIFO); virtual ~ACE_Reactor_Token_T (void); @@ -80,11 +83,7 @@ private: ACE_Reactor_Impl *reactor_; }; -// There's no Reactor_Token_T.inl, but if there was, here's where it would -// get included. -#if 0 // defined (__ACE_INLINE__) -#include "ace/Reactor_Token_T.inl" -#endif /* __ACE_INLINE__ */ +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Reactor_Token_T.cpp" diff --git a/ace/Read_Buffer.cpp b/ace/Read_Buffer.cpp index c6645957729..9401048f148 100644 --- a/ace/Read_Buffer.cpp +++ b/ace/Read_Buffer.cpp @@ -15,6 +15,9 @@ ACE_RCSID(ace, Read_Buffer, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Read_Buffer::dump (void) const { @@ -169,3 +172,5 @@ ACE_Read_Buffer::rec_read (int term, int search, int replace) return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Read_Buffer.h b/ace/Read_Buffer.h index f1075c70901..11176ef34df 100644 --- a/ace/Read_Buffer.h +++ b/ace/Read_Buffer.h @@ -25,6 +25,8 @@ #include "ace/Global_Macros.h" #include "ace/os_include/os_stdio.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Allocator; /** @@ -80,7 +82,7 @@ public: size_t replaced (void) const; /// Returns the size of the allocated buffer obtained during a - /// <read>, not including the null terminator. + /// @c read, not including the null terminator. size_t size (void) const; /// Returns a pointer to its allocator. @@ -90,6 +92,12 @@ public: void dump (void) const; private: + + // Disallow copying and assignment... + void operator= (const ACE_Read_Buffer &); + ACE_Read_Buffer (const ACE_Read_Buffer &); + +private: /// Recursive helper method that does the work... char *rec_read (int term, int search, int replace); @@ -109,11 +117,10 @@ private: /// Pointer to the allocator. ACE_Allocator *allocator_; - // = Disallow copying and assignment... - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Read_Buffer &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Read_Buffer (const ACE_Read_Buffer &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/Read_Buffer.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Read_Buffer.inl b/ace/Read_Buffer.inl index 3534c62db2e..1517e9c17e3 100644 --- a/ace/Read_Buffer.inl +++ b/ace/Read_Buffer.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Accessor to the number of bytes in the buffer. ACE_INLINE size_t @@ -26,3 +29,4 @@ ACE_Read_Buffer::alloc (void) const return this->allocator_; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Recursive_Thread_Mutex.cpp b/ace/Recursive_Thread_Mutex.cpp index 15a809ed898..ccb59b1064d 100644 --- a/ace/Recursive_Thread_Mutex.cpp +++ b/ace/Recursive_Thread_Mutex.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file Recursive_Thread_Mutex.cpp * @@ -21,6 +20,8 @@ ACE_RCSID(ace, Recursive_Thread_Mutex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Recursive_Thread_Mutex) ACE_Recursive_Thread_Mutex::ACE_Recursive_Thread_Mutex (const ACE_TCHAR *name, @@ -91,8 +92,11 @@ ACE_Recursive_Thread_Mutex::get_nesting_level (void) #elif defined (ACE_HAS_RECURSIVE_MUTEXES) // Nothing inside of a CRITICAL_SECTION object should ever be // accessed directly. It is documented to change at any time. -# if defined (ACE_WIN64) - // Things are different on Windows XP 64-bit +# if defined (ACE_WIN64) && !defined(_M_AMD64) + // Things are different on Windows XP 64-bit. However, as of Feb 2006 + // Windows XP 64-bit edition on Intel EM64T w/ VC8, LockCount is + // decremented at first acquire and then doesn't change. RecursionCount, + // however, works the same as Win32, below. return this->lock_.LockCount + 1; # elif defined (ACE_WIN32) // This is really a Win32-ism... @@ -142,4 +146,6 @@ ACE_Recursive_Thread_Mutex::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/Recursive_Thread_Mutex.h b/ace/Recursive_Thread_Mutex.h index 3732ff42334..e5ad28df15c 100644 --- a/ace/Recursive_Thread_Mutex.h +++ b/ace/Recursive_Thread_Mutex.h @@ -29,6 +29,8 @@ #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Recursive_Thread_Mutex * @@ -101,7 +103,7 @@ public: int tryacquire_write (void); /** - * This is only here to make the <ACE_Recursive_Thread_Mutex> + * This is only here to make the ACE_Recursive_Thread_Mutex * interface consistent with the other synchronization APIs. * Assumes the caller has already acquired the mutex using one of * the above calls, and returns 0 (success) always. @@ -158,6 +160,8 @@ private: ACE_Recursive_Thread_Mutex (const ACE_Recursive_Thread_Mutex &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Recursive_Thread_Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Recursive_Thread_Mutex.inl b/ace/Recursive_Thread_Mutex.inl index a1d84584315..5046cd01ec4 100644 --- a/ace/Recursive_Thread_Mutex.inl +++ b/ace/Recursive_Thread_Mutex.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_recursive_thread_mutex_t & ACE_Recursive_Thread_Mutex::mutex (void) { @@ -57,3 +60,6 @@ ACE_Recursive_Thread_Mutex::tryacquire_write_upgrade (void) { return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/ace/Recyclable.cpp b/ace/Recyclable.cpp index 483852486f1..5da42cc8d15 100644 --- a/ace/Recyclable.cpp +++ b/ace/Recyclable.cpp @@ -8,6 +8,7 @@ ACE_RCSID(ace, Recyclable, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Recyclable::ACE_Recyclable (ACE_Recyclable_State initial_state) : recycle_state_ (initial_state) @@ -17,3 +18,5 @@ ACE_Recyclable::ACE_Recyclable (ACE_Recyclable_State initial_state) ACE_Recyclable::~ACE_Recyclable (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Recyclable.h b/ace/Recyclable.h index 709c9d45a3f..2c3d088cacd 100644 --- a/ace/Recyclable.h +++ b/ace/Recyclable.h @@ -19,6 +19,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /// States of a recyclable object. enum ACE_Recyclable_State @@ -62,13 +63,17 @@ public: void recycle_state (ACE_Recyclable_State new_state); protected: - /// Protected constructor. + + /// Constructor. ACE_Recyclable (ACE_Recyclable_State initial_state); +protected: + /// Our state. ACE_Recyclable_State recycle_state_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Recyclable.inl" diff --git a/ace/Recyclable.inl b/ace/Recyclable.inl index c9a4318b2dc..ef096ff62be 100644 --- a/ace/Recyclable.inl +++ b/ace/Recyclable.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// //$Id$ - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Recyclable_State ACE_Recyclable::recycle_state (void) const @@ -12,8 +13,8 @@ ACE_Recyclable::recycle_state (void) const ACE_INLINE void ACE_Recyclable::recycle_state (ACE_Recyclable_State new_state) { - if (this->recycle_state_ == ACE_RECYCLABLE_CLOSED) - return; - - this->recycle_state_ = new_state; + if (this->recycle_state_ != ACE_RECYCLABLE_CLOSED) + this->recycle_state_ = new_state; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Refcountable.cpp b/ace/Refcountable.cpp index 0c77633f4d1..902e4362f65 100644 --- a/ace/Refcountable.cpp +++ b/ace/Refcountable.cpp @@ -11,7 +11,10 @@ ACE_RCSID (ace, Refcountable, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Refcountable::~ACE_Refcountable (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Refcountable.h b/ace/Refcountable.h index 8f1bc155705..192243bd256 100644 --- a/ace/Refcountable.h +++ b/ace/Refcountable.h @@ -20,6 +20,8 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Refcountable * @@ -45,6 +47,8 @@ protected: int refcount_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Refcountable.inl" diff --git a/ace/Refcountable.inl b/ace/Refcountable.inl index 1d9a03fb66a..993af65d452 100644 --- a/ace/Refcountable.inl +++ b/ace/Refcountable.inl @@ -1,5 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// //$Id$ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Refcountable::ACE_Refcountable (int refcount) : refcount_ (refcount) @@ -23,3 +27,5 @@ ACE_Refcountable::refcount (void) const { return this->refcount_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Refcounted_Auto_Ptr.cpp b/ace/Refcounted_Auto_Ptr.cpp index 8abc1d7768d..7dd9d862b64 100644 --- a/ace/Refcounted_Auto_Ptr.cpp +++ b/ace/Refcounted_Auto_Ptr.cpp @@ -5,10 +5,14 @@ #include "ace/Refcounted_Auto_Ptr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class X, class ACE_LOCK> ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::~ACE_Refcounted_Auto_Ptr (void) { AUTO_REFCOUNTED_PTR_REP::detach (rep_); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_REFCOUNTED_AUTO_PTR_CPP */ diff --git a/ace/Refcounted_Auto_Ptr.h b/ace/Refcounted_Auto_Ptr.h index adac3dd7cd3..d480c125c68 100644 --- a/ace/Refcounted_Auto_Ptr.h +++ b/ace/Refcounted_Auto_Ptr.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. template <class X, class ACE_LOCK> class ACE_Refcounted_Auto_Ptr_Rep; template <class X, class ACE_LOCK> class ACE_Refcounted_Auto_Ptr; @@ -188,6 +190,8 @@ private: ~ACE_Refcounted_Auto_Ptr_Rep (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include "ace/Refcounted_Auto_Ptr.inl" #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) diff --git a/ace/Refcounted_Auto_Ptr.inl b/ace/Refcounted_Auto_Ptr.inl index e0dfaa2e63c..3635393ecfa 100644 --- a/ace/Refcounted_Auto_Ptr.inl +++ b/ace/Refcounted_Auto_Ptr.inl @@ -5,6 +5,8 @@ #include "ace/Guard_T.h" #include "ace/Log_Msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class X, class ACE_LOCK> inline int ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::count (void) const { @@ -212,3 +214,5 @@ ACE_Refcounted_Auto_Ptr<X, ACE_LOCK>::operator = (const ACE_Refcounted_Auto_Ptr< AUTO_REFCOUNTED_PTR_REP::assign (this->rep_, AUTO_REFCOUNTED_PTR_REP::attach (r.rep_)); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Registry.cpp b/ace/Registry.cpp index dcac2651071..94b7641c422 100644 --- a/ace/Registry.cpp +++ b/ace/Registry.cpp @@ -25,9 +25,9 @@ ACE_RCSID (ace, } while (0) -// Separator for components in a name -/* static */ -const ACE_TCHAR *ACE_Registry::STRING_SEPARATOR = ACE_LIB_TEXT ("\\"); +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_TCHAR const ACE_Registry::STRING_SEPARATOR[] = ACE_LIB_TEXT ("\\"); bool ACE_Registry::Name_Component::operator== (const Name_Component &rhs) const @@ -623,7 +623,7 @@ ACE_Registry::make_string (const Name &const_name) { if (iterator != name.begin ()) // If this is not the first component, we will add separators - string += ACE_Registry::STRING_SEPARATOR; + string += STRING_SEPARATOR; const Name_Component &component = *iterator; // Add to string string += component.id_; @@ -646,7 +646,7 @@ ACE_Registry::make_name (const ACE_TString &string) { Name_Component component; // Find the separator - new_position = string.find (ACE_Registry::STRING_SEPARATOR, new_position); + new_position = string.find (STRING_SEPARATOR, new_position); if (new_position != ACE_TString::npos) // If we have not gone past the end { @@ -655,7 +655,7 @@ ACE_Registry::make_name (const ACE_TString &string) new_position - last_position); // Skip past the seperator new_position += - ACE_OS::strlen (ACE_Registry::STRING_SEPARATOR); + ACE_OS::strlen (STRING_SEPARATOR); } else { @@ -1134,20 +1134,6 @@ ACE_Predefined_Naming_Contexts::is_local_host (const ACE_TCHAR *machine_name) return result; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Node<ACE_Registry::Binding>; -template class ACE_Unbounded_Set<ACE_Registry::Binding>; -template class ACE_Unbounded_Set_Iterator<ACE_Registry::Binding>; -template class ACE_Node<ACE_Registry::Name_Component>; -template class ACE_Unbounded_Set<ACE_Registry::Name_Component>; -template class ACE_Unbounded_Set_Iterator<ACE_Registry::Name_Component>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Node<ACE_Registry::Binding> -#pragma instantiate ACE_Unbounded_Set<ACE_Registry::Binding> -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Registry::Binding> -#pragma instantiate ACE_Node<ACE_Registry::Name_Component> -#pragma instantiate ACE_Unbounded_Set<ACE_Registry::Name_Component> -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Registry::Name_Component> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_WIN32 */ diff --git a/ace/Registry.h b/ace/Registry.h index f4c311b0a60..5b06517655b 100644 --- a/ace/Registry.h +++ b/ace/Registry.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,6 +27,8 @@ #include "ace/Containers.h" #include "ace/SString.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Registry * @@ -60,7 +62,7 @@ public: typedef ACE_Unbounded_Set<Name_Component> Name; /// Separator for components in a name - static const ACE_TCHAR *STRING_SEPARATOR; + static const ACE_TCHAR STRING_SEPARATOR[]; /// Convert a @a name to a @c string static ACE_TString make_string (const Name &name); @@ -351,7 +353,7 @@ public: int flush (void); /// Close the handle of the context - /// Note: <close> does not call <flush> + /// @note <close> does not call <flush> int close (void); // Accessors @@ -554,12 +556,7 @@ private: static int is_local_host (const ACE_TCHAR *machine_name); }; -// Fix me! Shouldn't have to define this stuff - -#if defined (ACE_HAS_BROKEN_NESTED_TEMPLATES) - typedef ACE_Registry::Name_Component Name_Component; - typedef ACE_Registry::Binding Binding; -#endif /* ACE_HAS_BROKEN_NESTED_TEMPLATES */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_WIN32 */ #include /**/ "ace/post.h" diff --git a/ace/Registry_Name_Space.cpp b/ace/Registry_Name_Space.cpp index a2322c29a8a..465da31d34b 100644 --- a/ace/Registry_Name_Space.cpp +++ b/ace/Registry_Name_Space.cpp @@ -7,6 +7,8 @@ ACE_RCSID(ace, Registry_Name_Space, "$Id$") #if (defined (ACE_WIN32) && defined (UNICODE)) // This only works on Win32 platforms when UNICODE is turned on +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Registry_Name_Space::ACE_Registry_Name_Space (void) { } @@ -286,5 +288,6 @@ ACE_Registry_Name_Space::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_WIN32 && UNICODE */ diff --git a/ace/Registry_Name_Space.h b/ace/Registry_Name_Space.h index 7635b0bafbe..cfd16ddec7e 100644 --- a/ace/Registry_Name_Space.h +++ b/ace/Registry_Name_Space.h @@ -1,4 +1,4 @@ -/*-*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -28,6 +28,8 @@ #include "ace/Naming_Context.h" #include "ace/Name_Space.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Registry_Name_Space * @@ -129,6 +131,10 @@ private: ACE_Registry::Naming_Context context_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 && UNICODE */ + #include /**/ "ace/post.h" + #endif /* ACE_REGISTRY_NAME_SPACE_H */ diff --git a/ace/Remote_Name_Space.cpp b/ace/Remote_Name_Space.cpp index 12808ef2e62..2d3f7795e38 100644 --- a/ace/Remote_Name_Space.cpp +++ b/ace/Remote_Name_Space.cpp @@ -8,6 +8,8 @@ ACE_RCSID (ace, Remote_Name_Space, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_Remote_Name_Space::open (const ACE_TCHAR *servername, u_short port) { @@ -375,8 +377,4 @@ ACE_Remote_Name_Space::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Auto_Basic_Array_Ptr<wchar_t>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Auto_Basic_Array_Ptr<wchar_t> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Remote_Name_Space.h b/ace/Remote_Name_Space.h index 95c0d9c4531..a58ca4e83af 100644 --- a/ace/Remote_Name_Space.h +++ b/ace/Remote_Name_Space.h @@ -25,6 +25,7 @@ #include "ace/Name_Proxy.h" #include "ace/Name_Space.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_NS_WString; @@ -139,6 +140,8 @@ private: ACE_Name_Proxy ns_proxy_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_REMOTE_NAME_SPACE_H */ diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp index f80fe9a3bf8..fee4bb54869 100644 --- a/ace/Remote_Tokens.cpp +++ b/ace/Remote_Tokens.cpp @@ -1,4 +1,3 @@ -// Remote_Tokens.cpp // $Id$ #include "ace/Remote_Tokens.h" @@ -23,6 +22,8 @@ ACE_RCSID (ace, #define ACE_TSS_CONNECTION_MUTEX ACE_Null_Mutex #endif /* ACE_MT_SAFE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Make a typedef to simplify access to the Singleton below. typedef ACE_Singleton<ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX> ACE_Token_Connections; @@ -110,8 +111,8 @@ ACE_Remote_Token_Proxy::~ACE_Remote_Token_Proxy (void) int ACE_Remote_Token_Proxy::open (const ACE_TCHAR *name, - int ignore_deadlock, - int debug) + int ignore_deadlock, + int debug) { ACE_TRACE ("ACE_Remote_Token_Proxy::open"); ignore_shadow_deadlock_ = ignore_deadlock; @@ -144,7 +145,7 @@ ACE_Remote_Token_Proxy::initiate_connection (void) int ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request, - ACE_Synch_Options &) + ACE_Synch_Options &) { ACE_TRACE ("ACE_Remote_Token_Proxy::request_reply"); void *buffer; @@ -169,68 +170,68 @@ ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request, // Receive reply via blocking read. if (peer->recv (&reply, sizeof reply) != sizeof reply) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("recv failed")), -1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("recv failed")), -1); if (reply.decode () == -1) - ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("decode failed")), -1); + ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("decode failed")), -1); errno = int (reply.errnum ()); if (errno != 0) - ACE_RETURN (-1); + ACE_RETURN (-1); else - return 0; + return 0; } } int ACE_Remote_Token_Proxy::acquire (int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) + void (*sleep_hook)(void *), + ACE_Synch_Options &options) { ACE_TRACE ("ACE_Remote_Token_Proxy::acquire"); // First grab the local shadow mutex. if (ACE_Token_Proxy::acquire (notify, - sleep_hook, - ACE_Synch_Options::asynch) == -1) + sleep_hook, + ACE_Synch_Options::asynch) == -1) { // Acquire failed, deal with it... switch (errno) - { - case EWOULDBLOCK : - // Whoah, we detected wouldblock via the shadow mutex! - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) shadow: acquire will block, owner is %s\n"), - this->token_->owner_id ())); - // No error, but would block, - break; - - case EDEADLK : - if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) shadow: deadlock detected\n"))); - - if (ignore_shadow_deadlock_) - break; - else - { - errno = EDEADLK; - ACE_RETURN (-1); - } - - default : - ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("(%t) %p shadow acquire failed\n"), - ACE_LIB_TEXT ("ACE_Remote_Token_Proxy")), - -1); - } + { + case EWOULDBLOCK : + // Whoah, we detected wouldblock via the shadow mutex! + if (debug_) + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) shadow: acquire will block, owner is %s\n"), + this->token_->owner_id ())); + // No error, but would block, + break; + + case EDEADLK : + if (debug_) + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) shadow: deadlock detected\n"))); + + if (ignore_shadow_deadlock_) + break; + else + { + errno = EDEADLK; + ACE_RETURN (-1); + } + + default : + ACE_ERROR_RETURN ((LM_ERROR, + ACE_LIB_TEXT ("(%t) %p shadow acquire failed\n"), + ACE_LIB_TEXT ("ACE_Remote_Token_Proxy")), + -1); + } } ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::ACQUIRE, - this->name (), - this->client_id (), - options); + this->type (), + ACE_Token_Request::ACQUIRE, + this->name (), + this->client_id (), + options); request.notify (notify); @@ -266,51 +267,51 @@ ACE_Remote_Token_Proxy::tryacquire (void (*sleep_hook)(void *)) if (ACE_Token_Proxy::tryacquire (sleep_hook) == -1) { if (debug_) - { + { // Save/restore errno. ACE_Errno_Guard error (errno); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("shadow try acquire failed\n"))); - } + } return -1; } ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::TRY_ACQUIRE, - this->name (), - this->client_id (), - ACE_Synch_Options::synch); + this->type (), + ACE_Token_Request::TRY_ACQUIRE, + this->name (), + this->client_id (), + ACE_Synch_Options::synch); return this->request_reply (request, - ACE_Synch_Options::synch); + ACE_Synch_Options::synch); } int ACE_Remote_Token_Proxy::renew (int requeue_position, - ACE_Synch_Options &options) + ACE_Synch_Options &options) { ACE_TRACE ("ACE_Remote_Token_Proxy::renew"); if (ACE_Token_Proxy::renew (requeue_position, - ACE_Synch_Options::asynch) == -1) + ACE_Synch_Options::asynch) == -1) { // Check for error. if (errno != EWOULDBLOCK) - return -1; + return -1; else if (debug_) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%t) shadow: renew would block. owner %s.\n"), - this->token_->owner_id ())); + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t) shadow: renew would block. owner %s.\n"), + this->token_->owner_id ())); } ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::RENEW, - this->name (), - this->client_id (), - options); + this->type (), + ACE_Token_Request::RENEW, + this->name (), + this->client_id (), + options); request.requeue_position (requeue_position); @@ -330,7 +331,7 @@ ACE_Remote_Token_Proxy::renew (int requeue_position, else { if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) renewed %s remotely.\n"), this->name ())); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) renewed %s remotely.\n"), this->name ())); // Make sure that the local shadow reflects our new ownership. token_->make_owner (waiter_); return result; @@ -343,11 +344,11 @@ ACE_Remote_Token_Proxy::release (ACE_Synch_Options &options) ACE_TRACE ("ACE_Remote_Token_Proxy::release"); ACE_Token_Request request (token_->type (), - this->type (), - ACE_Token_Request::RELEASE, - this->name (), - this->client_id (), - options); + this->type (), + ACE_Token_Request::RELEASE, + this->name (), + this->client_id (), + options); int result = this->request_reply (request, options); if (result == 0) @@ -374,8 +375,8 @@ ACE_Remote_Token_Proxy::token_acquired (ACE_TPQ_Entry *) { ACE_TRACE ("ACE_Remote_Token_Proxy::token_acquired"); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) %s shadow token %s acquired\n"), - this->client_id (), - this->name ())); + this->client_id (), + this->name ())); // ACE_Token_Proxy::token_acquired (vp); } @@ -409,8 +410,8 @@ ACE_Remote_Mutex::clone (void) const ACE_Token_Proxy *temp; ACE_NEW_RETURN (temp, ACE_Remote_Mutex (this->name (), - ignore_deadlock_, - debug_), + ignore_deadlock_, + debug_), 0); return temp; } @@ -460,8 +461,8 @@ ACE_Remote_RLock::clone (void) const ACE_Token_Proxy *temp = 0; ACE_NEW_RETURN (temp, ACE_Remote_RLock (this->name (), - ignore_deadlock_, - debug_), + ignore_deadlock_, + debug_), 0); return temp; } @@ -521,12 +522,6 @@ ACE_Remote_WLock::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_TSS <ACE_SOCK_Stream>; -template class ACE_Singleton <ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_TSS <ACE_SOCK_Stream> -#pragma instantiate ACE_Singleton <ACE_TSS_Connection, ACE_TSS_CONNECTION_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Remote_Tokens.h b/ace/Remote_Tokens.h index d9310592f7f..ec39d3d26eb 100644 --- a/ace/Remote_Tokens.h +++ b/ace/Remote_Tokens.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,6 +13,7 @@ #ifndef ACE_REMOTE_MUTEX_H #define ACE_REMOTE_MUTEX_H + #include /**/ "ace/pre.h" #include "ace/INET_Addr.h" @@ -29,6 +30,8 @@ #if defined (ACE_HAS_TOKENS_LIBRARY) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Remote_Token_Proxy * @@ -306,6 +309,8 @@ private: void operator= (const ACE_TSS_Connection &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ #if defined (__ACE_INLINE__) @@ -313,4 +318,5 @@ private: #endif /* __ACE_INLINE__ */ #include /**/ "ace/post.h" + #endif /* ACE_REMOTE_TOKEN_H */ diff --git a/ace/Remote_Tokens.inl b/ace/Remote_Tokens.inl index 004fe75b7d4..50487075225 100644 --- a/ace/Remote_Tokens.inl +++ b/ace/Remote_Tokens.inl @@ -4,6 +4,8 @@ #if defined (ACE_HAS_TOKENS_LIBRARY) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Remote_Mutex::ACE_Remote_Mutex (void) { @@ -12,8 +14,8 @@ ACE_Remote_Mutex::ACE_Remote_Mutex (void) ACE_INLINE ACE_Remote_Mutex::ACE_Remote_Mutex (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) + int ignore_deadlock, + int debug) { ACE_TRACE ("ACE_Remote_Mutex::ACE_Remote_Mutex"); this->open (token_name, ignore_deadlock, debug); @@ -23,8 +25,8 @@ ACE_Remote_Mutex::ACE_Remote_Mutex (const ACE_TCHAR *token_name, ACE_INLINE ACE_Remote_RLock::ACE_Remote_RLock (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) + int ignore_deadlock, + int debug) { ACE_TRACE ("ACE_Remote_RLock::ACE_Remote_RLock"); this->open (token_name, ignore_deadlock, debug); @@ -34,11 +36,13 @@ ACE_Remote_RLock::ACE_Remote_RLock (const ACE_TCHAR *token_name, ACE_INLINE ACE_Remote_WLock::ACE_Remote_WLock (const ACE_TCHAR *token_name, - int ignore_deadlock, - int debug) + int ignore_deadlock, + int debug) { ACE_TRACE ("ACE_Remote_WLock::ACE_Remote_WLock"); this->open (token_name, ignore_deadlock, debug); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Reverse_Lock_T.cpp b/ace/Reverse_Lock_T.cpp index 0dc093cf7a5..348c81da62a 100644 --- a/ace/Reverse_Lock_T.cpp +++ b/ace/Reverse_Lock_T.cpp @@ -13,6 +13,7 @@ #include "ace/Reverse_Lock_T.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class ACE_LOCKING_MECHANISM> ACE_Reverse_Lock<ACE_LOCKING_MECHANISM>::~ACE_Reverse_Lock (void) @@ -87,4 +88,6 @@ ACE_Reverse_Lock<ACE_LOCKING_MECHANISM>::tryacquire_write_upgrade (void) ACE_NOTSUP_RETURN (-1); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_REVERSE_LOCK_T_CPP */ diff --git a/ace/Reverse_Lock_T.h b/ace/Reverse_Lock_T.h index 29f23b08c08..5bd1d3a6b8f 100644 --- a/ace/Reverse_Lock_T.h +++ b/ace/Reverse_Lock_T.h @@ -22,10 +22,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** - * @class ACE_Acquire_Method + * @namespace ACE_Acquire_Method * - * @brief An enum class. + * @brief An enum namespace. * * These enums should have been inside the reverse lock class, but * some lame compilers cannot handle enums inside template classes. @@ -38,16 +40,19 @@ * represented here because we have to make sure that the release() * method on the reverse lock acquires a lock on the real lock. **/ -class ACE_Acquire_Method +namespace ACE_Acquire_Method { -public: enum METHOD_TYPE { ACE_REGULAR, ACE_READ, ACE_WRITE }; -}; +} + +#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) + using namespace ACE_Acquire_Method; +#endif /** * @class ACE_Reverse_Lock @@ -77,8 +82,14 @@ public: // = Initialization/Finalization methods. /// Constructor. All locking requests will be forwarded to <lock>. +#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) + // Make LynxOS 3.x buggy compiler happy + ACE_Reverse_Lock (ACE_LOCKING_MECHANISM &lock, + METHOD_TYPE acquire_method = ACE_REGULAR); +#else ACE_Reverse_Lock (ACE_LOCKING_MECHANISM &lock, ACE_Acquire_Method::METHOD_TYPE acquire_method = ACE_Acquire_Method::ACE_REGULAR); +#endif /// Destructor. If <lock_> was not passed in by the user, it will be /// deleted. @@ -120,6 +131,8 @@ private: ACE_Acquire_Method::METHOD_TYPE acquire_method_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Reverse_Lock_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Reverse_Lock_T.inl b/ace/Reverse_Lock_T.inl index 84533466663..0f8598ffd23 100644 --- a/ace/Reverse_Lock_T.inl +++ b/ace/Reverse_Lock_T.inl @@ -5,6 +5,8 @@ #include "ace/config-all.h" #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class ACE_LOCKING_MECHANISM> ACE_INLINE ACE_Reverse_Lock<ACE_LOCKING_MECHANISM>::ACE_Reverse_Lock ( ACE_LOCKING_MECHANISM &lock, @@ -13,3 +15,5 @@ ACE_Reverse_Lock<ACE_LOCKING_MECHANISM>::ACE_Reverse_Lock ( acquire_method_ (acquire_method) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK.cpp b/ace/SOCK.cpp index 64bb4bc0210..f6618cdada4 100644 --- a/ace/SOCK.cpp +++ b/ace/SOCK.cpp @@ -1,4 +1,3 @@ -// SOCK.cpp // $Id$ #include "ace/SOCK.h" @@ -10,6 +9,8 @@ ACE_RCSID(ace, SOCK, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK) void @@ -180,3 +181,5 @@ ACE_SOCK::ACE_SOCK (int type, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SOCK::ACE_SOCK"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK.h b/ace/SOCK.h index d9bfd0c5eec..8348d0f35d8 100644 --- a/ace/SOCK.h +++ b/ace/SOCK.h @@ -24,6 +24,8 @@ #include "ace/IPC_SAP.h" #include "ace/OS_NS_stropts.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SOCK * @@ -39,8 +41,6 @@ class ACE_Export ACE_SOCK : public ACE_IPC_SAP { public: - /// Default ctor/dtor. - ~ACE_SOCK (void); /// Wrapper around the <setsockopt> system call. int set_option (int level, @@ -96,6 +96,7 @@ public: int reuse_addr); protected: + /// Constructor with arguments to call the BSD-style <socket> system /// call (no QoS). ACE_SOCK (int type, @@ -117,8 +118,18 @@ protected: /// from being defined. ACE_SOCK (void); + /// Protected destructor. + /** + * Not a virtual destructor. Protected destructor to prevent + * operator delete() from being called through a base class ACE_SOCK + * pointer/reference. + */ + ~ACE_SOCK (void); + }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK.inl b/ace/SOCK.inl index f35fda782d1..c57fa36dfec 100644 --- a/ace/SOCK.inl +++ b/ace/SOCK.inl @@ -1,10 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SOCK.i - #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_SOCK::~ACE_SOCK (void) { @@ -13,24 +14,26 @@ ACE_SOCK::~ACE_SOCK (void) ACE_INLINE int ACE_SOCK::set_option (int level, - int option, - void *optval, - int optlen) const + int option, + void *optval, + int optlen) const { ACE_TRACE ("ACE_SOCK::set_option"); return ACE_OS::setsockopt (this->get_handle (), level, - option, (char *) optval, optlen); + option, (char *) optval, optlen); } // Provides access to the ACE_OS::getsockopt system call. ACE_INLINE int ACE_SOCK::get_option (int level, - int option, - void *optval, - int *optlen) const + int option, + void *optval, + int *optlen) const { ACE_TRACE ("ACE_SOCK::get_option"); return ACE_OS::getsockopt (this->get_handle (), level, - option, (char *) optval, optlen); + option, (char *) optval, optlen); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp index ffb187b5e17..9a103d3f662 100644 --- a/ace/SOCK_Acceptor.cpp +++ b/ace/SOCK_Acceptor.cpp @@ -1,9 +1,9 @@ -// SOCK_Acceptor.cpp // $Id$ #include "ace/SOCK_Acceptor.h" #include "ace/Log_Msg.h" +#include "ace/OS_Errno.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_socket.h" #include "ace/os_include/os_fcntl.h" @@ -18,6 +18,8 @@ ACE_RCSID(ace, SOCK_Acceptor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Acceptor) // Do nothing routine for constructor. @@ -285,6 +287,7 @@ ACE_SOCK_Acceptor::shared_open (const ACE_Addr &local_sap, || ACE_OS::listen (this->get_handle (), backlog) == -1) { + ACE_Errno_Guard g (errno); // Preserve across close() below. error = 1; this->close (); } @@ -401,3 +404,5 @@ ACE_SOCK_Acceptor::close (void) { return ACE_SOCK::close (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Acceptor.h b/ace/SOCK_Acceptor.h index bad9010bfcc..4341698c7c9 100644 --- a/ace/SOCK_Acceptor.h +++ b/ace/SOCK_Acceptor.h @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; class ACE_Accept_QoS_Params; @@ -166,6 +168,8 @@ private: int get_remote_addr (ACE_Addr &) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_Acceptor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_Acceptor.inl b/ace/SOCK_Acceptor.inl index db6fa00f4ba..a4456ed3ab6 100644 --- a/ace/SOCK_Acceptor.inl +++ b/ace/SOCK_Acceptor.inl @@ -1,10 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_SOCK_Acceptor::~ACE_SOCK_Acceptor (void) { ACE_TRACE ("ACE_SOCK_Acceptor::~ACE_SOCK_Acceptor"); } - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_CODgram.cpp b/ace/SOCK_CODgram.cpp index 766819b1eb1..8bacd9d1220 100644 --- a/ace/SOCK_CODgram.cpp +++ b/ace/SOCK_CODgram.cpp @@ -1,4 +1,3 @@ -// SOCK_CODgram.cpp // $Id$ #include "ace/SOCK_CODgram.h" @@ -11,6 +10,8 @@ ACE_RCSID(ace, SOCK_CODgram, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_CODgram) void @@ -24,12 +25,12 @@ ACE_SOCK_CODgram::dump (void) const // Here's the general-purpose constructor. ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &local, - int protocol_family, int protocol, - int reuse_addr) + int protocol_family, int protocol, + int reuse_addr) { ACE_TRACE ("ACE_SOCK_CODgram::ACE_SOCK_CODgram"); if (this->open (remote, local, - protocol_family, protocol, reuse_addr) == -1) + protocol_family, protocol, reuse_addr) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SOCK_CODgram"))); } @@ -39,71 +40,73 @@ ACE_SOCK_CODgram::ACE_SOCK_CODgram (const ACE_Addr &remote, const ACE_Addr &loca 1. remote == ACE_Addr::sap_any && local == ACE_Addr::sap_any if protocol_family == PF_INET then - bind the local address to a randomly generated port number... + bind the local address to a randomly generated port number... 2. remote == ACE_Addr::sap_any && local != ACE_Addr::sap_any we are just binding the local address - (used primarily by servers) + (used primarily by servers) 3. remote != ACE_Addr::sap_any && local == ACE_Addr::sap_any we are connecting to the remote address - (used primarily by clients) + (used primarily by clients) 4. remote != ACE_Addr::sap_any && local != ACE_Addr::sap_any we are binding to the local address - and connecting to the remote address + and connecting to the remote address */ int ACE_SOCK_CODgram::open (const ACE_Addr &remote, const ACE_Addr &local, - int protocol_family, int protocol, - int reuse_addr) + int protocol_family, int protocol, + int reuse_addr) { ACE_TRACE ("ACE_SOCK_CODgram::open"); if (ACE_SOCK::open (SOCK_DGRAM, protocol_family, - protocol, reuse_addr) == -1) + protocol, reuse_addr) == -1) return -1; else { int error = 0; if (local == ACE_Addr::sap_any && remote == ACE_Addr::sap_any) - { - // Assign an arbitrary port number from the transient range!! + { + // Assign an arbitrary port number from the transient range!! - if (protocol_family == PF_INET - && ACE::bind_port (this->get_handle ()) == -1) - error = 1; - } + if (protocol_family == PF_INET + && ACE::bind_port (this->get_handle ()) == -1) + error = 1; + } // We are binding just the local address. else if (local != ACE_Addr::sap_any && remote == ACE_Addr::sap_any) - { - if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), - local.get_size ()) == -1) - error = 1; - } + { + if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), + local.get_size ()) == -1) + error = 1; + } // We are connecting to the remote address. else if (local == ACE_Addr::sap_any && remote != ACE_Addr::sap_any) - { - if (ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), - remote.get_size ()) == -1) - error = 1; - } + { + if (ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), + remote.get_size ()) == -1) + error = 1; + } // We are binding to the local address and connecting to the // remote addresses. else - { - if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), - local.get_size ()) == -1 - || ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), - remote.get_size ()) == -1) - error = 1; - } + { + if (ACE_OS::bind (this->get_handle (), (sockaddr *) local.get_addr (), + local.get_size ()) == -1 + || ACE_OS::connect (this->get_handle (), (sockaddr *) remote.get_addr (), + remote.get_size ()) == -1) + error = 1; + } if (error) - { - this->close (); - this->set_handle (ACE_INVALID_HANDLE); - } + { + this->close (); + this->set_handle (ACE_INVALID_HANDLE); + } return error ? -1 : 0; } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_CODgram.h b/ace/SOCK_CODgram.h index 7381b33f8f4..007f7352c97 100644 --- a/ace/SOCK_CODgram.h +++ b/ace/SOCK_CODgram.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -15,13 +15,7 @@ #define ACE_SOCK_CODGRAM_H #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ - +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -31,13 +25,15 @@ #include "ace/Addr.h" #include "ace/INET_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SOCK_CODgram * * @brief Defines the member functions for the ACE_SOCK connected * datagram abstraction. */ -class ACE_Sockets_Export ACE_SOCK_CODgram : public ACE_SOCK_IO +class ACE_Export ACE_SOCK_CODgram : public ACE_SOCK_IO { public: // = Initialization methods. @@ -72,6 +68,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_CODgram.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_CODgram.inl b/ace/SOCK_CODgram.inl index a921bb5df5a..de7b0570973 100644 --- a/ace/SOCK_CODgram.inl +++ b/ace/SOCK_CODgram.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SOCK_CODgram.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SOCK_CODgram::ACE_SOCK_CODgram (void) @@ -15,4 +16,4 @@ ACE_SOCK_CODgram::~ACE_SOCK_CODgram (void) ACE_TRACE ("ACE_SOCK_CODgram::~ACE_SOCK_CODgram"); } - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Connector.cpp b/ace/SOCK_Connector.cpp index 86c09b92f1d..dbbe3cb539c 100644 --- a/ace/SOCK_Connector.cpp +++ b/ace/SOCK_Connector.cpp @@ -1,4 +1,3 @@ -// SOCK_Connector.cpp // $Id$ #include "ace/SOCK_Connector.h" @@ -18,6 +17,8 @@ ACE_RCSID(ace, SOCK_Connector, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Connector) void @@ -325,3 +326,5 @@ ACE_SOCK_Connector::ACE_SOCK_Connector (ACE_SOCK_Stream &new_stream, ACE_LIB_TEXT ("ACE_SOCK_Connector::ACE_SOCK_Connector"))); } #endif // ACE_HAS_WINCE + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Connector.h b/ace/SOCK_Connector.h index c3395fd3c82..a829634f6fc 100644 --- a/ace/SOCK_Connector.h +++ b/ace/SOCK_Connector.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_QoS_Params; class ACE_Time_Value; @@ -317,6 +319,8 @@ protected: int result); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_Connector.inl b/ace/SOCK_Connector.inl index 423ffcd942e..bdbf5cd19f6 100644 --- a/ace/SOCK_Connector.inl +++ b/ace/SOCK_Connector.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SOCK_Connector.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // This constructor is used by a client when it wants to connect to // the specified REMOTE_SAP address using a blocking open. @@ -33,3 +34,5 @@ ACE_SOCK_Connector::reset_new_handle (ACE_HANDLE handle) return 0; #endif /* ACE_WIN32 */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp index 64c4bd35b27..89bbadc7201 100644 --- a/ace/SOCK_Dgram.cpp +++ b/ace/SOCK_Dgram.cpp @@ -28,6 +28,8 @@ ACE_RCSID (ace, #define IMR_MULTIADDR imr_multiaddr #endif /* ! defined (IMR_MULTIADDR) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_SOCK_Dgram) void @@ -84,10 +86,11 @@ ACE_SOCK_Dgram::recv (iovec *io_vec, sockaddr *saddr = (sockaddr *) addr.get_addr (); int addr_len = addr.get_size (); - u_long inlen; + int inlen; if (ACE_OS::ioctl (this->get_handle (), - FIONREAD, (u_long *) &inlen) == -1) + FIONREAD, + &inlen) == -1) return -1; else if (inlen > 0) { @@ -735,3 +738,5 @@ ACE_SOCK_Dgram::make_multicast_ifaddr6 (ipv6_mreq *ret_mreq, return 0; } #endif /* __linux__ && ACE_HAS_IPV6 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram.h b/ace/SOCK_Dgram.h index f07b77c85bb..c78b731db40 100644 --- a/ace/SOCK_Dgram.h +++ b/ace/SOCK_Dgram.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,6 +23,8 @@ #include "ace/Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -227,6 +229,8 @@ private: int get_remote_addr (ACE_Addr &) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_Dgram.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_Dgram.inl b/ace/SOCK_Dgram.inl index 8e7cd56aa69..55343b13668 100644 --- a/ace/SOCK_Dgram.inl +++ b/ace/SOCK_Dgram.inl @@ -1,10 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ // SOCK_Dgram.i #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Here's the simple-minded constructor. ACE_INLINE @@ -23,18 +26,18 @@ ACE_SOCK_Dgram::~ACE_SOCK_Dgram (void) ACE_INLINE ssize_t ACE_SOCK_Dgram::send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags) const + size_t n, + const ACE_Addr &addr, + int flags) const { ACE_TRACE ("ACE_SOCK_Dgram::send"); sockaddr *saddr = (sockaddr *) addr.get_addr (); int len = addr.get_size (); return ACE_OS::sendto (this->get_handle (), - (const char *) buf, + (const char *) buf, n, flags, - (struct sockaddr *) saddr, + (struct sockaddr *) saddr, len); } @@ -42,19 +45,19 @@ ACE_SOCK_Dgram::send (const void *buf, ACE_INLINE ssize_t ACE_SOCK_Dgram::recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags) const + size_t n, + ACE_Addr &addr, + int flags) const { ACE_TRACE ("ACE_SOCK_Dgram::recv"); sockaddr *saddr = (sockaddr *) addr.get_addr (); int addr_len = addr.get_size (); ssize_t status = ACE_OS::recvfrom (this->get_handle (), - (char *) buf, + (char *) buf, n, flags, - (sockaddr *) saddr, + (sockaddr *) saddr, &addr_len); addr.set_size (addr_len); addr.set_type (reinterpret_cast<sockaddr_in *> (saddr)->sin_family); @@ -78,7 +81,7 @@ ACE_SOCK_Dgram::send (const iovec buffers[], buffer_count, number_of_bytes_sent, flags, - (const sockaddr *) saddr, + (const sockaddr *) saddr, len, overlapped, func); @@ -98,11 +101,11 @@ ACE_SOCK_Dgram::recv (iovec buffers[], int addr_len = addr.get_size (); ssize_t status = ACE_OS::recvfrom (this->get_handle (), - buffers, + buffers, buffer_count, number_of_bytes_recvd, flags, - (sockaddr *) saddr, + (sockaddr *) saddr, &addr_len, overlapped, func); @@ -115,9 +118,9 @@ ACE_SOCK_Dgram::recv (iovec buffers[], ACE_INLINE ssize_t ACE_SOCK_Dgram::send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags, + size_t n, + const ACE_Addr &addr, + int flags, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const { @@ -140,9 +143,9 @@ ACE_SOCK_Dgram::send (const void *buf, ACE_INLINE ssize_t ACE_SOCK_Dgram::recv (void *buf, - size_t n, - ACE_Addr &addr, - int flags, + size_t n, + ACE_Addr &addr, + int flags, ACE_OVERLAPPED *overlapped, ACE_OVERLAPPED_COMPLETION_FUNC func) const { @@ -160,3 +163,5 @@ ACE_SOCK_Dgram::recv (void *buf, overlapped, func); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Bcast.cpp b/ace/SOCK_Dgram_Bcast.cpp index 8dbac334cc5..ff8d9f1fd69 100644 --- a/ace/SOCK_Dgram_Bcast.cpp +++ b/ace/SOCK_Dgram_Bcast.cpp @@ -15,6 +15,8 @@ ACE_RCSID(ace, SOCK_Dgram_Bcast, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Dgram_Bcast) ACE_Bcast_Node::ACE_Bcast_Node (ACE_INET_Addr &addr, @@ -172,7 +174,7 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name) There are addresses longer than sizeof (struct sockaddr) eg. IPv6 or QNX::links. In this case address does not fit into struct ifreq. The code below could be applied everywhere, but not every system - provides sockaddr.sa_len field. + provides sockaddr.sa_len field. */ for (int nbytes = ifc.ifc_len; nbytes >= (int) sizeof (struct ifreq) && ((ifr->ifr_addr.sa_len > sizeof (struct sockaddr)) ? @@ -225,8 +227,8 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name) (char *) &flags) == -1) { ACE_ERROR ((LM_ERROR, "%p [%s]\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get interface flags)", - flags.ifr_name)); + "ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get interface flags)", + flags.ifr_name)); continue; } @@ -234,8 +236,8 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name) IFF_UP) == 0) { ACE_ERROR ((LM_ERROR, "%p [%s]\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: Network interface is not up", - flags.ifr_name)); + "ACE_SOCK_Dgram_Bcast::mk_broadcast: Network interface is not up", + flags.ifr_name)); continue; } @@ -250,8 +252,8 @@ ACE_SOCK_Dgram_Bcast::mk_broadcast (const ACE_TCHAR *host_name) SIOCGIFBRDADDR, (char *) &if_req) == -1) ACE_ERROR ((LM_ERROR, "%p [%s]\n", - "ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get broadaddr)", - flags.ifr_name)); + "ACE_SOCK_Dgram_Bcast::mk_broadcast: ioctl (get broadaddr)", + flags.ifr_name)); else { ACE_INET_Addr addr (reinterpret_cast <sockaddr_in *> @@ -374,3 +376,5 @@ ACE_SOCK_Dgram_Bcast::send (const iovec iov[], return ACE_SOCK_Dgram::send (iov, n, addr, flags); } #endif /* ACE_HAS_MSG */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Bcast.h b/ace/SOCK_Dgram_Bcast.h index c9a7662ffb7..de0c80cb9e9 100644 --- a/ace/SOCK_Dgram_Bcast.h +++ b/ace/SOCK_Dgram_Bcast.h @@ -15,12 +15,7 @@ #define ACE_SOCK_DGRAM_BCAST_H #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -29,12 +24,14 @@ #include "ace/SOCK_Dgram.h" #include "ace/INET_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Bcast_Node * * @brief Linked list of broadcast interfaces. */ -class ACE_Sockets_Export ACE_Bcast_Node +class ACE_Export ACE_Bcast_Node { public: /// Default constructor. @@ -57,7 +54,7 @@ public: * @brief Defines the member functions for the ACE_SOCK datagram * abstraction. */ -class ACE_Sockets_Export ACE_SOCK_Dgram_Bcast : public ACE_SOCK_Dgram +class ACE_Export ACE_SOCK_Dgram_Bcast : public ACE_SOCK_Dgram { public: // = Initialization and termination methods. @@ -133,6 +130,8 @@ private: int get_remote_addr (ACE_Addr &) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_Dgram_Bcast.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_Dgram_Bcast.inl b/ace/SOCK_Dgram_Bcast.inl index 85c3312ef9d..00bb342be5e 100644 --- a/ace/SOCK_Dgram_Bcast.inl +++ b/ace/SOCK_Dgram_Bcast.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Bcast_Node::~ACE_Bcast_Node (void) { @@ -19,16 +22,16 @@ ACE_SOCK_Dgram_Bcast::~ACE_SOCK_Dgram_Bcast (void) ACE_INLINE ssize_t ACE_SOCK_Dgram_Bcast::send (const void *buf, - size_t n, - const ACE_Addr &addr, - int flags) const + size_t n, + const ACE_Addr &addr, + int flags) const { ACE_TRACE ("ACE_SOCK_Dgram_Bcast::send"); sockaddr *saddr = (sockaddr *) addr.get_addr (); int len = addr.get_size (); return ACE_OS::sendto (this->get_handle (), (const char *) buf, n, flags, - (struct sockaddr *) saddr, len); + (struct sockaddr *) saddr, len); } - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp index b11c5fd0ac7..2e5daad30a7 100644 --- a/ace/SOCK_Dgram_Mcast.cpp +++ b/ace/SOCK_Dgram_Mcast.cpp @@ -32,6 +32,8 @@ ACE_RCSID (ace, #define IMR_MULTIADDR imr_multiaddr #endif /* ! defined (IMR_MULTIADDR) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Helper (inline) functions. class ACE_SDM_helpers { @@ -47,9 +49,8 @@ public: ACE_OS::strcpy (ret_string, ACE_LIB_TEXT ("<?>")); else { - ACE_TCHAR *pc; - if (clip_portnum - && (pc = ACE_OS::strrchr (ret_string, ACE_LIB_TEXT (':')))) + ACE_TCHAR *pc = ACE_OS::strrchr (ret_string, ACE_LIB_TEXT (':')); + if (clip_portnum && pc) *pc = ACE_LIB_TEXT ('\0'); // clip port# info. } } @@ -984,3 +985,5 @@ ACE_SOCK_Dgram_Mcast::clear_subs_list (void) #endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Dgram_Mcast.h b/ace/SOCK_Dgram_Mcast.h index bfd47c52f36..1c4437a9226 100644 --- a/ace/SOCK_Dgram_Mcast.h +++ b/ace/SOCK_Dgram_Mcast.h @@ -19,12 +19,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -42,6 +37,8 @@ # endif /* ACE_SDM_LOCK */ #endif /* ACE_SOCK_DGRAM_MCAST_DUMPABLE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SOCK_Dgram_Mcast * @@ -94,7 +91,7 @@ * alphanumeric form and <subscribe> will convert them into numbers via * <ACE_OS::atoi>. */ -class ACE_Sockets_Export ACE_SOCK_Dgram_Mcast : public ACE_SOCK_Dgram +class ACE_Export ACE_SOCK_Dgram_Mcast : public ACE_SOCK_Dgram { public: @@ -103,7 +100,7 @@ public: * * These control per-instance optional functionality. They are set via * optional constructor arguments. - * Note: Certain option values are not valid for all environments (see + * @note Certain option values are not valid for all environments (see * comments in source file for environment-specific restrictions). Default * values are always valid values for the compilation environment. */ @@ -410,6 +407,8 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_Dgram_Mcast.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_Dgram_Mcast.inl b/ace/SOCK_Dgram_Mcast.inl index 3244f21b078..bf3574cfd54 100644 --- a/ace/SOCK_Dgram_Mcast.inl +++ b/ace/SOCK_Dgram_Mcast.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_SOCK_Dgram_Mcast::set_option (int option, char optval) @@ -45,3 +48,5 @@ ACE_SOCK_Dgram_Mcast::send (const iovec iov[], this->send_addr_, flags); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_IO.cpp b/ace/SOCK_IO.cpp index 844a70ef877..b3a1d5de90b 100644 --- a/ace/SOCK_IO.cpp +++ b/ace/SOCK_IO.cpp @@ -1,4 +1,3 @@ -// SOCK_IO.cpp // $Id$ #include "ace/SOCK_IO.h" @@ -7,6 +6,7 @@ #include "ace/OS_NS_sys_select.h" #include "ace/OS_NS_sys_socket.h" #include "ace/OS_Memory.h" +#include "ace/Truncate.h" #if !defined (__ACE_INLINE__) #include "ace/SOCK_IO.inl" @@ -14,6 +14,8 @@ ACE_RCSID(ace, SOCK_IO, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_IO) void @@ -67,20 +69,26 @@ ACE_SOCK_IO::recvv (iovec *io_vec, break; } - u_long inlen; + int inlen = 0; if (ACE_OS::ioctl (this->get_handle (), FIONREAD, - (u_long *) &inlen) == -1) + &inlen) == -1) return -1; else if (inlen > 0) { ACE_NEW_RETURN (io_vec->iov_base, char[inlen], -1); - io_vec->iov_len = this->recv (io_vec->iov_base, - inlen); - return io_vec->iov_len; + // It's ok to blindly cast this value since 'inlen' is an int and, thus, + // we can't get more than that back. Besides, if the recv() fails, we + // don't want that value cast to unsigned and returned. + ssize_t recv_len = this->recv (io_vec->iov_base, inlen); + if (recv_len > 0) + // u_long is the Windows type; size_t is everyone else's. A u_long + // should go into a size_t anywhere without an issue. + io_vec->iov_len = static_cast<u_long> (recv_len); + return recv_len; } else return 0; @@ -102,8 +110,8 @@ ACE_SOCK_IO::send (size_t n, ...) const ACE_TRACE ("ACE_SOCK_IO::send"); va_list argp; - int total_tuples = static_cast<int> (n) / 2; - iovec *iovp; + int total_tuples = ACE_Utils::Truncate<size_t> (n / 2); + iovec *iovp = 0; #if defined (ACE_HAS_ALLOCA) iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); #else @@ -142,7 +150,7 @@ ACE_SOCK_IO::recv (size_t n, ...) const ACE_TRACE ("ACE_SOCK_IO::recv"); va_list argp; - int total_tuples = static_cast<int> (n / 2); + int total_tuples = ACE_Utils::Truncate<size_t> (n / 2); iovec *iovp; #if defined (ACE_HAS_ALLOCA) iovp = (iovec *) alloca (total_tuples * sizeof (iovec)); @@ -169,3 +177,5 @@ ACE_SOCK_IO::recv (size_t n, ...) const va_end (argp); return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_IO.h b/ace/SOCK_IO.h index 650095ebf39..746a414f6a2 100644 --- a/ace/SOCK_IO.h +++ b/ace/SOCK_IO.h @@ -23,6 +23,8 @@ #include "ace/ACE.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SOCK_IO * @@ -68,6 +70,12 @@ public: const ACE_Time_Value *timeout = 0) const; /// Recv an <iovec> of size <n> from the connected socket. + /** + * @note The value of @a n will be silently reduced to the maximum + * value an @c int can hold if needed. This is due to the underlying + * system calls on many OSes limiting the number of @c iovec structures + * that can be passed in one call. + */ ssize_t recvv (iovec iov[], size_t n, const ACE_Time_Value *timeout = 0) const; @@ -113,6 +121,12 @@ public: const ACE_Time_Value *timeout = 0) const; /// Send an <iovec> of size <n> to the connected socket. + /** + * @note The value of @a n will be silently reduced to the maximum + * value an @c int can hold if needed. This is due to the underlying + * system calls on many OSes limiting the number of @c iovec structures + * that can be passed in one call. + */ ssize_t sendv (const iovec iov[], size_t n, const ACE_Time_Value *timeout = 0) const; @@ -138,6 +152,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_IO.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_IO.inl b/ace/SOCK_IO.inl index 96950c2cd99..f1aec4af3b8 100644 --- a/ace/SOCK_IO.inl +++ b/ace/SOCK_IO.inl @@ -1,7 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_unistd.h" +#include "ace/Truncate.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Send an n byte message to the connected socket. @@ -51,7 +55,7 @@ ACE_SOCK_IO::recvv (iovec iov[], ACE_TRACE ("ACE_SOCK_IO::recvv"); return ACE::recvv (this->get_handle (), iov, - n, + ACE_Utils::Truncate<size_t> (n), timeout); } @@ -62,7 +66,7 @@ ACE_SOCK_IO::recv (iovec iov[], { ACE_TRACE ("ACE_SOCK_IO::recv"); return this->recvv (iov, - static_cast<int> (n), + n, timeout); } @@ -121,7 +125,7 @@ ACE_SOCK_IO::sendv (const iovec iov[], ACE_TRACE ("ACE_SOCK_IO::sendv"); return ACE::sendv (this->get_handle (), iov, - n, + ACE_Utils::Truncate<size_t> (n), timeout); } @@ -143,7 +147,9 @@ ACE_SOCK_IO::send (const void *buf, { ACE_TRACE ("ACE_SOCK_IO::send"); return ACE_OS::write (this->get_handle (), - (const char *) buf, + buf, n, overlapped); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Acceptor.cpp b/ace/SOCK_SEQPACK_Acceptor.cpp index 7ec5fadbbde..69d832c41d0 100644 --- a/ace/SOCK_SEQPACK_Acceptor.cpp +++ b/ace/SOCK_SEQPACK_Acceptor.cpp @@ -15,6 +15,8 @@ ACE_RCSID(ace, SOCK_SEQPACK_Acceptor, "SOCK_SEQPACK_Acceptor.cpp,v 4.30 2002/03/08 23:18:09 spark Exp") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Acceptor) // Do nothing routine for constructor. @@ -591,3 +593,4 @@ ACE_SOCK_SEQPACK_Acceptor::close (void) return ACE_SOCK::close (); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Acceptor.h b/ace/SOCK_SEQPACK_Acceptor.h index ae04541b404..10d626e03d8 100644 --- a/ace/SOCK_SEQPACK_Acceptor.h +++ b/ace/SOCK_SEQPACK_Acceptor.h @@ -18,20 +18,16 @@ #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ - -#include "ace/SOCK_SEQPACK_Association.h" -#include "ace/Multihomed_INET_Addr.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/SOCK_SEQPACK_Association.h" +#include "ace/Multihomed_INET_Addr.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Time_Value; @@ -46,7 +42,7 @@ class ACE_Time_Value; * Therefore, by inheriting from <ACE_SOCK>, <ACE_SOCK_SEQPACK_Acceptor> * gets its very own socket. */ -class ACE_Sockets_Export ACE_SOCK_SEQPACK_Acceptor : public ACE_SOCK +class ACE_Export ACE_SOCK_SEQPACK_Acceptor : public ACE_SOCK { public: // = Initialization and termination methods. @@ -183,6 +179,8 @@ private: int get_remote_addr (ACE_Addr &) const; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_SEQPACK_Acceptor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_SEQPACK_Acceptor.inl b/ace/SOCK_SEQPACK_Acceptor.inl index 39c1700b53c..0a0b591d75f 100644 --- a/ace/SOCK_SEQPACK_Acceptor.inl +++ b/ace/SOCK_SEQPACK_Acceptor.inl @@ -1,10 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor (void) { ACE_TRACE ("ACE_SOCK_SEQPACK_Acceptor::~ACE_SOCK_SEQPACK_Acceptor"); } - +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Association.cpp b/ace/SOCK_SEQPACK_Association.cpp index 45eed58d1a4..9a17e0ddb33 100644 --- a/ace/SOCK_SEQPACK_Association.cpp +++ b/ace/SOCK_SEQPACK_Association.cpp @@ -13,6 +13,8 @@ ACE_RCSID(ace, SOCK_SEQPACK_Association, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Association) void @@ -334,10 +336,4 @@ ACE_SOCK_SEQPACK_Association::get_remote_addrs (ACE_INET_Addr *addrs, size_t &si return 0; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Auto_Array_Ptr<sockaddr_in>; -template class ACE_Auto_Basic_Array_Ptr<sockaddr_in>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Auto_Array_Ptr<sockaddr_in> -#pragma instantiate ACE_Auto_Basic_Array_Ptr<sockaddr_in> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Association.h b/ace/SOCK_SEQPACK_Association.h index c2b25065827..600744bdb5b 100644 --- a/ace/SOCK_SEQPACK_Association.h +++ b/ace/SOCK_SEQPACK_Association.h @@ -20,21 +20,17 @@ #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ - -#include "ace/SOCK_IO.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/SOCK_IO.h" #include "ace/Multihomed_INET_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. class ACE_Message_Block; @@ -79,14 +75,14 @@ class ACE_Message_Block; * will result in <send> getting called on Win32 platforms, and * <write> getting called on non-Win32 platforms. */ -class ACE_Sockets_Export ACE_SOCK_SEQPACK_Association : public ACE_SOCK_IO +class ACE_Export ACE_SOCK_SEQPACK_Association : public ACE_SOCK_IO { public: // Initialization and termination methods. /// Constructor. ACE_SOCK_SEQPACK_Association (void); - /// Constructor (sets the underlying <ACE_HANDLE> with <h>). + /// Constructor (sets the underlying ACE_HANDLE with <h>). ACE_SOCK_SEQPACK_Association (ACE_HANDLE h); /// Destructor. @@ -195,6 +191,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_SEQPACK_Association.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_SEQPACK_Association.inl b/ace/SOCK_SEQPACK_Association.inl index 3c33c96968e..a156a946257 100644 --- a/ace/SOCK_SEQPACK_Association.inl +++ b/ace/SOCK_SEQPACK_Association.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/SOCK_SEQPACK_Association.h" #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_SOCK_SEQPACK_Association::ACE_SOCK_SEQPACK_Association (void) { @@ -170,3 +173,5 @@ ACE_SOCK_SEQPACK_Association::recv_urg (void *ptr, MSG_OOB, timeout); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Connector.cpp b/ace/SOCK_SEQPACK_Connector.cpp index b7cb5471755..128beb23f22 100644 --- a/ace/SOCK_SEQPACK_Connector.cpp +++ b/ace/SOCK_SEQPACK_Connector.cpp @@ -20,6 +20,8 @@ ACE_RCSID(ace, SOCK_SEQPACK_Connector, "SOCK_SEQPACK_Connector.cpp,v 4.35 2002/03/08 23:18:09 spark Exp") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_SEQPACK_Connector) void @@ -166,14 +168,14 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association & // get sockaddr_in for the local handle if (ACE_OS::getsockname(new_association.get_handle (), reinterpret_cast<sockaddr *> (&portst), - &sn)) + &sn)) { ACE_Errno_Guard error (errno); - new_association.close (); + new_association.close (); return -1; } - // set the local port # assigned by the os to every secondary addr + // set the local port # assigned by the os to every secondary addr for (size_t i = 1; i < num_addresses; i++) { local_inet_addrs[i].sin_port = portst.sin_port; @@ -198,7 +200,7 @@ ACE_SOCK_SEQPACK_Connector::shared_connect_start (ACE_SOCK_SEQPACK_Association & return -1; } - delete [] local_sockaddr; + delete [] local_sockaddr; } #else @@ -437,3 +439,5 @@ ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector (ACE_SOCK_SEQPACK_Associa ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_SOCK_SEQPACK_Connector::ACE_SOCK_SEQPACK_Connector"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_SEQPACK_Connector.h b/ace/SOCK_SEQPACK_Connector.h index 3c913d3ff82..7a567c47ec0 100644 --- a/ace/SOCK_SEQPACK_Connector.h +++ b/ace/SOCK_SEQPACK_Connector.h @@ -9,7 +9,7 @@ * @author Patrick J. Lardieri <plardier@atl.lmco.com> * @author Gaurav Naik, Lockheed Martin ATL * @author based on SOCK_STREAM_Connector - * by Douglas C. Schmidt <schmidt@cs.wustl.edu> + * by Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> * */ //============================================================================= @@ -19,12 +19,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ +#include "ace/ACE_export.h" #include "ace/SOCK_SEQPACK_Association.h" #include "ace/Multihomed_INET_Addr.h" @@ -33,6 +28,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. class ACE_Time_Value; @@ -51,7 +48,7 @@ class ACE_Time_Value; * this is that @c ACE_SOCK_SEQPACK_Connector objects do not store state so * they can be used reentrantly in multithreaded programs. */ -class ACE_Sockets_Export ACE_SOCK_SEQPACK_Connector +class ACE_Export ACE_SOCK_SEQPACK_Connector { public: // = Initialization and termination methods. @@ -323,6 +320,8 @@ protected: int result); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_SEQPACK_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_SEQPACK_Connector.inl b/ace/SOCK_SEQPACK_Connector.inl index 6450abb6ce9..a89c41f4069 100644 --- a/ace/SOCK_SEQPACK_Connector.inl +++ b/ace/SOCK_SEQPACK_Connector.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // This constructor is used by a client when it wants to connect to // the specified REMOTE_SAP address using a blocking open. @@ -31,3 +34,5 @@ ACE_SOCK_SEQPACK_Connector::reset_new_handle (ACE_HANDLE handle) return 0; #endif /* ACE_WIN32 */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Stream.cpp b/ace/SOCK_Stream.cpp index ea794662356..2254f553413 100644 --- a/ace/SOCK_Stream.cpp +++ b/ace/SOCK_Stream.cpp @@ -1,4 +1,3 @@ -// SOCK_Stream.cpp // $Id$ #include "ace/SOCK_Stream.h" @@ -9,6 +8,8 @@ ACE_RCSID(ace, SOCK_Stream, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SOCK_Stream) void @@ -26,3 +27,4 @@ ACE_SOCK_Stream::close (void) return ACE_SOCK::close (); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SOCK_Stream.h b/ace/SOCK_Stream.h index 5cf0fadb8e8..92000947271 100644 --- a/ace/SOCK_Stream.h +++ b/ace/SOCK_Stream.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,6 +22,8 @@ #include "ace/INET_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. class ACE_Message_Block; @@ -159,6 +161,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SOCK_Stream.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SOCK_Stream.inl b/ace/SOCK_Stream.inl index 5ba88bc55c5..ed5e8b231b8 100644 --- a/ace/SOCK_Stream.inl +++ b/ace/SOCK_Stream.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/SOCK_Stream.h" #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_SOCK_Stream::ACE_SOCK_Stream (void) { @@ -170,3 +173,5 @@ ACE_SOCK_Stream::recv_urg (void *ptr, MSG_OOB, timeout); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE.cpp b/ace/SPIPE.cpp index f69c8b63b33..b6b1300b26d 100644 --- a/ace/SPIPE.cpp +++ b/ace/SPIPE.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, SPIPE, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE) // This is the do-nothing constructor. @@ -76,3 +78,5 @@ ACE_SPIPE::set_duplex_handle (ACE_HANDLE handle) this->duplex_pipe_handle_ = handle; } #endif /* ACE_HAS_STREAM_PIPES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE.h b/ace/SPIPE.h index 61278aac517..99bc370b84d 100644 --- a/ace/SPIPE.h +++ b/ace/SPIPE.h @@ -23,6 +23,8 @@ #include "ace/SPIPE_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SPIPE * @@ -104,6 +106,8 @@ protected: ACE_SPIPE_Addr local_addr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SPIPE.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SPIPE.inl b/ace/SPIPE.inl index 2912e4d7493..45814117a51 100644 --- a/ace/SPIPE.inl +++ b/ace/SPIPE.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_SPIPE::disable (int signum) const { @@ -12,3 +15,4 @@ ACE_SPIPE::disable (int signum) const #endif /* ACE_WIN32 */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Acceptor.cpp b/ace/SPIPE_Acceptor.cpp index 84e3d517b2c..a9303f0897d 100644 --- a/ace/SPIPE_Acceptor.cpp +++ b/ace/SPIPE_Acceptor.cpp @@ -1,4 +1,3 @@ -// SPIPE_Acceptor.cpp // $Id$ #include "ace/SPIPE_Acceptor.h" @@ -12,6 +11,8 @@ ACE_RCSID(ace, SPIPE_Acceptor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_SPIPE_Acceptor::ACE_SPIPE_Acceptor (void) #if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) : sa_ (0), pipe_handle_ (ACE_INVALID_HANDLE) @@ -182,9 +183,16 @@ ACE_SPIPE_Acceptor::close (void) ACE_TRACE ("ACE_SPIPE_Acceptor::close"); #if (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) - // Substitute the pipe handle back in so it's closed properly. + + // Check to see if we have a valid pipe; if not, nothing to do. + if (this->pipe_handle_ == ACE_INVALID_HANDLE) + return -1; + + // Substitute the pipe handle back in so it's closed properly in the + // ACE_OS wrapper. But leave the pipe_handle_ value so we can clean up the + // hanging overlapped operation afterwards. this->set_handle (this->pipe_handle_); - this->pipe_handle_ = ACE_INVALID_HANDLE; + #endif /* ACE_WIN32 */ // This behavior is shared by UNIX and Win32... @@ -193,7 +201,29 @@ ACE_SPIPE_Acceptor::close (void) #if defined (ACE_HAS_STREAM_PIPES) ACE_OS::fdetach (this->local_addr_.get_path_name ()); +#elif (defined (ACE_WIN32) && defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) + + // open () started the Connect in asynchronous mode, and accept() restarts + // the ConnectNamedPipe in overlapped mode. To avoid leaving a hanging + // overlapped operation that'll write into members of this object, + // wait for the event in the OVERLAPPED structure to be signalled. + if (this->already_connected_ == 0) + { + if (this->event_.wait () != -1) + { + // Should be here with the ConnectNamedPipe operation complete. + // Steal the already_connected_ flag to record the results. + DWORD unused; + ::GetOverlappedResult (this->pipe_handle_, + &this->overlapped_, + &unused, + FALSE); + } + this->pipe_handle_ = ACE_INVALID_HANDLE; + this->already_connected_ = 0; + } #endif /* ACE_HAS_STREAM_PIPES */ + return result; } @@ -302,3 +332,5 @@ ACE_SPIPE_Acceptor::accept (ACE_SPIPE_Stream &new_io, ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_STREAM_PIPES */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Acceptor.h b/ace/SPIPE_Acceptor.h index 0b73d2be05d..6e0bb7ed8aa 100644 --- a/ace/SPIPE_Acceptor.h +++ b/ace/SPIPE_Acceptor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,6 +26,8 @@ #include "ace/Manual_Event.h" #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SPIPE_Acceptor * @@ -41,7 +43,7 @@ * * @warning Works on non-Windows platforms only when @c ACE_HAS_STREAM_PIPES * is defined. - * + * */ class ACE_Export ACE_SPIPE_Acceptor : public ACE_SPIPE { @@ -160,5 +162,7 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SPIPE_ACCEPTOR_H */ diff --git a/ace/SPIPE_Addr.cpp b/ace/SPIPE_Addr.cpp index beb73d68b2d..b4ec63e4fc3 100644 --- a/ace/SPIPE_Addr.cpp +++ b/ace/SPIPE_Addr.cpp @@ -1,4 +1,3 @@ -// SPIPE_Addr.cpp // $Id$ #include "ace/SPIPE_Addr.h" @@ -12,6 +11,8 @@ ACE_RCSID(ace, SPIPE_Addr, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Addr) void @@ -29,8 +30,8 @@ ACE_SPIPE_Addr::set_addr (void *addr, int len) this->ACE_Addr::base_set (AF_SPIPE, len); ACE_OS::memcpy ((void *) &this->SPIPE_addr_, - (void *) addr, - len); + (void *) addr, + len); } // Return the address. @@ -49,7 +50,7 @@ ACE_SPIPE_Addr::ACE_SPIPE_Addr (void) { (void) ACE_OS::memset ((void *) &this->SPIPE_addr_, 0, - sizeof this->SPIPE_addr_); + sizeof this->SPIPE_addr_); } int @@ -95,8 +96,8 @@ ACE_SPIPE_Addr::ACE_SPIPE_Addr (const ACE_SPIPE_Addr &sa) int ACE_SPIPE_Addr::set (const ACE_TCHAR *addr, - gid_t gid, - uid_t uid) + gid_t gid, + uid_t uid) { int len = sizeof (this->SPIPE_addr_.uid_); len += sizeof (this->SPIPE_addr_.gid_); @@ -156,9 +157,11 @@ ACE_SPIPE_Addr::set (const ACE_TCHAR *addr, // Create a ACE_Addr from a ACE_SPIPE pathname. ACE_SPIPE_Addr::ACE_SPIPE_Addr (const ACE_TCHAR *addr, - gid_t gid, - uid_t uid) + gid_t gid, + uid_t uid) : ACE_Addr (AF_SPIPE, sizeof this->SPIPE_addr_) { this->set (addr, gid, uid); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Addr.h b/ace/SPIPE_Addr.h index ffc150b98cd..e6791a8c656 100644 --- a/ace/SPIPE_Addr.h +++ b/ace/SPIPE_Addr.h @@ -1,4 +1,5 @@ // -*- C++ -*- + //========================================================================== /** * @file SPIPE_Addr.h @@ -25,6 +26,8 @@ #include "ace/os_include/sys/os_types.h" #include "ace/os_include/os_dirent.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SPIPE_Addr * @@ -109,6 +112,8 @@ private: // Contents of an SPIPE address. }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SPIPE_Addr.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SPIPE_Addr.inl b/ace/SPIPE_Addr.inl index 1c2858bc399..ea4c71ef682 100644 --- a/ace/SPIPE_Addr.inl +++ b/ace/SPIPE_Addr.inl @@ -5,6 +5,7 @@ #include "ace/SString.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Compare two addresses for equality. @@ -20,7 +21,7 @@ ACE_SPIPE_Addr::operator == (const ACE_SPIPE_Addr &sap) const ACE_INLINE bool ACE_SPIPE_Addr::operator != (const ACE_SPIPE_Addr &sap) const { - return !((*this) == sap); // This is lazy, of course... ;-) + return !((*this) == sap); // This is lazy, of course... ;-) } // Return the path name used for the rendezvous point. @@ -54,3 +55,5 @@ ACE_SPIPE_Addr::group_id (gid_t gid) { this->SPIPE_addr_.gid_ = gid; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Connector.cpp b/ace/SPIPE_Connector.cpp index b715aa67690..c7c9a0c10dc 100644 --- a/ace/SPIPE_Connector.cpp +++ b/ace/SPIPE_Connector.cpp @@ -12,6 +12,8 @@ ACE_RCSID(ace, SPIPE_Connector, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Connector) // Creates a Local ACE_SPIPE. @@ -156,3 +158,5 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io, return handle == ACE_INVALID_HANDLE ? -1 : 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Connector.h b/ace/SPIPE_Connector.h index 7648e63b4a4..f9fc2455ecc 100644 --- a/ace/SPIPE_Connector.h +++ b/ace/SPIPE_Connector.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SPIPE_Connector * @@ -106,6 +108,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SPIPE_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SPIPE_Connector.inl b/ace/SPIPE_Connector.inl index 4ca09d7887e..bbec9b8f468 100644 --- a/ace/SPIPE_Connector.inl +++ b/ace/SPIPE_Connector.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_SPIPE_Connector::reset_new_handle (ACE_HANDLE handle) { @@ -9,3 +12,4 @@ ACE_SPIPE_Connector::reset_new_handle (ACE_HANDLE handle) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Stream.cpp b/ace/SPIPE_Stream.cpp index 40d96974ceb..fcc695d6271 100644 --- a/ace/SPIPE_Stream.cpp +++ b/ace/SPIPE_Stream.cpp @@ -1,4 +1,3 @@ -// SPIPE_Stream.cpp // $Id$ #include "ace/SPIPE_Stream.h" @@ -10,6 +9,8 @@ ACE_RCSID(ace, SPIPE_Stream, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE_Stream) void @@ -99,3 +100,5 @@ ACE_SPIPE_Stream::recv (size_t n, ...) const va_end (argp); return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SPIPE_Stream.h b/ace/SPIPE_Stream.h index 5146217c529..9a94216ae40 100644 --- a/ace/SPIPE_Stream.h +++ b/ace/SPIPE_Stream.h @@ -24,6 +24,8 @@ #include "ace/ACE.h" #include "ace/OS_NS_stropts.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SPIPE_Stream * @@ -159,6 +161,8 @@ private: ACE_SPIPE_Addr remote_addr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SPIPE_Stream.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SPIPE_Stream.inl b/ace/SPIPE_Stream.inl index 11b8fef5a9e..dbc3725782c 100644 --- a/ace/SPIPE_Stream.inl +++ b/ace/SPIPE_Stream.inl @@ -1,8 +1,7 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SPIPE_Stream.i - #include "ace/OS_NS_sys_uio.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_unistd.h" @@ -10,6 +9,8 @@ #include "ace/OS_NS_sys_socket.h" #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Create an ACE_SPIPE_Stream. ACE_INLINE int @@ -272,3 +273,5 @@ ACE_SPIPE_Stream::sendv (const iovec iov[], n); } +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/ace/SSL/ACE_SSL.pc.in b/ace/SSL/ACE_SSL.pc.in index 944adafc5e6..51c04a18ff1 100644 --- a/ace/SSL/ACE_SSL.pc.in +++ b/ace/SSL/ACE_SSL.pc.in @@ -7,5 +7,5 @@ Name: ACE_SSL Description: ACE SSL Library Requires: ACE Version: @VERSION@ -Libs: -L${libdir} -lACE_SSL -Cflags: -I${includedir} +Libs: -L${libdir} @ACE_TLS_LDFLAGS@ -lACE_SSL @ACE_TLS_LIBS@ +Cflags: -I${includedir} @ACE_TLS_CPPFLAGS@ diff --git a/ace/SSL/SSL_Asynch_BIO.cpp b/ace/SSL/SSL_Asynch_BIO.cpp index 93dedffa878..9e27ab1348f 100644 --- a/ace/SSL/SSL_Asynch_BIO.cpp +++ b/ace/SSL/SSL_Asynch_BIO.cpp @@ -1,14 +1,49 @@ // -*- C++ -*- -#include "ace/OS_NS_string.h" #include "SSL_Asynch_BIO.h" + +#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) + #include "SSL_Asynch_Stream.h" +#include "ace/OS_NS_string.h" + ACE_RCSID (ACE_SSL, SSL_Asynch_BIO, "$Id$") -#if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) + +#if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# define ACE_ASYNCH_BIO_WRITE_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_write) +# define ACE_ASYNCH_BIO_READ_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_read) +# define ACE_ASYNCH_BIO_PUTS_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_puts) +# define ACE_ASYNCH_BIO_CTRL_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_ctrl) +# define ACE_ASYNCH_BIO_NEW_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_new) +# define ACE_ASYNCH_BIO_FREE_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_Asynch_BIO_free) +#else +# define ACE_ASYNCH_BIO_WRITE_NAME ACE_Asynch_BIO_write +# define ACE_ASYNCH_BIO_READ_NAME ACE_Asynch_BIO_read +# define ACE_ASYNCH_BIO_PUTS_NAME ACE_Asynch_BIO_puts +# define ACE_ASYNCH_BIO_CTRL_NAME ACE_Asynch_BIO_ctrl +# define ACE_ASYNCH_BIO_NEW_NAME ACE_Asynch_BIO_new +# define ACE_ASYNCH_BIO_FREE_NAME ACE_Asynch_BIO_free +#endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + +/** + * @name OpenSSL BIO Helper Methods for use with ACE's Asynchronous + * SSL I/O support. + */ +//@{ +extern "C" +{ + int ACE_ASYNCH_BIO_WRITE_NAME (BIO *pBIO, const char *buf, int len); + int ACE_ASYNCH_BIO_READ_NAME (BIO *pBIO, char *buf, int len); + int ACE_ASYNCH_BIO_PUTS_NAME (BIO *pBIO, const char *str); + long ACE_ASYNCH_BIO_CTRL_NAME (BIO *pBIO, int cmd, long arg1, void *arg2); + int ACE_ASYNCH_BIO_NEW_NAME (BIO *pBIO); + int ACE_ASYNCH_BIO_FREE_NAME (BIO *pBIO); +} +//@} #define BIO_TYPE_ACE ( 21 | BIO_TYPE_SOURCE_SINK ) @@ -16,26 +51,22 @@ static BIO_METHOD methods_ACE = { BIO_TYPE_ACE, // BIO_TYPE_PROXY_SERVER, "ACE_Asynch_BIO", - ACE_Asynch_BIO_write, - ACE_Asynch_BIO_read, - ACE_Asynch_BIO_puts, - NULL, /* ACE_Asynch_BIO_gets, */ - ACE_Asynch_BIO_ctrl, - ACE_Asynch_BIO_new, - ACE_Asynch_BIO_free, + ACE_ASYNCH_BIO_WRITE_NAME, + ACE_ASYNCH_BIO_READ_NAME, + ACE_ASYNCH_BIO_PUTS_NAME, + NULL, /* ACE_ASYNCH_BIO_GETS_NAME, */ + ACE_ASYNCH_BIO_CTRL_NAME, + ACE_ASYNCH_BIO_NEW_NAME, + ACE_ASYNCH_BIO_FREE_NAME, NULL }; -BIO_METHOD * -BIO_s_ACE_Asynch (void) -{ - return (&methods_ACE); -} +ACE_BEGIN_VERSIONED_NAMESPACE_DECL BIO * -BIO_new_ACE_Asynch (void *ssl_asynch_stream) +ACE_SSL_make_BIO (void * ssl_asynch_stream) { - BIO * pBIO = BIO_new (BIO_s_ACE_Asynch ()); + BIO * const pBIO = BIO_new (&methods_ACE); if (pBIO) BIO_ctrl (pBIO, @@ -46,8 +77,41 @@ BIO_new_ACE_Asynch (void *ssl_asynch_stream) return pBIO; } +/** + * @struct @c ACE_SSL_Asynch_Stream_Accessor + * + * @brief Privileged @c ACE_SSL_Asynch_Stream accessor. + * + * This structure is a @c friend to the @c ACE_SSL_Asynch_Stream + * class so that it can gain access to the protected + * ssl_bio_{read,write}() methods in that class. It is full declared + * in this implementation file to hide its interface from users to + * prevent potential abuse of the friend relationship between it and + * the @c ACE_SSL_Asynch_Stream class. + */ +struct ACE_SSL_Asynch_Stream_Accessor +{ + static int read (ACE_SSL_Asynch_Stream * stream, + char * buf, + size_t len, + int & errval) + { + return stream->ssl_bio_read (buf, len, errval); + } + + static int write (ACE_SSL_Asynch_Stream * stream, + const char * buf, + size_t len, + int & errval) + { + return stream->ssl_bio_write (buf, len, errval); + } +}; + +ACE_END_VERSIONED_NAMESPACE_DECL + int -ACE_Asynch_BIO_new (BIO *pBIO) +ACE_ASYNCH_BIO_NEW_NAME (BIO * pBIO) { pBIO->init = 0; // not initialized pBIO->num = 0; // still zero ( we can use it ) @@ -58,37 +122,30 @@ ACE_Asynch_BIO_new (BIO *pBIO) } int -ACE_Asynch_BIO_free (BIO *pBIO) +ACE_ASYNCH_BIO_FREE_NAME (BIO * pBIO) { - if (pBIO == 0) - return 0; - - if (pBIO->shutdown) + if (pBIO && pBIO->shutdown) { pBIO->ptr = 0; pBIO->init = 0; pBIO->num = 0; pBIO->flags = 0; + + return 1; } - return 1; + return 0; } int -ACE_Asynch_BIO_read (BIO * pBIO, char * buf, int len) +ACE_ASYNCH_BIO_READ_NAME (BIO * pBIO, char * buf, int len) { BIO_clear_retry_flags (pBIO); - ACE_SSL_Asynch_Stream * p_stream = + ACE_SSL_Asynch_Stream * const p_stream = static_cast<ACE_SSL_Asynch_Stream *> (pBIO->ptr); - if (pBIO->init == 0 || p_stream == 0) - return -1; - - if (buf == 0) - return -1; - - if (len <= 0 ) + if (pBIO->init == 0 || p_stream == 0 || buf == 0 || len <= 0) return -1; BIO_clear_retry_flags (pBIO); @@ -96,9 +153,10 @@ ACE_Asynch_BIO_read (BIO * pBIO, char * buf, int len) int errval = 0; int retval = - p_stream->ssl_bio_read (buf, - len, - errval); + ACE_SSL_Asynch_Stream_Accessor::read (p_stream, + buf, + len, + errval); if (retval >= 0) return retval; @@ -110,20 +168,14 @@ ACE_Asynch_BIO_read (BIO * pBIO, char * buf, int len) } int -ACE_Asynch_BIO_write (BIO * pBIO, const char * buf, int len) +ACE_ASYNCH_BIO_WRITE_NAME (BIO * pBIO, const char * buf, int len) { BIO_clear_retry_flags (pBIO); ACE_SSL_Asynch_Stream * p_stream = static_cast<ACE_SSL_Asynch_Stream *> (pBIO->ptr); - if (pBIO->init == 0 || p_stream == 0) - return -1; - - if (buf == 0) - return -1; - - if (len <= 0) + if (pBIO->init == 0 || p_stream == 0 || buf == 0 || len <= 0) return -1; BIO_clear_retry_flags (pBIO); @@ -131,9 +183,10 @@ ACE_Asynch_BIO_write (BIO * pBIO, const char * buf, int len) int errval = 0; int retval = - p_stream->ssl_bio_write (buf, - len, - errval); + ACE_SSL_Asynch_Stream_Accessor::write (p_stream, + buf, + len, + errval); if (retval >= 0) return retval; @@ -145,7 +198,7 @@ ACE_Asynch_BIO_write (BIO * pBIO, const char * buf, int len) } long -ACE_Asynch_BIO_ctrl (BIO * pBIO, int cmd, long num, void *ptr) +ACE_ASYNCH_BIO_CTRL_NAME (BIO * pBIO, int cmd, long num, void *ptr) { long ret = 1; @@ -187,13 +240,12 @@ ACE_Asynch_BIO_ctrl (BIO * pBIO, int cmd, long num, void *ptr) return ret; } - int -ACE_Asynch_BIO_puts (BIO *pBIO, const char *str) +ACE_ASYNCH_BIO_PUTS_NAME (BIO *pBIO, const char *str) { - size_t n = ACE_OS::strlen (str); + size_t const n = ACE_OS::strlen (str); - return ACE_Asynch_BIO_write (pBIO, str, n); + return ACE_ASYNCH_BIO_WRITE_NAME (pBIO, str, n); } #endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || diff --git a/ace/SSL/SSL_Asynch_BIO.h b/ace/SSL/SSL_Asynch_BIO.h index d6cf4e571e4..22c6202754b 100644 --- a/ace/SSL/SSL_Asynch_BIO.h +++ b/ace/SSL/SSL_Asynch_BIO.h @@ -23,25 +23,16 @@ #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +// This must be included before any <openssl> include on LynxOS +#include "ace/os_include/os_stdio.h" + #include <openssl/bio.h> #if OPENSSL_VERSION_NUMBER > 0x0090581fL && ((defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)) || (defined (ACE_HAS_AIO_CALLS))) -/** - * @name OpenSSL BIO Helper Methods for use with ACE's Asynchronous - * SSL I/O support. - */ -//@{ -extern "C" -{ - int ACE_Asynch_BIO_write (BIO *pBIO, const char *buf, int len); - int ACE_Asynch_BIO_read (BIO *pBIO, char *buf, int len); - int ACE_Asynch_BIO_puts (BIO *pBIO, const char *str); - long ACE_Asynch_BIO_ctrl (BIO *pBIO, int cmd, long arg1, void *arg2); - int ACE_Asynch_BIO_new (BIO *pBIO); - int ACE_Asynch_BIO_free (BIO *pBIO); -} -//@} +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +extern BIO * ACE_SSL_make_BIO (void * ssl_asynch_stream); +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL (ACE_WIN32 || ACE_HAS_AIO_CALLS) */ diff --git a/ace/SSL/SSL_Asynch_Stream.cpp b/ace/SSL/SSL_Asynch_Stream.cpp index 2903fe7ba39..2967c7fd8b3 100644 --- a/ace/SSL/SSL_Asynch_Stream.cpp +++ b/ace/SSL/SSL_Asynch_Stream.cpp @@ -1,5 +1,3 @@ -// -*- C++ -*- - #include "SSL_Asynch_Stream.h" ACE_RCSID (ACE_SSL, @@ -36,12 +34,14 @@ ACE_RCSID (ACE_SSL, #include <openssl/err.h> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // ************************************************************ // SSL Asynchronous Write Result // ************************************************************ -class ACE_SSL_Export ACE_SSL_Asynch_Write_Stream_Result: - public AWS_RESULT +class ACE_SSL_Asynch_Write_Stream_Result + : public AWS_RESULT { /// Factory class will have special permissions. friend class ACE_SSL_Asynch_Stream; @@ -83,8 +83,8 @@ ACE_SSL_Asynch_Write_Stream_Result::ACE_SSL_Asynch_Write_Stream_Result // ************************************************************ // SSL Asynchronous Read Result // ************************************************************ -class ACE_SSL_Export ACE_SSL_Asynch_Read_Stream_Result: - public ARS_RESULT +class ACE_SSL_Asynch_Read_Stream_Result + : public ARS_RESULT { /// Factory class will have special permissions. friend class ACE_SSL_Asynch_Stream; @@ -223,7 +223,6 @@ ACE_SSL_Asynch_Stream::~ACE_SSL_Asynch_Stream (void) ACE_LIB_TEXT("if proactor still handles events\n"))); ::SSL_free (this->ssl_); - this->ssl_ = 0; // Was honestly copied from ACE_SSL_SOCK_Stream :) @@ -348,7 +347,7 @@ ACE_SSL_Asynch_Stream::open (ACE_Handler & handler, this->proactor_) != 0) return -1; - this->bio_ = ::BIO_new_ACE_Asynch (this); + this->bio_ = ACE_SSL_make_BIO (this); if (this->bio_ == 0) ACE_ERROR_RETURN @@ -783,15 +782,15 @@ ACE_SSL_Asynch_Stream::notify_read (int bytes_transferred, if (ext_read_result_ == 0) //nothing to notify return 1; - ext_read_result_->set_bytes_transferred (bytes_transferred); - ext_read_result_->set_error (error); + this->ext_read_result_->set_bytes_transferred (bytes_transferred); + this->ext_read_result_->set_error (error); - int retval = ext_read_result_->post_completion - (proactor_->implementation()); + int retval = + this->ext_read_result_->post_completion (proactor_->implementation ()); if (retval == 0) { - ext_read_result_ = 0; + this->ext_read_result_ = 0; return 0; // success } @@ -1120,5 +1119,7 @@ ACE_SSL_Asynch_Stream::pending_BIO_count (void) return ret; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || ACE_HAS_AIO_CALLS) */ diff --git a/ace/SSL/SSL_Asynch_Stream.h b/ace/SSL/SSL_Asynch_Stream.h index e8d2b8f8c34..57007f5013d 100644 --- a/ace/SSL/SSL_Asynch_Stream.h +++ b/ace/SSL/SSL_Asynch_Stream.h @@ -29,20 +29,19 @@ #include "ace/Synch_Traits.h" #include "ace/Thread_Mutex.h" -extern "C" -{ - BIO_METHOD * BIO_s_ACE_Asynch (void); - BIO * BIO_new_ACE_Asynch (void *ssl_asynch_stream); -} +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /// Forward declarations -class ACE_SSL_Asynch_Stream; class ACE_SSL_Asynch_Result; class ACE_SSL_Asynch_Read_Stream_Result; class ACE_SSL_Asynch_Write_Stream_Result; +// Only provide forward declarations to prevent possible abuse of the +// friend declarations in ACE_SSL_Asynch_Stream. +struct ACE_SSL_Asynch_Stream_Accessor; + /** * @class ACE_SSL_Asynch_Stream * @@ -60,11 +59,20 @@ class ACE_SSL_Export ACE_SSL_Asynch_Stream : public ACE_Asynch_Operation, public ACE_Service_Handler { - friend int ACE_Asynch_BIO_read (BIO * pBIO, char * buf, int len); - friend int ACE_Asynch_BIO_write (BIO * pBIO, const char * buf, int len); - public: + // Use a class/struct to work around scoping + // problems for extern "C" free functions with some compilers. For + // example, some can't handle + // + // friend ::some_extern_c_free_function (...) + // + // Note that we could use a straight C++ (i.e. not extern "C") free + // function, but using a class or struct allows us to hide the + // interface from the user, which prevents abuse of this friend + // relationship. + friend struct ACE_SSL_Asynch_Stream_Accessor; + enum Stream_Type { ST_CLIENT = 0x0001, @@ -168,6 +176,12 @@ protected: int ssl_bio_write (const char * buf, size_t len, int & errval); //@} +private: + + // Preventing copying through construction or assignment. + ACE_SSL_Asynch_Stream (ACE_SSL_Asynch_Stream const &); + ACE_SSL_Asynch_Stream & operator= (ACE_SSL_Asynch_Stream const &); + protected: /// Stream Type ST_CLIENT/ST_SERVER @@ -246,6 +260,7 @@ protected: }; +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* OPENSSL_VERSION_NUMBER > 0x0090581fL && (ACE_WIN32 || ACE_HAS_AIO_CALLS) */ diff --git a/ace/SSL/SSL_Context.cpp b/ace/SSL/SSL_Context.cpp index 4fe5260aded..fd884dd9044 100644 --- a/ace/SSL/SSL_Context.cpp +++ b/ace/SSL/SSL_Context.cpp @@ -1,7 +1,3 @@ -// -*- C++ -*- - -#include "ace/OS_NS_string.h" -#include "ace/ACE.h" #include "SSL_Context.h" #include "sslconf.h" @@ -15,7 +11,14 @@ #include "ace/Log_Msg.h" #include "ace/Singleton.h" #include "ace/Synch_Traits.h" +#include "ace/ACE.h" #include "ace/OS_NS_errno.h" +#include "ace/OS_NS_string.h" + +#ifdef ACE_HAS_THREADS +# include "ace/Thread_Mutex.h" +# include "ace/OS_NS_Thread.h" +#endif /* ACE_HAS_THREADS */ #include <openssl/x509.h> #include <openssl/err.h> @@ -25,12 +28,83 @@ ACE_RCSID (ACE_SSL, SSL_Context, "$Id$") + +namespace +{ + /// Reference count of the number of times the ACE_SSL_Context was + /// initialized. + int ssl_library_init_count = 0; + + // @@ This should also be done with a singleton, otherwise it is not + // thread safe and/or portable to some weird platforms... + #ifdef ACE_HAS_THREADS -ACE_mutex_t * ACE_SSL_Context::lock_ = 0; + /// Array of mutexes used internally by OpenSSL when the SSL + /// application is multithreaded. + ACE_SSL_Context::lock_type * ssl_locks = 0; + + // @@ This should also be managed by a singleton. +#endif +} + +#ifdef ACE_HAS_THREADS + +# if (defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1) +# define ACE_SSL_LOCKING_CALLBACK_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_SSL_locking_callback) +# define ACE_SSL_THREAD_ID_NAME ACE_PREPROC_CONCATENATE(ACE_VERSIONED_NAMESPACE_NAME, _ACE_SSL_thread_id) +# else +# define ACE_SSL_LOCKING_CALLBACK_NAME ACE_SSL_locking_callback +# define ACE_SSL_THREAD_ID_NAME ACE_SSL_thread_id +# endif /* ACE_HAS_VERSIONED_NAMESPACE == 1 */ + + + +extern "C" +{ + void + ACE_SSL_LOCKING_CALLBACK_NAME (int mode, + int type, + const char * /* file */, + int /* line */) + { + // #ifdef undef + // fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", + // CRYPTO_thread_id(), + // (mode&CRYPTO_LOCK)?"l":"u", + // (type&CRYPTO_READ)?"r":"w",file,line); + // #endif + // /* + // if (CRYPTO_LOCK_SSL_CERT == type) + // fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", + // CRYPTO_thread_id(), + // mode,file,line); + // */ + if (mode & CRYPTO_LOCK) + (void) ssl_locks[type].acquire (); + else + (void) ssl_locks[type].release (); + } + + // ------------------------------- + + // Return the current thread ID. OpenSSL uses this on platforms + // that need it. + unsigned long + ACE_SSL_THREAD_ID_NAME (void) + { + return (unsigned long) ACE_VERSIONED_NAMESPACE_NAME::ACE_OS::thr_self (); + } +} #endif /* ACE_HAS_THREADS */ -int ACE_SSL_Context::library_init_count_ = 0; +// **************************************************************** + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +#ifdef ACE_HAS_THREADS +ACE_SSL_Context::lock_type * ACE_SSL_Context::locks_ = 0; +#endif /* ACE_HAS_THREADS */ ACE_SSL_Context::ACE_SSL_Context (void) : context_ (0), @@ -65,34 +139,22 @@ ACE_SSL_Context::ssl_library_init (void) ace_ssl_mon, *ACE_Static_Object_Lock::instance ())); - if (ACE_SSL_Context::library_init_count_ == 0) + if (ssl_library_init_count == 0) { // Initialize the locking callbacks before initializing anything // else. #ifdef ACE_HAS_THREADS - int num_locks = ::CRYPTO_num_locks (); + int const num_locks = ::CRYPTO_num_locks (); - ACE_NEW (ACE_SSL_Context::lock_, - ACE_mutex_t[num_locks]); - - for (int i = 0; i < num_locks; ++i) - { - // rwlock_init(&(ACE_SSL_Context::lock_[i]), USYNC_THREAD, - // 0); - if (ACE_OS::mutex_init (&(ACE_SSL_Context::lock_[i]), - USYNC_THREAD) != 0) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("(%P|%t) ACE_SSL_Context::ssl_library_init ") - ACE_LIB_TEXT ("- %p\n"), - ACE_LIB_TEXT ("mutex_init"))); - } + this->locks_ = new lock_type[num_locks]; + ssl_locks = this->locks_; # if !defined (WIN32) // This call isn't necessary on some platforms. See the CRYPTO // library's threads(3) man page for details. - ::CRYPTO_set_id_callback (ACE_SSL_thread_id); -# endif /* WIN32 */ - ::CRYPTO_set_locking_callback (ACE_SSL_locking_callback); + ::CRYPTO_set_id_callback (ACE_SSL_THREAD_ID_NAME); +# endif /* !WIN32 */ + ::CRYPTO_set_locking_callback (ACE_SSL_LOCKING_CALLBACK_NAME); #endif /* ACE_HAS_THREADS */ ::SSLeay_add_ssl_algorithms (); @@ -128,7 +190,7 @@ ACE_SSL_Context::ssl_library_init (void) } - ++ACE_SSL_Context::library_init_count_; + ++ssl_library_init_count; } void @@ -138,8 +200,8 @@ ACE_SSL_Context::ssl_library_fini (void) ace_ssl_mon, *ACE_Static_Object_Lock::instance ())); - --ACE_SSL_Context::library_init_count_; - if (ACE_SSL_Context::library_init_count_ == 0) + --ssl_library_init_count; + if (ssl_library_init_count == 0) { ::ERR_free_strings (); ::EVP_cleanup (); @@ -147,13 +209,12 @@ ACE_SSL_Context::ssl_library_fini (void) // Clean up the locking callbacks after everything else has been // cleaned up. #ifdef ACE_HAS_THREADS - int num_locks = ::CRYPTO_num_locks (); - ::CRYPTO_set_locking_callback (0); - for (int i = 0; i < num_locks; ++i) - ACE_OS::mutex_destroy (&(ACE_SSL_Context::lock_[i])); + ssl_locks = 0; + + delete [] this->locks_; + this->locks_ = 0; - delete [] ACE_SSL_Context::lock_; #endif /* ACE_HAS_THREADS */ } } @@ -277,7 +338,7 @@ ACE_SSL_Context::load_trusted_ca (const char* ca_file, const char* ca_dir) || mode_ == SSLv2_server) { STACK_OF (X509_NAME) * cert_names; - cert_names = ::SSL_CTX_get_client_CA_list(this->context_); + cert_names = ::SSL_CTX_get_client_CA_list (this->context_); if (cert_names == 0) { @@ -328,7 +389,10 @@ ACE_SSL_Context::private_key (const char *file_name, if (::SSL_CTX_use_PrivateKey_file (this->context_, this->private_key_.file_name (), this->private_key_.type ()) <= 0) - return -1; + { + this->private_key_ = ACE_SSL_Data_File (); + return -1; + } else return this->verify_private_key (); } @@ -355,7 +419,10 @@ ACE_SSL_Context::certificate (const char *file_name, if (::SSL_CTX_use_certificate_file (this->context_, this->certificate_.file_name (), this->certificate_.type ()) <= 0) - return -1; + { + this->certificate_ = ACE_SSL_Data_File (); + return -1; + } else return 0; } @@ -456,30 +523,39 @@ ACE_SSL_Context::dh_params (const char *file_name, if (this->dh_params_.type () != -1) return 0; + // For now we only support PEM encodings + if (type != SSL_FILETYPE_PEM) + return -1; + this->dh_params_ = ACE_SSL_Data_File (file_name, type); this->check_context (); { - // For now we only support PEM encodings - if (this->dh_params_.type () != SSL_FILETYPE_PEM) - return -1; - // Swiped from Rescorla's examples and the OpenSSL s_server.c app - DH *ret=0; - BIO *bio = 0; + DH * ret=0; + BIO * bio = 0; if ((bio = ::BIO_new_file (this->dh_params_.file_name (), "r")) == NULL) - return -1; + { + this->dh_params_ = ACE_SSL_Data_File (); + return -1; + } ret = PEM_read_bio_DHparams (bio, NULL, NULL, NULL); BIO_free (bio); if (ret == 0) - return -1; - - if(::SSL_CTX_set_tmp_dh (this->context_, ret) < 0) - return -1; + { + this->dh_params_ = ACE_SSL_Data_File (); + return -1; + } + + if (::SSL_CTX_set_tmp_dh (this->context_, ret) < 0) + { + this->dh_params_ = ACE_SSL_Data_File (); + return -1; + } DH_free (ret); } @@ -488,56 +564,11 @@ ACE_SSL_Context::dh_params (const char *file_name, // **************************************************************** -#ifdef ACE_HAS_THREADS - -void -ACE_SSL_locking_callback (int mode, - int type, - const char * /* file */, - int /* line */) -{ - // #ifdef undef - // fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", - // CRYPTO_thread_id(), - // (mode&CRYPTO_LOCK)?"l":"u", - // (type&CRYPTO_READ)?"r":"w",file,line); - // #endif - // /* - // if (CRYPTO_LOCK_SSL_CERT == type) - // fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n", - // CRYPTO_thread_id(), - // mode,file,line); - // */ - if (mode & CRYPTO_LOCK) - ACE_OS::mutex_lock (&(ACE_SSL_Context::lock_[type])); - else - ACE_OS::mutex_unlock (&(ACE_SSL_Context::lock_[type])); -} - - - -unsigned long -ACE_SSL_thread_id (void) -{ - return (unsigned long) ACE_OS::thr_self (); -} -#endif /* ACE_HAS_THREADS */ - -// **************************************************************** - - - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX> - -#elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) template ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX> * ACE_Singleton<ACE_SSL_Context, ACE_SYNCH_MUTEX>::singleton_; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_Context.h b/ace/SSL/SSL_Context.h index 37a8de30496..748ca4cde72 100644 --- a/ace/SSL/SSL_Context.h +++ b/ace/SSL/SSL_Context.h @@ -7,6 +7,7 @@ * $Id$ * * @author Carlos O'Ryan <coryan@ece.uci.edu> + * @author Ossama Othman <ossama@dre.vanderbilt.edu> */ //============================================================================= @@ -25,28 +26,13 @@ #include "ace/SString.h" #ifdef ACE_HAS_THREADS -# include "ace/OS_NS_Thread.h" +# include "ace/Synch_Traits.h" #endif /* ACE_HAS_THREADS */ #include <openssl/ssl.h> -#ifdef ACE_HAS_THREADS -extern "C" -{ - - /// Mutex locking/unlocking callback for OpenSSL multithread - /// support. - void ACE_SSL_locking_callback (int mode, - int type, - const char * file, - int line); - - /// Return the current thread ID. OpenSSL uses this on platforms - /// that need it. - unsigned long ACE_SSL_thread_id (void); -} -#endif /* ACE_HAS_THREADS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_SSL_Export ACE_SSL_Data_File { @@ -88,10 +74,12 @@ private: */ class ACE_SSL_Export ACE_SSL_Context { - friend void ACE_SSL_locking_callback (int, int, const char *, int); - public: +#ifdef ACE_HAS_THREADS + typedef ACE_SYNCH_MUTEX lock_type; +#endif /* ACE_HAS_THREADS */ + enum { INVALID_METHOD = -1, SSLv2_client = 1, @@ -257,18 +245,18 @@ public: //@{ /// Seed the underlying random number generator. This value should /// have at least 128 bits of entropy. - int random_seed (const char * seed); + static int random_seed (const char * seed); /// Set the Entropy Gathering Daemon (EGD) UNIX domain socket file to /// read random seed values from. - int egd_file (const char * socket_file); + static int egd_file (const char * socket_file); /** * Set the file that contains the random seed value state, and the * amount of bytes to read. "-1" bytes causes the entire file to be * read. */ - int seed_file (const char * seed_file, long bytes = -1); + static int seed_file (const char * seed_file, long bytes = -1); //@} /// Print SSL error corresponding to the given error code. @@ -307,18 +295,13 @@ private: void ssl_library_init (); void ssl_library_fini (); - // = Prevent assignment and initialization. + // = Prevent assignment and copy initialization. //@{ - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_SSL_Context &)) - ACE_UNIMPLEMENTED_FUNC (ACE_SSL_Context (const ACE_SSL_Context &)) + ACE_SSL_Context (const ACE_SSL_Context &); + ACE_SSL_Context & operator= (const ACE_SSL_Context &); //@} private: - // @@ Carlos, I protected this variable with an ACE_GUARD, just like - // what we do for the orb_init_count_ variable in - // tao/ORB.cpp. The code isn't pretty but it should suffice - // until the SSL context is stored in a Singleton. - // -Ossama /// The SSL_CTX structure SSL_CTX *context_; @@ -337,23 +320,16 @@ private: /// count of successful CA load attempts int have_ca_; - /// Reference count of the number of times the ACE_SSL_Context was - /// initialized. - static int library_init_count_; - - // @@ This should also be done with a singleton, otherwise it is not - // thread safe and/or portable to some weird platforms... - #ifdef ACE_HAS_THREADS /// Array of mutexes used internally by OpenSSL when the SSL /// application is multithreaded. - static ACE_mutex_t * lock_; - - // @@ This should also be managed by a singleton. -#endif + static lock_type * locks_; +#endif /* ACE_HAS_THREADS */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined(__ACE_INLINE__) #include "SSL_Context.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SSL/SSL_Context.inl b/ace/SSL/SSL_Context.inl index 9008591e1c9..5fd50ec6d43 100644 --- a/ace/SSL/SSL_Context.inl +++ b/ace/SSL/SSL_Context.inl @@ -2,6 +2,7 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SSL_Data_File::ACE_SSL_Data_File (void) @@ -104,3 +105,5 @@ ACE_SSL_Context::have_trusted_ca (void) const { return this->have_ca_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK.cpp b/ace/SSL/SSL_SOCK.cpp index 0f38ddb4206..c6f1af15388 100644 --- a/ace/SSL/SSL_SOCK.cpp +++ b/ace/SSL/SSL_SOCK.cpp @@ -1,8 +1,5 @@ -// -*- C++ -*- -// // $Id$ - #include "SSL_SOCK.h" #if !defined (__ACE_INLINE__) @@ -17,6 +14,8 @@ ACE_RCSID (ACE_SSL, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_SSL_SOCK::ACE_SSL_SOCK (void) { ACE_TRACE ("ACE_SSL_SOCK::ACE_SSL_SOCK"); @@ -69,3 +68,5 @@ ACE_SSL_SOCK::disable (int value) const return -1; } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK.h b/ace/SSL/SSL_SOCK.h index c5d65b35a72..0a86a1f5c9f 100644 --- a/ace/SSL/SSL_SOCK.h +++ b/ace/SSL/SSL_SOCK.h @@ -34,6 +34,8 @@ # define ACE_SSL_SOCK_STREAM ACE_SSL_SOCK_Stream, ACE_INET_Addr #endif /* ACE_HAS_TEMPLATE_TYPEDEFS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SSL_SOCK * @@ -50,9 +52,6 @@ class ACE_SSL_Export ACE_SSL_SOCK : public ACE_SOCK { public: - /// Default destructor. - ~ACE_SSL_SOCK (void); - /** * Override ACE_SOCK base class implementations with these SSL * specific ones. @@ -79,8 +78,18 @@ protected: /// from being defined. ACE_SSL_SOCK (void); + /// Destructor + /** + * Not a virtual destructor. Protected destructor to prevent + * operator delete() from being called through a base class + * ACE_SSL_SOCK pointer/reference. + */ + ~ACE_SSL_SOCK (void); + }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "SSL_SOCK.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/SSL/SSL_SOCK.i b/ace/SSL/SSL_SOCK.i index bd2b967b97a..1a39d5214dc 100644 --- a/ace/SSL/SSL_SOCK.i +++ b/ace/SSL/SSL_SOCK.i @@ -1,8 +1,11 @@ // -*- C++ -*- +// // $Id$ #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE void ACE_SSL_SOCK::set_handle (ACE_HANDLE fd) { @@ -25,9 +28,9 @@ ACE_SSL_SOCK::control (int cmd, void *arg) const ACE_INLINE int ACE_SSL_SOCK::set_option (int level, - int option, - void *optval, - int optlen) const + int option, + void *optval, + int optlen) const { // switch (option) // { @@ -37,9 +40,9 @@ ACE_SSL_SOCK::set_option (int level, // return ::BIO_set_read_buffer_size (this->io_bio_, *((int *) optval)); // default: return ACE_OS::setsockopt (this->get_handle (), - level, - option, (char *) optval, - optlen); + level, + option, (char *) optval, + optlen); // } } @@ -47,9 +50,9 @@ ACE_SSL_SOCK::set_option (int level, ACE_INLINE int ACE_SSL_SOCK::get_option (int level, - int option, - void *optval, - int *optlen) const + int option, + void *optval, + int *optlen) const { // switch (option) // { @@ -59,8 +62,10 @@ ACE_SSL_SOCK::get_option (int level, // return ::BIO_get_read_buffer_size (this->io_bio_, *((int *) optval)); // default: return ACE_OS::getsockopt (this->get_handle (), - level, - option, (char *) optval, - optlen); + level, + option, (char *) optval, + optlen); // } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Acceptor.cpp b/ace/SSL/SSL_SOCK_Acceptor.cpp index 6dedbf05bca..61c91e999e4 100644 --- a/ace/SSL/SSL_SOCK_Acceptor.cpp +++ b/ace/SSL/SSL_SOCK_Acceptor.cpp @@ -12,8 +12,6 @@ #include "ace/Time_Value.h" #include "ace/Countdown_Time.h" -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Acceptor) - #if !defined (__ACE_INLINE__) #include "SSL_SOCK_Acceptor.i" #endif /* __ACE_INLINE__ */ @@ -22,6 +20,10 @@ ACE_RCSID (ACE_SSL, SSL_SOCK_Acceptor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Acceptor) + ACE_SSL_SOCK_Acceptor::~ACE_SSL_SOCK_Acceptor (void) { ACE_TRACE ("ACE_SSL_SOCK_Acceptor::~ACE_SSL_SOCK_Acceptor"); @@ -242,5 +244,6 @@ ACE_SSL_SOCK_Acceptor::accept (ACE_SSL_SOCK_Stream &new_stream, } return 0; - } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Acceptor.h b/ace/SSL/SSL_SOCK_Acceptor.h index 698ebcbefd9..0428365a753 100644 --- a/ace/SSL/SSL_SOCK_Acceptor.h +++ b/ace/SSL/SSL_SOCK_Acceptor.h @@ -29,6 +29,8 @@ #include "ace/SOCK_Acceptor.h" #include "ace/OS_QoS.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SSL_SOCK_Acceptor * @@ -68,10 +70,10 @@ public: * upon return. */ ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - int reuse_addr = 0, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); + int reuse_addr = 0, + int protocol_family = PF_UNSPEC, + int backlog = ACE_DEFAULT_BACKLOG, + int protocol = 0); /** * Initiate a passive-mode QoS-enabled acceptor socket. @@ -84,13 +86,13 @@ public: * upon return. */ ACE_SSL_SOCK_Acceptor (const ACE_Addr &local_sap, - ACE_Protocol_Info *protocolinfo, - ACE_SOCK_GROUP g, - u_long flags, - int reuse_addr, - int protocol_family = PF_UNSPEC, - int backlog = ACE_DEFAULT_BACKLOG, - int protocol = 0); + ACE_Protocol_Info *protocolinfo, + ACE_SOCK_GROUP g, + u_long flags, + int reuse_addr, + int protocol_family = PF_UNSPEC, + int backlog = ACE_DEFAULT_BACKLOG, + int protocol = 0); /** * Initiate a passive mode SSL/BSD-style acceptor socket. @@ -156,7 +158,7 @@ public: * @return 0 if success; -1 for failure (errno contains error code). */ int accept (ACE_SSL_SOCK_Stream &new_stream, - ACE_Accept_QoS_Params qos_params, + ACE_Accept_QoS_Params qos_params, ACE_Addr *remote_addr = 0, ACE_Time_Value *timeout = 0, int restart = 1, @@ -185,6 +187,8 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "SSL_SOCK_Acceptor.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/SSL/SSL_SOCK_Acceptor.i b/ace/SSL/SSL_SOCK_Acceptor.i index 01cc06fd8bb..7fd8cb04095 100644 --- a/ace/SSL/SSL_SOCK_Acceptor.i +++ b/ace/SSL/SSL_SOCK_Acceptor.i @@ -2,6 +2,7 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SSL_SOCK_Acceptor::ACE_SSL_SOCK_Acceptor (void) @@ -80,3 +81,5 @@ ACE_SSL_SOCK_Acceptor::close (void) return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Connector.cpp b/ace/SSL/SSL_SOCK_Connector.cpp index 5b6f2e09e0c..41e00ff6f4a 100644 --- a/ace/SSL/SSL_SOCK_Connector.cpp +++ b/ace/SSL/SSL_SOCK_Connector.cpp @@ -20,8 +20,9 @@ ACE_RCSID (ACE_SSL, SSL_SOCK_Connector, "$Id$") -ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Connector) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Connector) ACE_SSL_SOCK_Connector::~ACE_SSL_SOCK_Connector (void) { @@ -406,3 +407,5 @@ ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector ( reuse_addr, perms); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Connector.h b/ace/SSL/SSL_SOCK_Connector.h index 9ece41271a2..702dbbf82ec 100644 --- a/ace/SSL/SSL_SOCK_Connector.h +++ b/ace/SSL/SSL_SOCK_Connector.h @@ -30,6 +30,8 @@ #include "ace/SOCK_Connector.h" #include "ace/OS_QoS.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SSL_SOCK_Connector * @@ -258,13 +260,13 @@ public: int connect (ACE_SSL_SOCK_Stream &new_stream, const ACE_Addr &remote_sap, ACE_QoS_Params qos_params, - const ACE_Time_Value *timeout = 0, - const ACE_Addr &local_sap = ACE_Addr::sap_any, + const ACE_Time_Value *timeout = 0, + const ACE_Addr &local_sap = ACE_Addr::sap_any, ACE_Protocol_Info *protocolinfo = 0, ACE_SOCK_GROUP g = 0, u_long flags = 0, - int reuse_addr = 0, - int perms = 0); + int reuse_addr = 0, + int perms = 0); /** * Try to complete a non-blocking connection. @@ -305,6 +307,8 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "SSL_SOCK_Connector.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/SSL/SSL_SOCK_Connector.i b/ace/SSL/SSL_SOCK_Connector.i index f216828c622..67b5ef01540 100644 --- a/ace/SSL/SSL_SOCK_Connector.i +++ b/ace/SSL/SSL_SOCK_Connector.i @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SSL_SOCK_Connector.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_SSL_SOCK_Connector::ACE_SSL_SOCK_Connector (void) @@ -23,3 +24,5 @@ ACE_SSL_SOCK_Connector::dump (void) const ACE_TRACE ("ACE_SSL_SOCK_Connector::dump"); this->connector_.dump (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Stream.cpp b/ace/SSL/SSL_SOCK_Stream.cpp index fa50a8a5a62..f5ba831ad17 100644 --- a/ace/SSL/SSL_SOCK_Stream.cpp +++ b/ace/SSL/SSL_SOCK_Stream.cpp @@ -5,6 +5,7 @@ #include "ace/Countdown_Time.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_sys_select.h" +#include "ace/OS_Memory.h" #include <openssl/err.h> @@ -18,6 +19,8 @@ ACE_RCSID (ACE_SSL, SSL_SOCK_Stream, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SSL_SOCK_Stream) ACE_SSL_SOCK_Stream::ACE_SSL_SOCK_Stream (ACE_SSL_Context *context) @@ -155,12 +158,11 @@ ACE_SSL_SOCK_Stream::recvv (iovec *io_vec, break; } - u_long inlen; - + int inlen; if (ACE_OS::ioctl (this->get_handle (), FIONREAD, - (u_long *) &inlen) == -1) + &inlen) == -1) return -1; else if (inlen > 0) { @@ -586,3 +588,5 @@ ACE_SSL_SOCK_Stream::get_remote_addr (ACE_Addr &addr) const return -1; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SSL/SSL_SOCK_Stream.h b/ace/SSL/SSL_SOCK_Stream.h index abace05d58f..a58d91e7c4b 100644 --- a/ace/SSL/SSL_SOCK_Stream.h +++ b/ace/SSL/SSL_SOCK_Stream.h @@ -34,6 +34,7 @@ #include "ace/SOCK_Stream.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_SSL_SOCK_Stream @@ -309,6 +310,8 @@ protected: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "SSL_SOCK_Stream.i" #endif /* __ACE_INLINE__ */ diff --git a/ace/SSL/SSL_SOCK_Stream.i b/ace/SSL/SSL_SOCK_Stream.i index b80cd3e2884..352aca04b3e 100644 --- a/ace/SSL/SSL_SOCK_Stream.i +++ b/ace/SSL/SSL_SOCK_Stream.i @@ -4,6 +4,8 @@ #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE void ACE_SSL_SOCK_Stream::set_handle (ACE_HANDLE fd) { @@ -317,3 +319,5 @@ ACE_SSL_SOCK_Stream::ssl (void) const { return this->ssl_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SString.cpp b/ace/SString.cpp index 0d3ba9efef0..1c03657398f 100644 --- a/ace/SString.cpp +++ b/ace/SString.cpp @@ -1,6 +1,7 @@ // $Id$ -#include "ace/Malloc.h" +#include "ace/Malloc_T.h" +#include "ace/OS_Memory.h" #if !defined (ACE_HAS_WINCE) //# include "ace/Service_Config.h" #endif /* !ACE_HAS_WINCE */ @@ -24,6 +25,8 @@ ACE_RCSID (ace, // ************************************************************ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) ACE_OSTREAM_TYPE & operator<< (ACE_OSTREAM_TYPE &os, const ACE_CString &cs) @@ -532,31 +535,9 @@ EXIT_LABEL: // ************************************************************* -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_String_Base<char>; -template ACE_String_Base<char> operator + (const ACE_String_Base<char> &, - const ACE_String_Base<char> &); -template ACE_String_Base<char> operator + (const ACE_String_Base<char> &, - const char *); -template ACE_String_Base<char> operator + (const char *, - const ACE_String_Base<char> &); -template class ACE_String_Base<ACE_WSTRING_TYPE>; -template ACE_String_Base<ACE_WSTRING_TYPE> operator + (const ACE_String_Base<ACE_WSTRING_TYPE> &, - const ACE_String_Base<ACE_WSTRING_TYPE> &); -template ACE_String_Base<ACE_WSTRING_TYPE> operator + (const ACE_String_Base<ACE_WSTRING_TYPE> &, - const ACE_WSTRING_TYPE *); -template ACE_String_Base<ACE_WSTRING_TYPE> operator + (const ACE_WSTRING_TYPE *, - const ACE_String_Base<ACE_WSTRING_TYPE> &); -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_String_Base<char> -#pragma instantiate ACE_String_Base<char> operator + (const ACE_String_Base<char> &, const ACE_String_Base<char> &) -#pragma instantiate ACE_String_Base<char> operator + (const ACE_String_Base<char> &, const char *) -#pragma instantiate ACE_String_Base<char> operator + (const char *,const ACE_String_Base<char> &) -#pragma instantiate ACE_String_Base<ACE_WSTRING_TYPE> -#pragma instantiate ACE_String_Base<ACE_WSTRING_TYPE> operator + (const ACE_String_Base<ACE_WSTRING_TYPE> &, const ACE_String_Base<ACE_WSTRING_TYPE> &) -#pragma instantiate ACE_String_Base<ACE_WSTRING_TYPE> operator + (const ACE_String_Base<ACE_WSTRING_TYPE> &, const ACE_WSTRING_TYPE *) -#pragma instantiate ACE_String_Base<ACE_WSTRING_TYPE> operator + (const ACE_WSTRING_TYPE *,const ACE_String_Base<ACE_WSTRING_TYPE> &) -#elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) template char ACE_String_Base<char>::NULL_String_; template ACE_WSTRING_TYPE ACE_String_Base<ACE_WSTRING_TYPE>::NULL_String_; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SString.h b/ace/SString.h index f2f79014cc4..1d3f389b70f 100644 --- a/ace/SString.h +++ b/ace/SString.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -28,10 +28,14 @@ #if !defined (ACE_LACKS_IOSTREAM_TOTALLY) #include "ace/iosfwd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_CString &); ACE_Export ACE_OSTREAM_TYPE &operator << (ACE_OSTREAM_TYPE &, const ACE_WString &); +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT template class ACE_Export ACE_String_Base<char>; template class ACE_Export ACE_String_Base<ACE_WSTRING_TYPE>; @@ -265,7 +269,7 @@ public: * \a buffer will be parsed. Notice that ACE_Tokenizer will modify * \a buffer if you use <code> delimiter_replace </code> or <code> * preserve_designators </code> to do character substitution. - * NOTE: You should NOT pass a constant string or string literal + * @note You should NOT pass a constant string or string literal * to this constructor, since ACE_Tokenizer will try to modify * the string. * \sa preserve_designators @@ -479,6 +483,8 @@ private: char* p_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SString.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SString.inl b/ace/SString.inl index a985c5456af..395623910a0 100644 --- a/ace/SString.inl +++ b/ace/SString.inl @@ -9,6 +9,10 @@ # include "ace/ACE.h" #endif /* !ACE_ACE_H */ +#include "ace/OS_NS_stdlib.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_NS_WString::ACE_NS_WString (ACE_Allocator *alloc) : ACE_WString (alloc) @@ -290,3 +294,5 @@ ACE_Auto_String_Free::release (void) this->p_ = 0; return p; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SStringfwd.h b/ace/SStringfwd.h index 20e4b3011d2..8910233ed56 100644 --- a/ace/SStringfwd.h +++ b/ace/SStringfwd.h @@ -25,6 +25,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class CHAR> class ACE_String_Base; // Forward declaration. @@ -41,6 +42,8 @@ typedef ACE_WString ACE_TString; typedef ACE_CString ACE_TString; #endif /* ACE_USES_WCHAR */ +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SSTRINGFWD_H */ diff --git a/ace/SUN_Proactor.cpp b/ace/SUN_Proactor.cpp index 2f6e69fcc3d..c522f18d64b 100644 --- a/ace/SUN_Proactor.cpp +++ b/ace/SUN_Proactor.cpp @@ -14,6 +14,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_SUN_Proactor::ACE_SUN_Proactor (size_t max_aio_operations) : ACE_POSIX_AIOCB_Proactor (max_aio_operations, ACE_POSIX_Proactor::PROACTOR_SUN), @@ -315,6 +317,8 @@ ACE_POSIX_Proactor::Proactor_Type ACE_SUN_Proactor::get_impl_type (void) { return PROACTOR_SUN; -} +} + +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_AIO_CALLS && sun */ diff --git a/ace/SUN_Proactor.h b/ace/SUN_Proactor.h index fce65b40541..9d104355578 100644 --- a/ace/SUN_Proactor.h +++ b/ace/SUN_Proactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #include "ace/POSIX_Proactor.h" #include /**/ <sys/asynch.h> // Sun native aio calls +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SUN_Proactor * @@ -47,16 +49,16 @@ * it has the following structure: * typedef struct aiocb * { - * int aio_fildes; File descriptor - * void *aio_buf; buffer location + * int aio_fildes; File descriptor + * void *aio_buf; buffer location * size_t aio_nbytes; length of transfer * off_t aio_offset; file offset - * int aio_reqprio; request priority offset + * int aio_reqprio; request priority offset * sigevent aio_sigevent; signal number and offset - * int aio_lio_opcode; listio operation - * aio_result_t aio_resultp; results - * int aio_state; state flag for List I/O - * int aio__pad[1]; extension padding + * int aio_lio_opcode; listio operation + * aio_result_t aio_resultp; results + * int aio_state; state flag for List I/O + * int aio__pad[1]; extension padding * }; */ class ACE_Export ACE_SUN_Proactor : public ACE_POSIX_AIOCB_Proactor @@ -118,5 +120,7 @@ protected: ACE_SYNCH_CONDITION condition_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_AIO_CALLS && sun */ #endif /* ACE_SUN_PROACTOR_H*/ diff --git a/ace/SV_Message.cpp b/ace/SV_Message.cpp index f8ace600ab3..15368235910 100644 --- a/ace/SV_Message.cpp +++ b/ace/SV_Message.cpp @@ -9,6 +9,8 @@ ACE_RCSID(ace, SV_Message, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SV_Message) void @@ -19,3 +21,4 @@ ACE_SV_Message::dump (void) const #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Message.h b/ace/SV_Message.h index 2151329bd5c..04a9e20c12b 100644 --- a/ace/SV_Message.h +++ b/ace/SV_Message.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SV_Message * @@ -53,6 +55,9 @@ protected: long type_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + + #if defined (__ACE_INLINE__) #include "ace/SV_Message.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SV_Message.inl b/ace/SV_Message.inl index 51c035370b8..3f698bd5071 100644 --- a/ace/SV_Message.inl +++ b/ace/SV_Message.inl @@ -1,11 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SV_Message.i - #include "ace/Global_Macros.h" #include "ace/config-all.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_SV_Message::ACE_SV_Message (long t) : type_ (t) @@ -32,3 +33,5 @@ ACE_SV_Message::type (long t) ACE_TRACE ("ACE_SV_Message::type"); this->type_ = t; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Message_Queue.cpp b/ace/SV_Message_Queue.cpp index 3e57373e18d..1be06f0f8cc 100644 --- a/ace/SV_Message_Queue.cpp +++ b/ace/SV_Message_Queue.cpp @@ -9,6 +9,8 @@ ACE_RCSID(ace, SV_Message_Queue, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SV_Message_Queue) void @@ -30,11 +32,13 @@ ACE_SV_Message_Queue::~ACE_SV_Message_Queue (void) } ACE_SV_Message_Queue::ACE_SV_Message_Queue (key_t external_id, - int create, - int perms) + int create, + int perms) { ACE_TRACE ("ACE_SV_Message_Queue::ACE_SV_Message_Queue"); if (this->open (external_id, create, perms) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Message_Queue::ACE_SV_Message_Queue"))); + ACE_LIB_TEXT ("ACE_SV_Message_Queue::ACE_SV_Message_Queue"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Message_Queue.h b/ace/SV_Message_Queue.h index ac36423a463..42fd8f08693 100644 --- a/ace/SV_Message_Queue.h +++ b/ace/SV_Message_Queue.h @@ -26,6 +26,8 @@ #include "ace/os_include/sys/os_ipc.h" #include "ace/Default_Constants.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SV_Message_Queue * @@ -92,6 +94,8 @@ protected: int internal_id_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SV_Message_Queue.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SV_Message_Queue.inl b/ace/SV_Message_Queue.inl index 63585329b87..b84f6379901 100644 --- a/ace/SV_Message_Queue.inl +++ b/ace/SV_Message_Queue.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Global_Macros.h" #include "ace/OS_NS_sys_msg.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Open a message queue using the <external_id>. ACE_INLINE int @@ -28,7 +31,7 @@ ACE_SV_Message_Queue::control (int option, void *arg) { ACE_TRACE ("ACE_SV_Message_Queue::control"); return ACE_OS::msgctl (this->internal_id_, option, - (struct msqid_ds *) arg); + (struct msqid_ds *) arg); } ACE_INLINE int @@ -56,22 +59,23 @@ ACE_SV_Message_Queue::set_id (int id) ACE_INLINE ssize_t ACE_SV_Message_Queue::recv (ACE_SV_Message &mb, - int length, - long type, - int mflags) + int length, + long type, + int mflags) { ACE_TRACE ("ACE_SV_Message_Queue::recv"); return ACE_OS::msgrcv (this->internal_id_, (void *) &mb, - length, type, mflags); + length, type, mflags); } ACE_INLINE int ACE_SV_Message_Queue::send (const ACE_SV_Message &mb, - int length, - int mflags) + int length, + int mflags) { ACE_TRACE ("ACE_SV_Message_Queue::send"); return ACE_OS::msgsnd (this->internal_id_, (void *) &mb, - length, mflags); + length, mflags); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Complex.cpp b/ace/SV_Semaphore_Complex.cpp index cb81d8838f3..ce3c0b07858 100644 --- a/ace/SV_Semaphore_Complex.cpp +++ b/ace/SV_Semaphore_Complex.cpp @@ -11,6 +11,8 @@ ACE_RCSID(ace, SV_Semaphore_Complex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SV_Semaphore_Complex) void @@ -27,46 +29,46 @@ const int ACE_SV_Semaphore_Complex::BIGCOUNT_ = 10000; // Define the ACE_SV_Semaphore operation arrays for the semop() calls. sembuf ACE_SV_Semaphore_Complex::op_lock_[2] = { - {0, 0, 0}, // Wait for [0] (lock) to equal 0 - {0, 1, SEM_UNDO}, // then increment [0] to 1 - this locks it. + {0, 0, 0}, // Wait for [0] (lock) to equal 0 + {0, 1, SEM_UNDO}, // then increment [0] to 1 - this locks it. // UNDO to release the lock if processes exit - // before explicitly unlocking. + // before explicitly unlocking. }; sembuf ACE_SV_Semaphore_Complex::op_endcreate_[2] = { - {1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on + {1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on // exit, UNDO to adjust proc counter if - // process exits before explicitly calling close() - {0, -1, SEM_UNDO}, // the decrement [0] (lock) back to 0 + // process exits before explicitly calling close() + {0, -1, SEM_UNDO}, // the decrement [0] (lock) back to 0 }; sembuf ACE_SV_Semaphore_Complex::op_open_[1] = { - {1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on + {1, -1, SEM_UNDO}, // Decrement [1] (proc counter) with undo on // exit. }; sembuf ACE_SV_Semaphore_Complex::op_close_[3] = { - {0, 0, 0}, // Wait for [0] (lock) to equal 0 - {0, 1, SEM_UNDO}, // then increment [0] to 1 - this lock it - {1, 1, SEM_UNDO}, // then increment [1] (proc counter) + {0, 0, 0}, // Wait for [0] (lock) to equal 0 + {0, 1, SEM_UNDO}, // then increment [0] to 1 - this lock it + {1, 1, SEM_UNDO}, // then increment [1] (proc counter) }; sembuf ACE_SV_Semaphore_Complex::op_unlock_[1] = { - {0, -1, SEM_UNDO}, // Decrement [0] (lock) back to 0 + {0, -1, SEM_UNDO}, // Decrement [0] (lock) back to 0 }; // Open or create an array of SV_Semaphores. We return 0 if all is OK, else -1. int ACE_SV_Semaphore_Complex::open (key_t k, - int create, - int initial_value, - u_short nsems, - int perms) + short create, + int initial_value, + u_short nsems, + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Complex::open"); if (k == IPC_PRIVATE) @@ -83,35 +85,35 @@ ACE_SV_Semaphore_Complex::open (key_t k, int result; do - { - this->internal_id_ = ACE_OS::semget + { + this->internal_id_ = ACE_OS::semget (this->key_, (u_short) 2 + nsems, perms | ACE_SV_Semaphore_Complex::ACE_CREATE); - if (this->internal_id_ == -1) - return -1; // permission problem or tables full - - // When the <ACE_SV_Semaphore_Complex> is created, we know - // that the value of all 3 members is 0. Get a lock on the - // <ACE_SV_Semaphore_Complex> by waiting for [0] to equal 0, - // then increment it. - - // There is a race condition here. There is the possibility - // that between the <semget> above and the <semop> below, - // another process can call out <close> function which can - // remove the <ACE_SV_Semaphore> if that process is the last - // one using it. Therefor we handle the error condition of - // an invalid <ACE_SV_Semaphore> ID specifically below, and - // if it does happen, we just go back and create it again. - result = ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_lock_[0], - 2); - } + if (this->internal_id_ == -1) + return -1; // permission problem or tables full + + // When the <ACE_SV_Semaphore_Complex> is created, we know + // that the value of all 3 members is 0. Get a lock on the + // <ACE_SV_Semaphore_Complex> by waiting for [0] to equal 0, + // then increment it. + + // There is a race condition here. There is the possibility + // that between the <semget> above and the <semop> below, + // another process can call out <close> function which can + // remove the <ACE_SV_Semaphore> if that process is the last + // one using it. Therefor we handle the error condition of + // an invalid <ACE_SV_Semaphore> ID specifically below, and + // if it does happen, we just go back and create it again. + result = ACE_OS::semop (this->internal_id_, + &ACE_SV_Semaphore_Complex::op_lock_[0], + 2); + } while (result == -1 && (errno == EINVAL || errno == EIDRM)); if (result == -1) - return -1; + return -1; // Get the value of the process counter. If it equals 0, then no // one has initialized the ACE_SV_Semaphore yet. @@ -119,53 +121,53 @@ ACE_SV_Semaphore_Complex::open (key_t k, int semval = ACE_SV_Semaphore_Simple::control (GETVAL, 0, 1); if (semval == -1) - return this->init (); + return this->init (); else if (semval == 0) - { - // We should initialize by doing a SETALL, but that would - // clear the adjust value that we set when we locked the - // ACE_SV_Semaphore above. Instead we do system calls to - // initialize [1], as well as all the nsems SV_Semaphores. - - if (ACE_SV_Semaphore_Simple::control (SETVAL, - ACE_SV_Semaphore_Complex::BIGCOUNT_, - 1) == -1) - return -1; - else - for (u_short i = 0; i < nsems; i++) - if (this->control (SETVAL, initial_value, i) == -1) - return -1; - } + { + // We should initialize by doing a SETALL, but that would + // clear the adjust value that we set when we locked the + // ACE_SV_Semaphore above. Instead we do system calls to + // initialize [1], as well as all the nsems SV_Semaphores. + + if (ACE_SV_Semaphore_Simple::control (SETVAL, + ACE_SV_Semaphore_Complex::BIGCOUNT_, + 1) == -1) + return -1; + else + for (u_short i = 0; i < nsems; i++) + if (this->control (SETVAL, initial_value, i) == -1) + return -1; + } // Decrement the process counter and then release the lock. return ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_endcreate_[0], - 2); + &ACE_SV_Semaphore_Complex::op_endcreate_[0], + 2); } else { this->internal_id_ = ACE_OS::semget (this->key_, 2 + nsems, 0); if (this->internal_id_ == -1) - return -1; // doesn't exist or tables full + return -1; // doesn't exist or tables full // Decrement the process counter. We don't need a lock to do this. if (ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_open_[0], 1) < 0) - return this->init (); + &ACE_SV_Semaphore_Complex::op_open_[0], 1) < 0) + return this->init (); return 0; } } int ACE_SV_Semaphore_Complex::open (const char *name, - int flags, - int initial_value, - u_short nsems, - int perms) + short flags, + int initial_value, + u_short nsems, + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Complex::open"); return this->open (ACE_SV_Semaphore_Simple::name_2_key (name), - flags, initial_value, nsems, perms); + flags, initial_value, nsems, perms); } // Close a ACE_SV_Semaphore. Unlike the remove above, this function @@ -187,8 +189,8 @@ ACE_SV_Semaphore_Complex::close (void) // then increments [1] - the process number. if (ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_close_[0], - 3) == -1) + &ACE_SV_Semaphore_Complex::op_close_[0], + 3) == -1) return -1; // Now that we have a lock, read the value of the process counter to @@ -205,17 +207,17 @@ ACE_SV_Semaphore_Complex::close (void) else { int result = ACE_OS::semop (this->internal_id_, - &ACE_SV_Semaphore_Complex::op_unlock_[0], 1); + &ACE_SV_Semaphore_Complex::op_unlock_[0], 1); this->init (); return result; } } ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (key_t k, - int flags, - int initial_value, - u_short nsems, - int perms) + short flags, + int initial_value, + u_short nsems, + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex"); if (this->open (k, flags, initial_value, nsems, perms) == -1) @@ -223,10 +225,10 @@ ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (key_t k, } ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (const char *name, - int flags, - int initial_value, - u_short nsems, - int perms) + short flags, + int initial_value, + u_short nsems, + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex"); @@ -253,3 +255,5 @@ ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex (void) ACE_TRACE ("ACE_SV_Semaphore_Complex::ACE_SV_Semaphore_Complex"); this->init (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Complex.h b/ace/SV_Semaphore_Complex.h index 6278fb694c9..de48fc09359 100644 --- a/ace/SV_Semaphore_Complex.h +++ b/ace/SV_Semaphore_Complex.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SV_Semaphore_Complex * @@ -61,32 +63,32 @@ public: // = Initialization and termination methods. ACE_SV_Semaphore_Complex (void); ACE_SV_Semaphore_Complex (key_t key, - int create = ACE_SV_Semaphore_Complex::ACE_CREATE, + short create = ACE_SV_Semaphore_Complex::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); ACE_SV_Semaphore_Complex (const char *name, - int create = ACE_SV_Semaphore_Complex::ACE_CREATE, + short create = ACE_SV_Semaphore_Complex::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); ~ACE_SV_Semaphore_Complex (void); /// Open or create an array of SV_Semaphores. We return 0 if all is /// OK, else -1. int open (const char *name, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); /// Open or create an array of SV_Semaphores. We return 0 if all is /// OK, else -1. int open (key_t key, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); /** * Close an ACE_SV_Semaphore. Unlike the <remove> method, this @@ -100,28 +102,28 @@ public: // = Semaphore acquire and release methods. /// Acquire the semaphore. - int acquire (u_short n = 0, int flags = 0) const; + int acquire (u_short n = 0, short flags = 0) const; /// Acquire a semaphore for reading. - int acquire_read (u_short n = 0, int flags = 0) const; + int acquire_read (u_short n = 0, short flags = 0) const; /// Acquire a semaphore for writing - int acquire_write (u_short n = 0, int flags = 0) const; + int acquire_write (u_short n = 0, short flags = 0) const; /// Try to acquire the semaphore. - int tryacquire (u_short n = 0, int flags = 0) const; + int tryacquire (u_short n = 0, short flags = 0) const; /// Try to acquire the semaphore for reading. - int tryacquire_read (u_short n = 0, int flags = 0) const; + int tryacquire_read (u_short n = 0, short flags = 0) const; /// Try to acquire the semaphore for writing. - int tryacquire_write (u_short n = 0, int flags = 0) const; + int tryacquire_write (u_short n = 0, short flags = 0) const; /// Release the semaphore. - int release (u_short n = 0, int flags = 0) const; + int release (u_short n = 0, short flags = 0) const; // = Semaphore operation methods. - int op (int val, u_short n = 0, int flags = 0) const; + int op (short val, u_short n = 0, short flags = 0) const; int op (sembuf op_vec[], u_short n) const; // = Semaphore control methods. @@ -129,8 +131,8 @@ public: int control (int cmd, int value = 0, u_short n = 0) const; // = Upgrade access control... - ACE_USING ACE_SV_Semaphore_Simple::get_id; - ACE_USING ACE_SV_Semaphore_Simple::remove; + using ACE_SV_Semaphore_Simple::get_id; + using ACE_SV_Semaphore_Simple::remove; /// Dump the state of an object. void dump (void) const; @@ -147,6 +149,8 @@ private: static sembuf op_unlock_[1]; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SV_Semaphore_Complex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SV_Semaphore_Complex.inl b/ace/SV_Semaphore_Complex.inl index 00c3450c1bd..8b80748ebf5 100644 --- a/ace/SV_Semaphore_Complex.inl +++ b/ace/SV_Semaphore_Complex.inl @@ -1,57 +1,60 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int -ACE_SV_Semaphore_Complex::acquire (u_short n, int flags) const +ACE_SV_Semaphore_Complex::acquire (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire"); return ACE_SV_Semaphore_Simple::acquire ((u_short) n + 2, flags); } ACE_INLINE int -ACE_SV_Semaphore_Complex::acquire_read (u_short n, int flags) const +ACE_SV_Semaphore_Complex::acquire_read (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire_read"); return this->acquire (n, flags); } ACE_INLINE int -ACE_SV_Semaphore_Complex::acquire_write (u_short n, int flags) const +ACE_SV_Semaphore_Complex::acquire_write (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::acquire_write"); return this->acquire (n, flags); } ACE_INLINE int -ACE_SV_Semaphore_Complex::tryacquire (u_short n, int flags) const +ACE_SV_Semaphore_Complex::tryacquire (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire"); return ACE_SV_Semaphore_Simple::tryacquire ((u_short) n + 2, flags); } ACE_INLINE int -ACE_SV_Semaphore_Complex::tryacquire_read (u_short n, int flags) const +ACE_SV_Semaphore_Complex::tryacquire_read (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire_read"); return this->tryacquire (n, flags); } ACE_INLINE int -ACE_SV_Semaphore_Complex::tryacquire_write (u_short n, int flags) const +ACE_SV_Semaphore_Complex::tryacquire_write (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::tryacquire_write"); return this->tryacquire (n, flags); } ACE_INLINE int -ACE_SV_Semaphore_Complex::release (u_short n, int flags) const +ACE_SV_Semaphore_Complex::release (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::release"); return ACE_SV_Semaphore_Simple::release ((u_short) n + 2, flags); } ACE_INLINE int -ACE_SV_Semaphore_Complex::op (int val, u_short n, int flags) const +ACE_SV_Semaphore_Complex::op (short val, u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Complex::op"); return ACE_SV_Semaphore_Simple::op (val, (u_short) n + 2, flags); @@ -77,3 +80,5 @@ ACE_SV_Semaphore_Complex::control (int cmd, int value, u_short n) const ACE_TRACE ("ACE_SV_Semaphore_Complex::control"); return ACE_SV_Semaphore_Simple::control (cmd, value, (u_short) n + 2); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Simple.cpp b/ace/SV_Semaphore_Simple.cpp index 5fb1260144c..3156338c44b 100644 --- a/ace/SV_Semaphore_Simple.cpp +++ b/ace/SV_Semaphore_Simple.cpp @@ -11,8 +11,9 @@ ACE_RCSID (ace, SV_Semaphore_Simple, "$Id$") -ACE_ALLOC_HOOK_DEFINE (ACE_SV_Semaphore_Simple) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +ACE_ALLOC_HOOK_DEFINE (ACE_SV_Semaphore_Simple) void ACE_SV_Semaphore_Simple::dump (void) const @@ -55,7 +56,7 @@ ACE_SV_Semaphore_Simple::init (key_t k, int i) // specific amount (positive or negative; amount can`t be zero). int -ACE_SV_Semaphore_Simple::op (int val, u_short n, int flags) const +ACE_SV_Semaphore_Simple::op (short val, u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::op"); sembuf op_op; @@ -76,10 +77,10 @@ ACE_SV_Semaphore_Simple::op (int val, u_short n, int flags) const int ACE_SV_Semaphore_Simple::open (key_t k, - int flags, + short flags, int initial_value, u_short n, - int perms) + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Simple::open"); union semun ivalue; @@ -105,10 +106,10 @@ ACE_SV_Semaphore_Simple::open (key_t k, } ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (key_t k, - int flags, + short flags, int initial_value, u_short n, - int perms) + mode_t perms) : key_ (k) { ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"); @@ -153,10 +154,10 @@ ACE_SV_Semaphore_Simple::name_2_key (const char *name) int ACE_SV_Semaphore_Simple::open (const char *name, - int flags, + short flags, int initial_value, u_short n, - int perms) + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Simple::open"); @@ -171,10 +172,10 @@ ACE_SV_Semaphore_Simple::open (const char *name, } ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name, - int flags, + short flags, int initial_value, u_short n, - int perms) + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple"); if (this->open (name, @@ -188,10 +189,10 @@ ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const char *name, } ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple (const wchar_t *name, - int flags, + short flags, int initial_value, u_short nsems, - int perms) + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Simple::ACE_SV_Semaphore_Simple(wchar_t)"); if (this->open (ACE_TEXT_TO_CHAR_IN (name), @@ -230,3 +231,5 @@ ACE_SV_Semaphore_Simple::remove (void) const ((ACE_SV_Semaphore_Simple *) this)->init (); return result; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Semaphore_Simple.h b/ace/SV_Semaphore_Simple.h index 02d0da8ed12..d2c82b71181 100644 --- a/ace/SV_Semaphore_Simple.h +++ b/ace/SV_Semaphore_Simple.h @@ -38,6 +38,8 @@ # endif /* ACE_DEFAULT_SEM_KEY */ #endif /* ACE_WIN32 */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SV_Semaphore_Simple * @@ -58,43 +60,43 @@ public: // = Initialization and termination methods. ACE_SV_Semaphore_Simple (void); ACE_SV_Semaphore_Simple (key_t key, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); ACE_SV_Semaphore_Simple (const char *name, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); ACE_SV_Semaphore_Simple (const wchar_t *name, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); ~ACE_SV_Semaphore_Simple (void); int open (const char *name, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); int open (const wchar_t *name, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); /// Open or create one or more SV_Semaphores. We return 0 if all is /// OK, else -1. int open (key_t key, - int flags = ACE_SV_Semaphore_Simple::ACE_CREATE, + short flags = ACE_SV_Semaphore_Simple::ACE_CREATE, int initial_value = 1, u_short nsems = 1, - int perms = ACE_DEFAULT_FILE_PERMS); + mode_t perms = ACE_DEFAULT_FILE_PERMS); /// Close a ACE_SV_Semaphore, marking it as invalid for subsequent /// operations... @@ -115,31 +117,31 @@ public: * decrement it by 1 and return. Dijkstra's P operation, Tannenbaums * DOWN operation. */ - int acquire (u_short n = 0, int flags = 0) const; + int acquire (u_short n = 0, short flags = 0) const; /// Acquire a semaphore for reading. - int acquire_read (u_short n = 0, int flags = 0) const; + int acquire_read (u_short n = 0, short flags = 0) const; /// Acquire a semaphore for writing - int acquire_write (u_short n = 0, int flags = 0) const; + int acquire_write (u_short n = 0, short flags = 0) const; /// Non-blocking version of <acquire>. - int tryacquire (u_short n = 0, int flags = 0) const; + int tryacquire (u_short n = 0, short flags = 0) const; /// Try to acquire the semaphore for reading. - int tryacquire_read (u_short n = 0, int flags = 0) const; + int tryacquire_read (u_short n = 0, short flags = 0) const; /// Try to acquire the semaphore for writing. - int tryacquire_write (u_short n = 0, int flags = 0) const; + int tryacquire_write (u_short n = 0, short flags = 0) const; /// Increment ACE_SV_Semaphore by one. Dijkstra's V operation, /// Tannenbaums UP operation. - int release (u_short n = 0, int flags = 0) const; + int release (u_short n = 0, short flags = 0) const; // = Semaphore operation methods. /// General ACE_SV_Semaphore operation. Increment or decrement by a /// specific amount (positive or negative; amount can`t be zero). - int op (int val, u_short semnum = 0, int flags = SEM_UNDO) const; + int op (short val, u_short semnum = 0, short flags = SEM_UNDO) const; /// General ACE_SV_Semaphore operation on an array of SV_Semaphores. int op (sembuf op_vec[], u_short nsems) const; @@ -181,6 +183,8 @@ protected: key_t name_2_key (const char *name); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SV_Semaphore_Simple.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SV_Semaphore_Simple.inl b/ace/SV_Semaphore_Simple.inl index 46122d4e140..81a828b4401 100644 --- a/ace/SV_Semaphore_Simple.inl +++ b/ace/SV_Semaphore_Simple.inl @@ -1,19 +1,20 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SV_Semaphore_Simple.i - #include "ace/Global_Macros.h" #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Semaphores don't offer wide-char names, so convert the name and forward // to the narrow-char open(). ACE_INLINE int ACE_SV_Semaphore_Simple::open (const wchar_t *name, - int flags, + short flags, int initial_value, u_short nsems, - int perms) + mode_t perms) { ACE_TRACE ("ACE_SV_Semaphore_Simple::open (wchar_t)"); return this->open (ACE_TEXT_TO_CHAR_IN (name), @@ -25,8 +26,8 @@ ACE_SV_Semaphore_Simple::open (const wchar_t *name, ACE_INLINE int ACE_SV_Semaphore_Simple::control (int cmd, - semun arg, - u_short n) const + semun arg, + u_short n) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::control"); return this->internal_id_ == -1 ? @@ -58,21 +59,21 @@ ACE_SV_Semaphore_Simple::op (sembuf op_vec[], u_short n) const // DOWN operation. ACE_INLINE int -ACE_SV_Semaphore_Simple::acquire (u_short n, int flags) const +ACE_SV_Semaphore_Simple::acquire (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire"); return this->op (-1, n, flags); } ACE_INLINE int -ACE_SV_Semaphore_Simple::acquire_read (u_short n, int flags) const +ACE_SV_Semaphore_Simple::acquire_read (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_read"); return this->acquire (n, flags); } ACE_INLINE int -ACE_SV_Semaphore_Simple::acquire_write (u_short n, int flags) const +ACE_SV_Semaphore_Simple::acquire_write (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::acquire_write"); return this->acquire (n, flags); @@ -81,7 +82,7 @@ ACE_SV_Semaphore_Simple::acquire_write (u_short n, int flags) const // Non-blocking version of acquire(). ACE_INLINE int -ACE_SV_Semaphore_Simple::tryacquire (u_short n, int flags) const +ACE_SV_Semaphore_Simple::tryacquire (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire"); return this->op (-1, n, flags | IPC_NOWAIT); @@ -90,7 +91,7 @@ ACE_SV_Semaphore_Simple::tryacquire (u_short n, int flags) const // Non-blocking version of acquire(). ACE_INLINE int -ACE_SV_Semaphore_Simple::tryacquire_read (u_short n, int flags) const +ACE_SV_Semaphore_Simple::tryacquire_read (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_read"); return this->tryacquire (n, flags); @@ -99,7 +100,7 @@ ACE_SV_Semaphore_Simple::tryacquire_read (u_short n, int flags) const // Non-blocking version of acquire(). ACE_INLINE int -ACE_SV_Semaphore_Simple::tryacquire_write (u_short n, int flags) const +ACE_SV_Semaphore_Simple::tryacquire_write (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::tryacquire_write"); return this->tryacquire (n, flags); @@ -109,7 +110,7 @@ ACE_SV_Semaphore_Simple::tryacquire_write (u_short n, int flags) const // Tannenbaums UP operation. ACE_INLINE int -ACE_SV_Semaphore_Simple::release (u_short n, int flags) const +ACE_SV_Semaphore_Simple::release (u_short n, short flags) const { ACE_TRACE ("ACE_SV_Semaphore_Simple::release"); return this->op (1, n, flags); @@ -122,3 +123,4 @@ ACE_SV_Semaphore_Simple::get_id (void) const return this->internal_id_; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Shared_Memory.cpp b/ace/SV_Shared_Memory.cpp index 5a9d33e934f..ab56249cbe6 100644 --- a/ace/SV_Shared_Memory.cpp +++ b/ace/SV_Shared_Memory.cpp @@ -1,4 +1,3 @@ -// SV_Shared_Memory.cpp // $Id$ #include "ace/SV_Shared_Memory.h" @@ -10,6 +9,8 @@ ACE_RCSID(ace, SV_Shared_Memory, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_SV_Shared_Memory) void @@ -25,11 +26,11 @@ ACE_SV_Shared_Memory::dump (void) const int ACE_SV_Shared_Memory::open_and_attach (key_t external_id, - size_t sz, - int create, - int perms, - void *virtual_addr, - int flags) + size_t sz, + int create, + int perms, + void *virtual_addr, + int flags) { ACE_TRACE ("ACE_SV_Shared_Memory::open_and_attach"); if (this->open (external_id, sz, create, perms) == -1) @@ -43,17 +44,17 @@ ACE_SV_Shared_Memory::open_and_attach (key_t external_id, // Constructor interface to this->open_and_attach () member function. ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (key_t external_id, - size_t sz, - int create, - int perms, - void *virtual_addr, - int flags) + size_t sz, + int create, + int perms, + void *virtual_addr, + int flags) { ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); if (this->open_and_attach (external_id, sz, create, - perms, virtual_addr, flags) == -1) + perms, virtual_addr, flags) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); + ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); } // The "do nothing" constructor. @@ -74,12 +75,14 @@ ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (void) // (maw@fsg.com). ACE_SV_Shared_Memory::ACE_SV_Shared_Memory (ACE_HANDLE int_id, - int flags) + int flags) : internal_id_ (int_id), size_ (0) { ACE_TRACE ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"); if (this->attach (0, flags) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); + ACE_LIB_TEXT ("ACE_SV_Shared_Memory::ACE_SV_Shared_Memory"))); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/SV_Shared_Memory.h b/ace/SV_Shared_Memory.h index 0cbb8febe7e..4f4da514c45 100644 --- a/ace/SV_Shared_Memory.h +++ b/ace/SV_Shared_Memory.h @@ -15,12 +15,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -30,12 +25,14 @@ #include "ace/os_include/sys/os_ipc.h" #include "ace/Default_Constants.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_SV_Shared_Memory * * @brief This is a wrapper for System V shared memory. */ -class ACE_Memory_Export ACE_SV_Shared_Memory +class ACE_Export ACE_SV_Shared_Memory { public: enum @@ -114,6 +111,8 @@ protected: size_t round_up (size_t len); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/SV_Shared_Memory.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/SV_Shared_Memory.inl b/ace/SV_Shared_Memory.inl index f01f5b2c969..3aaa41414e0 100644 --- a/ace/SV_Shared_Memory.inl +++ b/ace/SV_Shared_Memory.inl @@ -1,12 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// SV_Shared_Memory.i - #include "ace/OS_NS_sys_shm.h" #include "ace/Global_Macros.h" #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE size_t ACE_SV_Shared_Memory::round_up (size_t len) { @@ -17,15 +18,15 @@ ACE_SV_Shared_Memory::round_up (size_t len) // Creates a shared memory segment of SIZE bytes. Does *not* attach // this memory segment... -ACE_INLINE int +ACE_INLINE int ACE_SV_Shared_Memory::open (key_t external_id, size_t sz, int create, int perms) { ACE_TRACE ("ACE_SV_Shared_Memory::open"); #if defined (ACE_WIN32) - ACE_UNUSED_ARG(perms); - ACE_UNUSED_ARG(create); - ACE_UNUSED_ARG(sz); - ACE_UNUSED_ARG(external_id); + ACE_UNUSED_ARG(perms); + ACE_UNUSED_ARG(create); + ACE_UNUSED_ARG(sz); + ACE_UNUSED_ARG(external_id); ACE_NOTSUP_RETURN (-1); #else this->segment_ptr_ = 0; @@ -37,15 +38,15 @@ ACE_SV_Shared_Memory::open (key_t external_id, size_t sz, int create, int perms) #endif /* ACE_WIN32 */ } -// Attachs to the shared memory segment. +// Attachs to the shared memory segment. ACE_INLINE int ACE_SV_Shared_Memory::attach (void *virtual_addr, int flags) { ACE_TRACE ("ACE_SV_Shared_Memory::attach"); #if defined (ACE_WIN32) - ACE_UNUSED_ARG(flags); - ACE_UNUSED_ARG(virtual_addr); + ACE_UNUSED_ARG(flags); + ACE_UNUSED_ARG(virtual_addr); ACE_NOTSUP_RETURN (-1); #else this->segment_ptr_ = ACE_OS::shmat (this->internal_id_, virtual_addr, flags); @@ -53,23 +54,23 @@ ACE_SV_Shared_Memory::attach (void *virtual_addr, int flags) #endif /* ACE_WIN32 */ } -// Interface to the underlying shared memory control function. +// Interface to the underlying shared memory control function. ACE_INLINE int ACE_SV_Shared_Memory::control (int cmd, void *buf) { ACE_TRACE ("ACE_SV_Shared_Memory::control"); #if defined (ACE_WIN32) - ACE_UNUSED_ARG(cmd); - ACE_UNUSED_ARG(buf); - - ACE_NOTSUP_RETURN (-1); + ACE_UNUSED_ARG(cmd); + ACE_UNUSED_ARG(buf); + + ACE_NOTSUP_RETURN (-1); #else return ACE_OS::shmctl (this->internal_id_, cmd, (struct shmid_ds *) buf); #endif /* ACE_WIN32 */ } -// The overall size of the segment. +// The overall size of the segment. ACE_INLINE size_t ACE_SV_Shared_Memory::get_segment_size (void) const @@ -78,7 +79,7 @@ ACE_SV_Shared_Memory::get_segment_size (void) const return this->size_; } -// Removes the shared memory segment. +// Removes the shared memory segment. ACE_INLINE int ACE_SV_Shared_Memory::remove (void) @@ -114,3 +115,5 @@ ACE_SV_Shared_Memory::get_id (void) const ACE_TRACE ("ACE_SV_Shared_Memory::get_id"); return this->internal_id_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sample_History.cpp b/ace/Sample_History.cpp index fac82d844e1..ffa138571d0 100644 --- a/ace/Sample_History.cpp +++ b/ace/Sample_History.cpp @@ -12,6 +12,9 @@ ACE_RCSID(ace, Sample_History, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Sample_History::ACE_Sample_History (size_t max_samples) : max_samples_ (max_samples) , sample_count_ (0) @@ -58,3 +61,5 @@ ACE_Sample_History::collect_basic_stats (ACE_Basic_Stats &stats) const stats.sample (this->samples_[i]); } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sample_History.h b/ace/Sample_History.h index 83febc46f39..0ab521dac66 100644 --- a/ace/Sample_History.h +++ b/ace/Sample_History.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Basic_Stats; /// Save multiple samples in an array @@ -78,6 +81,8 @@ private: ACE_UINT64 *samples_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Sample_History.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Sample_History.inl b/ace/Sample_History.inl index e3882a28bc3..42eca62e69b 100644 --- a/ace/Sample_History.inl +++ b/ace/Sample_History.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Sample_History::sample (ACE_UINT64 value) { @@ -18,3 +22,5 @@ ACE_Sample_History::get_sample (size_t i) const return this->samples_[i]; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sbrk_Memory_Pool.cpp b/ace/Sbrk_Memory_Pool.cpp index ae9157a09c9..eda87a42c63 100644 --- a/ace/Sbrk_Memory_Pool.cpp +++ b/ace/Sbrk_Memory_Pool.cpp @@ -7,6 +7,9 @@ ACE_RCSID(ace, Sbrk_Memory_Pool, "$Id$") #if !defined (ACE_LACKS_SBRK) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Sbrk_Memory_Pool) // Ask system for more local memory via sbrk(2). @@ -107,7 +110,6 @@ ACE_Sbrk_Memory_Pool::base_addr (void) const return 0; } - // Round up the request to a multiple of the page size. size_t @@ -116,4 +118,7 @@ ACE_Sbrk_Memory_Pool::round_up (size_t nbytes) ACE_TRACE ("ACE_Sbrk_Memory_Pool::round_up"); return ACE::round_to_pagesize (nbytes); } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_LACKS_SBRK */ diff --git a/ace/Sbrk_Memory_Pool.h b/ace/Sbrk_Memory_Pool.h index 55856be303b..092099e9e34 100644 --- a/ace/Sbrk_Memory_Pool.h +++ b/ace/Sbrk_Memory_Pool.h @@ -16,12 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -32,6 +27,9 @@ #include "ace/ACE.h" #include "ace/os_include/sys/os_mman.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Sbrk_Memory_Pool_Options * @@ -40,7 +38,7 @@ * This should be a nested class, but that breaks too many * compilers. */ -class ACE_Memory_Export ACE_Sbrk_Memory_Pool_Options +class ACE_Export ACE_Sbrk_Memory_Pool_Options { }; @@ -49,7 +47,7 @@ class ACE_Memory_Export ACE_Sbrk_Memory_Pool_Options * * @brief Make a memory pool that is based on <sbrk(2)>. */ -class ACE_Memory_Export ACE_Sbrk_Memory_Pool +class ACE_Export ACE_Sbrk_Memory_Pool { public: typedef ACE_Sbrk_Memory_Pool_Options OPTIONS; @@ -111,6 +109,9 @@ protected: /// appropriate chunksize. virtual size_t round_up (size_t nbytes); }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_LACKS_SBRK */ #include /**/ "ace/post.h" diff --git a/ace/Sched_Params.cpp b/ace/Sched_Params.cpp index a86c0b55d0f..e6395c148a3 100644 --- a/ace/Sched_Params.cpp +++ b/ace/Sched_Params.cpp @@ -29,6 +29,8 @@ ACE_RCSID(ace, Sched_Params, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + int ACE_Sched_Params::priority_min (const Policy policy, const int scope) @@ -127,7 +129,7 @@ ACE_Sched_Params::priority_min (const Policy policy, ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); return THREAD_PRIORITY_IDLE; -#elif defined (VXWORKS) +#elif defined (ACE_VXWORKS) ACE_UNUSED_ARG (policy); ACE_UNUSED_ARG (scope); return 255; @@ -332,3 +334,5 @@ ACE_Sched_Params::previous_priority (const Policy policy, ACE_NOTSUP_RETURN (-1); #endif /* ACE_HAS_THREADS */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sched_Params.h b/ace/Sched_Params.h index c68e701f9b4..76603c8a21a 100644 --- a/ace/Sched_Params.h +++ b/ace/Sched_Params.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #include "ace/Time_Value.h" #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Sched_Params * @@ -49,7 +51,7 @@ * usual using <ACE_OS::thr_prio> or via the ACE_Thread * interface. See the parameter descriptions in the private: * section below. - * NOTE: this class does not do any checking of parameters. It + * @note This class does not do any checking of parameters. It * is just a container class. If it is constructed with values * that are not supported on a platform, the call to * <ACE_OS::sched_params> will fail by returning -1 with EINVAL @@ -220,6 +222,8 @@ private: int done_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Sched_Params.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Sched_Params.inl b/ace/Sched_Params.inl index 041f9cb1648..2917acc691d 100644 --- a/ace/Sched_Params.inl +++ b/ace/Sched_Params.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ // ============================================================================ @@ -17,6 +18,8 @@ // // ============================================================================ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Sched_Params::ACE_Sched_Params ( const Policy policy, @@ -134,3 +137,5 @@ ACE_Sched_Priority_Iterator::next (void) this->scope ()); this->done_ = old_priority == priority_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Select_Reactor.cpp b/ace/Select_Reactor.cpp index 3c7f5850f03..7f1e9505855 100644 --- a/ace/Select_Reactor.cpp +++ b/ace/Select_Reactor.cpp @@ -4,6 +4,7 @@ ACE_RCSID(ace, Select_Reactor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) # if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) @@ -28,3 +29,5 @@ template class ACE_Lock_Adapter< ACE_Reactor_Token_T<ACE_Noop_Token> >; # pragma instantiate ACE_Lock_Adapter< ACE_Reactor_Token_T<ACE_Noop_Token> > # endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Select_Reactor.h b/ace/Select_Reactor.h index a52203869cb..8e7b1697ce3 100644 --- a/ace/Select_Reactor.h +++ b/ace/Select_Reactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + //@@ TAO_REACTOR_SPL_COMMENT_HOOK_START typedef ACE_Reactor_Token_T<ACE_SELECT_TOKEN> ACE_Select_Reactor_Token; @@ -31,8 +33,8 @@ typedef ACE_Select_Reactor_T<ACE_Select_Reactor_Token> ACE_Select_Reactor; /** * @class ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> > * - * @brief Template specialization of <ACE_Guard> for the - * <ACE_Null_Mutex>. + * @brief Template specialization of ACE_Guard for the + * ACE_Null_Mutex. * * This specialization is useful since it helps to speedup * performance of the "Null_Mutex" considerably. @@ -54,11 +56,14 @@ public: void dump (void) const {} private: - // = Prevent assignment and initialization. - ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> > &)) - ACE_UNIMPLEMENTED_FUNC (ACE_Guard (const ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> > &)) + // Disallow copying and assignment. + ACE_Guard (const ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> > &); + void operator= (const ACE_Guard< ACE_Reactor_Token_T<ACE_Noop_Token> > &); + }; #endif /* ACE_MT_SAFE && ACE_MT_SAFE == 0 */ +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SELECT_REACTOR_H */ diff --git a/ace/Select_Reactor_Base.cpp b/ace/Select_Reactor_Base.cpp index ab156aa1c20..75f3efb2d19 100644 --- a/ace/Select_Reactor_Base.cpp +++ b/ace/Select_Reactor_Base.cpp @@ -19,6 +19,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) #define ACE_SELECT_REACTOR_HANDLE(H) (this->event_handlers_[(H)].handle_) #define ACE_SELECT_REACTOR_EVENT_HANDLER(THIS,H) ((THIS)->event_handlers_[(H)].event_handler_) @@ -444,8 +446,7 @@ ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, // Call remove_reference() if the removal is complete and reference // counting is needed. - if (complete_removal && - requires_reference_counting) + if (complete_removal && requires_reference_counting) { event_handler->remove_reference (); } @@ -523,7 +524,7 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%t) max_handlep1_ = %d, max_size_ = %d\n"), + ACE_LIB_TEXT ("max_handlep1_ = %d, max_size_ = %d\n"), this->max_handlep1_, this->max_size_)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("["))); @@ -532,10 +533,10 @@ ACE_Select_Reactor_Handler_Repository::dump (void) const for (ACE_Select_Reactor_Handler_Repository_Iterator iter (this); iter.next (event_handler) != 0; iter.advance ()) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (event_handler = %x, event_handler->handle_ = %d)"), + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" (event_handler = %x, event_handler->handle_ = %d)\n"), event_handler, event_handler->get_handle ())); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" ]"))); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (" ]\n"))); ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } @@ -586,7 +587,7 @@ ACE_Select_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, if (this->notify_queue_.is_empty ()) return 0; - ACE_Notification_Buffer *temp; + ACE_Notification_Buffer *temp = 0; ACE_Unbounded_Queue <ACE_Notification_Buffer *> local_queue; size_t queue_size = this->notify_queue_.size (); @@ -706,7 +707,7 @@ ACE_Select_Reactor_Notify::open (ACE_Reactor_Impl *r, #endif /* F_SETFD */ #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) - ACE_Notification_Buffer *temp; + ACE_Notification_Buffer *temp = 0; ACE_NEW_RETURN (temp, ACE_Notification_Buffer[ACE_REACTOR_NOTIFICATION_ARRAY_SIZE], @@ -749,7 +750,7 @@ ACE_Select_Reactor_Notify::close (void) #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) // Free up the dynamically allocated resources. - ACE_Notification_Buffer **b; + ACE_Notification_Buffer **b = 0; for (ACE_Unbounded_Queue_Iterator<ACE_Notification_Buffer *> alloc_iter (this->alloc_queue_); alloc_iter.next (b) != 0; @@ -802,7 +803,7 @@ ACE_Select_Reactor_Notify::notify (ACE_Event_Handler *event_handler, if (free_queue_.dequeue_head (temp) == -1) { // Grow the queue of available buffers. - ACE_Notification_Buffer *temp1; + ACE_Notification_Buffer *temp1 = 0; ACE_NEW_RETURN (temp1, ACE_Notification_Buffer[ACE_REACTOR_NOTIFICATION_ARRAY_SIZE], @@ -922,7 +923,7 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) // holding the lock while delivering callbacks... ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, mon, this->notify_queue_lock_, -1); - ACE_Notification_Buffer *temp; + ACE_Notification_Buffer *temp = 0; if (notify_queue_.is_empty ()) return 0; @@ -939,7 +940,7 @@ ACE_Select_Reactor_Notify::dispatch_notify (ACE_Notification_Buffer &buffer) -1); bool write_next_buffer = false; - ACE_Notification_Buffer ** next; + ACE_Notification_Buffer ** next = 0; if(!this->notify_queue_.is_empty()) { @@ -1255,16 +1256,4 @@ ACE_Select_Reactor_Impl::resumable_handler (void) return 0; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) -template class ACE_Unbounded_Queue <ACE_Notification_Buffer *>; -template class ACE_Unbounded_Queue_Iterator <ACE_Notification_Buffer *>; -template class ACE_Node <ACE_Notification_Buffer *>; -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) -#pragma instantiate ACE_Unbounded_Queue <ACE_Notification_Buffer *> -#pragma instantiate ACE_Unbounded_Queue_Iterator <ACE_Notification_Buffer *> -#pragma instantiate ACE_Node <ACE_Notification_Buffer *> -#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Select_Reactor_Base.h b/ace/Select_Reactor_Base.h index fb340cb4beb..fdcd4eee991 100644 --- a/ace/Select_Reactor_Base.h +++ b/ace/Select_Reactor_Base.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,19 +27,22 @@ #include "ace/Reactor_Impl.h" #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) -#include "ace/Unbounded_Queue.h" +# include "ace/Unbounded_Queue.h" #endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Add useful typedefs to simplify the following code. typedef void (ACE_Handle_Set::*ACE_FDS_PTMF) (ACE_HANDLE); typedef int (ACE_Event_Handler::*ACE_EH_PTMF) (ACE_HANDLE); // Forward declaration. class ACE_Select_Reactor_Impl; +class ACE_Sig_Handler; /* * Hook to specialize the Select_Reactor_Base implementation - * with the concrete reactor, e.g., select or tp reactor + * with the concrete reactor, e.g., select or tp reactor * specified at build/compilation time. */ //@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK @@ -68,8 +71,8 @@ public: * * @brief An ACE_Event_Handler and its associated ACE_HANDLE. * - * One <ACE_Event_Handler> is registered for one or more - * <ACE_HANDLE>. At various points, this information must be + * One ACE_Event_Handler is registered for one or more + * ACE_HANDLE. At various points, this information must be * stored explicitly. This class provides a lightweight * mechanism to do so. */ @@ -95,7 +98,7 @@ public: /// Handle. ACE_HANDLE handle_; - /// <ACE_Event_Handler> associated with the <ACE_HANDLE>. + /// ACE_Event_Handler associated with the ACE_HANDLE. ACE_Event_Handler *event_handler_; }; @@ -161,8 +164,8 @@ public: /// because of a thread trying to unblock the <Reactor_Impl> virtual int dispatch_notify (ACE_Notification_Buffer &buffer); - /// Read one of the notify call on the <handle> into the - /// <buffer>. This could be because of a thread trying to unblock + /// Read one of the notify call on the @a handle into the + /// @a buffer. This could be because of a thread trying to unblock /// the <Reactor_Impl> virtual int read_notify_pipe (ACE_HANDLE handle, ACE_Notification_Buffer &buffer); @@ -170,7 +173,7 @@ public: /// Verify whether the buffer has dispatchable info or not. virtual int is_dispatchable (ACE_Notification_Buffer &buffer); - /// Called back by the <ACE_Select_Reactor> when a thread wants to + /// Called back by the ACE_Select_Reactor when a thread wants to /// unblock us. virtual int handle_input (ACE_HANDLE handle); @@ -196,14 +199,14 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. If <eh> == 0, all notifications for all + * ACE_Event_Handler object. If @a eh == 0, all notifications for all * handlers are removed (but not any notifications posted just to wake up * the reactor itself). Returns the number of notifications purged. * Returns -1 on error. */ virtual int purge_pending_notifications ( - ACE_Event_Handler *, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + ACE_Event_Handler *sh, + ACE_Reactor_Mask mask = ACE_Event_Handler::ALL_EVENTS_MASK); /// Dump the state of an object. virtual void dump (void) const; @@ -213,16 +216,16 @@ public: protected: /** - * Keep a back pointer to the <ACE_Select_Reactor>. If this value - * if NULL then the <ACE_Select_Reactor> has been initialized with + * Keep a back pointer to the ACE_Select_Reactor. If this value + * if NULL then the ACE_Select_Reactor has been initialized with * <disable_notify_pipe>. */ ACE_Select_Reactor_Impl *select_reactor_; /** - * Contains the <ACE_HANDLE> the <ACE_Select_Reactor> is listening - * on, as well as the <ACE_HANDLE> that threads wanting the - * attention of the <ACE_Select_Reactor> will write to. + * Contains the ACE_HANDLE the ACE_Select_Reactor is listening + * on, as well as the ACE_HANDLE that threads wanting the + * attention of the ACE_Select_Reactor will write to. */ ACE_Pipe notification_pipe_; @@ -260,13 +263,13 @@ protected: /** * @class ACE_Select_Reactor_Handler_Repository * - * @brief Used to map <ACE_HANDLE>s onto the appropriate - * <ACE_Event_Handler> *. + * @brief Used to map ACE_HANDLEs onto the appropriate + * ACE_Event_Handler *. * * This class is necessary to shield differences between UNIX - * and Win32. In UNIX, <ACE_HANDLE> is an int, whereas in Win32 + * and Win32. In UNIX, ACE_HANDLE is an int, whereas in Win32 * it's a void *. This class hides all these details from the - * bulk of the <ACE_Select_Reactor> code. All of these methods + * bulk of the ACE_Select_Reactor code. All of these methods * are called with the main <Select_Reactor> token lock held. */ class ACE_Export ACE_Select_Reactor_Handler_Repository @@ -298,19 +301,19 @@ public: // = Search structure operations. /** - * Return the <ACE_Event_Handler *> associated with <ACE_HANDLE>. + * Return the <ACE_Event_Handler *> associated with ACE_HANDLE. * If <index_p> is non-0, then return the index location of the * <handle>, if found. */ ACE_Event_Handler *find (ACE_HANDLE handle, size_t *index_p = 0); - /// Bind the <ACE_Event_Handler *> to the <ACE_HANDLE> with the - /// appropriate <ACE_Reactor_Mask> settings. + /// Bind the ACE_Event_Handler * to the ACE_HANDLE with the + /// appropriate ACE_Reactor_Mask settings. int bind (ACE_HANDLE, ACE_Event_Handler *, ACE_Reactor_Mask); - /// Remove the binding of <ACE_HANDLE> in accordance with the <mask>. + /// Remove the binding of ACE_HANDLE in accordance with the @a mask. int unbind (ACE_HANDLE, ACE_Reactor_Mask mask); @@ -376,7 +379,7 @@ private: /** * @class ACE_Select_Reactor_Handler_Repository_Iterator * - * @brief Iterate through the <ACE_Select_Reactor_Handler_Repository>. + * @brief Iterate through the ACE_Select_Reactor_Handler_Repository. */ class ACE_Export ACE_Select_Reactor_Handler_Repository_Iterator { @@ -438,7 +441,7 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. Returns the number of notifications + * ACE_Event_Handler object. Returns the number of notifications * purged. Returns -1 on error. */ virtual int purge_pending_notifications (ACE_Event_Handler * = 0, @@ -451,7 +454,7 @@ public: virtual int resumable_handler (void); /* - * Hook to add concrete methods required to specialize the + * Hook to add concrete methods required to specialize the * implementation with concrete methods required for the concrete * reactor implementation, for example, select, tp reactors. */ @@ -461,14 +464,14 @@ protected: /// Allow manipulation of the <wait_set_> mask and <ready_set_> mask. virtual int bit_ops (ACE_HANDLE handle, ACE_Reactor_Mask mask, - ACE_Select_Reactor_Handle_Set &wait_Set, + ACE_Select_Reactor_Handle_Set &handle_set, int ops); /// Enqueue ourselves into the list of waiting threads at the /// appropriate point specified by <requeue_position_>. virtual void renew (void) = 0; - /// Check to see if the <Event_Handler> associated with <handle> is + /// Check to see if the <Event_Handler> associated with @a handle is /// suspended. Returns 0 if not, 1 if so. virtual int is_suspended_i (ACE_HANDLE handle) = 0; @@ -480,7 +483,6 @@ protected: /// Table that maps <ACE_HANDLEs> to <ACE_Event_Handler *>'s. ACE_Select_Reactor_Handler_Repository handler_rep_; - /// Tracks handles that are ready for dispatch from <select> ACE_Select_Reactor_Handle_Set dispatch_set_; @@ -497,24 +499,27 @@ protected: /// Defined as a pointer to allow overriding by derived classes... ACE_Timer_Queue *timer_queue_; - /// Keeps track of whether we should delete the timer queue (if we - /// didn't create it, then we don't delete it). - int delete_timer_queue_; - /// Handle signals without requiring global/static variables. ACE_Sig_Handler *signal_handler_; - /// Keeps track of whether we should delete the signal handler (if we - /// didn't create it, then we don't delete it). - int delete_signal_handler_; - - /// Callback object that unblocks the <ACE_Select_Reactor> if it's + /// Callback object that unblocks the ACE_Select_Reactor if it's /// sleeping. ACE_Reactor_Notify *notify_handler_; + /// Keeps track of whether we should delete the timer queue (if we + /// didn't create it, then we don't delete it). + bool delete_timer_queue_; + + /// Keeps track of whether we should delete the signal handler (if we + /// didn't create it, then we don't delete it). + bool delete_signal_handler_; + /// Keeps track of whether we need to delete the notify handler (if /// we didn't create it, then we don't delete it). - int delete_notify_handler_; + bool delete_notify_handler_; + + /// True if we've been initialized yet... + bool initialized_; /// Restart the <handle_events> event-loop method automatically when /// <select> is interrupted via <EINTR>. @@ -529,9 +534,6 @@ protected: */ int requeue_position_; - /// True if we've been initialized yet... - int initialized_; - /// The original thread that created this Select_Reactor. ACE_thread_t owner_; @@ -558,6 +560,7 @@ protected: private: + /// Determine whether we should renew Select_Reactor's token after handling /// the notification message. int supress_renew_; @@ -567,6 +570,8 @@ private: ACE_Select_Reactor_Impl &operator = (const ACE_Select_Reactor_Impl &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Select_Reactor_Base.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Select_Reactor_Base.inl b/ace/Select_Reactor_Base.inl index 90b2dc7e54c..83c561b8e8d 100644 --- a/ace/Select_Reactor_Base.inl +++ b/ace/Select_Reactor_Base.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Reactor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Event_Tuple::~ACE_Event_Tuple (void) { @@ -55,11 +58,14 @@ ACE_INLINE ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms) : handler_rep_ (*this) , timer_queue_ (0) - , delete_timer_queue_ (0) - , delete_signal_handler_ (0) - , delete_notify_handler_ (0) + , signal_handler_ (0) + , notify_handler_ (0) + , delete_timer_queue_ (false) + , delete_signal_handler_ (false) + , delete_notify_handler_ (false) + , initialized_ (false) + , restart_ (0) , requeue_position_ (-1) // Requeue at end of waiters by default. - , initialized_ (0) , state_changed_ (0) , mask_signals_ (ms) , supress_renew_ (0) @@ -77,3 +83,5 @@ ACE_Select_Reactor_Impl::supress_notify_renew (int sr) { this->supress_renew_ = sr; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Select_Reactor_T.cpp b/ace/Select_Reactor_T.cpp index d864f6728bb..994477eb215 100644 --- a/ace/Select_Reactor_T.cpp +++ b/ace/Select_Reactor_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_SELECT_REACTOR_T_C -#define ACE_SELECT_REACTOR_T_C +#ifndef ACE_SELECT_REACTOR_T_CPP +#define ACE_SELECT_REACTOR_T_CPP #include "ace/Select_Reactor_T.h" @@ -27,10 +27,7 @@ */ //@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK -// @@ The latest version of SunCC can't grok the code if we put inline -// function here. Therefore, we temporarily disable the code here. -// We shall turn this back on once we know the problem gets fixed. -#if 1 // !defined (__ACE_INLINE__) +#if !defined (__ACE_INLINE__) #include "ace/Select_Reactor_T.inl" #endif /* __ACE_INLINE__ */ @@ -38,6 +35,8 @@ ACE_RCSID (ace, Select_Reactor_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Select_Reactor_T) #if defined (ACE_WIN32) @@ -382,7 +381,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::open ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1)); // Can't initialize ourselves more than once. - if (this->initialized_ > 0) + if (this->initialized_) return -1; this->owner_ = ACE_Thread::self (); @@ -1199,7 +1198,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::dispatch_io_set // clear the bit from that dispatch mask, // so when we need to restart the iteration (rebuilding the iterator...) - // we will not dispatch the already dipatched handlers + // we will not dispatch the already dispatched handlers this->clear_dispatch_mask (handle, mask); if (this->state_changed_) @@ -1352,6 +1351,15 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::dispatch io_handlers_dispatched) == -1) // State has changed, so exit loop. break; + + // if state changed, we need to re-eval active_handle_count, + // so we will not end with an endless loop + if (this->state_changed_) + { + active_handle_count = this->dispatch_set_.rd_mask_.num_set () + + this->dispatch_set_.wr_mask_.num_set () + + this->dispatch_set_.ex_mask_.num_set (); + } } while (active_handle_count > 0); @@ -1481,7 +1489,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::check_handles (void) select_width = 0; # else select_width = int (h) + 1; -# endif /* ACE_WIN64 */ +# endif /* ACE_WIN32 */ if (ACE_OS::select (select_width, rd_mask, 0, 0, @@ -1552,10 +1560,25 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::dump (void) const ++handle_iter_ex_ready) ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("except_handle_ready = %d\n"), h)); + for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.wr_mask_); + (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE; + ++handle_iter_su_ready) + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("write_handle_suspend = %d\n"), h)); + + for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.rd_mask_); + (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE; + ++handle_iter_su_ready) + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("read_handle_suspend = %d\n"), h)); + + for (ACE_Handle_Set_Iterator handle_iter_su_ready (this->suspend_set_.ex_mask_); + (h = handle_iter_su_ready ()) != ACE_INVALID_HANDLE; + ++handle_iter_su_ready) + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("except_handle_suspend = %d\n"), h)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("restart_ = %d\n"), this->restart_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nrequeue_position_ = %d\n"), this->requeue_position_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ninitialized_ = %d\n"), this->initialized_)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\nowner_ = %d\n"), this->owner_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("requeue_position_ = %d\n"), this->requeue_position_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("initialized_ = %d\n"), this->initialized_)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("owner_ = %d\n"), this->owner_)); #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) this->notify_handler_->dump (); @@ -1565,4 +1588,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ } -#endif /* ACE_SELECT_REACTOR_T_C */ + +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_SELECT_REACTOR_T_CPP */ diff --git a/ace/Select_Reactor_T.h b/ace/Select_Reactor_T.h index ecaf22957ed..bb9cdceed61 100644 --- a/ace/Select_Reactor_T.h +++ b/ace/Select_Reactor_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,9 +23,11 @@ #include "ace/Lock_Adapter_T.h" #include "ace/Token.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /* - * Hook for specializing the reactor with the concrete - * type, for example, select, or thread pool. + * Hook for specializing the reactor with the concrete + * type, for example, select, or thread pool. */ //@@ REACTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK @@ -128,7 +130,7 @@ public: /// Set a user-specified timer queue. virtual int timer_queue (ACE_Timer_Queue *tq); - /// Return the current <ACE_Timer_Queue>. + /// Return the current ACE_Timer_Queue. virtual ACE_Timer_Queue *timer_queue (void) const; /// Close down the select_reactor and release all of its resources. @@ -147,20 +149,20 @@ public: virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero); /** - * This event loop driver that blocks for <max_wait_time> before + * This event loop driver that blocks for @a max_wait_time before * returning. It will return earlier if timer events, I/O events, - * or signal events occur. Note that <max_wait_time> can be 0, in + * or signal events occur. Note that @a max_wait_time can be 0, in * which case this method blocks indefinitely until events occur. * - * <max_wait_time> is decremented to reflect how much time this call + * @a max_wait_time is decremented to reflect how much time this call * took. For instance, if a time value of 3 seconds is passed to * handle_events and an event occurs after 2 seconds, - * <max_wait_time> will equal 1 second. This can be used if an + * @a max_wait_time will equal 1 second. This can be used if an * application wishes to handle events for some fixed amount of * time. * - * Returns the total number of I/O and Timer <ACE_Event_Handler>s - * that were dispatched, 0 if the <max_wait_time> elapsed without + * Returns the total number of I/O and Timer ACE_Event_Handler's + * that were dispatched, 0 if the @a max_wait_time elapsed without * dispatching any handlers, or -1 if something goes wrong. * * Current <alertable_handle_events> is identical to @@ -171,7 +173,7 @@ public: /** * This method is just like the one above, except the - * <max_wait_time> value is a reference and can therefore never be + * @a max_wait_time value is a reference and can therefore never be * NULL. * * Current <alertable_handle_events> is identical to @@ -196,7 +198,7 @@ public: */ virtual void deactivate (int do_stop); - // = Register and remove <ACE_Event_Handler>s. + // = Register and remove ACE_Event_Handlers. /** * Register a <eh> with a particular <mask>. Note that the * <Select_Reactor> will call <ACE_Event_Handler::get_handle> to @@ -206,9 +208,9 @@ public: ACE_Reactor_Mask mask); /** - * Register a <eh> with a particular <mask>. Note that since the - * <handle> is given the Select_Reactor will *not* call - * <ACE_Event_Handler::get_handle> to extract the underlying I/O + * Register a @a eh with a particular @a mask. Note that since the + * @a handle is given the Select_Reactor will *not* call + * ACE_Event_Handler::get_handle() to extract the underlying I/O * handle. */ virtual int register_handler (ACE_HANDLE handle, @@ -236,7 +238,7 @@ public: ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask); - /// Register <eh> with all the <handles> in the <Handle_Set>. + /// Register @a eh with all the @a handles in the <Handle_Set>. virtual int register_handler (const ACE_Handle_Set &handles, ACE_Event_Handler *eh, ACE_Reactor_Mask mask); @@ -348,9 +350,10 @@ public: * @see reset_timer_interval() * * @param event_handler Event handler to schedule on reactor - * @param arg Argument passed to the handle_timeout() method of event_handler - * @param delay Time interval after which the timer will expire - * @param interval Time interval after which the timer will be automatically rescheduled + * @param arg Argument passed to the handle_timeout() method of event_handler + * @param delay Time interval after which the timer will expire + * @param interval Time interval after which the timer will be automatically + * rescheduled * @return -1 on failure, a timer_id value on success */ virtual long schedule_timer (ACE_Event_Handler * event_handler, @@ -378,7 +381,7 @@ public: int dont_call_handle_close = 1); /** - * Cancel the single <ACE_Event_Handler> that matches the <timer_id> + * Cancel the single ACE_Event_Handler that matches the <timer_id> * value (which was returned from the <schedule> method). If arg is * non-NULL then it will be set to point to the ``magic cookie'' * argument passed in when the <Event_Handler> was registered. This @@ -612,9 +615,9 @@ protected: // = Dispatching methods. /** - * Template Method that dispatches <ACE_Event_Handler>s for time + * Template Method that dispatches ACE_Event_Handlers for time * events, I/O events, and signal events. Returns the total number - * of <ACE_Event_Handler>s that were dispatched or -1 if something + * of ACE_Event_Handlers that were dispatched or -1 if something * goes wrong. */ virtual int dispatch (int nfound, @@ -697,10 +700,9 @@ private: ACE_UNIMPLEMENTED_FUNC (ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &operator= (const ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &) ) }; -// @@ The latest version of SunCC can't grok the code if we put inline -// function here. Therefore, we temporarily disable the code here. -// We shall turn this back on once we know the problem gets fixed. -#if 0 // defined (__ACE_INLINE__) +ACE_END_VERSIONED_NAMESPACE_DECL + +#if defined (__ACE_INLINE__) #include "ace/Select_Reactor_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Select_Reactor_T.inl b/ace/Select_Reactor_T.inl index 136d445810a..0ad9033f9a0 100644 --- a/ace/Select_Reactor_T.inl +++ b/ace/Select_Reactor_T.inl @@ -1,16 +1,22 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Reactor.h" +#include "ace/Signal.h" -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (ACE_Event_Handler *h) { ACE_TRACE ("ACE_Select_Reactor_T::resume_handler"); return this->resume_handler (h->get_handle ()); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (const ACE_Handle_Set &handles) { ACE_TRACE ("ACE_Select_Reactor_T::resume_handler"); @@ -26,14 +32,16 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (const ACE_Handle return 0; } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (ACE_Event_Handler *h) { ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler"); return this->suspend_handler (h->get_handle ()); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (const ACE_Handle_Set &handles) { ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler"); @@ -49,7 +57,8 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (const ACE_Handl return 0; } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (int signum, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp, @@ -64,40 +73,38 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (int signum, #if defined (ACE_WIN32) -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int -ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_Event_Handler *event_handler, - ACE_HANDLE event_handle) +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int +ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_Event_Handler *, + ACE_HANDLE ) { // Don't have an implementation for this yet... - ACE_UNUSED_ARG (event_handler); - ACE_UNUSED_ARG (event_handle); ACE_NOTSUP_RETURN (-1); } #endif /* ACE_WIN32 */ -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int -ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_HANDLE event_handle, - ACE_HANDLE io_handle, - ACE_Event_Handler *event_handler, - ACE_Reactor_Mask mask) +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int +ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_HANDLE , + ACE_HANDLE , + ACE_Event_Handler *, + ACE_Reactor_Mask ) { // Don't have an implementation for this yet... - ACE_UNUSED_ARG (event_handle); - ACE_UNUSED_ARG (io_handle); - ACE_UNUSED_ARG (event_handler); - ACE_UNUSED_ARG (mask); ACE_NOTSUP_RETURN (-1); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler (int signum, ACE_Event_Handler **handler) { ACE_TRACE ("ACE_Select_Reactor_T::handler"); return this->handler_i (signum, handler); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::remove_handler (int signum, ACE_Sig_Action *new_disp, ACE_Sig_Action *old_disp, @@ -107,7 +114,8 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::remove_handler (int signum, return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> +ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::uses_event_associations (void) { // Since the Select_Reactor does not do any event associations, this @@ -120,7 +128,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::uses_event_associations (void) // Performs operations on the "ready" bits. -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ready_ops (ACE_Event_Handler *handler, ACE_Reactor_Mask mask, int ops) @@ -131,7 +139,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ready_ops (ACE_Event_Handler *ha // Performs operations on the "dispatch" masks. -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::mask_ops (ACE_Event_Handler *handler, ACE_Reactor_Mask mask, int ops) @@ -140,7 +148,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::mask_ops (ACE_Event_Handler *han return this->mask_ops (handler->get_handle (), mask, ops); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_Event_Handler *eh, ACE_Reactor_Mask mask) { @@ -148,7 +156,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_Event_Handl return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_Event_Handler *eh, ACE_Reactor_Mask mask) { @@ -156,7 +164,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_Event_Handler return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask mask) { @@ -164,7 +172,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_HANDLE hand return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_HANDLE handle, ACE_Reactor_Mask mask) { @@ -172,14 +180,14 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_HANDLE handle return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ ACE_Lock & +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE ACE_Lock & ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::lock (void) { ACE_TRACE ("ACE_Select_Reactor_T::lock"); return this->lock_adapter_; } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ void +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE void ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wakeup_all_threads (void) { // Send a notification, but don't block if there's no one to receive @@ -187,25 +195,25 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wakeup_all_threads (void) this->notify (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value *max_wait_time) { return this->handle_events (max_wait_time); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value &max_wait_time) { return this->handle_events (max_wait_time); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE int ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivated (void) { return this->deactivated_; } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ void +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE void ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop) { { @@ -218,8 +226,10 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop) this->wakeup_all_threads (); } -template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ size_t +template <class ACE_SELECT_REACTOR_TOKEN> ACE_INLINE size_t ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::size (void) const { return this->handler_rep_.size (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Semaphore.cpp b/ace/Semaphore.cpp index 374e4cad282..3a48bd38168 100644 --- a/ace/Semaphore.cpp +++ b/ace/Semaphore.cpp @@ -13,6 +13,8 @@ ACE_RCSID (ace, Semaphore, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Semaphore) void @@ -56,3 +58,5 @@ ACE_Semaphore::~ACE_Semaphore (void) this->remove (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Semaphore.h b/ace/Semaphore.h index 01c116ef991..afee6043bbd 100644 --- a/ace/Semaphore.h +++ b/ace/Semaphore.h @@ -24,6 +24,8 @@ #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -64,7 +66,7 @@ public: * value of <tv> is updated upon return to show the actual * (absolute) acquisition time. * - * NOTE: Solaris threads do not support timed semaphores. + * @note Solaris threads do not support timed semaphores. * Therefore, if you're running on Solaris you might want to * consider using the ACE POSIX pthreads implementation instead, * which can be enabled by compiling ACE with @@ -81,7 +83,7 @@ public: * The value of <*tv> is updated upon return to show the actual * (absolute) acquisition time. * - * NOTE: Solaris threads do not support timed semaphores. + * @note Solaris threads do not support timed semaphores. * Therefore, if you're running on Solaris you might want to * consider using the ACE POSIX pthreads implementation instead, * which can be enabled by compiling ACE with @@ -170,6 +172,8 @@ private: ACE_Semaphore (const ACE_Semaphore &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Semaphore.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Semaphore.inl b/ace/Semaphore.inl index a519c4e7920..8bfe49ce39c 100644 --- a/ace/Semaphore.inl +++ b/ace/Semaphore.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE const ACE_sema_t & ACE_Semaphore::lock (void) const { @@ -112,3 +115,5 @@ ACE_Semaphore::tryacquire_write_upgrade (void) { return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 4055edd6a78..e56b5b04489 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -34,6 +34,8 @@ ACE_RCSID (ace, Service_Config, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_Service_Config) void @@ -44,13 +46,6 @@ ACE_Service_Config::dump (void) const #endif /* ACE_HAS_DUMP */ } -// All the factory functions that allocate default statically linked -// services should be placed below. - -// Allocate a Service Manager. - -ACE_FACTORY_DEFINE (ACE, ACE_Service_Manager) - // ---------------------------------------- // Set the signal handler to point to the handle_signal() function. @@ -350,6 +345,15 @@ ACE_Service_Config::initialize (const ACE_Service_Type *sr, ACE_LIB_TEXT ("opening dynamic service %s\n"), sr->name ())); + ACE_Service_Type *srp = 0; + if (ACE_Service_Repository::instance ()->find + (sr->name (), + (const ACE_Service_Type **) &srp) >= 0) + ACE_ERROR_RETURN ((LM_DEBUG, + ACE_LIB_TEXT ("%s already installed, please remove first before reinstalling\n"), + sr->name ()), + 0); + if (sr->type ()->init (args.argc (), args.argv ()) == -1) { @@ -735,12 +739,14 @@ ACE_Service_Config::open_i (const ACE_TCHAR program_name[], // There's no point in dealing with this on NT since it doesn't // really support signals very well... #if !defined (ACE_LACKS_UNIX_SIGNALS) - // @@ This really ought to be a Singleton. - if (ACE_Reactor::instance ()->register_handler - (ACE_Service_Config::signum_, - ACE_Service_Config::signal_handler_) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("can't register signal handler\n"))); + // Only attempt to register a signal handler for positive + // signal numbers. + if (ACE_Service_Config::signum_ > 0) + if (ACE_Reactor::instance ()->register_handler + (ACE_Service_Config::signum_, + ACE_Service_Config::signal_handler_) == -1) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("can't register signal handler\n"))); #endif /* ACE_LACKS_UNIX_SIGNALS */ // See if we need to load the static services. @@ -914,3 +920,12 @@ ACE_Service_Config::start_daemon (void) ACE_TRACE ("ACE_Service_Config::start_daemon"); return ACE::daemonize (); } + +ACE_END_VERSIONED_NAMESPACE_DECL + +// All the factory functions that allocate default statically linked +// services should be placed below. + +// Allocate a Service Manager. + +ACE_FACTORY_DEFINE (ACE, ACE_Service_Manager) diff --git a/ace/Service_Config.h b/ace/Service_Config.h index 9397025be47..6fafb50408b 100644 --- a/ace/Service_Config.h +++ b/ace/Service_Config.h @@ -27,6 +27,8 @@ #include "ace/SString.h" #include "ace/OS_NS_signal.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. class ACE_Service_Object; class ACE_Service_Type; @@ -59,6 +61,8 @@ class ACE_DLL; "() \"" \ parameters \ "\"" + + #define ACE_REMOVE_SERVICE_DIRECTIVE(ident) \ ACE_LIB_TEXT ("remove ") \ ACE_LIB_TEXT (ident) @@ -74,7 +78,7 @@ class ACE_Svc_Conf_Param; ACE_LIB_TEXT (objectclass) \ ACE_LIB_TEXT ("\"") \ ACE_LIB_TEXT (" params=\"") \ - ACE_LIB_TEXT (parameters) + ACE_LIB_TEXT (parameters) \ ACE_LIB_TEXT ("\"/></dynamic></ACE_Svc_Conf>") #define ACE_REMOVE_SERVICE_DIRECTIVE(ident) \ ACE_LIB_TEXT ("<ACE_Svc_Conf><remove id=\"") \ @@ -83,11 +87,15 @@ class ACE_Svc_Conf_Param; class ACE_XML_Svc_Conf; #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ +ACE_END_VERSIONED_NAMESPACE_DECL + extern "C" { typedef ACE_Service_Object *(*ACE_SERVICE_ALLOCATOR) (ACE_Service_Object_Exterminator *); } +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Static_Svc_Descriptor * @@ -166,7 +174,11 @@ public: // = Initialization and termination methods. - /// Initialize the Service Repository. + /** + * Initialize the Service Repository. Note that initialising @a + * signum to a negative number will prevent a signal handler being + * registered when the repository is opened. + */ ACE_Service_Config (int ignore_static_svcs = 1, size_t size = ACE_Service_Config::MAX_SERVICES, int signum = SIGHUP); @@ -206,7 +218,7 @@ public: * number of errors encountered loading the services in the * specified svc.conf configuration file. If @a ignore_debug_flag is * non-0 then the application is responsible for setting the - * <ACE_Log_Msg::priority_mask> appropriately. + * @c ACE_Log_Msg::priority_mask appropriately. */ static int open (const ACE_TCHAR program_name[], const ACE_TCHAR *logger_key = ACE_DEFAULT_LOGGER_KEY, @@ -327,7 +339,7 @@ public: * Suspend @a svc_name. Note that this will not unlink the service * from the daemon if it was dynamically linked, it will mark it as * being suspended in the Service Repository and call the <suspend> - * member function on the appropriate <ACE_Service_Object>. A + * member function on the appropriate ACE_Service_Object. A * service can be resumed later on by calling the <RESUME> member * function... */ @@ -391,7 +403,7 @@ public: /** * Handle the command-line options intended for the - * <ACE_Service_Config>. Note that <argv[0]> is assumed to be the + * ACE_Service_Config. Note that @c argv[0] is assumed to be the * program name. * The arguments that are valid in a call to this method are * - '-b' Option to indicate that we should be a daemon @@ -479,7 +491,7 @@ private: static ACE_Sig_Adapter *signal_handler_; /** - * Keep track of whether the <ACE_Service_Config> is already + * Keep track of whether the ACE_Service_Config is already * initialized. If so, we can't allow <yyparse> to be called since * it's not reentrant. This variable is incremented by the * <ACE_Service_Config::open> method and decremented by the @@ -488,6 +500,8 @@ private: static int is_initialized_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Service_Config.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Service_Config.inl b/ace/Service_Config.inl index 23a6f81d12f..4dd09e802b0 100644 --- a/ace/Service_Config.inl +++ b/ace/Service_Config.inl @@ -4,6 +4,8 @@ #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // This is the primary entry point into the ACE_Service_Config (the // constructor just handles simple initializations). @@ -100,3 +102,5 @@ ACE_Service_Config::remove (const char svc_name[]) return ACE_Service_Config::remove (ACE_TEXT_TO_TCHAR_IN (svc_name)); } #endif /* ACE_HAS_WINCE && !ACE_USES_WCHAR */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Manager.cpp b/ace/Service_Manager.cpp index 2cee64c36c8..3dd1c8e151c 100644 --- a/ace/Service_Manager.cpp +++ b/ace/Service_Manager.cpp @@ -1,8 +1,6 @@ -#include "ace/Service_Manager.h" +// $Id$ -#if !defined (__ACE_INLINE__) -#include "ace/Service_Manager.inl" -#endif /* __ACE_INLINE__ */ +#include "ace/Service_Manager.h" #include "ace/Get_Opt.h" #include "ace/Log_Msg.h" @@ -18,6 +16,7 @@ ACE_RCSID (ace, Service_Manager, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE (ACE_Service_Manager) @@ -40,6 +39,11 @@ ACE_Service_Manager::ACE_Service_Manager (void) ACE_TRACE ("ACE_Service_Manager::ACE_Service_Manager"); } +ACE_Service_Manager::~ACE_Service_Manager (void) +{ + ACE_TRACE ("ACE_Service_Manager::~ACE_Service_Manager"); +} + int ACE_Service_Manager::suspend (void) { @@ -229,8 +233,8 @@ ACE_Service_Manager::reconfigure_services (void) // the rug" out from underneath the existing services in a // problematic way. ACE_Service_Config::reconfig_occurred ((sig_atomic_t) 1); - return this->client_stream_.send_n ("done\n", - sizeof ("done\n")); + return static_cast<int> (this->client_stream_.send_n ("done\n", + sizeof ("done\n"))); } // isolate the request-processing code @@ -376,3 +380,5 @@ ACE_Service_Manager::handle_input (ACE_HANDLE) ACE_LIB_TEXT ("close"))); return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Manager.h b/ace/Service_Manager.h index 6c7d745e65e..c49449bb820 100644 --- a/ace/Service_Manager.h +++ b/ace/Service_Manager.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,11 +24,13 @@ #include "ace/INET_Addr.h" #include "ace/Service_Object.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Service_Manager * * @brief Provide a standard ACE service for managing all the services - * configured in an <ACE_Service_Repository>. + * configured in an ACE_Service_Repository. * * This implementation is simple and just handles each client * request one at a time. There are currently 3 types of requests: @@ -112,9 +114,7 @@ protected: static u_short DEFAULT_PORT_; }; -#if defined (__ACE_INLINE__) -#include "ace/Service_Manager.inl" -#endif /* __ACE_INLINE__ */ +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* _SERVICE_MANAGER_H */ diff --git a/ace/Service_Manager.inl b/ace/Service_Manager.inl deleted file mode 100644 index f329d08adfb..00000000000 --- a/ace/Service_Manager.inl +++ /dev/null @@ -1,8 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -ACE_INLINE -ACE_Service_Manager::~ACE_Service_Manager (void) -{ - ACE_TRACE ("ACE_Service_Manager::~ACE_Service_Manager"); -} diff --git a/ace/Service_Object.cpp b/ace/Service_Object.cpp index 42786291f87..00de5f6e056 100644 --- a/ace/Service_Object.cpp +++ b/ace/Service_Object.cpp @@ -12,8 +12,10 @@ #include "ace/config-all.h" ACE_RCSID (ace, - Service_Object, - "$Id$") + Service_Object, + "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Service_Object) ACE_ALLOC_HOOK_DEFINE(ACE_Service_Type) @@ -124,3 +126,5 @@ ACE_Service_Type::name (const ACE_TCHAR *n) delete [] const_cast <ACE_TCHAR *> (this->name_); this->name_ = ACE::strnew (n); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Object.h b/ace/Service_Object.h index d96e5c59255..6101372c5f1 100644 --- a/ace/Service_Object.h +++ b/ace/Service_Object.h @@ -24,6 +24,8 @@ #include "ace/Event_Handler.h" #include "ace/DLL.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #define ACE_Component ACE_Service_Object /** * @class ACE_Service_Object @@ -32,9 +34,9 @@ * implementations. * * Classes that inherit from <ACE_Service_Objects> are capable - * of being registered with the <ACE_Reactor> (due to the - * <ACE_Event_Handler>, as well as being dynamically linked by - * the <ACE_Service_Config> (due to the <ACE_Shared_Object>). + * of being registered with the ACE_Reactor (due to the + * ACE_Event_Handler, as well as being dynamically linked by + * the ACE_Service_Config (due to the <ACE_Shared_Object>). */ class ACE_Export ACE_Service_Object : public ACE_Event_Handler, public ACE_Shared_Object { @@ -140,7 +142,7 @@ private: * @class ACE_Service_Object_Ptr * * @brief This is a smart pointer that holds onto the associated - * <ACE_Service_Object> * until the current scope is left, at + * ACE_Service_Object * until the current scope is left, at * which point the object's <fini> hook is called and the * service_object_ gets deleted. * @@ -167,6 +169,8 @@ private: ACE_Service_Object *service_object_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Service_Object.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Service_Object.inl b/ace/Service_Object.inl index 5e1b7ae475e..23eb323085f 100644 --- a/ace/Service_Object.inl +++ b/ace/Service_Object.inl @@ -1,7 +1,7 @@ -/* -*- C++ -*- */ +// -*- C++ -*- // $Id$ -// Service_Object.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Service_Object_Ptr::ACE_Service_Object_Ptr (ACE_Service_Object *so) : service_object_ (so) @@ -62,3 +62,6 @@ ACE_Service_Type::fini_called (void) const ACE_TRACE ("ACE_Service_Type::fini_called"); return this->fini_already_called_; } + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp index c872df591ff..81feb3b233e 100644 --- a/ace/Service_Repository.cpp +++ b/ace/Service_Repository.cpp @@ -17,6 +17,8 @@ ACE_RCSID (ace, Service_Repository, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Service_Repository) // Process-wide Service Repository. @@ -442,3 +444,5 @@ ACE_Service_Repository_Iterator::advance (void) return this->next_ < this->svc_rep_.current_size_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Repository.h b/ace/Service_Repository.h index 5479f59238e..1bda4000913 100644 --- a/ace/Service_Repository.h +++ b/ace/Service_Repository.h @@ -24,6 +24,7 @@ #include "ace/Default_Constants.h" #include "ace/Recursive_Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Service_Type; @@ -75,10 +76,10 @@ public: /// dynamically allocated services. int fini (void); - /// Get pointer to a process-wide <ACE_Service_Repository>. + /// Get pointer to a process-wide ACE_Service_Repository. static ACE_Service_Repository *instance (int size = ACE_Service_Repository::DEFAULT_SIZE); - /// Set pointer to a process-wide <ACE_Service_Repository> and return + /// Set pointer to a process-wide ACE_Service_Repository and return /// existing pointer. static ACE_Service_Repository *instance (ACE_Service_Repository *); @@ -145,7 +146,7 @@ private: /// Maximum number of services. int total_size_; - /// Pointer to a process-wide <ACE_Service_Repository>. + /// Pointer to a process-wide ACE_Service_Repository. static ACE_Service_Repository *svc_rep_; /// Must delete the <svc_rep_> if non-0. @@ -160,7 +161,7 @@ private: /** * @class ACE_Service_Repository_Iterator * - * @brief Iterate through the <ACE_Service_Repository>. + * @brief Iterate through the ACE_Service_Repository. * * Make sure not to delete entries as the iteration is going on * since this class is not designed as a robust iterator. @@ -206,6 +207,8 @@ private: int ignore_suspended_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Service_Repository.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Service_Repository.inl b/ace/Service_Repository.inl index f6e13326eab..2ecf2de05fa 100644 --- a/ace/Service_Repository.inl +++ b/ace/Service_Repository.inl @@ -1,8 +1,7 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Service_Repository.i - // Returns a count of the number of currently valid entries (counting // both resumed and suspended entries). @@ -11,6 +10,8 @@ #include "ace/Thread_Mutex.h" #endif /* ACE_MT_SAFE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Service_Repository::current_size (void) const { @@ -34,3 +35,5 @@ ACE_INLINE ACE_Service_Repository_Iterator::~ACE_Service_Repository_Iterator (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Templates.cpp b/ace/Service_Templates.cpp index d5f3f1b328b..11569316299 100644 --- a/ace/Service_Templates.cpp +++ b/ace/Service_Templates.cpp @@ -1,9 +1,19 @@ // $Id$ -#include "ace/Service_Templates.h" -#include "ace/SString.h" +#include "ace/config-lite.h" + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || \ + defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +# include "ace/Service_Templates.h" +# include "ace/SString.h" + +#endif #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template class ACE_Node<ACE_Static_Svc_Descriptor *>; template class ACE_Unbounded_Set<ACE_Static_Svc_Descriptor *>; template class ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Descriptor *>; @@ -42,7 +52,13 @@ template class ACE_Thru_Task<ACE_SYNCH>; template class ACE_Task<ACE_NULL_SYNCH>; template class ACE_Thru_Task<ACE_NULL_SYNCH>; #endif /* ACE_HAS_THREADS */ + +ACE_END_VERSIONED_NAMESPACE_DECL + #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #pragma instantiate ACE_Node<ACE_Static_Svc_Descriptor *> #pragma instantiate ACE_Unbounded_Set<ACE_Static_Svc_Descriptor *> #pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Descriptor *> @@ -80,4 +96,8 @@ template class ACE_Thru_Task<ACE_SYNCH>; #pragma instantiate ACE_Task<ACE_NULL_SYNCH> #pragma instantiate ACE_Thru_Task<ACE_NULL_SYNCH> #endif /* ACE_HAS_THREADS */ + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/ace/Service_Types.cpp b/ace/Service_Types.cpp index f62a9c0ce98..35140d29d4e 100644 --- a/ace/Service_Types.cpp +++ b/ace/Service_Types.cpp @@ -16,6 +16,7 @@ ACE_RCSID (ace, Service_Types, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL typedef ACE_Stream<ACE_SYNCH> MT_Stream; typedef ACE_Module<ACE_SYNCH> MT_Module; @@ -455,54 +456,4 @@ ACE_Stream_Type::find (const ACE_TCHAR *mod_name) const } -/* -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Message_Queue<ACE_SYNCH>; -template class ACE_Message_Queue_Iterator<ACE_SYNCH>; -template class ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH>; -template class ACE_Message_Queue_Factory<ACE_SYNCH>; -template class ACE_Dynamic_Message_Queue<ACE_SYNCH>; -template class ACE_Module<ACE_SYNCH>; -template class ACE_Stream<ACE_SYNCH>; -template class ACE_Stream_Head<ACE_SYNCH>; -template class ACE_Stream_Tail<ACE_SYNCH>; -template class ACE_Task<ACE_SYNCH>; -template class ACE_Thru_Task<ACE_SYNCH>; - -// Even with threads, these ACE_NULL_SYNCH specializations are necessary. -#if defined (ACE_HAS_THREADS) - template class ACE_Message_Queue<ACE_NULL_SYNCH>; - template class ACE_Message_Queue_Iterator<ACE_NULL_SYNCH>; - template class ACE_Message_Queue_Reverse_Iterator<ACE_NULL_SYNCH>; - template class ACE_Message_Queue_Factory<ACE_NULL_SYNCH>; - template class ACE_Dynamic_Message_Queue<ACE_NULL_SYNCH>; - template class ACE_Module<ACE_NULL_SYNCH>; - template class ACE_Task<ACE_NULL_SYNCH>; - template class ACE_Thru_Task<ACE_NULL_SYNCH>; - #endif *//* ACE_HAS_THREADS */ -/* -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Message_Queue<ACE_SYNCH> -#pragma instantiate ACE_Message_Queue_Iterator<ACE_SYNCH> -#pragma instantiate ACE_Message_Queue_Reverse_Iterator<ACE_SYNCH> -#pragma instantiate ACE_Message_Queue_Factory<ACE_SYNCH> -#pragma instantiate ACE_Dynamic_Message_Queue<ACE_SYNCH> -#pragma instantiate ACE_Module<ACE_SYNCH> -#pragma instantiate ACE_Stream<ACE_SYNCH> -#pragma instantiate ACE_Stream_Head<ACE_SYNCH> -#pragma instantiate ACE_Stream_Tail<ACE_SYNCH> -#pragma instantiate ACE_Task<ACE_SYNCH> -#pragma instantiate ACE_Thru_Task<ACE_SYNCH> -// Even with threads, these ACE_NULL_SYNCH specializations are necessary. -#if defined (ACE_HAS_THREADS) - #pragma instantiate ACE_Message_Queue<ACE_NULL_SYNCH> - #pragma instantiate ACE_Message_Queue_Iterator<ACE_NULL_SYNCH> - #pragma instantiate ACE_Message_Queue_Reverse_Iterator<ACE_NULL_SYNCH> - #pragma instantiate ACE_Message_Queue_Factory<ACE_NULL_SYNCH> - #pragma instantiate ACE_Dynamic_Message_Queue<ACE_NULL_SYNCH> - #pragma instantiate ACE_Module<ACE_NULL_SYNCH> - #pragma instantiate ACE_Task<ACE_NULL_SYNCH> - #pragma instantiate ACE_Thru_Task<ACE_NULL_SYNCH> - #endif *//* ACE_HAS_THREADS */ -//#else -//#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Service_Types.h b/ace/Service_Types.h index a87169c7dbb..e2f6500e8ae 100644 --- a/ace/Service_Types.h +++ b/ace/Service_Types.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Service_Type_Impl * @@ -189,6 +191,8 @@ private: ACE_Module_Type *head_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Service_Types.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Service_Types.inl b/ace/Service_Types.inl index 7412140a4d2..9ebfd705ced 100644 --- a/ace/Service_Types.inl +++ b/ace/Service_Types.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/ACE.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE void * ACE_Service_Type_Impl::object (void) const { @@ -25,3 +28,5 @@ ACE_Service_Type_Impl::name (const ACE_TCHAR *n) ACE::strdelete (const_cast<ACE_TCHAR*> (this->name_)); this->name_ = ACE::strnew (n); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Shared_Memory.cpp b/ace/Shared_Memory.cpp index 5e4447075ee..90a9a7ed93e 100644 --- a/ace/Shared_Memory.cpp +++ b/ace/Shared_Memory.cpp @@ -4,6 +4,10 @@ ACE_RCSID(ace, Shared_Memory, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Shared_Memory::~ACE_Shared_Memory (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Shared_Memory.h b/ace/Shared_Memory.h index 7d07b598610..2ebc8b79d36 100644 --- a/ace/Shared_Memory.h +++ b/ace/Shared_Memory.h @@ -16,12 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #include "ace/os_include/os_stddef.h" @@ -29,6 +24,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Shared_Memory * @@ -40,7 +37,7 @@ * memory. For a much more sophisticated version, please check * out the <ACE_Malloc> class. */ -class ACE_Memory_Export ACE_Shared_Memory +class ACE_Export ACE_Shared_Memory { public: virtual ~ACE_Shared_Memory (void); @@ -54,6 +51,8 @@ public: virtual ACE_HANDLE get_id (void) const = 0; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SHARED_MEMORY_H */ diff --git a/ace/Shared_Memory_MM.cpp b/ace/Shared_Memory_MM.cpp index 9ad0bb021f3..945cb345b20 100644 --- a/ace/Shared_Memory_MM.cpp +++ b/ace/Shared_Memory_MM.cpp @@ -11,6 +11,7 @@ ACE_RCSID (ace, Shared_Memory_MM, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_MM) @@ -88,7 +89,7 @@ void * ACE_Shared_Memory_MM::malloc (size_t) { ACE_TRACE ("ACE_Shared_Memory_MM::malloc"); - void *addr; + void *addr = 0; return this->shared_memory_ (addr) == -1 ? 0 : addr; } @@ -106,3 +107,5 @@ ACE_Shared_Memory_MM::free (void *p) ACE_TRACE ("ACE_Shared_Memory_MM::free"); return p != 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Shared_Memory_MM.h b/ace/Shared_Memory_MM.h index bbdf2ef43a7..5a8bd83eed1 100644 --- a/ace/Shared_Memory_MM.h +++ b/ace/Shared_Memory_MM.h @@ -6,7 +6,7 @@ * * $Id$ * - * @author Doug Schmidt + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //============================================================================= @@ -23,16 +23,18 @@ #include "ace/Mem_Map.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Shared_Memory_MM * * @brief Shared memory wrapper based on MMAP. * - * This class provides a very simple-minded shared memory - * manager. For more a powerful memory allocator please see - * <ACE_Malloc>. + * This class provides a very simple-minded shared memory manager. We + * strongly recommend that you do NOT use this class. Instead, please + * use @c ACE_Malloc, which has much more powerful capabilities. */ -class ACE_Memory_Export ACE_Shared_Memory_MM : public ACE_Shared_Memory +class ACE_Export ACE_Shared_Memory_MM : public ACE_Shared_Memory { public: // = Initialization and termination methods. @@ -108,6 +110,8 @@ private: ACE_Mem_Map shared_memory_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Shared_Memory_MM.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Shared_Memory_MM.inl b/ace/Shared_Memory_MM.inl index ff52dacd44b..96d865b667b 100644 --- a/ace/Shared_Memory_MM.inl +++ b/ace/Shared_Memory_MM.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Shared_Memory_MM.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Return the name of file that is mapped (if any). @@ -37,3 +38,5 @@ ACE_Shared_Memory_MM::open (const ACE_TCHAR *file_name, return shared_memory_.map (file_name, len, flags, mode, prot, share, addr, pos); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Shared_Memory_Pool.cpp b/ace/Shared_Memory_Pool.cpp index 014616407da..93fb2e97fcf 100644 --- a/ace/Shared_Memory_Pool.cpp +++ b/ace/Shared_Memory_Pool.cpp @@ -8,6 +8,9 @@ ACE_RCSID(ace, Shared_Memory_Pool, "$Id$") #if !defined (ACE_LACKS_SYSV_SHMEM) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_Pool) ACE_Shared_Memory_Pool_Options::ACE_Shared_Memory_Pool_Options (const char *base_addr, @@ -148,7 +151,7 @@ ACE_Shared_Memory_Pool::handle_signal (int , siginfo_t *siginfo, ucontext_t *) ACE_TRACE ("ACE_Shared_Memory_Pool::handle_signal"); // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("signal %S occurred\n"), signum)); - // While FreeBSD 5.X has a siginfo_t struct with a si_addr field, + // While FreeBSD 5.X has a siginfo_t struct with a si_addr field, // it does not define SEGV_MAPERR. #if defined (ACE_HAS_SIGINFO_T) && !defined (ACE_LACKS_SI_ADDR) && \ (defined (SEGV_MAPERR) || defined (SEGV_MEMERR)) @@ -450,4 +453,7 @@ ACE_Shared_Memory_Pool::round_up (size_t nbytes) return ACE::round_to_pagesize (nbytes); } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_LACKS_SYSV_SHMEM */ diff --git a/ace/Shared_Memory_Pool.h b/ace/Shared_Memory_Pool.h index 1fb46a5cc9c..996cde2b490 100644 --- a/ace/Shared_Memory_Pool.h +++ b/ace/Shared_Memory_Pool.h @@ -16,25 +16,21 @@ #include /**/ "ace/pre.h" -#ifdef ACE_MEMORY_BUILD_DLL -# include "ace/ACE_Memory_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Memory_Export ACE_Export -#endif /* ACE_MEMORY_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#if !defined (ACE_LACKS_SYSV_SHMEM) + #include "ace/ACE.h" #include "ace/Event_Handler.h" #include "ace/Signal.h" - -#if !defined (ACE_LACKS_SYSV_SHMEM) - #include "ace/os_include/sys/os_mman.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Shared_Memory_Pool_Options * @@ -43,7 +39,7 @@ * This should be a nested class, but that breaks too many * compilers. */ -class ACE_Memory_Export ACE_Shared_Memory_Pool_Options +class ACE_Export ACE_Shared_Memory_Pool_Options { public: /// Initialization method. @@ -82,7 +78,7 @@ public: * provides more powerful features, such as persistent backing store * and greatly scalability. */ -class ACE_Memory_Export ACE_Shared_Memory_Pool : public ACE_Event_Handler +class ACE_Export ACE_Shared_Memory_Pool : public ACE_Event_Handler { public: typedef ACE_Shared_Memory_Pool_Options OPTIONS; @@ -203,6 +199,9 @@ protected: /// properly. virtual int handle_signal (int signum, siginfo_t *, ucontext_t *); }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* !ACE_LACKS_SYSV_SHMEM */ #include /**/ "ace/post.h" diff --git a/ace/Shared_Memory_SV.cpp b/ace/Shared_Memory_SV.cpp index 59d6ad2fedc..8378b75d7dc 100644 --- a/ace/Shared_Memory_SV.cpp +++ b/ace/Shared_Memory_SV.cpp @@ -12,6 +12,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Shared_Memory_SV) void @@ -23,11 +25,11 @@ ACE_Shared_Memory_SV::dump (void) const } ACE_Shared_Memory_SV::ACE_Shared_Memory_SV (key_t id, - int length, - int create, - int perms, - void *addr, - int flags) + int length, + int create, + int perms, + void *addr, + int flags) : shared_memory_ (id, length, create, perms, addr, flags) { ACE_TRACE ("ACE_Shared_Memory_SV::ACE_Shared_Memory_SV"); @@ -82,3 +84,5 @@ ACE_Shared_Memory_SV::free (void *p) ACE_TRACE ("ACE_Shared_Memory_SV::free"); return p != 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Shared_Memory_SV.h b/ace/Shared_Memory_SV.h index c4c59d5d4e6..565d69c14cb 100644 --- a/ace/Shared_Memory_SV.h +++ b/ace/Shared_Memory_SV.h @@ -6,7 +6,7 @@ * * $Id$ * - * @author Doug Schmidt + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ //============================================================================= @@ -23,16 +23,18 @@ #include "ace/SV_Shared_Memory.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Shared_Memory_SV * * @brief Shared memory wrapper based on System V shared memory. * - * This class provides a very simple-minded shared memory - * manager. For more a powerful memory allocator please see - * <ACE_Malloc>. + * This class provides a very simple-minded shared memory manager. We + * strongly recommend that you do NOT use this class. Instead, please + * use @c ACE_Malloc, which has much more powerful capabilities. */ -class ACE_Memory_Export ACE_Shared_Memory_SV : public ACE_Shared_Memory +class ACE_Export ACE_Shared_Memory_SV : public ACE_Shared_Memory { public: enum @@ -89,6 +91,8 @@ private: ACE_SV_Shared_Memory shared_memory_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Shared_Memory_SV.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Shared_Memory_SV.inl b/ace/Shared_Memory_SV.inl index 1830df3f630..f40fc55c28d 100644 --- a/ace/Shared_Memory_SV.inl +++ b/ace/Shared_Memory_SV.inl @@ -1,21 +1,22 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Shared_Memory_SV.i - #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Shared_Memory_SV::open (key_t id, - int length, - int create, - int perms, - void *addr, - int flags) + int length, + int create, + int perms, + void *addr, + int flags) { ACE_TRACE ("ACE_Shared_Memory_SV::open"); return shared_memory_.open_and_attach (id, length, create, - perms, addr, flags); + perms, addr, flags); } // The "do-nothing" constructor. @@ -25,3 +26,5 @@ ACE_Shared_Memory_SV::ACE_Shared_Memory_SV (void) { ACE_TRACE ("ACE_Shared_Memory_SV::ACE_Shared_Memory_SV"); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Shared_Object.cpp b/ace/Shared_Object.cpp index 86164c16759..2be49edf997 100644 --- a/ace/Shared_Object.cpp +++ b/ace/Shared_Object.cpp @@ -16,6 +16,8 @@ ACE_RCSID (ace, Shared_Object, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Initializes object when dynamic linking occurs. int @@ -49,3 +51,5 @@ ACE_Shared_Object::~ACE_Shared_Object (void) { ACE_TRACE ("ACE_Shared_Object::~ACE_Shared_Object"); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Shared_Object.h b/ace/Shared_Object.h index 006dbb99eaf..ee987b23122 100644 --- a/ace/Shared_Object.h +++ b/ace/Shared_Object.h @@ -23,6 +23,8 @@ #include "ace/os_include/sys/os_types.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Shared_Object * @@ -46,6 +48,8 @@ public: virtual ~ACE_Shared_Object (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Shared_Object.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Shared_Object.inl b/ace/Shared_Object.inl index 36a42157cb2..cd76cb6a267 100644 --- a/ace/Shared_Object.inl +++ b/ace/Shared_Object.inl @@ -1,7 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Shared_Object::ACE_Shared_Object (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Signal.cpp b/ace/Signal.cpp index 624787c6ee4..b90607968f4 100644 --- a/ace/Signal.cpp +++ b/ace/Signal.cpp @@ -45,6 +45,8 @@ ace_sig_handlers_dispatch (int signum, siginfo_t *info, ucontext_t *context) #endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ #endif /* ACE_HAS_SIG_C_FUNC */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Array of Event_Handlers that will handle the signals. ACE_Event_Handler *ACE_Sig_Handler::signal_handlers_[ACE_NSIG]; @@ -861,20 +863,6 @@ ACE_Sig_Handlers::handler (int signum, ACE_Event_Handler *new_sh) return *eh; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -ACE_MT (template class ACE_TSS_Guard<ACE_Recursive_Thread_Mutex>); -ACE_MT (template class ACE_Guard<ACE_Recursive_Thread_Mutex>); -template class ACE_Fixed_Set<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS>; -template class ACE_Fixed_Set_Iterator<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS>; -template class ACE_Fixed_Set_Iterator_Base<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -#pragma instantiate ACE_TSS_Guard<ACE_Recursive_Thread_Mutex> -#pragma instantiate ACE_Guard<ACE_Recursive_Thread_Mutex> -#endif /* ACE_MT_SAFE */ -#pragma instantiate ACE_Fixed_Set<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> -#pragma instantiate ACE_Fixed_Set_Iterator<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> -#pragma instantiate ACE_Fixed_Set_Iterator_Base<ACE_Event_Handler *, ACE_MAX_SIGNAL_HANDLERS> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - #endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Signal.h b/ace/Signal.h index 576f80f2a70..45bddf2c22f 100644 --- a/ace/Signal.h +++ b/ace/Signal.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -32,6 +32,8 @@ // Type of the extended signal handler. typedef void (*ACE_Sig_Handler_Ex) (int, siginfo_t *siginfo, ucontext_t *ucontext); +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Sig_Set * @@ -264,11 +266,11 @@ private: * objects to handle signals in a way that avoids the use of * global/static variables and functions. * - * Using this class a program can register an <ACE_Event_Handler> - * with the <ACE_Sig_Handler> in order to handle a designated + * Using this class a program can register an ACE_Event_Handler + * with the ACE_Sig_Handler in order to handle a designated * <signum>. When a signal occurs that corresponds to this * <signum>, the <handle_signal> method of the registered - * <ACE_Event_Handler> is invoked automatically. + * ACE_Event_Handler is invoked automatically. */ class ACE_Export ACE_Sig_Handler { @@ -279,8 +281,8 @@ public: // = Registration and removal methods. /** - * Add a new <ACE_Event_Handler> and a new sigaction associated with - * <signum>. Passes back the existing <ACE_Event_Handler> and its + * Add a new ACE_Event_Handler and a new sigaction associated with + * <signum>. Passes back the existing ACE_Event_Handler and its * sigaction if pointers are non-zero. Returns -1 on failure and >= * 0 on success. */ @@ -291,7 +293,7 @@ public: ACE_Sig_Action *old_disp = 0); /** - * Remove the <ACE_Event_Handler> currently associated with + * Remove the ACE_Event_Handler currently associated with * <signum>. <sigkey> is ignored in this implementation since there * is only one instance of a signal handler. Install the new * disposition (if given) and return the previous disposition (if @@ -312,10 +314,10 @@ public: // = Set/get the handler associated with a particular signal. - /// Return the <ACE_Sig_Handler> associated with <signum>. + /// Return the ACE_Sig_Handler associated with <signum>. virtual ACE_Event_Handler *handler (int signum); - /// Set a new <ACE_Event_Handler> that is associated with <signum>. + /// Set a new ACE_Event_Handler that is associated with <signum>. /// Return the existing handler. virtual ACE_Event_Handler *handler (int signum, ACE_Event_Handler *); @@ -338,7 +340,7 @@ protected: // = These methods and data members are shared by derived classes. /** - * Set a new <ACE_Event_Handler> that is associated with <signum>. + * Set a new ACE_Event_Handler that is associated with <signum>. * Return the existing handler. Does not acquire any locks so that * it can be called from a signal handler, such as <dispatch>. */ @@ -349,8 +351,8 @@ protected: * This implementation method is called by <register_handler> and * <dispatch>. It doesn't do any locking so that it can be called * within a signal handler, such as <dispatch>. It adds a new - * <ACE_Event_Handler> and a new sigaction associated with <signum>. - * Passes back the existing <ACE_Event_Handler> and its sigaction if + * ACE_Event_Handler and a new sigaction associated with <signum>. + * Passes back the existing ACE_Event_Handler and its sigaction if * pointers are non-zero. Returns -1 on failure and >= 0 on * success. */ @@ -376,7 +378,7 @@ private: * @class ACE_Sig_Adapter * * @brief Provide an adapter that transforms various types of signal - * handlers into the scheme used by the <ACE_Reactor>. + * handlers into the scheme used by the ACE_Reactor. */ class ACE_Export ACE_Sig_Adapter : public ACE_Event_Handler { @@ -387,7 +389,7 @@ public: ~ACE_Sig_Adapter (void); /// Returns this signal key that's used to remove this from the - /// <ACE_Reactor>'s internal table. + /// ACE_Reactor's internal table. int sigkey (void); /// Called by the <Reactor> to dispatch the signal handler. @@ -452,7 +454,7 @@ public: ACE_Sig_Action *old_disp = 0); /** - * Remove an <ACE_Event_Handler> currently associated with <signum>. + * Remove an ACE_Event_Handler currently associated with <signum>. * We remove the handler if (1) its <sigkey> matches the <sigkey> * passed as a parameter or (2) if we've been told to remove all the * handlers, i.e., <sigkey> == -1. If a new disposition is given it @@ -467,12 +469,12 @@ public: // = Set/get the handler associated with a particular signal. - /// Return the head of the list of <ACE_Sig_Handler>s associated with + /// Return the head of the list of ACE_Sig_Handlers associated with /// SIGNUM. virtual ACE_Event_Handler *handler (int signum); /** - * Set a new <ACE_Event_Handler> that is associated with SIGNUM at + * Set a new ACE_Event_Handler that is associated with SIGNUM at * the head of the list of signals. Return the existing handler * that was at the head. */ @@ -506,16 +508,7 @@ private: }; #endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ -#if defined (ACE_HAS_SIG_C_FUNC) -extern "C" void -ace_sig_handler_dispatch (int signum, siginfo_t *info, ucontext_t *context); - -#if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) -extern "C" void -ace_sig_handlers_dispatch (int signum, siginfo_t *info, ucontext_t *context); -#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ - -#endif /* ACE_HAS_SIG_C_FUNC */ +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Signal.inl" diff --git a/ace/Signal.inl b/ace/Signal.inl index e7a12852d95..ef871441aca 100644 --- a/ace/Signal.inl +++ b/ace/Signal.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/OS_NS_signal.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Sig_Set::ACE_Sig_Set (sigset_t *ss) // : sigset_ () @@ -301,3 +304,5 @@ ACE_Sig_Handler::in_range (int signum) ACE_TRACE ("ACE_Sig_Handler::in_range"); return signum > 0 && signum < ACE_NSIG; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Singleton.cpp b/ace/Singleton.cpp index 45965f85814..ec7797ae156 100644 --- a/ace/Singleton.cpp +++ b/ace/Singleton.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_SINGLETON_C -#define ACE_SINGLETON_C +#ifndef ACE_SINGLETON_CPP +#define ACE_SINGLETON_CPP #include "ace/Singleton.h" @@ -22,6 +22,9 @@ ACE_RCSID (ace, Singleton, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TYPE, class ACE_LOCK> void ACE_Singleton<TYPE, ACE_LOCK>::dump (void) { @@ -526,4 +529,6 @@ ACE_DLL_Singleton_Adapter_T<TYPE>::dll_name (void) return ACE_LIB_TEXT("ACE"); } -#endif /* ACE_SINGLETON_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_SINGLETON_CPP */ diff --git a/ace/Singleton.h b/ace/Singleton.h index 57b0a8a9d75..7c6baca3edb 100644 --- a/ace/Singleton.h +++ b/ace/Singleton.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -29,6 +29,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Singleton * @@ -62,7 +64,7 @@ * typedef ACE_Singleton<foo, ACE_Null_Mutex> FOO; * @endverbatim * - * NOTE: the best types to use for ACE_LOCK are + * @note The best types to use for ACE_LOCK are * ACE_Recursive_Thread_Mutex and ACE_Null_Mutex. * ACE_Recursive_Thread_Mutex should be used in multi-threaded * programs in which it is possible for more than one thread to @@ -308,6 +310,8 @@ public: const ACE_TCHAR *dll_name (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Singleton.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Singleton.inl b/ace/Singleton.inl index 12dfe1bdda3..4351a59a5f6 100644 --- a/ace/Singleton.inl +++ b/ace/Singleton.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Default constructors. // // Note: don't explicitly initialize "instance_", because TYPE may not @@ -35,3 +38,5 @@ template <class TYPE, class ACE_LOCK> ACE_DLL_Singleton_T<TYPE, ACE_LOCK>::~ACE_DLL_Singleton_T (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp index ed8e2082d25..e0ff264da00 100644 --- a/ace/Sock_Connect.cpp +++ b/ace/Sock_Connect.cpp @@ -29,14 +29,14 @@ # include /**/ <ifaddrs.h> # endif /* ACE_HAS_GETIFADDRS */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) #include /**/ <inetLib.h> #include /**/ <netinet/in_var.h> extern "C" { extern struct in_ifaddr* in_ifaddr; } #include "ace/OS_NS_stdio.h" -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ #if defined (ACE_HAS_WINCE) #include /**/ <Iphlpapi.h> @@ -51,13 +51,13 @@ extern "C" { # include "ace/Object_Manager.h" # endif /* ACE_HAS_THREADS */ -namespace ACE +namespace { // private: // Used internally so not exported. /// Does this box have ipv6 turned on? - int ipv6_enabled_ = -1; + int ace_ipv6_enabled = -1; } #endif /* ACE_HAS_IPV6 */ @@ -67,10 +67,7 @@ namespace ACE // and not the one for <sys/socket.h> which is also needed. Although we // don't need the template defined here, it makes the compiler pull in // <sys/socket.h> and the build runs clean. -#if defined (AIX) && defined (__IBMCPP__) && (__IBMCPP__ >= 500) -# if (__IBMCPP__ >= 700) -# error Recheck this hack to see if version 7 fixed it! -# endif +#if defined (AIX) && defined (__IBMCPP__) && (__IBMCPP__ >= 500) && (__IBMCPP__ < 700) static ACE_Auto_Array_Ptr<sockaddr> force_compiler_to_include_socket_h; #endif /* AIX && __IBMCPP__ >= 500 */ @@ -275,6 +272,8 @@ get_windows_version() #endif //(ACE_WIN32) && !(ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2) && (ACE_HAS_WINSOCK2 == 0) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Bind socket to an unused port. int @@ -626,10 +625,10 @@ ACE::get_ip_interfaces (size_t &count, // Now go through the list and transfer the good ones to the list of // because they're down or don't have an IP address. - for (count = 0, i = 0; i < n_interfaces; i++) + for (count = 0, i = 0; i < n_interfaces; ++i) { LPINTERFACE_INFO lpii; - struct sockaddr_in *addrp; + struct sockaddr_in *addrp = 0; lpii = &info[i]; if (!(lpii->iiFlags & IFF_UP)) @@ -977,7 +976,7 @@ ACE::get_ip_interfaces (size_t &count, // Count the number of interfaces while (dev_names.next () != 0) - n_interfaces ++; + ++n_interfaces; // case 1. no interfaces present, empty string? OS version change? if (n_interfaces == 0) @@ -1077,7 +1076,7 @@ ACE::get_ip_interfaces (size_t &count, addrs[count].set ((u_short) 0, addr->sin_addr.s_addr, 0); - count++; + ++count; } } # if defined (ACE_HAS_IPV6) @@ -1092,7 +1091,7 @@ ACE::get_ip_interfaces (size_t &count, { addrs[count].set(reinterpret_cast<struct sockaddr_in *> (addr), sizeof(sockaddr_in6)); - count++; + ++count; } } # endif /* ACE_HAS_IPV6 */ @@ -1102,7 +1101,7 @@ ACE::get_ip_interfaces (size_t &count, return 0; -#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) +#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) // COMMON (SVR4 and BSD) UNIX CODE size_t num_ifs, num_ifs_found; @@ -1212,17 +1211,17 @@ ACE::get_ip_interfaces (size_t &count, if (inAddr.sin_addr.s_addr != 0) { addrs[count].set(&inAddr, sizeof(struct sockaddr_in)); - count++; + ++count; } #endif /* ! _UNICOS */ } #if !defined(CHORUS_4) && !defined(AIX) && !defined (__QNX__) && !defined (__FreeBSD__) && !defined(__NetBSD__) - pcur++; + ++pcur; #else if (pcur->ifr_addr.sa_len <= sizeof (struct sockaddr)) { - pcur++; + ++pcur; } else { @@ -1270,7 +1269,7 @@ ACE::get_ip_interfaces (size_t &count, !IN6_IS_ADDR_UNSPECIFIED (&reinterpret_cast<sockaddr_in6 *> (res0->ai_addr)->sin6_addr)) { addrs[count].set(reinterpret_cast<sockaddr_in *> (res0->ai_addr), res0->ai_addrlen); - count++; + ++count; } freeaddrinfo (res0); @@ -1280,7 +1279,7 @@ ACE::get_ip_interfaces (size_t &count, # endif /* ACE_HAS_IPV6 */ return 0; -#elif defined (VXWORKS) +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x600) count = 0; // Loop through each address structure for (struct in_ifaddr* ia = in_ifaddr; ia != 0; ia = ia->ia_next) @@ -1330,7 +1329,7 @@ ACE::get_ip_interfaces (size_t &count, #else ACE_UNUSED_ARG (count); ACE_UNUSED_ARG (addrs); - ACE_NOTSUP_RETURN (-1);; // no implementation + ACE_NOTSUP_RETURN (-1); // no implementation #endif /* ACE_WIN32 */ } @@ -1371,7 +1370,7 @@ ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many) how_many = num_ifs; return 0; -#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) +#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) // Note: DEC CXX doesn't define "unix". BSD compatible OS: HP UX, // AIX, SunOS 4.x perform some ioctls to retrieve ifconf list of // ifreq structs no SIOCGIFNUM on SunOS 4.x, so use guess and scan @@ -1467,7 +1466,7 @@ ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many) #else ACE_UNUSED_ARG (handle); ACE_UNUSED_ARG (how_many); - ACE_NOTSUP_RETURN (-1);; // no implmentation + ACE_NOTSUP_RETURN (-1); // no implementation #endif /* sparc && SIOCGIFNUM */ } @@ -1480,7 +1479,7 @@ ACE::get_handle (void) ACE_HANDLE handle = ACE_INVALID_HANDLE; #if defined (sparc) && ! defined (CHORUS) handle = ACE_OS::open ("/dev/udp", O_RDONLY); -#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) +#elif defined (__unix) || defined (__unix__) || defined (__Lynx__) || defined (_AIX) || (defined (ACE_VXWORKS) && (ACE_VXWORKS >= 0x600)) // Note: DEC CXX doesn't define "unix" BSD compatible OS: HP UX, // AIX, SunOS 4.x @@ -1494,42 +1493,33 @@ int ACE::ipv6_enabled (void) { #if defined (ACE_HAS_IPV6) - if (ACE::ipv6_enabled_ == -1) + if (ace_ipv6_enabled == -1) { // Perform Double-Checked Locking Optimization. ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, *ACE_Static_Object_Lock::instance (), 0)); - if (ACE::ipv6_enabled_ == -1) + if (ace_ipv6_enabled == -1) { // Determine if the kernel has IPv6 support by attempting to // create a PF_INET6 socket and see if it fails. ACE_HANDLE s = ACE_OS::socket (PF_INET6, SOCK_DGRAM, 0); if (s == ACE_INVALID_HANDLE) { - ACE::ipv6_enabled_ = 0; + ace_ipv6_enabled = 0; } else { - ACE::ipv6_enabled_ = 1; + ace_ipv6_enabled = 1; ACE_OS::closesocket (s); } } } - return ACE::ipv6_enabled_; + return ace_ipv6_enabled; #else /* ACE_HAS_IPV6 */ return 0; #endif /* !ACE_HAS_IPV6 */ } -#if defined (__unix) || defined (__unix__) || defined (__Lynx__) || \ - defined (_AIX) -# if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Auto_Array_Ptr<struct ifreq>; -template class ACE_Auto_Basic_Array_Ptr<struct ifreq>; -# elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Auto_Array_Ptr<struct ifreq> -#pragma instantiate ACE_Auto_Basic_Array_Ptr<struct ifreq> -# endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -#endif /* (__unix || __Lynx_ || AIX ) */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Sock_Connect.h b/ace/Sock_Connect.h index 532892d64fa..90e9ecf1c07 100644 --- a/ace/Sock_Connect.h +++ b/ace/Sock_Connect.h @@ -25,6 +25,8 @@ #include "ace/Basic_Types.h" #include "ace/os_include/netinet/os_in.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward Declarations class ACE_INET_Addr; @@ -82,6 +84,8 @@ namespace ACE extern ACE_Export int ipv6_enabled (void); } +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SOCK_CONNECT_H */ diff --git a/ace/Static_Object_Lock.h b/ace/Static_Object_Lock.h index 93006c34001..5a765a24fbd 100644 --- a/ace/Static_Object_Lock.h +++ b/ace/Static_Object_Lock.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Recursive_Thread_Mutex; /** @@ -47,11 +49,15 @@ public: static void cleanup_lock (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ // hack to get around errors while compiling using split-cpp #if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_IS_SPLITTING) typedef ACE_Cleanup_Adapter<ACE_Recursive_Thread_Mutex> ACE_Static_Object_Lock_Type; @@ -64,6 +70,8 @@ static ACE_Static_Object_Lock_Type *ACE_Static_Object_Lock_lock = 0; # endif /* ACE_IS_SPLITTING */ +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ #include /**/ "ace/post.h" diff --git a/ace/Stats.cpp b/ace/Stats.cpp index bd371c95169..fa75340c83e 100644 --- a/ace/Stats.cpp +++ b/ace/Stats.cpp @@ -12,6 +12,8 @@ ACE_RCSID(ace, Stats, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_UINT32 ACE_Stats_Value::fractional_field (void) const { @@ -661,10 +663,4 @@ ACE_Throughput_Stats::dump_throughput (const wchar_t *msg, #endif /* ACE_NLOGGING */ } -// **************************************************************** - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Stats.h b/ace/Stats.h index ab11b399303..e98305cb0b8 100644 --- a/ace/Stats.h +++ b/ace/Stats.h @@ -26,6 +26,8 @@ #include "ace/Log_Msg.h" #include "ace/Basic_Stats.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Stats_Value * @@ -79,6 +81,10 @@ public: void dump (void) const; private: + + ACE_Stats_Value (void) {} + +private: /// The integer portion of the value. ACE_UINT32 whole_; @@ -92,7 +98,6 @@ private: */ u_int precision_; - ACE_UNIMPLEMENTED_FUNC (ACE_Stats_Value (void)) }; /** @@ -188,7 +193,7 @@ public: /// Print summary statistics to stdout. void dump (void) const; -private: +protected: /// Internal indication of whether there has been overflow. Contains /// the errno corresponding to the cause of overflow. u_int overflow_; @@ -271,6 +276,7 @@ private: #endif /* 0 */ }; +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) # include "ace/Stats.inl" diff --git a/ace/Stats.inl b/ace/Stats.inl index bafa86161e8..5fecfde1de8 100644 --- a/ace/Stats.inl +++ b/ace/Stats.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Stats_Value::ACE_Stats_Value (const u_int precision) : whole_ (0), @@ -97,3 +100,5 @@ ACE_Stats::dump (void) const print_summary (3u); #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp index 2bf2eaeb93f..9704224fdf5 100644 --- a/ace/Strategies_T.cpp +++ b/ace/Strategies_T.cpp @@ -1,3 +1,5 @@ +// $Id$ + #ifndef ACE_STRATEGIES_T_CPP #define ACE_STRATEGIES_T_CPP @@ -20,11 +22,7 @@ #include "ace/Strategies_T.inl" #endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - Strategies_T, - "$Id$") - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template<class SVC_HANDLER> ACE_Recycling_Strategy<SVC_HANDLER>::~ACE_Recycling_Strategy (void) @@ -1487,4 +1485,6 @@ ACE_ALLOC_HOOK_DEFINE(ACE_Process_Strategy) ACE_ALLOC_HOOK_DEFINE(ACE_Accept_Strategy) ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Strategy) +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_STRATEGIES_T_CPP */ diff --git a/ace/Strategies_T.h b/ace/Strategies_T.h index 9dfcfc1f134..8171bf8b07f 100644 --- a/ace/Strategies_T.h +++ b/ace/Strategies_T.h @@ -32,6 +32,7 @@ // Needed for broken linkers that can't grok long symbols. #define ACE_Refcounted_Hash_Recyclable ARHR +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Service_Repository; @@ -1056,6 +1057,8 @@ protected: int delete_recycling_strategy_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Strategies_T.inl" #endif /* __ACE_INLINE__ */ @@ -1070,5 +1073,4 @@ protected: #include /**/ "ace/post.h" - #endif /* ACE_STRATEGIES_T_H */ diff --git a/ace/Strategies_T.inl b/ace/Strategies_T.inl index 6f0c59304b1..a6a6d1dfd1a 100644 --- a/ace/Strategies_T.inl +++ b/ace/Strategies_T.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class SVC_HANDLER> ACE_INLINE ACE_Singleton_Strategy<SVC_HANDLER>::ACE_Singleton_Strategy (SVC_HANDLER *sh, ACE_Thread_Manager *tm) @@ -224,3 +226,5 @@ ACE_Refcounted_Hash_Recyclable<T>::operator!= (const ACE_Refcounted_Hash_Recycla { return !this->operator== (rhs); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Stream.cpp b/ace/Stream.cpp index e76db19c6ce..b44b04ddacc 100644 --- a/ace/Stream.cpp +++ b/ace/Stream.cpp @@ -1,8 +1,8 @@ // Stream.cpp // $Id$ -#ifndef ACE_STREAM_C -#define ACE_STREAM_C +#ifndef ACE_STREAM_CPP +#define ACE_STREAM_CPP //#include "ace/Module.h" #include "ace/Stream.h" @@ -18,7 +18,7 @@ #include "ace/Stream.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Stream, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Stream) @@ -614,4 +614,6 @@ ACE_Stream_Iterator<ACE_SYNCH_USE>::ACE_Stream_Iterator (const ACE_Stream<ACE_SY ACE_TRACE ("ACE_Stream_Iterator<ACE_SYNCH_USE>::ACE_Stream_Iterator"); } -#endif /* ACE_STREAM_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_STREAM_CPP */ diff --git a/ace/Stream.h b/ace/Stream.h index fed079368e4..1ab1cacf3ea 100644 --- a/ace/Stream.h +++ b/ace/Stream.h @@ -25,6 +25,8 @@ #include "ace/Message_Block.h" #include "ace/Module.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decls. template<ACE_SYNCH_DECL> class ACE_Stream_Iterator; class ACE_Time_Value; @@ -220,6 +222,8 @@ private: ACE_Module<ACE_SYNCH_USE> *next_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Stream.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Stream.inl b/ace/Stream.inl index 42a4989eff0..24ff6840431 100644 --- a/ace/Stream.inl +++ b/ace/Stream.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Stream.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <ACE_SYNCH_DECL> ACE_INLINE ACE_Module<ACE_SYNCH_USE> * ACE_Stream<ACE_SYNCH_USE>::head (void) @@ -47,3 +48,4 @@ ACE_Stream_Iterator<ACE_SYNCH_USE>::advance (void) return this->next_ != 0; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Stream_Modules.cpp b/ace/Stream_Modules.cpp index 3e4b4a6f1b7..69163951323 100644 --- a/ace/Stream_Modules.cpp +++ b/ace/Stream_Modules.cpp @@ -1,8 +1,7 @@ -// Stream_Modules.cpp // $Id$ -#ifndef ACE_STREAM_MODULES_C -#define ACE_STREAM_MODULES_C +#ifndef ACE_STREAM_MODULES_CPP +#define ACE_STREAM_MODULES_CPP #include "ace/Stream_Modules.h" #include "ace/OS_NS_string.h" @@ -11,7 +10,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Stream_Modules, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Stream_Head) @@ -375,4 +375,6 @@ ACE_Thru_Task<ACE_SYNCH_USE>::fini (void) return 0; } -#endif /* ACE_STREAM_MODULES_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_STREAM_MODULES_CPP */ diff --git a/ace/Stream_Modules.h b/ace/Stream_Modules.h index c108ff55603..10d396c95f5 100644 --- a/ace/Stream_Modules.h +++ b/ace/Stream_Modules.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ #define ACE_STREAM_MODULES #include /**/ "ace/pre.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Stream_Head * @@ -150,6 +152,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Stream_Modules.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/String_Base.cpp b/ace/String_Base.cpp index d5f065938d7..5aefdddbc75 100644 --- a/ace/String_Base.cpp +++ b/ace/String_Base.cpp @@ -1,3 +1,5 @@ +// $Id$ + #ifndef ACE_STRING_BASE_CPP #define ACE_STRING_BASE_CPP @@ -11,11 +13,7 @@ #include "ace/String_Base.inl" #endif /* __ACE_INLINE__ */ - -ACE_RCSID (ace, - String_Base, - "$Id$") - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_String_Base) @@ -294,6 +292,16 @@ ACE_String_Base<CHAR>::clear (int release) // Assignment operator (does copy memory). template <class CHAR> ACE_String_Base<CHAR> & +ACE_String_Base<CHAR>::operator= (const CHAR *s) +{ + ACE_TRACE ("ACE_String_Base<CHAR>::operator="); + if (s != 0) + this->set (s, 1); + return *this; +} + +// Assignment operator (does copy memory). +template <class CHAR> ACE_String_Base<CHAR> & ACE_String_Base<CHAR>::operator= (const ACE_String_Base<CHAR> &s) { ACE_TRACE ("ACE_String_Base<CHAR>::operator="); @@ -353,10 +361,10 @@ template <class CHAR> int ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const { ACE_TRACE ("ACE_String_Base<CHAR>::compare"); - + if (this->rep_ == s.rep_) return 0; - + // Pick smaller of the two lengths and perform the comparison. size_t smaller_length = ace_min (this->len_, s.len_); @@ -477,7 +485,7 @@ ACE_String_Base<CHAR>::operator+= (const CHAR* s) size_t slen = 0; if (s != 0) slen = ACE_OS::strlen (s); - return this->append(s, slen); + return this->append (s, slen); } template <class CHAR> ACE_String_Base<CHAR> & @@ -495,5 +503,6 @@ ACE_String_Base<CHAR>::operator+= (const CHAR c) return this->append(&c, slen); } +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_STRING_BASE_CPP */ diff --git a/ace/String_Base.h b/ace/String_Base.h index da9ab247d98..b8297c68a4a 100644 --- a/ace/String_Base.h +++ b/ace/String_Base.h @@ -24,6 +24,8 @@ #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Allocator; /** @@ -36,7 +38,7 @@ class ACE_Allocator; * ACE_Allocator with a persistable memory pool. This class is * optimized for efficiency, so it doesn't provide any internal * locking. - * NOTE: if an instance of this class is constructed from or + * @note If an instance of this class is constructed from or * assigned an empty string (with first element of '\0'), then it * is not allocated new space. Instead, its internal * representation is set equal to a global empty string. @@ -156,6 +158,14 @@ public: /** * Assignment operator (does copy memory). * + * @param s Input null-terminated CHAR string to assign to this object. + * @return Return a copy of the this string. + */ + ACE_String_Base < CHAR > &operator = (const CHAR * s); + + /** + * Assignment operator (does copy memory). + * * @param s Input ACE_String_Base string to assign to this object. * @return Return a copy of the this string. */ @@ -313,6 +323,9 @@ public: */ size_t length (void) const; + /// Return @c true if the length of the string is zero. + bool empty (void) const; + /** * Get a copy of the underlying representation. * @@ -514,6 +527,8 @@ template < class CHAR > ACE_String_Base < CHAR > operator + (const CHAR c, const ACE_String_Base < CHAR > &t); +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/String_Base.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/String_Base.inl b/ace/String_Base.inl index 2a27f4b158c..7234f916aab 100644 --- a/ace/String_Base.inl +++ b/ace/String_Base.inl @@ -8,6 +8,7 @@ #include "ace/OS_NS_string.h" #include "ace/OS_Memory.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class CHAR> ACE_INLINE void ACE_String_Base<CHAR>::dump (void) const @@ -33,6 +34,12 @@ ACE_String_Base<CHAR>::length (void) const return this->len_; } +template <class CHAR> ACE_INLINE bool +ACE_String_Base<CHAR>::empty (void) const +{ + return this->len_ == 0; +} + template <class CHAR> ACE_INLINE ACE_String_Base<CHAR> ACE_String_Base<CHAR>::substr (size_t offset, ssize_t length) const @@ -113,3 +120,4 @@ ACE_String_Base<CHAR>::strstr (const ACE_String_Base<CHAR> &s) const return this->find (s.rep_); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/String_Base_Const.cpp b/ace/String_Base_Const.cpp index bf66b2cf873..5f193d6c77e 100644 --- a/ace/String_Base_Const.cpp +++ b/ace/String_Base_Const.cpp @@ -2,4 +2,8 @@ #include "ace/String_Base_Const.h" -ssize_t ACE_String_Base_Const::npos = -1; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ssize_t const ACE_String_Base_Const::npos = -1; + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/String_Base_Const.h b/ace/String_Base_Const.h index 50a9c086c2b..5a3f935308e 100644 --- a/ace/String_Base_Const.h +++ b/ace/String_Base_Const.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,6 +23,8 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_String_Base_Const * @@ -32,8 +34,10 @@ class ACE_Export ACE_String_Base_Const { public: - static ssize_t npos; + static ssize_t const npos; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_STRING_BASE_CONST_H */ diff --git a/ace/Svc_Conf.h b/ace/Svc_Conf.h index 32385a37df7..4c14981caa3 100644 --- a/ace/Svc_Conf.h +++ b/ace/Svc_Conf.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -30,6 +30,8 @@ #if (ACE_USES_CLASSIC_SVC_CONF == 1) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. struct ace_yy_buffer_state; @@ -153,20 +155,6 @@ typedef union // Forward declaration struct ace_yy_buffer_state; -/// Create and push a new lexer buffer on to the buffer stack for use -/// when scanning the given file. -void ace_yy_push_buffer (FILE *file, - ace_yy_buffer_state *&buffer); - -/// Create and push a new lexer buffer on to the buffer stack for use -/// when scanning the given directive. -void ace_yy_push_buffer (const ACE_TCHAR *directive, - ace_yy_buffer_state *&buffer); - -/// Pop the current lexer buffer off of the buffer stack and -/// deallocate it. -void ace_yy_pop_buffer (ace_yy_buffer_state *buf); - /// Performs the parsing #ifdef ACE_YYPARSE_PARAM int ace_yyparse (void *); @@ -200,6 +188,8 @@ ace_create_service_type (const ACE_TCHAR *, ACE_Service_Object_Exterminator = 0); +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SVC_CONF_H */ diff --git a/ace/Svc_Conf.l b/ace/Svc_Conf.l deleted file mode 100644 index 8943882cdf7..00000000000 --- a/ace/Svc_Conf.l +++ /dev/null @@ -1,134 +0,0 @@ -%{ -// $Id$ -// Sample lexical analysis for regular expression subset. Must be -// compiled with FLEX and an ANSI C++ compiler. - -// Lexical tokens values defined by YACC. -#include "ace/Svc_Conf.h" -#include "ace/Svc_Conf_Tokens.h" -#include "ace/Svc_Conf_Lexer_Guard.h" - -ACE_RCSID (ace, - Svc_Conf_l, - "$Id$") - -#define token(x) x -%} - -%s PARAMETERS -%s NORMAL - -letter [a-zA-Z_] -letter_or_digit [a-zA-Z_0-9] -digit [0-9] -ident {letter}{letter_or_digit}* -pathname ([A-Za-z\%]:)?[a-zA-Z_0-9/\%\.\\~-]+ -symbol [ -~] -string (\"{symbol}*\"|\'{symbol}*\') -white_space [ \t] -newline \n -carrage_retn \r -other . - -%% - -^#{other}*$ ; /* EMPTY */ -dynamic { return token (ACE_DYNAMIC); } -static { return token (ACE_STATIC); } -suspend { return token (ACE_SUSPEND); } -resume { return token (ACE_RESUME); } -remove { return token (ACE_REMOVE); } -stream { return token (ACE_USTREAM); } -Module { return token (ACE_MODULE_T); } -Service_Object { return token (ACE_SVC_OBJ_T); } -STREAM { return token (ACE_STREAM_T); } -active { return token (ACE_ACTIVE); } -inactive { return token (ACE_INACTIVE); } -":" { return token (':'); } -"*" { return token ('*'); } -"(" { return token ('('); } -")" { return token (')'); } -"{" { return token ('{'); } -"}" { return token ('}'); } -{string} { - /* Remove trailing double quote character */ - ACE_TCHAR *s = ACE_OS::strrchr (yytext, yytext[0]); - - ACE_ASSERT (s != 0); - /* Eliminate the opening and closing double or - single quotes. */ - *s = '\0'; - yyleng -= 1; - yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (yytext + 1, yyleng); - return token (ACE_STRING); } -{ident} { - yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (yytext, yyleng); - return token (ACE_IDENT); - } -{pathname} { - yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (yytext, yyleng); - return token (ACE_PATHNAME); - } -{white_space}+ ; /* EMPTY */ -{carrage_retn} ; /* EMPTY */ -{newline} { ACE_SVC_CONF_PARAM->yylineno++; } -{other} { - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("unknown character = (%d"), - *yytext)); - if (ACE_OS::ace_isprint (*yytext)) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("|%c"), *yytext)); - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT (")\n"))); - } -<<EOF>> { yyterminate (); } -%% -int -yywrap (void) -{ - ACE_OS::fflush (yyin); - yytext[0] = '#'; - yyleng = 0; - - return 1; -} - -void -yy_push_buffer (FILE *file, yy_buffer_state *&buffer) -{ - // External synchronization is required. - - if (buffer == 0) - buffer = yy_create_buffer (file, YY_BUF_SIZE); - - yy_switch_to_buffer (buffer); -} - -void -yy_push_buffer (const ACE_TCHAR *directive, yy_buffer_state *&buffer) -{ - // External synchronization is required. - - // yyparse() may invoke yylex() multiple times when parsing - // a single directive. Prevent a new buffer from created during - // each call to yylex(). - if (YY_CURRENT_BUFFER != 0 - && directive == YY_CURRENT_BUFFER->yy_ch_buf) - return; - - if (buffer == 0) - { - // yy_scan_string() already switches the buffer so there is - // no need to explicitly make the switch. - buffer = yy_scan_string (directive); - } - else - yy_switch_to_buffer (buffer); -} - -void -yy_pop_buffer (yy_buffer_state *buffer) -{ - // External synchronization is required. - - yy_switch_to_buffer (buffer); -} diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y index 005f8ad972a..cb159d68b2f 100644 --- a/ace/Svc_Conf.y +++ b/ace/Svc_Conf.y @@ -16,6 +16,7 @@ ACE_RCSID (ace, Svc_Conf_y, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Prototypes. static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec, @@ -428,4 +429,7 @@ main (int argc, char *argv[]) return ::yyparse (¶m); } #endif /* DEBUGGING */ + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Svc_Conf_Lexer_Guard.cpp b/ace/Svc_Conf_Lexer_Guard.cpp deleted file mode 100644 index c5d79aa1f32..00000000000 --- a/ace/Svc_Conf_Lexer_Guard.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -*- C++ -*- - -#include "ace/Svc_Conf_Lexer_Guard.h" - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - -#include "ace/Svc_Conf.h" - -ACE_RCSID (ace, - Svc_Conf_Lexer_Guard, - "$Id$") - -ACE_Svc_Conf_Lexer_Guard::ACE_Svc_Conf_Lexer_Guard (ACE_Svc_Conf_Param *param) - : buffer_ (0) -{ - // External synchronization is required. - - // Note that allocation/deallocation is done once during the - // processing of a service configurator directive. Memory - // managements is done at a higher level, not in this class. This - // is necessary to prevent an allocation/deallocation from occurring - // when parsing/scanning each token. - - if (param->type == ACE_Svc_Conf_Param::SVC_CONF_FILE) - ::ace_yy_push_buffer (param->source.file, param->buffer); - else - ::ace_yy_push_buffer (param->source.directive, - param->buffer); - - this->buffer_ = param->buffer; -} - -ACE_Svc_Conf_Lexer_Guard::~ACE_Svc_Conf_Lexer_Guard (void) -{ - // External synchronization is required. - - ::ace_yy_pop_buffer (this->buffer_); -} -#endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Svc_Conf_Lexer_Guard.h b/ace/Svc_Conf_Lexer_Guard.h deleted file mode 100644 index 46f0c9a450d..00000000000 --- a/ace/Svc_Conf_Lexer_Guard.h +++ /dev/null @@ -1,79 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Svc_Conf_Lexer_Guard.h - * - * $Id$ - * - * @author Ossama Othman <ossama@uci.edu> - */ -//============================================================================= - -#ifndef ACE_SVC_CONF_LEXER_GUARD_H -#define ACE_SVC_CONF_LEXER_GUARD_H - -#include /**/ "ace/pre.h" - -#include "ace/config-all.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -/// Forward declarations -class ACE_Svc_Conf_Param; - -struct ace_yy_buffer_state; - -/** - * @class ACE_Svc_Conf_Lexer_Guard - * - * @brief "Guard" that ensures lexer buffer switching is - * exception-safe. - * - * Buffers are switched, if necessary, each time a token is - * parsed/scanned. The buffer switching must be synchronized - * externally. This class performs no synchronization. - * - * @note Note that allocation/deallocation is done once during the - * processing of a service configurator directive. Memory - * managements is done at a higher level, not in this class. - * This is necessary to prevent an allocation/deallocation from - * occurring when parsing/scanning each token. - */ -class ACE_Svc_Conf_Lexer_Guard -{ -public: - - /// Constructor - /** - * Switches buffers, if necessary, when token scanning first - * begins. Allocation of the buffer will also occur if one has not - * already been allocated. This operation effectively pushes a - * buffer on to a stack. - */ - ACE_Svc_Conf_Lexer_Guard (ACE_Svc_Conf_Param *param); - - /// Destructor - /** - * Switches buffers, if necessary when token scanning completes. No - * buffer deallocation occurs here. Buffers are deallocated when - * parsing of the entire directive is done, not when scanning of a - * single token is done. This operation effective pops a buffer off - * of a stack. - */ - ~ACE_Svc_Conf_Lexer_Guard (void); - -private: - - /// Lexer buffer that corresponds to the current Service - /// Configurator file/direct scan. - ace_yy_buffer_state *buffer_; - -}; - - -#include /**/ "ace/post.h" - -#endif /* ACE_SVC_CONF_LEXER_GUARD_H */ diff --git a/ace/Svc_Conf_l.cpp b/ace/Svc_Conf_l.cpp deleted file mode 100644 index 7d820243d36..00000000000 --- a/ace/Svc_Conf_l.cpp +++ /dev/null @@ -1,1850 +0,0 @@ -#define ACE_YY_NO_UNPUT - -#include "ace/Object_Manager.h" -#include "ace/Guard_T.h" -#include "ace/Recursive_Thread_Mutex.h" -#include "ace/Synch_Traits.h" -#include "ace/OS_NS_ctype.h" -#include "ace/OS_NS_string.h" -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header$ - */ - -#define FLEX_SCANNER -#define ACE_YY_FLEX_MAJOR_VERSION 2 -#define ACE_YY_FLEX_MINOR_VERSION 5 - -#include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_unistd.h" - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include "ace/OS_NS_stdlib.h" - -/* Use prototypes in function declarations. */ -#define ACE_YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define ACE_YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define ACE_YY_USE_PROTOS -#define ACE_YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include /**/ <io.h> -#include "ace/OS_NS_stdlib.h" -#define ACE_YY_USE_CONST -#define ACE_YY_USE_PROTOS -#endif - -#ifdef ACE_YY_USE_CONST -#define ace_yyconst const -#else -#define ace_yyconst -#endif - - -#ifdef ACE_YY_USE_PROTOS -#define ACE_YY_PROTO(proto) proto -#else -#define ACE_YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define ACE_YY_NULL 0 - -/* Promotes a possibly negative, possibly signed ACE_TCHAR to an unsigned - * integer for use as an array index. If the signed ACE_TCHAR is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define ACE_YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN ace_yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The ACE_YYSTATE alias is for lex - * compatibility. - */ -#define ACE_YY_START ((ace_yy_start - 1) / 2) -#define ACE_YYSTATE ACE_YY_START - -/* Action number for EOF rule of a given start state. */ -#define ACE_YY_STATE_EOF(state) (ACE_YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define ACE_YY_NEW_FILE ace_yyrestart( ace_yyin ) - -#define ACE_YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define ACE_YY_BUF_SIZE 16384 - -typedef struct ace_yy_buffer_state *ACE_YY_BUFFER_STATE; - -extern int ace_yyleng; -extern FILE *ace_yyin, *ace_yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * ace_yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the ace_yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define ace_yyless(n) \ - do \ - { \ - /* Undo effects of setting up ace_yytext. */ \ - *ace_yy_cp = ace_yy_hold_char; \ - ACE_YY_RESTORE_ACE_YY_MORE_OFFSET \ - ace_yy_c_buf_p = ace_yy_cp = ace_yy_bp + n - ACE_YY_MORE_ADJ; \ - ACE_YY_DO_BEFORE_ACTION; /* set up ace_yytext again */ \ - } \ - while ( 0 ) - -#if (ACE_USES_CLASSIC_SVC_CONF == 1) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int ace_yy_size_t; - - -struct ace_yy_buffer_state - { - FILE *ace_yy_input_file; - - ACE_TCHAR *ace_yy_ch_buf; /* input buffer */ - ACE_TCHAR *ace_yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - ace_yy_size_t ace_yy_buf_size; - - /* Number of characters read into ace_yy_ch_buf, not including EOB - * characters. - */ - int ace_yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int ace_yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int ace_yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int ace_yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int ace_yy_fill_buffer; - - int ace_yy_buffer_status; -#define ACE_YY_BUFFER_NEW 0 -#define ACE_YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as ACE_YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via ace_yyrestart()), so that the user can continue scanning by - * just pointing ace_yyin at a new input file. - */ -#define ACE_YY_BUFFER_EOF_PENDING 2 - }; - -static ACE_YY_BUFFER_STATE ace_yy_current_buffer = 0; - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define ACE_YY_CURRENT_BUFFER ace_yy_current_buffer - - -/* ace_yy_hold_char holds the character lost when ace_yytext is formed. */ -static ACE_TCHAR ace_yy_hold_char; - -static int ace_yy_n_chars; /* number of characters read into ace_yy_ch_buf */ - - -int ace_yyleng; - -/* Points to current character in buffer. */ -static ACE_TCHAR *ace_yy_c_buf_p = (ACE_TCHAR *) 0; -static int ace_yy_init = 1; /* whether we need to initialize */ -static int ace_yy_start = 0; /* start state number */ - -/* Flag which is used to allow ace_yywrap()'s to do buffer switches - * instead of setting up a fresh ace_yyin. A bit of a hack ... - */ -static int ace_yy_did_buffer_switch_on_eof; - -void ace_yyrestart ACE_YY_PROTO(( FILE *input_file )); - -void ace_yy_switch_to_buffer ACE_YY_PROTO(( ACE_YY_BUFFER_STATE new_buffer )); -void ace_yy_load_buffer_state ACE_YY_PROTO(( void )); -ACE_YY_BUFFER_STATE ace_yy_create_buffer ACE_YY_PROTO(( FILE *file, int size )); -void ace_yy_delete_buffer ACE_YY_PROTO(( ACE_YY_BUFFER_STATE b )); -void ace_yy_init_buffer ACE_YY_PROTO(( ACE_YY_BUFFER_STATE b, FILE *file )); -void ace_yy_flush_buffer ACE_YY_PROTO(( ACE_YY_BUFFER_STATE b )); -#define ACE_YY_FLUSH_BUFFER ace_yy_flush_buffer( ace_yy_current_buffer ) - -ACE_YY_BUFFER_STATE ace_yy_scan_buffer ACE_YY_PROTO(( ACE_TCHAR *base, ace_yy_size_t size )); -ACE_YY_BUFFER_STATE ace_yy_scan_string ACE_YY_PROTO(( ace_yyconst ACE_TCHAR *ace_yy_str )); -ACE_YY_BUFFER_STATE ace_yy_scan_bytes ACE_YY_PROTO(( ace_yyconst ACE_TCHAR *bytes, int len )); - -static void *ace_yy_flex_alloc ACE_YY_PROTO(( ace_yy_size_t )); -static void *ace_yy_flex_realloc ACE_YY_PROTO(( void *, ace_yy_size_t )); -static void ace_yy_flex_free ACE_YY_PROTO(( void * )); - -#define ace_yy_new_buffer ace_yy_create_buffer - -#define ace_yy_set_interactive(is_interactive) \ - { \ - if ( ! ace_yy_current_buffer ) \ - ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); \ - ace_yy_current_buffer->ace_yy_is_interactive = is_interactive; \ - } - -#define ace_yy_set_bol(at_bol) \ - { \ - if ( ! ace_yy_current_buffer ) \ - ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); \ - ace_yy_current_buffer->ace_yy_at_bol = at_bol; \ - } - -#define ACE_YY_AT_BOL() (ace_yy_current_buffer->ace_yy_at_bol) - -typedef ACE_TCHAR ACE_YY_CHAR; -FILE *ace_yyin = (FILE *) 0, *ace_yyout = (FILE *) 0; -typedef int ace_yy_state_type; -extern ACE_TCHAR *ace_yytext; -#define ace_yytext_ptr ace_yytext - -static ace_yy_state_type ace_yy_get_previous_state ACE_YY_PROTO(( void )); -static ace_yy_state_type ace_yy_try_NUL_trans ACE_YY_PROTO(( ace_yy_state_type current_state )); -static int ace_yy_get_next_buffer ACE_YY_PROTO(( void )); -static void ace_yy_fatal_error ACE_YY_PROTO(( ace_yyconst char msg[] )); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up ace_yytext. - */ -#define ACE_YY_DO_BEFORE_ACTION \ - ace_yytext_ptr = ace_yy_bp; \ - ace_yyleng = (int) (ace_yy_cp - ace_yy_bp); \ - ace_yy_hold_char = *ace_yy_cp; \ - *ace_yy_cp = '\0'; \ - ace_yy_c_buf_p = ace_yy_cp; - -#define ACE_YY_NUM_RULES 26 -#define ACE_YY_END_OF_BUFFER 27 -static ace_yyconst short int ace_yy_accept[108] = - { 0, - 0, 0, 0, 0, 0, 0, 27, 25, 22, 24, - 23, 25, 21, 25, 15, 16, 14, 21, 13, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 17, 18, - 25, 22, 0, 19, 21, 0, 0, 19, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 0, 1, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 8, 10, 20, 11, 20, 20, 6, - 5, 3, 7, 20, 20, 2, 20, 4, 20, 12, - - 20, 20, 20, 20, 20, 9, 0 - } ; - -static ace_yyconst int ace_yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 5, 6, 7, 8, 6, 9, 6, 10, 11, - 12, 13, 6, 6, 14, 14, 14, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 16, 6, 6, - 6, 6, 6, 6, 17, 18, 18, 18, 19, 18, - 18, 18, 18, 18, 18, 18, 20, 18, 21, 18, - 18, 22, 23, 24, 18, 18, 18, 18, 18, 18, - 6, 14, 6, 6, 25, 6, 26, 27, 28, 29, - - 30, 18, 18, 18, 31, 32, 18, 33, 34, 35, - 36, 37, 18, 38, 39, 40, 41, 42, 18, 18, - 43, 18, 44, 6, 45, 14, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static ace_yyconst int ace_yy_meta[46] = - { 0, - 1, 1, 1, 1, 2, 2, 2, 2, 3, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 2, 2 - } ; - -static ace_yyconst short int ace_yy_base[113] = - { 0, - 0, 127, 0, 118, 0, 117, 124, 438, 44, 438, - 438, 115, 100, 93, 438, 438, 438, 86, 438, 38, - 39, 42, 48, 51, 54, 60, 64, 68, 438, 438, - 98, 81, 86, 82, 72, 71, 71, 61, 76, 82, - 90, 91, 101, 104, 105, 114, 118, 124, 58, 438, - 133, 136, 145, 148, 151, 157, 166, 167, 175, 179, - 183, 189, 197, 203, 207, 216, 215, 219, 228, 227, - 231, 237, 250, 254, 262, 263, 272, 273, 282, 283, - 286, 292, 301, 302, 311, 314, 315, 323, 324, 332, - 333, 336, 344, 345, 348, 354, 362, 363, 366, 372, - - 375, 381, 384, 387, 390, 396, 438, 429, 56, 431, - 47, 434 - } ; - -static ace_yyconst short int ace_yy_def[113] = - { 0, - 107, 1, 1, 1, 1, 1, 107, 107, 107, 107, - 107, 108, 109, 110, 107, 107, 107, 109, 107, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 107, 107, - 112, 107, 108, 108, 109, 109, 110, 110, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 112, 107, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - - 111, 111, 111, 111, 111, 111, 0, 107, 107, 107, - 107, 107 - } ; - -static ace_yyconst short int ace_yy_nxt[484] = - { 0, - 8, 9, 10, 11, 9, 8, 12, 8, 13, 14, - 15, 16, 17, 18, 18, 19, 20, 20, 20, 21, - 20, 20, 22, 20, 23, 24, 20, 20, 25, 20, - 26, 20, 20, 20, 20, 20, 20, 27, 28, 20, - 20, 20, 20, 29, 30, 32, 35, 35, 32, 39, - 35, 35, 35, 36, 36, 35, 35, 36, 35, 35, - 50, 35, 35, 107, 35, 41, 36, 35, 35, 36, - 38, 42, 35, 35, 40, 36, 35, 35, 43, 36, - 38, 35, 32, 36, 35, 32, 107, 107, 34, 35, - 35, 107, 34, 46, 45, 35, 44, 107, 35, 35, - - 50, 107, 38, 35, 35, 107, 107, 47, 48, 35, - 51, 52, 35, 35, 35, 36, 107, 35, 35, 107, - 107, 34, 35, 107, 31, 31, 35, 35, 53, 107, - 56, 35, 35, 107, 31, 107, 107, 35, 55, 107, - 54, 35, 107, 59, 35, 107, 35, 57, 107, 35, - 107, 107, 58, 35, 63, 60, 35, 107, 35, 35, - 107, 35, 61, 107, 35, 35, 107, 107, 107, 107, - 35, 107, 107, 62, 35, 35, 66, 107, 65, 35, - 35, 107, 107, 35, 67, 107, 64, 35, 35, 107, - 107, 35, 35, 107, 107, 107, 35, 35, 107, 107, - - 107, 68, 35, 107, 107, 35, 107, 69, 71, 107, - 35, 35, 107, 74, 70, 35, 35, 107, 107, 72, - 35, 73, 107, 35, 35, 107, 107, 35, 35, 35, - 107, 107, 35, 75, 107, 35, 35, 107, 107, 35, - 35, 35, 107, 107, 35, 35, 107, 107, 76, 77, - 35, 107, 107, 107, 78, 107, 82, 81, 35, 107, - 79, 80, 35, 35, 107, 107, 83, 35, 107, 107, - 35, 35, 107, 85, 107, 35, 35, 107, 107, 84, - 35, 35, 107, 107, 107, 35, 35, 107, 107, 86, - 35, 35, 87, 107, 35, 35, 35, 107, 107, 35, - - 35, 107, 88, 89, 107, 35, 107, 107, 107, 35, - 35, 90, 91, 92, 35, 35, 107, 107, 107, 35, - 107, 107, 35, 35, 35, 93, 107, 35, 35, 107, - 107, 35, 35, 107, 107, 94, 35, 35, 107, 107, - 35, 35, 107, 95, 35, 35, 35, 107, 107, 35, - 96, 107, 35, 35, 107, 107, 35, 35, 35, 107, - 107, 35, 35, 107, 107, 97, 107, 35, 107, 107, - 35, 35, 99, 98, 35, 35, 35, 107, 107, 35, - 35, 107, 107, 35, 107, 35, 101, 107, 35, 35, - 107, 100, 35, 107, 35, 35, 107, 35, 35, 107, - - 35, 102, 107, 35, 35, 107, 107, 107, 107, 35, - 107, 107, 103, 104, 105, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, - 33, 33, 37, 37, 49, 49, 49, 7, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107 - } ; - -static ace_yyconst short int ace_yy_chk[484] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 9, 20, 21, 9, 111, - 22, 20, 21, 20, 21, 22, 23, 22, 109, 24, - 49, 23, 25, 23, 24, 22, 24, 25, 26, 25, - 38, 22, 27, 26, 21, 26, 28, 27, 24, 27, - 37, 28, 32, 28, 39, 32, 36, 35, 34, 39, - 40, 39, 33, 27, 26, 40, 25, 40, 41, 42, - - 31, 18, 14, 41, 42, 41, 42, 28, 28, 43, - 40, 41, 44, 45, 43, 13, 43, 44, 45, 44, - 45, 12, 46, 7, 6, 4, 47, 46, 42, 46, - 45, 47, 48, 47, 2, 0, 0, 48, 44, 48, - 43, 51, 0, 47, 52, 0, 51, 46, 51, 52, - 0, 52, 46, 53, 52, 47, 54, 0, 53, 55, - 53, 54, 48, 54, 55, 56, 55, 0, 0, 0, - 56, 0, 56, 51, 57, 58, 55, 0, 54, 57, - 58, 57, 58, 59, 56, 0, 53, 60, 59, 0, - 59, 61, 60, 0, 60, 0, 61, 62, 61, 0, - - 0, 57, 62, 0, 62, 63, 0, 58, 60, 0, - 63, 64, 63, 63, 59, 65, 64, 0, 64, 61, - 65, 62, 65, 67, 66, 0, 0, 68, 67, 66, - 67, 66, 68, 64, 68, 70, 69, 0, 0, 71, - 70, 69, 70, 69, 71, 72, 71, 0, 65, 66, - 72, 0, 72, 0, 67, 0, 71, 70, 73, 0, - 68, 69, 74, 73, 0, 73, 72, 74, 0, 74, - 75, 76, 0, 74, 0, 75, 76, 75, 76, 73, - 77, 78, 0, 0, 0, 77, 78, 77, 78, 75, - 79, 80, 76, 0, 81, 79, 80, 79, 80, 81, - - 82, 81, 77, 78, 0, 82, 0, 82, 0, 83, - 84, 79, 80, 81, 83, 84, 83, 84, 0, 85, - 0, 0, 86, 87, 85, 82, 85, 86, 87, 86, - 87, 88, 89, 0, 0, 83, 88, 89, 88, 89, - 90, 91, 0, 86, 92, 90, 91, 90, 91, 92, - 88, 92, 93, 94, 0, 0, 95, 93, 94, 93, - 94, 95, 96, 95, 0, 89, 0, 96, 0, 96, - 97, 98, 95, 94, 99, 97, 98, 97, 98, 99, - 100, 99, 0, 101, 0, 100, 99, 100, 101, 102, - 101, 97, 103, 0, 102, 104, 102, 103, 105, 103, - - 104, 101, 104, 105, 106, 105, 0, 0, 0, 106, - 0, 106, 102, 103, 104, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, - 108, 108, 110, 110, 112, 112, 112, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107 - } ; - -static ace_yy_state_type ace_yy_last_accepting_state; -static ACE_TCHAR *ace_yy_last_accepting_cpos; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define ace_yymore() ace_yymore_used_but_not_detected -#define ACE_YY_MORE_ADJ 0 -#define ACE_YY_RESTORE_ACE_YY_MORE_OFFSET -ACE_TCHAR *ace_yytext; -#define INITIAL 0 -// $Id$ -// Sample lexical analysis for regular expression subset. Must be -// compiled with FLEX and an ANSI C++ compiler. - -// Lexical tokens values defined by YACC. -#include "ace/Svc_Conf.h" -#include "ace/Svc_Conf_Tokens.h" -#include "ace/Svc_Conf_Lexer_Guard.h" - -ACE_RCSID (ace, - Svc_Conf_l, - "$Id$") - -#define token(x) x -#define PARAMETERS 1 - -#define NORMAL 2 - - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef ACE_YY_SKIP_ACE_YYWRAP -#ifdef __cplusplus -extern "C" int ace_yywrap ACE_YY_PROTO(( void )); -#else -extern int ace_yywrap ACE_YY_PROTO(( void )); -#endif -#endif - -#ifndef ACE_YY_NO_UNPUT -static void ace_yyunput ACE_YY_PROTO(( int c, ACE_TCHAR *buf_ptr )); -#endif - -#ifndef ace_yytext_ptr -static void ace_yy_flex_strncpy ACE_YY_PROTO(( ACE_TCHAR *, ace_yyconst ACE_TCHAR *, int )); -#endif - -#ifdef ACE_YY_NEED_STRLEN -static int ace_yy_flex_strlen ACE_YY_PROTO(( ace_yyconst ACE_TCHAR * )); -#endif - -#ifndef ACE_YY_NO_INPUT -#ifdef __cplusplus -static int ace_yyinput ACE_YY_PROTO(( void )); -#else -static int input ACE_YY_PROTO(( void )); -#endif -#endif - -#if ACE_YY_STACK_USED -static int ace_yy_start_stack_ptr = 0; -static int ace_yy_start_stack_depth = 0; -static int *ace_yy_start_stack = 0; -#ifndef ACE_YY_NO_PUSH_STATE -static void ace_yy_push_state ACE_YY_PROTO(( int new_state )); -#endif -#ifndef ACE_YY_NO_POP_STATE -static void ace_yy_pop_state ACE_YY_PROTO(( void )); -#endif -#ifndef ACE_YY_NO_TOP_STATE -static int ace_yy_top_state ACE_YY_PROTO(( void )); -#endif - -#else -#define ACE_YY_NO_PUSH_STATE 1 -#define ACE_YY_NO_POP_STATE 1 -#define ACE_YY_NO_TOP_STATE 1 -#endif - -#ifdef ACE_YY_MALLOC_DECL -ACE_YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include "ace/OS_NS_stdlib.h" -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef ACE_YY_READ_BUF_SIZE -#define ACE_YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ACE_SVC_CONF_ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ACE_SVC_CONF_ECHO (void) fwrite( ace_yytext, ace_yyleng, 1, ace_yyout ) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or ACE_YY_NULL, - * is returned in "result". - */ -#ifndef ACE_YY_INPUT -#define ACE_YY_INPUT(buf,result,max_size) \ - if ( ace_yy_current_buffer->ace_yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( ace_yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (ACE_TCHAR) c; \ - if ( c == '\n' ) \ - buf[n++] = (ACE_TCHAR) c; \ - if ( c == EOF && ferror( ace_yyin ) ) \ - ACE_YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno = 0; \ - while ( ((result = fread( buf, sizeof (ACE_TCHAR), max_size, ace_yyin )) == 0) \ - && ferror( ace_yyin ) ) \ - { \ - if (errno != EINTR) \ - { \ - ACE_YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno = 0; \ - clearerr(ace_yyin); \ - } \ - } -#endif - -/* No semi-colon after return; correct usage is to write "ace_yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef ace_yyterminate -#define ace_yyterminate() return ACE_YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef ACE_YY_START_STACK_INCR -#define ACE_YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef ACE_YY_FATAL_ERROR -#define ACE_YY_FATAL_ERROR(msg) ace_yy_fatal_error( msg ) -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef ACE_YY_DECL -#define ACE_YY_DECL int ace_yylex ACE_YY_PROTO(( void )) -#endif - -/* Code executed at the beginning of each rule, after ace_yytext and ace_yyleng - * have been set up. - */ -#ifndef ACE_YY_USER_ACTION -#define ACE_YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef ACE_YY_BREAK -#define ACE_YY_BREAK break; -#endif - -#define ACE_YY_RULE_SETUP \ - if ( ace_yyleng > 0 ) \ - ace_yy_current_buffer->ace_yy_at_bol = \ - (ace_yytext[ace_yyleng - 1] == '\n'); \ - ACE_YY_USER_ACTION - -ACE_YY_DECL - { - register ace_yy_state_type ace_yy_current_state; - register ACE_TCHAR *ace_yy_cp = 0, *ace_yy_bp = 0; - register int ace_yy_act; - - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, - ace_mon, - *ACE_Static_Object_Lock::instance (), - -1)); - - ACE_Svc_Conf_Lexer_Guard ace_lexer_guard (ACE_SVC_CONF_PARAM); - - if ( ace_yy_init ) - { - ace_yy_init = 0; - -#ifdef ACE_YY_USER_INIT - ACE_YY_USER_INIT; -#endif - - if ( ! ace_yy_start ) - ace_yy_start = 1; /* first start state */ - - if ( ! ace_yyin ) - ace_yyin = stdin; - - if ( ! ace_yyout ) - ace_yyout = stdout; - - if ( ! ace_yy_current_buffer ) - ace_yy_current_buffer = - ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); - - ace_yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { - ace_yy_cp = ace_yy_c_buf_p; - - /* Support of ace_yytext. */ - *ace_yy_cp = ace_yy_hold_char; - - /* ace_yy_bp points to the position in ace_yy_ch_buf of the start of - * the current run. - */ - ace_yy_bp = ace_yy_cp; - - ace_yy_current_state = ace_yy_start; - ace_yy_current_state += ACE_YY_AT_BOL(); -ace_yy_match: - do - { - register ACE_YY_CHAR ace_yy_c = ace_yy_ec[ACE_YY_SC_TO_UI(*ace_yy_cp)]; - if ( ace_yy_accept[ace_yy_current_state] ) - { - ace_yy_last_accepting_state = ace_yy_current_state; - ace_yy_last_accepting_cpos = ace_yy_cp; - } - while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) - { - ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; - if ( ace_yy_current_state >= 108 ) - ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; - } - ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; - ++ace_yy_cp; - } - while ( ace_yy_base[ace_yy_current_state] != 438 ); - -ace_yy_find_action: - ace_yy_act = ace_yy_accept[ace_yy_current_state]; - if ( ace_yy_act == 0 ) - { /* have to back up */ - ace_yy_cp = ace_yy_last_accepting_cpos; - ace_yy_current_state = ace_yy_last_accepting_state; - ace_yy_act = ace_yy_accept[ace_yy_current_state]; - } - - ACE_YY_DO_BEFORE_ACTION; - - -do_action: /* This label is used only to access EOF actions. */ - - - switch ( ace_yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of ACE_YY_DO_BEFORE_ACTION */ - *ace_yy_cp = ace_yy_hold_char; - ace_yy_cp = ace_yy_last_accepting_cpos; - ace_yy_current_state = ace_yy_last_accepting_state; - goto ace_yy_find_action; - -case 1: -*ace_yy_cp = ace_yy_hold_char; /* undo effects of setting up ace_yytext */ -ace_yy_c_buf_p = ace_yy_cp -= 1; -ACE_YY_DO_BEFORE_ACTION; /* set up ace_yytext again */ -ACE_YY_RULE_SETUP -; /* EMPTY */ - ACE_YY_BREAK -case 2: -ACE_YY_RULE_SETUP -{ return token (ACE_DYNAMIC); } - //ACE_YY_BREAK -case 3: -ACE_YY_RULE_SETUP -{ return token (ACE_STATIC); } - //ACE_YY_BREAK -case 4: -ACE_YY_RULE_SETUP -{ return token (ACE_SUSPEND); } - //ACE_YY_BREAK -case 5: -ACE_YY_RULE_SETUP -{ return token (ACE_RESUME); } - //ACE_YY_BREAK -case 6: -ACE_YY_RULE_SETUP -{ return token (ACE_REMOVE); } - //ACE_YY_BREAK -case 7: -ACE_YY_RULE_SETUP -{ return token (ACE_USTREAM); } - //ACE_YY_BREAK -case 8: -ACE_YY_RULE_SETUP -{ return token (ACE_MODULE_T); } - //ACE_YY_BREAK -case 9: -ACE_YY_RULE_SETUP -{ return token (ACE_SVC_OBJ_T); } - //ACE_YY_BREAK -case 10: -ACE_YY_RULE_SETUP -{ return token (ACE_STREAM_T); } - //ACE_YY_BREAK -case 11: -ACE_YY_RULE_SETUP -{ return token (ACE_ACTIVE); } - //ACE_YY_BREAK -case 12: -ACE_YY_RULE_SETUP -{ return token (ACE_INACTIVE); } - //ACE_YY_BREAK -case 13: -ACE_YY_RULE_SETUP -{ return token (':'); } - //ACE_YY_BREAK -case 14: -ACE_YY_RULE_SETUP -{ return token ('*'); } - //ACE_YY_BREAK -case 15: -ACE_YY_RULE_SETUP -{ return token ('('); } - //ACE_YY_BREAK -case 16: -ACE_YY_RULE_SETUP -{ return token (')'); } - //ACE_YY_BREAK -case 17: -ACE_YY_RULE_SETUP -{ return token ('{'); } - //ACE_YY_BREAK -case 18: -ACE_YY_RULE_SETUP -{ return token ('}'); } - //ACE_YY_BREAK -case 19: -ACE_YY_RULE_SETUP -{ - /* Remove trailing quote character (' or ") */ - ACE_TCHAR *s = ACE_OS::strrchr (ace_yytext, ace_yytext[0]); - - ACE_ASSERT (s != 0); - /* Eliminate the opening and closing double or - single quotes. */ - *s = '\0'; - ace_yyleng -= 1; - ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext + 1, ace_yyleng); - return token (ACE_STRING); } - //ACE_YY_BREAK -case 20: -ACE_YY_RULE_SETUP -{ - ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext, ace_yyleng); - return token (ACE_IDENT); - } - //ACE_YY_BREAK -case 21: -ACE_YY_RULE_SETUP -{ - ace_yylval->ident_ = ACE_SVC_CONF_PARAM->obstack.copy (ace_yytext, ace_yyleng); - return token (ACE_PATHNAME); - } - //ACE_YY_BREAK -case 22: -ACE_YY_RULE_SETUP -; /* EMPTY */ - ACE_YY_BREAK -case 23: -ACE_YY_RULE_SETUP -; /* EMPTY */ - ACE_YY_BREAK -case 24: -ACE_YY_RULE_SETUP -{ ACE_SVC_CONF_PARAM->yylineno++; } - ACE_YY_BREAK -case 25: -ACE_YY_RULE_SETUP -{ - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("unknown character = (%d"), - *ace_yytext)); - if (ACE_OS::ace_isprint (*ace_yytext)) - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("|%c"), *ace_yytext)); - ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT (")\n"))); - } - ACE_YY_BREAK -case ACE_YY_STATE_EOF(INITIAL): -case ACE_YY_STATE_EOF(PARAMETERS): -case ACE_YY_STATE_EOF(NORMAL): -{ ace_yyterminate (); } - ACE_YY_BREAK -case 26: -ACE_YY_RULE_SETUP -ACE_SVC_CONF_ECHO; - ACE_YY_BREAK - - case ACE_YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int ace_yy_amount_of_matched_text = (int) (ace_yy_cp - ace_yytext_ptr) - 1; - - /* Undo the effects of ACE_YY_DO_BEFORE_ACTION. */ - *ace_yy_cp = ace_yy_hold_char; - ACE_YY_RESTORE_ACE_YY_MORE_OFFSET - - if ( ace_yy_current_buffer->ace_yy_buffer_status == ACE_YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed ace_yyin at a new source and called - * ace_yylex(). If so, then we have to assure - * consistency between ace_yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - ace_yy_n_chars = ace_yy_current_buffer->ace_yy_n_chars; - ace_yy_current_buffer->ace_yy_input_file = ace_yyin; - ace_yy_current_buffer->ace_yy_buffer_status = ACE_YY_BUFFER_NORMAL; - } - - /* Note that here we test for ace_yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since ace_yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( ace_yy_c_buf_p <= &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] ) - { /* This was really a NUL. */ - ace_yy_state_type ace_yy_next_state; - - ace_yy_c_buf_p = ace_yytext_ptr + ace_yy_amount_of_matched_text; - - ace_yy_current_state = ace_yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * ace_yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - ace_yy_next_state = ace_yy_try_NUL_trans( ace_yy_current_state ); - - ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; - - if ( ace_yy_next_state ) - { - /* Consume the NUL. */ - ace_yy_cp = ++ace_yy_c_buf_p; - ace_yy_current_state = ace_yy_next_state; - goto ace_yy_match; - } - - else - { - ace_yy_cp = ace_yy_c_buf_p; - goto ace_yy_find_action; - } - } - - else switch ( ace_yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - ace_yy_did_buffer_switch_on_eof = 0; - - if ( ace_yywrap() ) - { - /* Note: because we've taken care in - * ace_yy_get_next_buffer() to have set up - * ace_yytext, we can now set up - * ace_yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * ACE_YY_NULL, it'll still work - another - * ACE_YY_NULL will get returned. - */ - ace_yy_c_buf_p = ace_yytext_ptr + ACE_YY_MORE_ADJ; - - ace_yy_act = ACE_YY_STATE_EOF(ACE_YY_START); - goto do_action; - } - - else - { - if ( ! ace_yy_did_buffer_switch_on_eof ) - ACE_YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - ace_yy_c_buf_p = - ace_yytext_ptr + ace_yy_amount_of_matched_text; - - ace_yy_current_state = ace_yy_get_previous_state(); - - ace_yy_cp = ace_yy_c_buf_p; - ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; - goto ace_yy_match; - - case EOB_ACT_LAST_MATCH: - ace_yy_c_buf_p = - &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars]; - - ace_yy_current_state = ace_yy_get_previous_state(); - - ace_yy_cp = ace_yy_c_buf_p; - ace_yy_bp = ace_yytext_ptr + ACE_YY_MORE_ADJ; - goto ace_yy_find_action; - } - break; - } - - default: - ACE_YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of ace_yylex */ - - -/* ace_yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -static int ace_yy_get_next_buffer() - { - register ACE_TCHAR *dest = ace_yy_current_buffer->ace_yy_ch_buf; - register ACE_TCHAR *source = ace_yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( ace_yy_c_buf_p > &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars + 1] ) - ACE_YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( ace_yy_current_buffer->ace_yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( ace_yy_c_buf_p - ace_yytext_ptr - ACE_YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (ace_yy_c_buf_p - ace_yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( ace_yy_current_buffer->ace_yy_buffer_status == ACE_YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars = 0; - - else - { - int num_to_read = - ace_yy_current_buffer->ace_yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef ACE_YY_USES_REJECT - ACE_YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - ACE_YY_BUFFER_STATE b = ace_yy_current_buffer; - - int ace_yy_c_buf_p_offset = - (int) (ace_yy_c_buf_p - b->ace_yy_ch_buf); - - if ( b->ace_yy_is_our_buffer ) - { - int new_size = b->ace_yy_buf_size * 2; - - if ( new_size <= 0 ) - b->ace_yy_buf_size += b->ace_yy_buf_size / 8; - else - b->ace_yy_buf_size *= 2; - - b->ace_yy_ch_buf = (ACE_TCHAR *) - /* Include room in for 2 EOB chars. */ - ace_yy_flex_realloc( (void *) b->ace_yy_ch_buf, - (b->ace_yy_buf_size + 2) * sizeof (ACE_TCHAR) ); - } - else - /* Can't grow it, we don't own it. */ - b->ace_yy_ch_buf = 0; - - if ( ! b->ace_yy_ch_buf ) - ACE_YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - ace_yy_c_buf_p = &b->ace_yy_ch_buf[ace_yy_c_buf_p_offset]; - - num_to_read = ace_yy_current_buffer->ace_yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read * sizeof (ACE_TCHAR) > ACE_YY_READ_BUF_SIZE ) - num_to_read = ACE_YY_READ_BUF_SIZE / sizeof (ACE_TCHAR); - - /* Read in more data. */ - ACE_YY_INPUT( (&ace_yy_current_buffer->ace_yy_ch_buf[number_to_move]), - ace_yy_n_chars, num_to_read ); - - ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars; - } - - if ( ace_yy_n_chars == 0 ) - { - if ( number_to_move == ACE_YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - ace_yyrestart( ace_yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - ace_yy_current_buffer->ace_yy_buffer_status = - ACE_YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - ace_yy_n_chars += number_to_move; - ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] = ACE_YY_END_OF_BUFFER_CHAR; - ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars + 1] = ACE_YY_END_OF_BUFFER_CHAR; - - ace_yytext_ptr = &ace_yy_current_buffer->ace_yy_ch_buf[0]; - - return ret_val; - } - - -/* ace_yy_get_previous_state - get the state just before the EOB ACE_TCHAR was reached */ - -static ace_yy_state_type ace_yy_get_previous_state() - { - register ace_yy_state_type ace_yy_current_state; - register ACE_TCHAR *ace_yy_cp; - - ace_yy_current_state = ace_yy_start; - ace_yy_current_state += ACE_YY_AT_BOL(); - - for ( ace_yy_cp = ace_yytext_ptr + ACE_YY_MORE_ADJ; ace_yy_cp < ace_yy_c_buf_p; ++ace_yy_cp ) - { - register ACE_YY_CHAR ace_yy_c = (*ace_yy_cp ? ace_yy_ec[ACE_YY_SC_TO_UI(*ace_yy_cp)] : 1); - if ( ace_yy_accept[ace_yy_current_state] ) - { - ace_yy_last_accepting_state = ace_yy_current_state; - ace_yy_last_accepting_cpos = ace_yy_cp; - } - while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) - { - ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; - if ( ace_yy_current_state >= 108 ) - ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; - } - ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; - } - - return ace_yy_current_state; - } - - -/* ace_yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = ace_yy_try_NUL_trans( current_state ); - */ - -#ifdef ACE_YY_USE_PROTOS -static ace_yy_state_type ace_yy_try_NUL_trans( ace_yy_state_type ace_yy_current_state ) -#else -static ace_yy_state_type ace_yy_try_NUL_trans( ace_yy_current_state ) -ace_yy_state_type ace_yy_current_state; -#endif - { - register int ace_yy_is_jam; - register ACE_TCHAR *ace_yy_cp = ace_yy_c_buf_p; - - register ACE_YY_CHAR ace_yy_c = 1; - if ( ace_yy_accept[ace_yy_current_state] ) - { - ace_yy_last_accepting_state = ace_yy_current_state; - ace_yy_last_accepting_cpos = ace_yy_cp; - } - while ( ace_yy_chk[ace_yy_base[ace_yy_current_state] + ace_yy_c] != ace_yy_current_state ) - { - ace_yy_current_state = (int) ace_yy_def[ace_yy_current_state]; - if ( ace_yy_current_state >= 108 ) - ace_yy_c = ace_yy_meta[(unsigned int) ace_yy_c]; - } - ace_yy_current_state = ace_yy_nxt[ace_yy_base[ace_yy_current_state] + (unsigned int) ace_yy_c]; - ace_yy_is_jam = (ace_yy_current_state == 107); - - return ace_yy_is_jam ? 0 : ace_yy_current_state; - } - - -#ifndef ACE_YY_NO_UNPUT -#ifdef ACE_YY_USE_PROTOS -static void ace_yyunput( int c, register ACE_TCHAR *ace_yy_bp ) -#else -static void ace_yyunput( c, ace_yy_bp ) -int c; -register ACE_TCHAR *ace_yy_bp; -#endif - { - register ACE_TCHAR *ace_yy_cp = ace_yy_c_buf_p; - - /* undo effects of setting up ace_yytext */ - *ace_yy_cp = ace_yy_hold_char; - - if ( ace_yy_cp < ace_yy_current_buffer->ace_yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = ace_yy_n_chars + 2; - register ACE_TCHAR *dest = &ace_yy_current_buffer->ace_yy_ch_buf[ - ace_yy_current_buffer->ace_yy_buf_size + 2]; - register ACE_TCHAR *source = - &ace_yy_current_buffer->ace_yy_ch_buf[number_to_move]; - - while ( source > ace_yy_current_buffer->ace_yy_ch_buf ) - *--dest = *--source; - - ace_yy_cp += (int) (dest - source); - ace_yy_bp += (int) (dest - source); - ace_yy_current_buffer->ace_yy_n_chars = - ace_yy_n_chars = ace_yy_current_buffer->ace_yy_buf_size; - - if ( ace_yy_cp < ace_yy_current_buffer->ace_yy_ch_buf + 2 ) - ACE_YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--ace_yy_cp = (ACE_TCHAR) c; - - - ace_yytext_ptr = ace_yy_bp; - ace_yy_hold_char = *ace_yy_cp; - ace_yy_c_buf_p = ace_yy_cp; - } -#endif /* ifndef ACE_YY_NO_UNPUT */ - - -#ifdef __cplusplus -static int ace_yyinput() -#else -static int input() -#endif - { - int c; - - *ace_yy_c_buf_p = ace_yy_hold_char; - - if ( *ace_yy_c_buf_p == ACE_YY_END_OF_BUFFER_CHAR ) - { - /* ace_yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( ace_yy_c_buf_p < &ace_yy_current_buffer->ace_yy_ch_buf[ace_yy_n_chars] ) - /* This was really a NUL. */ - *ace_yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = ace_yy_c_buf_p - ace_yytext_ptr; - ++ace_yy_c_buf_p; - - switch ( ace_yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because ace_yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - ace_yyrestart( ace_yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( ace_yywrap() ) - return EOF; - - if ( ! ace_yy_did_buffer_switch_on_eof ) - ACE_YY_NEW_FILE; -#ifdef __cplusplus - return ace_yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - ace_yy_c_buf_p = ace_yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) ace_yy_c_buf_p; /* cast for 8-bit char's */ - *ace_yy_c_buf_p = '\0'; /* preserve ace_yytext */ - ace_yy_hold_char = *++ace_yy_c_buf_p; - - ace_yy_current_buffer->ace_yy_at_bol = (c == '\n'); - - return c; - } - - -#ifdef ACE_YY_USE_PROTOS -void ace_yyrestart( FILE *input_file ) -#else -void ace_yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! ace_yy_current_buffer ) - ace_yy_current_buffer = ace_yy_create_buffer( ace_yyin, ACE_YY_BUF_SIZE ); - - ace_yy_init_buffer( ace_yy_current_buffer, input_file ); - ace_yy_load_buffer_state(); - } - - -#ifdef ACE_YY_USE_PROTOS -void ace_yy_switch_to_buffer( ACE_YY_BUFFER_STATE new_buffer ) -#else -void ace_yy_switch_to_buffer( new_buffer ) -ACE_YY_BUFFER_STATE new_buffer; -#endif - { - if ( ace_yy_current_buffer == new_buffer ) - return; - - if ( ace_yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *ace_yy_c_buf_p = ace_yy_hold_char; - ace_yy_current_buffer->ace_yy_buf_pos = ace_yy_c_buf_p; - ace_yy_current_buffer->ace_yy_n_chars = ace_yy_n_chars; - } - - ace_yy_current_buffer = new_buffer; - ace_yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (ace_yywrap()) processing, but the only time this flag - * is looked at is after ace_yywrap() is called, so it's safe - * to go ahead and always set it. - */ - ace_yy_did_buffer_switch_on_eof = 1; - } - - -#ifdef ACE_YY_USE_PROTOS -void ace_yy_load_buffer_state( void ) -#else -void ace_yy_load_buffer_state() -#endif - { - ace_yy_n_chars = ace_yy_current_buffer->ace_yy_n_chars; - ace_yytext_ptr = ace_yy_c_buf_p = ace_yy_current_buffer->ace_yy_buf_pos; - ace_yyin = ace_yy_current_buffer->ace_yy_input_file; - ace_yy_hold_char = *ace_yy_c_buf_p; - } - - -#ifdef ACE_YY_USE_PROTOS -ACE_YY_BUFFER_STATE ace_yy_create_buffer( FILE *file, int size ) -#else -ACE_YY_BUFFER_STATE ace_yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - ACE_YY_BUFFER_STATE b; - - b = (ACE_YY_BUFFER_STATE) ace_yy_flex_alloc( sizeof( struct ace_yy_buffer_state ) ); - if ( ! b ) - ACE_YY_FATAL_ERROR( "out of dynamic memory in ace_yy_create_buffer()" ); - - b->ace_yy_buf_size = size; - - /* ace_yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->ace_yy_ch_buf = (ACE_TCHAR *) ace_yy_flex_alloc( (b->ace_yy_buf_size + 2) * sizeof (ACE_TCHAR) ); - if ( ! b->ace_yy_ch_buf ) - ACE_YY_FATAL_ERROR( "out of dynamic memory in ace_yy_create_buffer()" ); - - b->ace_yy_is_our_buffer = 1; - - ace_yy_init_buffer( b, file ); - - return b; - } - - -#ifdef ACE_YY_USE_PROTOS -void ace_yy_delete_buffer( ACE_YY_BUFFER_STATE b ) -#else -void ace_yy_delete_buffer( b ) -ACE_YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; - - if ( b == ace_yy_current_buffer ) - ace_yy_current_buffer = (ACE_YY_BUFFER_STATE) 0; - - if ( b->ace_yy_is_our_buffer ) - ace_yy_flex_free( (void *) b->ace_yy_ch_buf ); - - ace_yy_flex_free( (void *) b ); - } - - - -#ifdef ACE_YY_USE_PROTOS -void ace_yy_init_buffer( ACE_YY_BUFFER_STATE b, FILE *file ) -#else -void ace_yy_init_buffer( b, file ) -ACE_YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - ace_yy_flush_buffer( b ); - - b->ace_yy_input_file = file; - b->ace_yy_fill_buffer = 1; - -#if ACE_YY_ALWAYS_INTERACTIVE - b->ace_yy_is_interactive = 1; -#else -#if ACE_YY_NEVER_INTERACTIVE - b->ace_yy_is_interactive = 0; -#else - b->ace_yy_is_interactive = file ? (ACE_OS::isatty( fileno (file) ) > 0) : 0; -#endif -#endif - } - - -#ifdef ACE_YY_USE_PROTOS -void ace_yy_flush_buffer( ACE_YY_BUFFER_STATE b ) -#else -void ace_yy_flush_buffer( b ) -ACE_YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) - return; - - b->ace_yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->ace_yy_ch_buf[0] = ACE_YY_END_OF_BUFFER_CHAR; - b->ace_yy_ch_buf[1] = ACE_YY_END_OF_BUFFER_CHAR; - - b->ace_yy_buf_pos = &b->ace_yy_ch_buf[0]; - - b->ace_yy_at_bol = 1; - b->ace_yy_buffer_status = ACE_YY_BUFFER_NEW; - - if ( b == ace_yy_current_buffer ) - ace_yy_load_buffer_state(); - } - - -#ifndef ACE_YY_NO_SCAN_BUFFER -#ifdef ACE_YY_USE_PROTOS -ACE_YY_BUFFER_STATE ace_yy_scan_buffer( ACE_TCHAR *base, ace_yy_size_t size ) -#else -ACE_YY_BUFFER_STATE ace_yy_scan_buffer( base, size ) -ACE_TCHAR *base; -ace_yy_size_t size; -#endif - { - ACE_YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != ACE_YY_END_OF_BUFFER_CHAR || - base[size-1] != ACE_YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (ACE_YY_BUFFER_STATE) ace_yy_flex_alloc( sizeof( struct ace_yy_buffer_state ) ); - if ( ! b ) - ACE_YY_FATAL_ERROR( "out of dynamic memory in ace_yy_scan_buffer()" ); - - b->ace_yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->ace_yy_buf_pos = b->ace_yy_ch_buf = base; - b->ace_yy_is_our_buffer = 0; - b->ace_yy_input_file = 0; - b->ace_yy_n_chars = b->ace_yy_buf_size; - b->ace_yy_is_interactive = 0; - b->ace_yy_at_bol = 1; - b->ace_yy_fill_buffer = 0; - b->ace_yy_buffer_status = ACE_YY_BUFFER_NEW; - - ace_yy_switch_to_buffer( b ); - - return b; - } -#endif - - -#ifndef ACE_YY_NO_SCAN_STRING -#ifdef ACE_YY_USE_PROTOS -ACE_YY_BUFFER_STATE ace_yy_scan_string( ace_yyconst ACE_TCHAR *ace_yy_str ) -#else -ACE_YY_BUFFER_STATE ace_yy_scan_string( ace_yy_str ) -ace_yyconst ACE_TCHAR *ace_yy_str; -#endif - { - int len; - for ( len = 0; ace_yy_str[len]; ++len ) - ; - - return ace_yy_scan_bytes( ace_yy_str, len ); - } -#endif - - -#ifndef ACE_YY_NO_SCAN_BYTES -#ifdef ACE_YY_USE_PROTOS -ACE_YY_BUFFER_STATE ace_yy_scan_bytes( ace_yyconst ACE_TCHAR *bytes, int len ) -#else -ACE_YY_BUFFER_STATE ace_yy_scan_bytes( bytes, len ) -ace_yyconst ACE_TCHAR *bytes; -int len; -#endif - { - ACE_YY_BUFFER_STATE b; - ACE_TCHAR *buf; - ace_yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (ACE_TCHAR *) ace_yy_flex_alloc( n * sizeof (ACE_TCHAR)); - if ( ! buf ) - ACE_YY_FATAL_ERROR( "out of dynamic memory in ace_yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = ACE_YY_END_OF_BUFFER_CHAR; - - b = ace_yy_scan_buffer( buf, n ); - if ( ! b ) - ACE_YY_FATAL_ERROR( "bad buffer in ace_yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->ace_yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef ACE_YY_NO_PUSH_STATE -#ifdef ACE_YY_USE_PROTOS -static void ace_yy_push_state( int new_state ) -#else -static void ace_yy_push_state( new_state ) -int new_state; -#endif - { - if ( ace_yy_start_stack_ptr >= ace_yy_start_stack_depth ) - { - ace_yy_size_t new_size; - - ace_yy_start_stack_depth += ACE_YY_START_STACK_INCR; - new_size = ace_yy_start_stack_depth * sizeof( int ); - - if ( ! ace_yy_start_stack ) - ace_yy_start_stack = (int *) ace_yy_flex_alloc( new_size ); - - else - ace_yy_start_stack = (int *) ace_yy_flex_realloc( - (void *) ace_yy_start_stack, new_size ); - - if ( ! ace_yy_start_stack ) - ACE_YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - ace_yy_start_stack[ace_yy_start_stack_ptr++] = ACE_YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef ACE_YY_NO_POP_STATE -static void ace_yy_pop_state() - { - if ( --ace_yy_start_stack_ptr < 0 ) - ACE_YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(ace_yy_start_stack[ace_yy_start_stack_ptr]); - } -#endif - - -#ifndef ACE_YY_NO_TOP_STATE -static int ace_yy_top_state() - { - return ace_yy_start_stack[ace_yy_start_stack_ptr - 1]; - } -#endif - -#ifndef ACE_YY_EXIT_FAILURE -#define ACE_YY_EXIT_FAILURE 2 -#endif - -#ifdef ACE_YY_USE_PROTOS -static void ace_yy_fatal_error( ace_yyconst char msg[] ) -#else -static void ace_yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) ACE_OS::fprintf( stderr, "%s\n", msg ); - ACE_OS::exit( ACE_YY_EXIT_FAILURE ); - } - - - -/* Redefine ace_yyless() so it works in section 3 code. */ - -#undef ace_yyless -#define ace_yyless(n) \ - do \ - { \ - /* Undo effects of setting up ace_yytext. */ \ - ace_yytext[ace_yyleng] = ace_yy_hold_char; \ - ace_yy_c_buf_p = ace_yytext + n; \ - ace_yy_hold_char = *ace_yy_c_buf_p; \ - *ace_yy_c_buf_p = '\0'; \ - ace_yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef ace_yytext_ptr -#ifdef ACE_YY_USE_PROTOS -static void ace_yy_flex_strncpy( ACE_TCHAR *s1, ace_yyconst ACE_TCHAR *s2, int n ) -#else -static void ace_yy_flex_strncpy( s1, s2, n ) -ACE_TCHAR *s1; -ace_yyconst ACE_TCHAR *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef ACE_YY_NEED_STRLEN -#ifdef ACE_YY_USE_PROTOS -static int ace_yy_flex_strlen( ace_yyconst ACE_TCHAR *s ) -#else -static int ace_yy_flex_strlen( s ) -ace_yyconst ACE_TCHAR *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef ACE_YY_USE_PROTOS -static void *ace_yy_flex_alloc( ace_yy_size_t size ) -#else -static void *ace_yy_flex_alloc( size ) -ace_yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef ACE_YY_USE_PROTOS -static void *ace_yy_flex_realloc( void *ptr, ace_yy_size_t size ) -#else -static void *ace_yy_flex_realloc( ptr, size ) -void *ptr; -ace_yy_size_t size; -#endif - { - /* The cast to (ACE_TCHAR *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef ACE_YY_USE_PROTOS -static void ace_yy_flex_free( void *ptr ) -#else -static void ace_yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ACE_MALLOC_T (ptr) ); - } - -#if ACE_YY_MAIN -int main() - { - ace_yylex(); - return 0; - } -#endif - -int -ace_yywrap (void) -{ - ACE_OS::fflush (ace_yyin); - ace_yytext[0] = '#'; - ace_yyleng = 0; - - return 1; -} - -void -ace_yy_push_buffer (FILE *file, ace_yy_buffer_state *&buffer) -{ - // External synchronization is required. - - if (buffer == 0) - buffer = ace_yy_create_buffer (file, ACE_YY_BUF_SIZE); - - ace_yy_switch_to_buffer (buffer); -} - -void -ace_yy_push_buffer (const ACE_TCHAR *directive, ace_yy_buffer_state *&buffer) -{ - // External synchronization is required. - - // ace_yyparse() may invoke ace_yylex() multiple times when parsing - // a single directive. Prevent a new buffer from created during - // each call to ace_yylex(). - if (ACE_YY_CURRENT_BUFFER != 0 - && directive == ACE_YY_CURRENT_BUFFER->ace_yy_ch_buf) - return; - - if (buffer == 0) - { - // ace_yy_scan_string() already switches the buffer so there is - // no need to explicitly make the switch. - buffer = ace_yy_scan_string (directive); - } - else - ace_yy_switch_to_buffer (buffer); -} - -void -ace_yy_pop_buffer (ace_yy_buffer_state *buffer) -{ - // External synchronization is required. - - ace_yy_switch_to_buffer (buffer); -} -#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */ diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp index 13e67fba952..f8cb4551e48 100644 --- a/ace/Svc_Conf_y.cpp +++ b/ace/Svc_Conf_y.cpp @@ -37,6 +37,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Prototypes. static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec, ACE_Static_Node *svc_type, @@ -298,7 +300,9 @@ static const short ace_yycheck[] = # define ACE_YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) +ACE_END_VERSIONED_NAMESPACE_DECL # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL # define ACE_YYSIZE_T size_t # endif # define ACE_YYSTACK_ALLOC malloc @@ -381,7 +385,9 @@ union ace_yyalloc #endif #if ! defined (ACE_YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) +ACE_END_VERSIONED_NAMESPACE_DECL # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL # define ACE_YYSIZE_T size_t # endif #endif @@ -461,7 +467,9 @@ while (0) #if ACE_YYDEBUG # ifndef ACE_YYFPRINTF +ACE_END_VERSIONED_NAMESPACE_DECL # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL # define ACE_YYFPRINTF ACE_OS::fprintf # endif @@ -1523,4 +1531,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) return ::ace_yyparse (¶m); } #endif /* DEBUGGING */ + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_USES_CLASSIC_SVC_CONF == 1 */ diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp index 2fb990a9064..a1cb000c58a 100644 --- a/ace/Svc_Handler.cpp +++ b/ace/Svc_Handler.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_SVC_HANDLER_C -#define ACE_SVC_HANDLER_C +#ifndef ACE_SVC_HANDLER_CPP +#define ACE_SVC_HANDLER_CPP #include "ace/Svc_Handler.h" @@ -15,11 +15,11 @@ #include "ace/Dynamic.h" -ACE_RCSID(ace, Svc_Handler, "$Id$") - #define PR_ST_1 ACE_PEER_STREAM_1 #define PR_ST_2 ACE_PEER_STREAM_2 +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <PR_ST_1, ACE_SYNCH_DECL> void * ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator new (size_t, void *p) @@ -91,6 +91,18 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator new (size_t n, return ::new(ACE_nothrow) char[n]; } } + +#if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE) +template <PR_ST_1, ACE_SYNCH_DECL> void +ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator delete (void *p, + const ACE_nothrow_t&) throw() +{ + ACE_TRACE + ("ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator delete(nothrow)"); + ::delete [] static_cast <char *> (p); +} +#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */ + #endif /* ACE_HAS_NEW_NOTHROW */ template <PR_ST_1, ACE_SYNCH_DECL> void @@ -115,8 +127,7 @@ ACE_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::operator delete (void *obj) // You cannot delete a 'void*' (X3J16/95-0087 5.3.5.3), but we know // the pointer was created using new char[] (see operator new code), // so we use a cast: - char *tmp = (char *) obj; - ::delete [] tmp; + ::delete [] static_cast <char *> (obj); } // Default constructor. @@ -509,6 +520,8 @@ ACE_Buffered_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::handle_timeout (const ACE_Time return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #undef PR_ST_1 #undef PR_ST_2 -#endif /* ACE_SVC_HANDLER_C */ +#endif /* ACE_SVC_HANDLER_CPP */ diff --git a/ace/Svc_Handler.h b/ace/Svc_Handler.h index 2fd4f15320e..76027b9e409 100644 --- a/ace/Svc_Handler.h +++ b/ace/Svc_Handler.h @@ -16,9 +16,6 @@ #include /**/ "ace/pre.h" -// Forward decls. -class ACE_Connection_Recycling_Strategy; - #include "ace/Synch_Options.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -29,6 +26,11 @@ class ACE_Connection_Recycling_Strategy; #include "ace/Recyclable.h" #include "ace/Reactor.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// Forward decls. +class ACE_Connection_Recycling_Strategy; + /** * @class ACE_Svc_Handler * @@ -155,6 +157,9 @@ public: /// itself up correctly whether or not it's allocated statically or /// dynamically. void *operator new (size_t n, const ACE_nothrow_t&) throw(); +#if !defined (ACE_LACKS_PLACEMENT_OPERATOR_DELETE) + void operator delete (void *p, const ACE_nothrow_t&) throw (); +#endif /* ACE_LACKS_PLACEMENT_OPERATOR_DELETE */ #endif /// This operator permits "placement new" on a per-object basis. @@ -231,7 +236,7 @@ protected: /// Keeps track of whether we are in the process of closing (required /// to avoid circular calls to <handle_close>). - char closing_; + int closing_; /// Pointer to the connection recycler. ACE_Connection_Recycling_Strategy *recycler_; @@ -248,7 +253,7 @@ protected: * its connected peer and supports buffering. * * The buffering feature makes it possible to queue up - * <ACE_Message_Blocks> in an <ACE_Message_Queue> until (1) the + * <ACE_Message_Blocks> in an ACE_Message_Queue until (1) the * queue is "full" or (2) a period of time elapses, at which * point the queue is "flushed" via <sendv_n> to the peer. */ @@ -260,7 +265,7 @@ public: /** * Constructor initializes the <thr_mgr> and <mq> by passing them * down to the <ACE_Task> base class. The <reactor> is passed to - * the <ACE_Event_Handler>. The <max_buffer_size> and + * the ACE_Event_Handler. The <max_buffer_size> and * <relative_timeout> are used to determine at what point to flush * the <mq>. By default, there's no buffering at all. The * <relative_timeout> value is interpreted to be in a unit that's @@ -276,8 +281,8 @@ public: virtual ~ACE_Buffered_Svc_Handler (void); /** - * Insert the <ACE_Message_Block> chain rooted at <message_block> - * into the <ACE_Message_Queue> with the designated <timeout>. The + * Insert the ACE_Message_Block chain rooted at <message_block> + * into the ACE_Message_Queue with the designated <timeout>. The * <flush> method will be called if this <put> causes the number of * bytes to exceed the maximum buffer size or if the timeout period * has elapsed. @@ -285,8 +290,8 @@ public: virtual int put (ACE_Message_Block *message_block, ACE_Time_Value *timeout = 0); - /// Flush the <ACE_Message_Queue>, which writes all the queued - /// <ACE_Message_Block>s to the <PEER_STREAM>. + /// Flush the ACE_Message_Queue, which writes all the queued + /// ACE_Message_Blocks to the <PEER_STREAM>. virtual int flush (void); /// This method is not currently implemented -- this is where the @@ -298,8 +303,8 @@ public: void dump (void) const; protected: - /// Implement the flush operation on the <ACE_Message_Queue>, which - /// writes all the queued <ACE_Message_Block>s to the <PEER_STREAM>. + /// Implement the flush operation on the ACE_Message_Queue, which + /// writes all the queued ACE_Message_Blocks to the <PEER_STREAM>. /// Assumes that the caller holds the lock. virtual int flush_i (void); @@ -320,6 +325,8 @@ protected: ACE_Time_Value *timeoutp_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Svc_Handler.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Swap.cpp b/ace/Swap.cpp index 4f62e72ade6..eb14789c3de 100644 --- a/ace/Swap.cpp +++ b/ace/Swap.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file Swap.cpp * @@ -7,8 +6,8 @@ * @author Carlos O'Ryan <coryan@uci.edu> */ -#ifndef ACE_SWAP_C -#define ACE_SWAP_C +#ifndef ACE_SWAP_CPP +#define ACE_SWAP_CPP #include "ace/Swap.h" @@ -20,6 +19,4 @@ #include "ace/Swap.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Swap, "$Id$") - -#endif /* ACE_SWAP_C */ +#endif /* ACE_SWAP_CPP */ diff --git a/ace/Swap.h b/ace/Swap.h index 0d2ebcf0c05..a5688095eae 100644 --- a/ace/Swap.h +++ b/ace/Swap.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + /** * @file Swap.h * @@ -17,11 +18,16 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Swap * * @brief Defines a function to swap two variables. * + * @deprecated This template is deprecated, you can use std::swap without + * problems on all platforms. + * */ template<class T> class ACE_Swap { @@ -30,6 +36,8 @@ public: static void swap (T &lhs, T &rhs); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Swap.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Swap.inl b/ace/Swap.inl index b1139ca3ffb..195f1559f69 100644 --- a/ace/Swap.inl +++ b/ace/Swap.inl @@ -1,3 +1,5 @@ +// -*- C++ -*- + /** * @file Swap.inl * @@ -6,6 +8,8 @@ * @author Carlos O'Ryan <coryan@uci.edu> */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class T> ACE_INLINE void ACE_Swap<T>::swap (T &lhs, T& rhs) { @@ -13,3 +17,5 @@ ACE_Swap<T>::swap (T &lhs, T& rhs) lhs = rhs; rhs = tmp; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Synch.cpp b/ace/Synch.cpp index 6a81cb386f7..d6972b74a5d 100644 --- a/ace/Synch.cpp +++ b/ace/Synch.cpp @@ -1,5 +1,5 @@ -#ifndef ACE_SYNCH_C -#define ACE_SYNCH_C +#ifndef ACE_SYNCH_CPP +#define ACE_SYNCH_CPP #include "ace/Thread.h" #include "ace/ACE.h" @@ -33,6 +33,8 @@ ACE_RCSID (ace, #include "ace/Thread_Mutex.cpp" #include "ace/Thread_Semaphore.cpp" - //ACE_ALLOC_HOOK_DEFINE(ACE_Null_Mutex) +// ACE_BEGIN_VERSIONED_NAMESPACE_DECL +// ACE_ALLOC_HOOK_DEFINE(ACE_Null_Mutex) +// ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_SYNCH_C */ +#endif /* ACE_SYNCH_CPP */ diff --git a/ace/Synch_Options.cpp b/ace/Synch_Options.cpp index d8f4e9bba9a..4f95720486c 100644 --- a/ace/Synch_Options.cpp +++ b/ace/Synch_Options.cpp @@ -1,9 +1,5 @@ #include "ace/Synch_Options.h" -#if !defined (__ACE_INLINE__) -#include "ace/Synch_Options.inl" -#endif /* __ACE_INLINE__ */ - #include "ace/Global_Macros.h" #include "ace/config-all.h" @@ -11,6 +7,7 @@ ACE_RCSID (ace, Synch_Options, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE (ACE_Synch_Options) @@ -109,3 +106,5 @@ ACE_Synch_Options::arg (const void *a) ACE_TRACE ("ACE_Synch_Options::arg"); this->arg_ = a; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Synch_Options.h b/ace/Synch_Options.h index f9c97033759..288e4acb329 100644 --- a/ace/Synch_Options.h +++ b/ace/Synch_Options.h @@ -23,6 +23,7 @@ #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Synch_Options @@ -81,9 +82,6 @@ public: const ACE_Time_Value &timeout = ACE_Time_Value::zero, const void *arg = 0); - /// Default dtor. - ~ACE_Synch_Options (void); - /// Initialize the Synch_Options based on parameters. void set (unsigned long options = 0, const ACE_Time_Value &timeout = ACE_Time_Value::zero, @@ -149,9 +147,7 @@ private: const void *arg_; }; -#if defined (__ACE_INLINE__) -#include "ace/Synch_Options.inl" -#endif /* __ACE_INLINE__ */ +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/ace/Synch_Options.inl b/ace/Synch_Options.inl deleted file mode 100644 index 3cba94e0fef..00000000000 --- a/ace/Synch_Options.inl +++ /dev/null @@ -1,7 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -ACE_INLINE -ACE_Synch_Options::~ACE_Synch_Options (void) -{ -} diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp index b41640ba1d2..22ee08d4e0b 100644 --- a/ace/Synch_T.cpp +++ b/ace/Synch_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_SYNCH_T_C -#define ACE_SYNCH_T_C +#ifndef ACE_SYNCH_T_CPP +#define ACE_SYNCH_T_CPP #include "ace/Thread.h" @@ -13,12 +13,10 @@ #include "ace/Synch_T.h" #include "ace/Log_Msg.h" -ACE_RCSID(ace, Synch_T, "$Id$") - #include "ace/Lock_Adapter_T.cpp" #include "ace/Reverse_Lock_T.cpp" #include "ace/Guard_T.cpp" #include "ace/TSS_T.cpp" #include "ace/Condition_T.cpp" -#endif /* ACE_SYNCH_T_C */ +#endif /* ACE_SYNCH_T_CPP */ diff --git a/ace/Synch_T.h b/ace/Synch_T.h index 9b9eba49734..c853a3f3325 100644 --- a/ace/Synch_T.h +++ b/ace/Synch_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** diff --git a/ace/Synch_Traits.h b/ace/Synch_Traits.h index a9b9481433b..03e8b25362d 100644 --- a/ace/Synch_Traits.h +++ b/ace/Synch_Traits.h @@ -23,6 +23,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl class ACE_Null_Mutex; class ACE_Null_Condition; @@ -144,5 +146,7 @@ public: #define ACE_SYNCH ACE_NULL_SYNCH #endif /* ACE_HAS_THREADS */ +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SYNCH_TRAITS_H */ diff --git a/ace/System_Time.cpp b/ace/System_Time.cpp index dcb1480aa51..9aa77c4ddf1 100644 --- a/ace/System_Time.cpp +++ b/ace/System_Time.cpp @@ -1,4 +1,3 @@ -// System_Time.cpp // $Id$ #include "ace/System_Time.h" @@ -8,6 +7,8 @@ ACE_RCSID(ace, System_Time, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname) : delta_time_ (0) { @@ -66,7 +67,7 @@ int ACE_System_Time::get_local_system_time (ACE_Time_Value &time_out) { ACE_TRACE ("ACE_System_Time::get_local_system_time"); - time_out.sec (ACE_OS::time (0)); + time_out.set (ACE_OS::time (0), 0); return 0; } @@ -132,12 +133,4 @@ ACE_System_Time::sync_local_system_time (ACE_System_Time::Sync_Mode) ACE_NOTSUP_RETURN (-1); } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block>; -template class ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex>; -template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> >; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Malloc_T<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex, ACE_Control_Block> -#pragma instantiate ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> -#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> > -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/System_Time.h b/ace/System_Time.h index 1688ae45755..6128f61ec3d 100644 --- a/ace/System_Time.h +++ b/ace/System_Time.h @@ -1,5 +1,4 @@ -/* -*- C++ -*- */ - +// -*- C++ -*- //============================================================================= /** @@ -22,10 +21,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Memory_Pool.h" +#include "ace/MMAP_Memory_Pool.h" #include "ace/Malloc_T.h" #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_System_Time * @@ -70,7 +71,7 @@ public: int sync_local_system_time (ACE_System_Time::Sync_Mode mode); private: - typedef ACE_Malloc <ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC; + typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> MALLOC; typedef ACE_Allocator_Adapter<MALLOC> ALLOCATOR; /// Our allocator (used for obtaining system time from shared memory). @@ -83,5 +84,7 @@ private: long *delta_time_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_SYSTEM_TIME_H */ diff --git a/ace/TLI.cpp b/ace/TLI.cpp index 3efa611ef74..c53ed5a7e4e 100644 --- a/ace/TLI.cpp +++ b/ace/TLI.cpp @@ -19,6 +19,8 @@ ACE_RCSID(ace, TLI, "$Id$") #include "ace/TLI.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_TLI) void @@ -266,4 +268,6 @@ ACE_TLI::get_option (int level, int option, void *optval, int &optlen) #endif /* ACE_HAS_SVR4_TLI */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TLI */ diff --git a/ace/TLI.h b/ace/TLI.h index 6960af430cf..20fcec2841a 100644 --- a/ace/TLI.h +++ b/ace/TLI.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -44,6 +44,8 @@ #define ACE_XTI_ATM_DEVICE "/dev/xtisvc0" #endif +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_TLI * @@ -103,6 +105,8 @@ private: #endif /* ACE_HAS_SVR4_TLI */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/TLI.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/TLI.inl b/ace/TLI.inl index 8f32186deaf..2485cdc5557 100644 --- a/ace/TLI.inl +++ b/ace/TLI.inl @@ -1,12 +1,14 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// TLI.i - #include "ace/TLI.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE -int +int ACE_TLI::look (void) const { ACE_TRACE ("ACE_TLI::look"); @@ -14,7 +16,7 @@ ACE_TLI::look (void) const } ACE_INLINE -int +int ACE_TLI::rcvdis (struct t_discon *discon) const { ACE_TRACE ("ACE_TLI::rcvdis"); @@ -22,7 +24,7 @@ ACE_TLI::rcvdis (struct t_discon *discon) const } ACE_INLINE -int +int ACE_TLI::snddis (struct t_call *call) const { ACE_TRACE ("ACE_TLI::snddis"); @@ -30,7 +32,7 @@ ACE_TLI::snddis (struct t_call *call) const } ACE_INLINE -int +int ACE_TLI::rcvrel (void) const { ACE_TRACE ("ACE_TLI::rcvrel"); @@ -38,9 +40,11 @@ ACE_TLI::rcvrel (void) const } ACE_INLINE -int +int ACE_TLI::sndrel (void) const { ACE_TRACE ("ACE_TLI::sndrel"); return ACE_OS::t_sndrel (this->get_handle ()); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TLI_Acceptor.cpp b/ace/TLI_Acceptor.cpp index 180bcc95717..427cca27f69 100644 --- a/ace/TLI_Acceptor.cpp +++ b/ace/TLI_Acceptor.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, TLI_Acceptor, "$Id$") #if defined (ACE_HAS_TLI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Put the actual definitions of the ACE_TLI_Request and // ACE_TLI_Request_Queue classes here to hide them from clients... @@ -552,4 +554,6 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, return new_tli_sap.get_handle () == ACE_INVALID_HANDLE ? -1 : 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TLI */ diff --git a/ace/TLI_Acceptor.h b/ace/TLI_Acceptor.h index 9d74cd69569..e7855b83c8f 100644 --- a/ace/TLI_Acceptor.h +++ b/ace/TLI_Acceptor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,6 +26,8 @@ #if defined (ACE_HAS_TLI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward reference... class ACE_TLI_Request_Queue; class ACE_Time_Value; @@ -114,6 +116,8 @@ private: struct t_discon *disp_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TLI */ #include /**/ "ace/post.h" #endif /* ACE_TLI_ACCEPTOR_H */ diff --git a/ace/TLI_Connector.cpp b/ace/TLI_Connector.cpp index d48d854f8e1..9a11d2c880b 100644 --- a/ace/TLI_Connector.cpp +++ b/ace/TLI_Connector.cpp @@ -1,4 +1,3 @@ -// TLI_Connector.cpp // $Id$ #include "ace/TLI_Connector.h" @@ -16,6 +15,8 @@ ACE_RCSID(ace, TLI_Connector, "$Id$") #include "ace/OS_NS_string.h" #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Connector) void @@ -250,4 +251,6 @@ ACE_TLI_Connector::complete (ACE_TLI_Stream &new_stream, #endif /* ACE_WIN32 */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TLI */ diff --git a/ace/TLI_Connector.h b/ace/TLI_Connector.h index f625458f204..d8e8f381bfb 100644 --- a/ace/TLI_Connector.h +++ b/ace/TLI_Connector.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -24,6 +24,8 @@ #if defined (ACE_HAS_TLI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_TLI_Connector * @@ -117,6 +119,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/TLI_Connector.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/TLI_Connector.inl b/ace/TLI_Connector.inl index 6539e19a6cd..f2a29f122c3 100644 --- a/ace/TLI_Connector.inl +++ b/ace/TLI_Connector.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// TLI_Connector.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_TLI_Connector::ACE_TLI_Connector (ACE_TLI_Stream &new_stream, @@ -45,3 +46,4 @@ ACE_TLI_Connector::reset_new_handle (ACE_HANDLE handle) return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TLI_Stream.cpp b/ace/TLI_Stream.cpp index cf42719db85..7b7e41fa42d 100644 --- a/ace/TLI_Stream.cpp +++ b/ace/TLI_Stream.cpp @@ -15,6 +15,8 @@ ACE_RCSID(ace, TLI_Stream, "$Id$") #include "ace/TLI_Stream.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_TLI_Stream) void @@ -222,4 +224,6 @@ ACE_TLI_Stream::recv_n (void *buf, bytes_transferred); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TLI */ diff --git a/ace/TLI_Stream.h b/ace/TLI_Stream.h index 468ab87f9ac..fe54f76f30b 100644 --- a/ace/TLI_Stream.h +++ b/ace/TLI_Stream.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,6 +27,8 @@ #if defined (ACE_HAS_TLI) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Time_Value; /** @@ -122,12 +124,14 @@ private: int rwflag_; /// Get rwflag - int get_rwflag (void); + int get_rwflag (void) const; /// Set rwflag - void set_rwflag (int); + void set_rwflag (int value); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/TLI_Stream.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/TLI_Stream.inl b/ace/TLI_Stream.inl index 89583e7fb8b..8ef7265f8cd 100644 --- a/ace/TLI_Stream.inl +++ b/ace/TLI_Stream.inl @@ -1,10 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// TLI_Stream.i - #include "ace/TLI_Stream.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE void ACE_TLI_Stream::set_rwflag (int value) @@ -15,8 +16,10 @@ ACE_TLI_Stream::set_rwflag (int value) ACE_INLINE int -ACE_TLI_Stream::get_rwflag (void) +ACE_TLI_Stream::get_rwflag (void) const { ACE_TRACE ("ACE_TLI_Stream::get_rwflag"); return this->rwflag_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TP_Reactor.cpp b/ace/TP_Reactor.cpp index c4eb9c1726d..2b1a8463ce9 100644 --- a/ace/TP_Reactor.cpp +++ b/ace/TP_Reactor.cpp @@ -15,12 +15,14 @@ ACE_RCSID (ace, TP_Reactor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_TP_Reactor) int -ACE_TP_Token_Guard::grab_token (ACE_Time_Value *max_wait_time) +ACE_TP_Token_Guard::acquire_read_token (ACE_Time_Value *max_wait_time) { - ACE_TRACE ("ACE_TP_Token_Guard::grab_token"); + ACE_TRACE ("ACE_TP_Token_Guard::acquire_read_token"); // The order of these events is very subtle, modify with care. @@ -89,7 +91,7 @@ ACE_TP_Token_Guard::acquire_token (ACE_Time_Value *max_wait_time) return -1; } - // We got the token and so let us mark ourseleves as owner + // We got the token and so let us mark ourselves as owner this->owner_ = 1; return result; @@ -106,13 +108,13 @@ ACE_TP_Reactor::ACE_TP_Reactor (ACE_Sig_Handler *sh, this->supress_notify_renew (1); } -ACE_TP_Reactor::ACE_TP_Reactor (size_t size, - int rs, +ACE_TP_Reactor::ACE_TP_Reactor (size_t max_number_of_handles, + int restart, ACE_Sig_Handler *sh, ACE_Timer_Queue *tq, int mask_signals, int s_queue) - : ACE_Select_Reactor (size, rs, sh, tq, 0, 0, mask_signals, s_queue) + : ACE_Select_Reactor (max_number_of_handles, restart, sh, tq, 0, 0, mask_signals, s_queue) { ACE_TRACE ("ACE_TP_Reactor::ACE_TP_Reactor"); this->supress_notify_renew (1); @@ -155,7 +157,7 @@ ACE_TP_Reactor::handle_events (ACE_Time_Value *max_wait_time) // this thread. ACE_TP_Token_Guard guard (this->token_); - int result = guard.grab_token (max_wait_time); + int const result = guard.acquire_read_token (max_wait_time); // If the guard is NOT the owner just return the retval if (!guard.is_owner ()) @@ -452,7 +454,7 @@ ACE_TP_Reactor::handle_notify_events (int & /*event_count*/, } } - // If we did ssome work, then we just return 1 which will allow us + // If we did some work, then we just return 1 which will allow us // to get out of here. If we return 0, then we will be asked to do // some work ie. dispacth socket events return result; @@ -476,25 +478,17 @@ ACE_TP_Reactor::handle_socket_events (int &event_count, } // Suspend the handler so that other threads don't start dispatching - // it. + // it, if we can't suspend then return directly // // NOTE: This check was performed in older versions of the // TP_Reactor. Looks like it is a waste.. if (dispatch_info.event_handler_ != this->notify_handler_) - this->suspend_i (dispatch_info.handle_); - - int resume_flag = - dispatch_info.event_handler_->resume_handler (); - - int reference_counting_required = - dispatch_info.event_handler_->reference_counting_policy ().value () == - ACE_Event_Handler::Reference_Counting_Policy::ENABLED; + if (this->suspend_i (dispatch_info.handle_) == -1) + return 0; // Call add_reference() if needed. - if (reference_counting_required) - { - dispatch_info.event_handler_->add_reference (); - } + if (dispatch_info.reference_counting_required_) + dispatch_info.event_handler_->add_reference (); // Release the lock. Others threads can start waiting. guard.release_token (); @@ -509,17 +503,6 @@ ACE_TP_Reactor::handle_socket_events (int &event_count, if (this->dispatch_socket_event (dispatch_info) == 0) ++result; - // Resume handler if required. - if (dispatch_info.event_handler_ != this->notify_handler_ && - resume_flag == ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER) - this->resume_handler (dispatch_info.handle_); - - // Call remove_reference() if needed. - if (reference_counting_required) - { - dispatch_info.event_handler_->remove_reference (); - } - return result; } @@ -543,18 +526,9 @@ ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time) // yet have a size_ > 0. This is an attempt to remedy the affect, // without knowing why it happens. - //# if !(defined (__SUNPRO_CC) && (__SUNPRO_CC > 0x500)) - // SunCC seems to be having problems with this piece of code - // here. I am not sure why though. This works fine with other - // compilers. As we dont seem to understand when this piece of - // code is needed and as it creates problems for SunCC we will - // not compile this. Most of the tests in TAO seem to be happy - // without this in SunCC. this->ready_set_.rd_mask_.sync (this->ready_set_.rd_mask_.max_set ()); this->ready_set_.wr_mask_.sync (this->ready_set_.wr_mask_.max_set ()); this->ready_set_.ex_mask_.sync (this->ready_set_.ex_mask_.max_set ()); - //# endif /* ! __SUNPRO_CC */ - } return this->wait_for_multiple_events (this->ready_set_, @@ -564,9 +538,6 @@ ACE_TP_Reactor::get_event_for_dispatching (ACE_Time_Value *max_wait_time) int ACE_TP_Reactor::get_socket_event_info (ACE_EH_Dispatch_Info &event) { - // Nothing to dispatch yet - event.reset (); - // Check for dispatch in write, except, read. Only catch one, but if // one is caught, be sure to clear the handle from each mask in case // there is more than one mask set for it. This would cause problems @@ -640,18 +611,14 @@ ACE_TP_Reactor::get_socket_event_info (ACE_EH_Dispatch_Info &event) return found_io; } - - // Dispatches a single event handler int ACE_TP_Reactor::dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info) { ACE_TRACE ("ACE_TP_Reactor::dispatch_socket_event"); - ACE_HANDLE handle = dispatch_info.handle_; - ACE_Event_Handler *event_handler = dispatch_info.event_handler_; - ACE_Reactor_Mask mask = dispatch_info.mask_; - ACE_EH_PTMF callback = dispatch_info.callback_; + ACE_Event_Handler * const event_handler = dispatch_info.event_handler_; + ACE_EH_PTMF const callback = dispatch_info.callback_; // Check for removed handlers. if (event_handler == 0) @@ -664,19 +631,55 @@ ACE_TP_Reactor::dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info) // handling other things. int status = 1; while (status > 0) - status = (event_handler->*callback) (handle); + status = (event_handler->*callback) (dispatch_info.handle_); + + // Post process socket event + return this->post_process_socket_event (dispatch_info, status); +} + +int +ACE_TP_Reactor::post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info, + int status) +{ + int result = 0; - // If negative, remove from Reactor - if (status < 0) + // First check if we really have to post process something, if not, then + // we don't acquire the token which saves us a lot of time. + if (status < 0 || + (dispatch_info.event_handler_ != this->notify_handler_ && + dispatch_info.resume_flag_ == + ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER)) { - int retval = - this->remove_handler (handle, mask); + // Get the reactor token and with this token acquired remove first the + // handler and resume it at the same time. This must be atomic, see also + // bugzilla 2395. When this is not atomic it can be that we resume the + // handle after it is reused by the OS. + ACE_TP_Token_Guard guard (this->token_); + + result = guard.acquire_token (); + + // If the guard is NOT the owner just return the retval + if (!guard.is_owner ()) + return result; - return retval; + if (status < 0) + { + result = + this->remove_handler_i (dispatch_info.handle_, dispatch_info.mask_); + } + + // Resume handler if required. + if (dispatch_info.event_handler_ != this->notify_handler_ && + dispatch_info.resume_flag_ == + ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER) + this->resume_i (dispatch_info.handle_); } - // assert (status >= 0); - return 0; + // Call remove_reference() if needed. + if (dispatch_info.reference_counting_required_) + dispatch_info.event_handler_->remove_reference (); + + return result; } int @@ -711,7 +714,7 @@ ACE_TP_Reactor::get_notify_handle (void) { // Call the notify handler to get a handle on which we would have a // notify waiting - ACE_HANDLE read_handle = + ACE_HANDLE const read_handle = this->notify_handler_->notify_handle (); // Check whether the rd_mask has been set on that handle. If so @@ -721,18 +724,9 @@ ACE_TP_Reactor::get_notify_handle (void) { return read_handle; } - /*if (read_handle != ACE_INVALID_HANDLE) - { - ACE_Handle_Set_Iterator handle_iter (this->ready_set_.rd_mask_); - ACE_HANDLE handle = ACE_INVALID_HANDLE; - - while ((handle = handle_iter ()) == read_handle) - { - return read_handle; - } - ACE_UNUSED_ARG (handle); - }*/ // None found.. return ACE_INVALID_HANDLE; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TP_Reactor.h b/ace/TP_Reactor.h index 75a05e93fab..5c39225c1e7 100644 --- a/ace/TP_Reactor.h +++ b/ace/TP_Reactor.h @@ -6,21 +6,20 @@ * * $Id$ * - * The <ACE_TP_Reactor> (aka, Thread Pool Reactor) uses the + * The ACE_TP_Reactor (aka, Thread Pool Reactor) uses the * Leader/Followers pattern to demultiplex events among a pool of * threads. When using a thread pool reactor, an application * pre-spawns a _fixed_ number of threads. When these threads - * invoke the <ACE_TP_Reactor>'s <handle_events> method, one thread + * invoke the ACE_TP_Reactor's <handle_events> method, one thread * will become the leader and wait for an event. The other * follower threads will queue up waiting for their turn to become * the leader. When an event occurs, the leader will pick a * follower to become the leader and go on to handle the event. - * The consequence of using <ACE_TP_Reactor> is the amortization of + * The consequence of using ACE_TP_Reactor is the amortization of * the costs used to creating threads. The context switching cost * will also reduce. More over, the total resources used by * threads are bounded because there are a fixed number of threads. * - * * @author Irfan Pyarali <irfan@cs.wustl.edu> * @author Nanbor Wang <nanbor@cs.wustl.edu> */ @@ -39,16 +38,17 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_EH_Dispatch_Info * * @brief This structure contains information of the activated event * handler. */ -class ACE_Export ACE_EH_Dispatch_Info +class ACE_EH_Dispatch_Info { public: - ACE_EH_Dispatch_Info (void); void set (ACE_HANDLE handle, @@ -56,20 +56,21 @@ public: ACE_Reactor_Mask mask, ACE_EH_PTMF callback); - void reset (void); - - int dispatch (void) const; + bool dispatch (void) const; ACE_HANDLE handle_; ACE_Event_Handler *event_handler_; ACE_Reactor_Mask mask_; ACE_EH_PTMF callback_; - - int dispatch_; + int resume_flag_; + bool reference_counting_required_; private: - ACE_UNIMPLEMENTED_FUNC (ACE_EH_Dispatch_Info (const ACE_EH_Dispatch_Info &)) - ACE_UNIMPLEMENTED_FUNC (ACE_EH_Dispatch_Info &operator= (const ACE_EH_Dispatch_Info &)) + bool dispatch_; + + // Disallow copying and assignment. + ACE_EH_Dispatch_Info (const ACE_EH_Dispatch_Info &); + ACE_EH_Dispatch_Info &operator= (const ACE_EH_Dispatch_Info &); }; @@ -84,7 +85,7 @@ private: * and manages the ownership */ -class ACE_Export ACE_TP_Token_Guard +class ACE_TP_Token_Guard { public: @@ -104,19 +105,27 @@ public: /// A helper method that grabs the token for us, after which the /// thread that owns that can do some actual work. - /// @todo Should probably be called acquire_read_token () - int grab_token (ACE_Time_Value *max_wait_time = 0); + int acquire_read_token (ACE_Time_Value *max_wait_time = 0); /** * A helper method that grabs the token for us, after which the * thread that owns that can do some actual work. This differs from - * grab_token () as it uses acquire () to get the token instead of + * acquire_read_token() as it uses acquire () to get the token instead of * acquire_read () */ int acquire_token (ACE_Time_Value *max_wait_time = 0); private: + // Disallow default construction. + ACE_TP_Token_Guard (void); + + // Disallow copying and assignment. + ACE_TP_Token_Guard (const ACE_TP_Token_Guard &); + ACE_TP_Token_Guard &operator= (const ACE_TP_Token_Guard &); + +private: + /// The Select Reactor token. ACE_Select_Reactor_Token &token_; @@ -126,9 +135,6 @@ private: /// vice-versa. int owner_; -private: - - ACE_UNIMPLEMENTED_FUNC (ACE_TP_Token_Guard (void)) }; /** @@ -150,7 +156,9 @@ private: * that just got activated, releasing the internal lock (so that some * other thread can start waiting in the event loop) and then * dispatching the event handler outside the context of the Reactor - * lock. + * lock. After the event handler has been dispatched the event handler is + * resumed again. Don't call remove_handler() from the handle_x methods, + * instead return -1. * * This Reactor is best suited for situations when the callbacks to * event handlers can take arbitrarily long and/or a number of threads @@ -168,24 +176,24 @@ public: // = Initialization and termination methods. - /// Initialize <ACE_TP_Reactor> with the default size. + /// Initialize ACE_TP_Reactor with the default size. ACE_TP_Reactor (ACE_Sig_Handler * = 0, ACE_Timer_Queue * = 0, int mask_signals = 1, int s_queue = ACE_Select_Reactor_Token::FIFO); /** - * Initialize the <ACE_TP_Reactor> to manage - * <max_number_of_handles>. If <restart> is non-0 then the - * <ACE_Reactor>'s <handle_events> method will be restarted + * Initialize the ACE_TP_Reactor to manage + * @a max_number_of_handles. If @a restart is non-0 then the + * ACE_Reactor's <handle_events> method will be restarted * automatically when <EINTR> occurs. If <signal_handler> or * <timer_queue> are non-0 they are used as the signal handler and * timer queue, respectively. */ ACE_TP_Reactor (size_t max_number_of_handles, int restart = 0, - ACE_Sig_Handler * = 0, - ACE_Timer_Queue * = 0, + ACE_Sig_Handler *sh = 0, + ACE_Timer_Queue *tq = 0, int mask_signals = 1, int s_queue = ACE_Select_Reactor_Token::FIFO); @@ -204,7 +212,7 @@ public: * application wishes to handle events for some fixed amount of * time. * - * Returns the total number of <ACE_Event_Handler>s that were + * Returns the total number of ACE_Event_Handlers that were * dispatched, 0 if the <max_wait_time> elapsed without dispatching * any handlers, or -1 if something goes wrong. */ @@ -212,7 +220,8 @@ public: virtual int handle_events (ACE_Time_Value &max_wait_time); - /* @todo The following methods are not supported. Support for + /* + * @todo The following methods are not supported. Support for * signals is not available in the TP_Reactor. These methods will be * supported once signal handling is supported. */ @@ -268,7 +277,7 @@ public: /// Does the reactor allow the application to resume the handle on /// its own ie. can it pass on the control of handle resumption to /// the application. The TP reactor has can allow applications to - /// resume handles. So return a +ve value. + /// resume handles. So return a positive value. virtual int resumable_handler (void); /// Called from handle events @@ -281,7 +290,7 @@ public: virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0); /// Return the current owner of the thread. - virtual int owner (ACE_thread_t *); + virtual int owner (ACE_thread_t *t_id); /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; @@ -297,14 +306,14 @@ protected: int dispatch_i (ACE_Time_Value *max_wait_time, ACE_TP_Token_Guard &guard); - /// Get the event that needs dispatching.It could be either a + /// Get the event that needs dispatching. It could be either a /// signal, timer, notification handlers or return possibly 1 I/O /// handler for dispatching. In the most common use case, this would /// return 1 I/O handler for dispatching int get_event_for_dispatching (ACE_Time_Value *max_wait_time); /// Method to handle signals - /// NOTE: It is just busted at this point in time. + /// @note It is just busted at this point in time. int handle_signals (int &event_count, ACE_TP_Token_Guard &g); @@ -339,15 +348,19 @@ private: /// associated with <handle> that a particular event has occurred. int dispatch_socket_event (ACE_EH_Dispatch_Info &dispatch_info); - /// Clear the <handle> from the read_set + /// Clear the @a handle from the read_set void clear_handle_read_set (ACE_HANDLE handle); + int post_process_socket_event (ACE_EH_Dispatch_Info &dispatch_info,int status); + private: /// Deny access since member-wise won't work... ACE_TP_Reactor (const ACE_TP_Reactor &); ACE_TP_Reactor &operator = (const ACE_TP_Reactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/TP_Reactor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/TP_Reactor.inl b/ace/TP_Reactor.inl index 08c17a7e65e..b4fa3c258d1 100644 --- a/ace/TP_Reactor.inl +++ b/ace/TP_Reactor.inl @@ -1,26 +1,23 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /************************************************************************/ // Methods for ACE_EH_Dispatch_Info /************************************************************************/ -ACE_INLINE void -ACE_EH_Dispatch_Info::reset (void) -{ - this->dispatch_ = 0; - - this->handle_ = ACE_INVALID_HANDLE; - this->event_handler_ = 0; - this->mask_ = ACE_Event_Handler::NULL_MASK; - this->callback_ = 0; -} - - ACE_INLINE -ACE_EH_Dispatch_Info::ACE_EH_Dispatch_Info (void) +ACE_EH_Dispatch_Info::ACE_EH_Dispatch_Info (void) : + handle_ (ACE_INVALID_HANDLE), + event_handler_ (0), + mask_ (ACE_Event_Handler::NULL_MASK), + callback_ (0), + resume_flag_ (ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER), + reference_counting_required_ (false), + dispatch_ (false) { - this->reset (); } ACE_INLINE void @@ -29,15 +26,19 @@ ACE_EH_Dispatch_Info::set (ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_EH_PTMF callback) { - this->dispatch_ = 1; + this->dispatch_ = true; this->handle_ = handle; this->event_handler_ = event_handler; this->mask_ = mask; this->callback_ = callback; + this->resume_flag_ = event_handler->resume_handler (); + this->reference_counting_required_ = + (event_handler_->reference_counting_policy ().value () == + ACE_Event_Handler::Reference_Counting_Policy::ENABLED); } -ACE_INLINE int +ACE_INLINE bool ACE_EH_Dispatch_Info::dispatch (void) const { return this->dispatch_; @@ -109,3 +110,5 @@ ACE_TP_Reactor::clear_dispatch_mask (ACE_HANDLE , this->ready_set_.wr_mask_.reset (); this->ready_set_.ex_mask_.reset (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TSS_Adapter.cpp b/ace/TSS_Adapter.cpp index cbddcd752a6..ddca0236d4f 100644 --- a/ace/TSS_Adapter.cpp +++ b/ace/TSS_Adapter.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file TSS_Adapter.cpp * @@ -11,12 +10,10 @@ #include "ace/TSS_Adapter.h" -#if !defined (__ACE_INLINE__) -#include "ace/TSS_Adapter.inl" -#endif /* __ACE_INLINE__ */ - ACE_RCSID(ace, TSS_Adapter, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_TSS_Adapter::ACE_TSS_Adapter (void *object, ACE_THR_DEST f) : ts_obj_ (object), func_ (f) @@ -31,17 +28,18 @@ ACE_TSS_Adapter::cleanup (void) (*this->func_)(this->ts_obj_); // call cleanup routine for ts_obj_ } +ACE_END_VERSIONED_NAMESPACE_DECL + extern "C" void ACE_TSS_C_cleanup (void *object) { // ACE_TRACE ("ACE_TSS_C_cleanup"); if (object != 0) { - ACE_TSS_Adapter *tss_adapter = (ACE_TSS_Adapter *) object; + ACE_TSS_Adapter * const tss_adapter = (ACE_TSS_Adapter *) object; // Perform cleanup on the real TS object. tss_adapter->cleanup (); // Delete the adapter object. delete tss_adapter; } } - diff --git a/ace/TSS_Adapter.h b/ace/TSS_Adapter.h index 8fd09f2dd26..d4f20979b46 100644 --- a/ace/TSS_Adapter.h +++ b/ace/TSS_Adapter.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_TSS_Adapter * @@ -41,24 +43,19 @@ public: /// Initialize the adapter. ACE_TSS_Adapter (void *object, ACE_THR_DEST f); - /// Default dtor. - ~ACE_TSS_Adapter (void); - /// Perform the cleanup operation. void cleanup (void); //private: /// The real TS object. - void *ts_obj_; + void * const ts_obj_; /// The real cleanup routine for ts_obj; ACE_THR_DEST func_; }; -#if defined (__ACE_INLINE__) -#include "ace/TSS_Adapter.inl" -#endif /* __ACE_INLINE__ */ +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ACE_TSS_ADAPTER_H */ diff --git a/ace/TSS_Adapter.inl b/ace/TSS_Adapter.inl deleted file mode 100644 index 59651ec36f8..00000000000 --- a/ace/TSS_Adapter.inl +++ /dev/null @@ -1,7 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -ACE_INLINE -ACE_TSS_Adapter::~ACE_TSS_Adapter (void) -{ -} diff --git a/ace/TSS_T.cpp b/ace/TSS_T.cpp index b2fe5a89ea2..d6dc2599e8d 100644 --- a/ace/TSS_T.cpp +++ b/ace/TSS_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_TSS_T_C -#define ACE_TSS_T_C +#ifndef ACE_TSS_T_CPP +#define ACE_TSS_T_CPP #include "ace/TSS_T.h" @@ -9,8 +9,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, TSS_T, "$Id$") - #if !defined (__ACE_INLINE__) #include "ace/TSS_T.inl" #endif /* __ACE_INLINE__ */ @@ -24,6 +22,8 @@ ACE_RCSID(ace, TSS_T, "$Id$") # include "ace/TSS_Adapter.h" #endif /* ACE_HAS_THR_C_DEST */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_TSS) template <class TYPE> @@ -81,7 +81,7 @@ ACE_TSS<TYPE>::dump (void) const #if defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) #if defined (ACE_HAS_THR_C_DEST) -extern "C" void ACE_TSS_C_cleanup(void *); // defined in Synch.cpp +extern "C" void ACE_TSS_C_cleanup (void *); // defined in Synch.cpp #endif /* ACE_HAS_THR_C_DEST */ template <class TYPE> void @@ -94,7 +94,7 @@ ACE_TSS<TYPE>::cleanup (void *ptr) template <class TYPE> int ACE_TSS<TYPE>::ts_init (void) const { - // Insure that we are serialized! + // Ensure that we are serialized! ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->keylock_, 0); // Use the Double-Check pattern to make sure we only create the key @@ -195,18 +195,20 @@ ACE_TSS<TYPE>::ts_get (void) const ACE_TSS_Adapter *tss_adapter = 0; // Get the adapter from thread-specific storage - if (ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter) == -1) + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) return 0; // This should not happen! + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); // Check to see if this is the first time in for this thread. if (tss_adapter == 0) #else // Get the ts_obj from thread-specific storage. Note that no locks // are required here... - if (ACE_Thread::getspecific (this->key_, - (void **) &ts_obj) == -1) + void *temp = ts_obj; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) return 0; // This should not happen! + ts_obj = static_cast <TYPE *> (temp); // Check to see if this is the first time in for this thread. if (ts_obj == 0) @@ -249,7 +251,7 @@ ACE_TSS<TYPE>::ts_get (void) const #if defined (ACE_HAS_THR_C_DEST) // Return the underlying ts object. - return (TYPE *) tss_adapter->ts_obj_; + return static_cast <TYPE *> (tss_adapter->ts_obj_); #else return ts_obj; #endif /* ACE_HAS_THR_C_DEST */ @@ -274,16 +276,25 @@ ACE_TSS<TYPE>::ts_object (void) const ACE_TSS_Adapter *tss_adapter = 0; // Get the tss adapter from thread-specific storage - if (ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter) == -1) - return 0; // This should not happen! - else if (tss_adapter != 0) - // Extract the real TS object. - ts_obj = (TYPE *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) + { + return 0; // This should not happen! + } + else + { + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + { + if (tss_adapter != 0) + // Extract the real TS object. + ts_obj = static_cast <TYPE *> (tss_adapter->ts_obj_); + } + } #else - if (ACE_Thread::getspecific (this->key_, - (void **) &ts_obj) == -1) + void *temp = ts_obj; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) return 0; // This should not happen! + ts_obj = static_cast <TYPE *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return ts_obj; @@ -310,13 +321,14 @@ ACE_TSS<TYPE>::ts_object (TYPE *new_ts_obj) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - if (ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter) == -1) + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + if (ACE_Thread::getspecific (this->key_, &temp) == -1) return 0; // This should not happen! + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); if (tss_adapter != 0) { - ts_obj = (TYPE *) tss_adapter->ts_obj_; + ts_obj = static_cast <TYPE *> (tss_adapter->ts_obj_); delete tss_adapter; // don't need this anymore } @@ -332,9 +344,11 @@ ACE_TSS<TYPE>::ts_object (TYPE *new_ts_obj) return ts_obj; // This should not happen! } #else + void *temp = ts_obj; // Need this temp to keep G++ from complaining. if (ACE_Thread::getspecific (this->key_, - (void **) &ts_obj) == -1) + &temp) == -1) return 0; // This should not happen! + ts_obj = static_cast <TYPE *> (temp); if (ACE_Thread::setspecific (this->key_, (void *) new_ts_obj) == -1) return ts_obj; // This should not happen! @@ -389,12 +403,14 @@ ACE_TSS_Guard<ACE_LOCK>::release (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *)tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->release (); @@ -409,12 +425,14 @@ ACE_TSS_Guard<ACE_LOCK>::remove (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->remove (); @@ -429,12 +447,14 @@ ACE_TSS_Guard<ACE_LOCK>::~ACE_TSS_Guard (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ // Make sure that this pointer is NULL when we shut down... @@ -486,12 +506,14 @@ ACE_TSS_Guard<ACE_LOCK>::acquire (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->acquire (); @@ -506,12 +528,14 @@ ACE_TSS_Guard<ACE_LOCK>::tryacquire (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->tryacquire (); @@ -551,12 +575,14 @@ ACE_TSS_Write_Guard<ACE_LOCK>::acquire (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->acquire_write (); @@ -571,12 +597,14 @@ ACE_TSS_Write_Guard<ACE_LOCK>::tryacquire (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, temp); + guard = static_cast <ACE_Write_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->tryacquire_write (); @@ -639,12 +667,14 @@ ACE_TSS_Read_Guard<ACE_LOCK>::acquire (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->acquire_read (); @@ -659,12 +689,14 @@ ACE_TSS_Read_Guard<ACE_LOCK>::tryacquire (void) #if defined (ACE_HAS_THR_C_DEST) ACE_TSS_Adapter *tss_adapter = 0; - ACE_Thread::getspecific (this->key_, - (void **) &tss_adapter); - guard = (ACE_Guard<ACE_LOCK> *) tss_adapter->ts_obj_; + void *temp = tss_adapter; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + tss_adapter = static_cast <ACE_TSS_Adapter *> (temp); + guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (tss_adapter->ts_obj_); #else - ACE_Thread::getspecific (this->key_, - (void **) &guard); + void *temp = guard; // Need this temp to keep G++ from complaining. + ACE_Thread::getspecific (this->key_, &temp); + guard = static_cast <ACE_Read_Guard<ACE_LOCK> *> (temp); #endif /* ACE_HAS_THR_C_DEST */ return guard->tryacquire_read (); @@ -697,4 +729,6 @@ ACE_TSS_Read_Guard<ACE_LOCK>::dump (void) const #endif /* defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION)) */ -#endif /* ACE_TSS_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TSS_T_CPP */ diff --git a/ace/TSS_T.h b/ace/TSS_T.h index 537a89cc15a..6c8c7b99847 100644 --- a/ace/TSS_T.h +++ b/ace/TSS_T.h @@ -37,6 +37,8 @@ #include "ace/Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_TSS * @@ -49,7 +51,7 @@ * shield applications from the details of accessing * thread-specific storage. * - * NOTE: For maximal portability, <TYPE> cannot be a built-in type, + * @note For maximal portability, <TYPE> cannot be a built-in type, * but instead should be a user-defined class (some compilers will * allow a built-in type, others won't). See template class * ACE_TSS_Type_Adapter, below, for adapting built-in types to work @@ -171,6 +173,8 @@ private: TYPE value_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/TSS_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/TSS_T.inl b/ace/TSS_T.inl index a0bdccba905..d4378089137 100644 --- a/ace/TSS_T.inl +++ b/ace/TSS_T.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #if !(defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TYPE> ACE_INLINE ACE_TSS<TYPE>::ACE_TSS (TYPE *type) : type_ (type) @@ -34,4 +37,6 @@ ACE_TSS<TYPE>::ts_get (void) const return this->type_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ! (defined (ACE_HAS_THREADS) && (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || defined (ACE_HAS_TSS_EMULATION))) */ diff --git a/ace/TTY_IO.cpp b/ace/TTY_IO.cpp index 128a07d6ac2..9119e0caca0 100644 --- a/ace/TTY_IO.cpp +++ b/ace/TTY_IO.cpp @@ -1,27 +1,34 @@ // $Id$ -#include "ace/config-lite.h" -#if defined (ACE_HAS_TERMIOS) -# include "ace/os_include/os_termios.h" -#elif defined (ACE_HAS_TERMIO) -# include <termio.h> -#endif #include "ace/TTY_IO.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" -static const char* const ACE_TTY_IO_ODD = "odd"; -static const char* const ACE_TTY_IO_EVEN = "even"; -#if defined (ACE_WIN32) -static const char* const ACE_TTY_IO_MARK = "mark"; -static const char* const ACE_TTY_IO_SPACE = "space"; -#endif /* ACE_WIN32 */ +#if defined (ACE_HAS_TERMIOS) +# include "ace/os_include/os_termios.h" +#elif defined (ACE_HAS_TERMIO) +# include <termio.h> +#endif ACE_RCSID (ace, TTY_IO, "$Id$") +#if defined (ACE_HAS_TERMIOS) || defined (ACE_HAS_TERMIO) || defined (ACE_WIN32) +namespace +{ + const char ACE_TTY_IO_ODD[] = "odd"; + const char ACE_TTY_IO_EVEN[] = "even"; +#if defined (ACE_WIN32) + const char ACE_TTY_IO_MARK[] = "mark"; + const char ACE_TTY_IO_SPACE[] = "space"; +#endif /* ACE_WIN32 */ +} +#endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_TTY_IO::Serial_Params::Serial_Params (void) { ACE_OS::memset (this, 0, sizeof *this); @@ -320,7 +327,8 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const devpar.c_cc[VMIN] = static_cast<unsigned char>(arg->readmincharacters); } -#if defined (TIOCMGET) +#if defined (TIOCMGET) && !defined (__Lynx__) + // This sets serial port under LynxOS to non-functional state int status; this->ACE_IO_SAP::control (TIOCMGET, &status); @@ -455,9 +463,9 @@ int ACE_TTY_IO::control (Control_Mode cmd, Serial_Params *arg) const // Always set limits unless set to negative to use default. if (arg->xonlim >= 0) - dcb.XonLim = arg->xonlim; + dcb.XonLim = static_cast<WORD>(arg->xonlim); if (arg->xofflim >= 0) - dcb.XoffLim = arg->xofflim; + dcb.XoffLim = static_cast<WORD>(arg->xofflim); dcb.fAbortOnError = FALSE; dcb.fErrorChar = FALSE; @@ -526,3 +534,5 @@ ACE_TTY_IO::operator ACE_DEV_IO &() return static_cast<ACE_DEV_IO &>(*this); } #endif /* ACE_NEEDS_DEV_IO_CONVERSION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TTY_IO.h b/ace/TTY_IO.h index 60f6dc6ba1e..708da7fe31c 100644 --- a/ace/TTY_IO.h +++ b/ace/TTY_IO.h @@ -19,6 +19,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_TTY_IO * @@ -89,8 +91,8 @@ public: bool rcvenb; /** Controls whether DSR is disabled or enabled (Win32). */ bool dsrenb; - /** Controls whether DTR is disabled or enabled (Win32). */ - int dtrdisable; + /** Controls whether DTR is disabled or enabled. */ + bool dtrdisable; /** Data bits. Valid values 5, 6, 7 and 8 data bits. Additionally Win32 supports 4 data bits. */ unsigned char databits; @@ -107,4 +109,6 @@ public: #endif /* ACE_NEEDS_DEV_IO_CONVERSION */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_TTY_IO_H */ diff --git a/ace/Task.cpp b/ace/Task.cpp index 293bbb187f0..8617e6ec183 100644 --- a/ace/Task.cpp +++ b/ace/Task.cpp @@ -13,6 +13,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man) : thr_count_ (0), thr_mgr_ (thr_man), @@ -90,7 +92,7 @@ int ACE_Task_Base::suspend (void) { ACE_TRACE ("ACE_Task_Base::suspend"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); if (this->thr_count_ > 0) return this->thr_mgr_->suspend_task (this); @@ -102,7 +104,7 @@ int ACE_Task_Base::resume (void) { ACE_TRACE ("ACE_Task_Base::resume"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1)); if (this->thr_count_ > 0) return this->thr_mgr_->resume_task (this); @@ -124,7 +126,7 @@ ACE_Task_Base::activate (long flags, ACE_TRACE ("ACE_Task_Base::activate"); #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) - ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); + ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1); // If the task passed in is zero, we will use <this> if (task == 0) @@ -214,9 +216,13 @@ ACE_Task_Base::cleanup (void *object, void *) { ACE_Task_Base *t = (ACE_Task_Base *) object; + // The thread count decrement and close must be done atomically + // so that thr_count checks from within close are correct. + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, t->lock_)); + // The thread count must be decremented first in case the <close> // hook does something crazy like "delete this". - t->thr_count_dec (); + --(t->thr_count_); // @@ Is it possible to pass in the exit status somehow? t->close (); @@ -272,3 +278,5 @@ ACE_Task_Base::svc_run (void *args) #endif return status; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Task.h b/ace/Task.h index 9460673d06e..130feaeff40 100644 --- a/ace/Task.h +++ b/ace/Task.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -20,8 +20,11 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Recursive_Thread_Mutex.h" #include "ace/Thread_Manager.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Task_Flags * @@ -32,9 +35,8 @@ * code defined here, so we don't have to worry about multiple * definitions. */ -class ACE_Export ACE_Task_Flags +namespace ACE_Task_Flags { -public: enum { /// Identifies a Task as being the "reader" in a Module. @@ -50,7 +52,7 @@ public: /// Flush both queues ACE_FLUSHRW = 030 }; -}; +} /** * @class ACE_Task_Base @@ -267,7 +269,7 @@ public: #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) /// Protect the state of a Task during concurrent operations, but /// only if we're configured as MT safe... - ACE_Thread_Mutex lock_; + ACE_Recursive_Thread_Mutex lock_; #endif /* ACE_MT_SAFE */ private: @@ -277,6 +279,8 @@ private: ACE_Task_Base (const ACE_Task_Base &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Task.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Task.inl b/ace/Task.inl index c903afffbc2..9343ae057e4 100644 --- a/ace/Task.inl +++ b/ace/Task.inl @@ -2,6 +2,7 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_Thread_Manager * ACE_Task_Base::thr_mgr (void) const @@ -22,7 +23,11 @@ ACE_INLINE size_t ACE_Task_Base::thr_count (void) const { ACE_TRACE ("ACE_Task_Base::thr_count"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, 0)); + ACE_MT + (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, + const_cast <ACE_Recursive_Thread_Mutex&>(this->lock_), + 0)); return this->thr_count_; } @@ -33,7 +38,7 @@ ACE_INLINE void ACE_Task_Base::thr_count_dec (void) { ACE_TRACE ("ACE_Task_Base::thr_count_dec"); - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_)); this->thr_count_--; } @@ -57,7 +62,11 @@ ACE_INLINE int ACE_Task_Base::grp_id (void) const { ACE_TRACE ("ACE_Task_Base::grp_id"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1)); + ACE_MT + (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, + ace_mon, + const_cast <ACE_Recursive_Thread_Mutex&>(this->lock_), + -1)); return this->grp_id_; } @@ -67,7 +76,7 @@ ACE_INLINE void ACE_Task_Base::grp_id (int identifier) { ACE_TRACE ("ACE_Task_Base::grp_id"); - ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_)); + ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_)); // Cache the group id in the task and then set it in the // Thread_Manager, if there is one. @@ -76,3 +85,4 @@ ACE_Task_Base::grp_id (int identifier) this->thr_mgr ()->set_grp (this, identifier); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Task_Ex_T.cpp b/ace/Task_Ex_T.cpp index a265355c22e..0c5871657dd 100644 --- a/ace/Task_Ex_T.cpp +++ b/ace/Task_Ex_T.cpp @@ -1,8 +1,7 @@ -// Task_Ex_T.cpp // $Id$ -#ifndef ACE_TASK_EX_T_C -#define ACE_TASK_EX_T_C +#ifndef ACE_TASK_EX_T_CPP +#define ACE_TASK_EX_T_CPP #include "ace/Task_Ex_T.h" @@ -17,7 +16,8 @@ #include "ace/Task_Ex_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Task_Ex_T, "$Id$") + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> void ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::dump (void) const @@ -109,4 +109,6 @@ ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE>::module (void) const return this->mod_; } -#endif /* ACE_TASK_EX_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TASK_EX_T_CPP */ diff --git a/ace/Task_Ex_T.h b/ace/Task_Ex_T.h index 9777a90ff03..d958bd2d5e6 100644 --- a/ace/Task_Ex_T.h +++ b/ace/Task_Ex_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,6 +23,8 @@ #include "ace/Synch_Traits.h" #include "ace/Task.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decls... template <ACE_SYNCH_DECL> class ACE_Module; @@ -150,7 +152,13 @@ public: // Should be protected: * Note that if this conflicts with the C++ iostream <flush> * function, just rewrite the iostream function as ::<flush>. */ + +#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) + // Make LynxOS 3.x buggy compiler happy + int flush (u_long flag = ACE_FLUSHALL); +#else int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL); +#endif // = Special routines corresponding to certain message types. @@ -182,6 +190,8 @@ private: ACE_UNIMPLEMENTED_FUNC (ACE_Task_Ex (const ACE_Task_Ex<ACE_SYNCH_USE, ACE_MESSAGE_TYPE> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Task_Ex_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Task_Ex_T.inl b/ace/Task_Ex_T.inl index fb68b7f874e..b49f4bf53f1 100644 --- a/ace/Task_Ex_T.inl +++ b/ace/Task_Ex_T.inl @@ -1,13 +1,14 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Task_Ex_T.i - #include "ace/os_include/os_assert.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE void -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, - size_t wm_size) +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, + size_t wm_size) { ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks"); if (cmd == ACE_IO_Cntl_Msg::SET_LWM) @@ -16,14 +17,14 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::water_marks (ACE_IO_Cntl_Msg::ACE_I this->msg_queue_->high_water_mark (wm_size); } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::getq (ACE_MESSAGE_TYPE *&mb, ACE_Time_Value *tv) { ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::getq"); return this->msg_queue_->dequeue_head (mb, tv); } -template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int +template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::can_put (ACE_MESSAGE_TYPE *) { ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::can_put"); @@ -100,10 +101,12 @@ ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::next (ACE_Task<ACE_SYNCH_USE> *q) // Transfer msg to the next ACE_Task_Ex. template <ACE_SYNCH_DECL, class ACE_MESSAGE_TYPE> ACE_INLINE int -ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next (ACE_MESSAGE_TYPE *msg, ACE_Time_Value *tv) +ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next ( + ACE_MESSAGE_TYPE * /* msg */, + ACE_Time_Value * /* tv */) { ACE_TRACE ("ACE_Task_Ex<ACE_SYNCH_USE,ACE_MESSAGE_TYPE>::put_next"); - ACE_UNUSED_ARG (msg); - ACE_UNUSED_ARG (tv); return -1; // this->next_ == 0 ? -1 : this->next_->put (msg, tv); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Task_T.cpp b/ace/Task_T.cpp index e35297792cb..f0c97e74193 100644 --- a/ace/Task_T.cpp +++ b/ace/Task_T.cpp @@ -1,8 +1,7 @@ -// Task.cpp // $Id$ -#ifndef ACE_TASK_T_C -#define ACE_TASK_T_C +#ifndef ACE_TASK_T_CPP +#define ACE_TASK_T_CPP #include "ace/Task_T.h" @@ -17,7 +16,7 @@ #include "ace/Task_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Task_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <ACE_SYNCH_DECL> void ACE_Task<ACE_SYNCH_USE>::dump (void) const @@ -104,4 +103,6 @@ ACE_Task<ACE_SYNCH_USE>::module (void) const return this->mod_; } -#endif /* ACE_TASK_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TASK_T_CPP */ diff --git a/ace/Task_T.h b/ace/Task_T.h index 52c0f6b2218..68e54562612 100644 --- a/ace/Task_T.h +++ b/ace/Task_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,9 +23,15 @@ #include "ace/Synch_Traits.h" #include "ace/Task.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decls... template <ACE_SYNCH_DECL> class ACE_Module; +#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) + using namespace ACE_Task_Flags; +#endif + /** * @class ACE_Task * @@ -130,7 +136,13 @@ public: // Should be protected: * Note that if this conflicts with the C++ iostream <flush> * function, just rewrite the iostream function as ::<flush>. */ + +#if defined (ACE_LYNXOS_MAJOR) && (ACE_LYNXOS_MAJOR < 4) + // Make LynxOS 3.x buggy compiler happy + int flush (u_long flag = ACE_FLUSHALL); +#else int flush (u_long flag = ACE_Task_Flags::ACE_FLUSHALL); +#endif // = Special routines corresponding to certain message types. @@ -167,6 +179,8 @@ template class ACE_Export ACE_Task<ACE_MT_SYNCH>; template class ACE_Export ACE_Task<ACE_NULL_SYNCH>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_EXPORT */ +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Task_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Task_T.inl b/ace/Task_T.inl index e4694062fc4..77d7c0d789e 100644 --- a/ace/Task_T.inl +++ b/ace/Task_T.inl @@ -1,13 +1,14 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Task_T.i - #include "ace/os_include/os_assert.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <ACE_SYNCH_DECL> ACE_INLINE void -ACE_Task<ACE_SYNCH_USE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, - size_t wm_size) +ACE_Task<ACE_SYNCH_USE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, + size_t wm_size) { ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::water_marks"); if (cmd == ACE_IO_Cntl_Msg::SET_LWM) @@ -16,14 +17,14 @@ ACE_Task<ACE_SYNCH_USE>::water_marks (ACE_IO_Cntl_Msg::ACE_IO_Cntl_Cmds cmd, this->msg_queue_->high_water_mark (wm_size); } -template <ACE_SYNCH_DECL> ACE_INLINE int +template <ACE_SYNCH_DECL> ACE_INLINE int ACE_Task<ACE_SYNCH_USE>::getq (ACE_Message_Block *&mb, ACE_Time_Value *tv) { ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::getq"); return this->msg_queue_->dequeue_head (mb, tv); } -template <ACE_SYNCH_DECL> ACE_INLINE int +template <ACE_SYNCH_DECL> ACE_INLINE int ACE_Task<ACE_SYNCH_USE>::can_put (ACE_Message_Block *) { ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::can_put"); @@ -103,3 +104,5 @@ ACE_Task<ACE_SYNCH_USE>::put_next (ACE_Message_Block *msg, ACE_Time_Value *tv) ACE_TRACE ("ACE_Task<ACE_SYNCH_USE>::put_next"); return this->next_ == 0 ? -1 : this->next_->put (msg, tv); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Template_Instantiations.cpp b/ace/Template_Instantiations.cpp index 9542848b4f5..3df1a0062ec 100644 --- a/ace/Template_Instantiations.cpp +++ b/ace/Template_Instantiations.cpp @@ -35,6 +35,8 @@ #error ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION_FILE may not be used with ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION or ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA #endif /* defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) || defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // D E P T H = 0 // Templates with nesting depth 0 (no dependencies on // other templates), ordered by number of template arguments @@ -350,6 +352,8 @@ template class ACE_Timer_Queue_T<ACE_Event_Handler*, ACE_Timer_Hash_Upcall<ACE_E template class ACE_Timer_Queue_Iterator_T<ACE_Event_Handler*, ACE_Timer_Hash_Upcall<ACE_Event_Handler*, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, ACE_Null_Mutex>, ACE_Null_Mutex>; +ACE_END_VERSIONED_NAMESPACE_DECL + #elif defined (__HP_aCC) // Make aC++ stop complaining about an empty translation unit static int shut_up_aCC = 0; diff --git a/ace/Test_and_Set.cpp b/ace/Test_and_Set.cpp index 5a9cbdb0bfe..ea420bbe508 100644 --- a/ace/Test_and_Set.cpp +++ b/ace/Test_and_Set.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_TEST_AND_SET_C -#define ACE_TEST_AND_SET_C +#ifndef ACE_TEST_AND_SET_CPP +#define ACE_TEST_AND_SET_CPP #include "ace/Test_and_Set.h" #include "ace/Guard_T.h" @@ -10,7 +10,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Test_and_Set, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class ACE_LOCK, class TYPE> ACE_Test_and_Set<ACE_LOCK, TYPE>::ACE_Test_and_Set (TYPE initial_value) @@ -46,4 +46,6 @@ ACE_Test_and_Set<ACE_LOCK, TYPE>::handle_signal (int, siginfo_t *, ucontext_t *) return 0; } -#endif /* ACE_TEST_AND_SET_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TEST_AND_SET_CPP */ diff --git a/ace/Test_and_Set.h b/ace/Test_and_Set.h index 37e810f1b4e..d72c3d474b0 100644 --- a/ace/Test_and_Set.h +++ b/ace/Test_and_Set.h @@ -1,11 +1,10 @@ +// -*- C++ -*- //============================================================================= /** * @file Test_and_Set.h * * $Id$ - * - * @author Priyanka Gontla <pgontla@ece.uci.edu> */ //============================================================================= @@ -20,6 +19,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Test_and_Set * @@ -28,7 +29,7 @@ * * This class keeps track of the status of <is_set_>, which can * be set based on various events (such as receipt of a - * signal). This class is derived from <ACE_Event_Handler> so + * signal). This class is derived from ACE_Event_Handler so * that it can be "signaled" by a Reactor when a signal occurs. * We assume that <TYPE> is a data type that can be assigned the * value 0 or 1. @@ -60,6 +61,8 @@ private: ACE_LOCK lock_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Test_and_Set.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Thread.cpp b/ace/Thread.cpp index 80ce71f3d7e..a920e131be9 100644 --- a/ace/Thread.cpp +++ b/ace/Thread.cpp @@ -1,18 +1,19 @@ -// Thread.cpp // $Id$ #include "ace/Thread.h" -#if !defined (__ACE_INLINE__) -#include "ace/Thread.inl" -#endif /* !defined (__ACE_INLINE__) */ - ACE_RCSID(ace, Thread, "$Id$") +#if !defined (__ACE_INLINE__) +#include "ace/Thread.inl" +#endif /* !defined (__ACE_INLINE__) */ + #if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + size_t ACE_Thread::spawn_n (size_t n, ACE_THR_FUNC func, @@ -89,4 +90,6 @@ ACE_Thread::spawn_n (ACE_thread_t thread_ids[], return i; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/Thread.h b/ace/Thread.h index 05a81548d97..ba1b9d64a57 100644 --- a/ace/Thread.h +++ b/ace/Thread.h @@ -24,6 +24,8 @@ #include "ace/OS_NS_Thread.h" #include "ace/Thread_Adapter.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + struct cancel_state { /// e.g., PTHREAD_CANCEL_ENABLE, PTHREAD_CANCEL_DISABLE, @@ -265,6 +267,8 @@ private: ACE_Thread (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Thread.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Thread.inl b/ace/Thread.inl index 0091d8eec3a..ba635c6b2f0 100644 --- a/ace/Thread.inl +++ b/ace/Thread.inl @@ -1,10 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Thread.inl - #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Allocates a <keyp> that is used to identify data that is specific // to each thread in the process. The key is global to all threads in // the process. @@ -279,3 +280,5 @@ ACE_Thread::setprio (ACE_hthread_t ht_id, int priority, int policy) ACE_TRACE ("ACE_Thread::setprio"); return ACE_OS::thr_setprio (ht_id, priority, policy); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Adapter.cpp b/ace/Thread_Adapter.cpp index 8b1abafa302..d969e3e9d0d 100644 --- a/ace/Thread_Adapter.cpp +++ b/ace/Thread_Adapter.cpp @@ -14,6 +14,8 @@ ACE_RCSID (ace, # include "ace/Thread_Adapter.inl" #endif /* ACE_HAS_INLINED_OS_CALLS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func, void *arg, ACE_THR_C_FUNC entry_point, @@ -245,3 +247,5 @@ ACE_Thread_Adapter::invoke_i (void) return status; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Adapter.h b/ace/Thread_Adapter.h index 78dfa4b96e4..046d21b238f 100644 --- a/ace/Thread_Adapter.h +++ b/ace/Thread_Adapter.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +22,8 @@ #include "ace/Base_Thread_Adapter.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. class ACE_Thread_Manager; class ACE_Thread_Descriptor; @@ -46,7 +49,7 @@ public: /// Constructor. ACE_Thread_Adapter (ACE_THR_FUNC user_func, void *arg, - ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ace_thread_adapter, + ACE_THR_C_FUNC entry_point = (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, ACE_Thread_Manager *thr_mgr = 0, ACE_Thread_Descriptor *td = 0 # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) @@ -65,23 +68,26 @@ public: /// Accessor for the optional <Thread_Manager>. ACE_Thread_Manager *thr_mgr (void); -private: +protected: + /// Ensure that this object must be allocated on the heap. ~ACE_Thread_Adapter (void); +private: + /// Called by invoke, mainly here to separate the SEH stuff because /// SEH on Win32 doesn't compile with local vars with destructors. virtual ACE_THR_FUNC_RETURN invoke_i (void); private: + /// Optional thread manager. ACE_Thread_Manager *thr_mgr_; - /// Friend declaration to avoid compiler warning: only defines a private - /// destructor and has no friends. - friend class ACE_Thread_Adapter_Has_Private_Destructor; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/Thread_Adapter.inl b/ace/Thread_Adapter.inl index 433023aad93..4f1fa0fce49 100644 --- a/ace/Thread_Adapter.inl +++ b/ace/Thread_Adapter.inl @@ -1,8 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Thread_Manager * ACE_Thread_Adapter::thr_mgr (void) { return this->thr_mgr_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Control.cpp b/ace/Thread_Control.cpp index 5415e74b687..5198fad391d 100644 --- a/ace/Thread_Control.cpp +++ b/ace/Thread_Control.cpp @@ -18,6 +18,8 @@ ACE_RCSID(ace, Thread_Control, "$Id$") # include "ace/Thread_Control.inl" #endif /* ACE_HAS_INLINED_OS_CALLS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Thread_Control::dump (void) const { @@ -90,3 +92,5 @@ ACE_Thread_Control::exit (ACE_THR_FUNC_RETURN exit_status, int do_thr_exit) return 0; } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Control.h b/ace/Thread_Control.h index fa2bc559c8d..6989d77daad 100644 --- a/ace/Thread_Control.h +++ b/ace/Thread_Control.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -20,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Thread_Manager; /** @@ -85,6 +88,8 @@ private: ACE_THR_FUNC_RETURN status_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_INLINED_OSCALLS) # if defined (ACE_INLINE) # undef ACE_INLINE diff --git a/ace/Thread_Control.inl b/ace/Thread_Control.inl index 0c2ab504112..7b96cb369f8 100644 --- a/ace/Thread_Control.inl +++ b/ace/Thread_Control.inl @@ -1,6 +1,9 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Set the exit status. ACE_INLINE ACE_THR_FUNC_RETURN @@ -40,3 +43,4 @@ ACE_Thread_Control::thr_mgr (ACE_Thread_Manager *tm) return o_tm; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Exit.cpp b/ace/Thread_Exit.cpp index 160c1e0429c..6ef493e7b97 100644 --- a/ace/Thread_Exit.cpp +++ b/ace/Thread_Exit.cpp @@ -7,6 +7,8 @@ ACE_RCSID(ace, Thread_Exit, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + u_int ACE_Thread_Exit::is_constructed_ = 0; void @@ -118,14 +120,4 @@ ACE_Thread_Exit_Maybe::instance (void) const return this->instance_; } -#if (defined (ACE_HAS_THREADS) && \ - (defined (ACE_HAS_THREAD_SPECIFIC_STORAGE) || \ - defined (ACE_HAS_TSS_EMULATION))) - -# if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_TSS<ACE_Thread_Exit>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_TSS<ACE_Thread_Exit> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_HAS_THREADS && (ACE_HAS_THREAD_SPECIFIC_STORAGE || ACE_HAS_TSS_EMULATION) */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Exit.h b/ace/Thread_Exit.h index e183512e5a5..fc828c5aa03 100644 --- a/ace/Thread_Exit.h +++ b/ace/Thread_Exit.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -22,6 +23,8 @@ #include "ace/Thread_Control.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Thread_Exit * @@ -102,5 +105,7 @@ private: }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_THREAD_EXIT_H */ diff --git a/ace/Thread_Hook.cpp b/ace/Thread_Hook.cpp index e866a3626e5..e69eb0a482c 100644 --- a/ace/Thread_Hook.cpp +++ b/ace/Thread_Hook.cpp @@ -5,6 +5,8 @@ ACE_RCSID(ace, Thread_Hook, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_Thread_Hook::~ACE_Thread_Hook () { } @@ -27,3 +29,5 @@ ACE_Thread_Hook::thread_hook (void) { return ACE_OS_Object_Manager::thread_hook (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Hook.h b/ace/Thread_Hook.h index c8aa941d669..a6748d25061 100644 --- a/ace/Thread_Hook.h +++ b/ace/Thread_Hook.h @@ -23,6 +23,8 @@ #include "ace/ACE_export.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Thread_Hook * @@ -57,5 +59,7 @@ public: static ACE_Thread_Hook *thread_hook (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_THREAD_HOOK_H */ diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index ffd9950c38a..a733388cef5 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -18,6 +18,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) ACE_At_Thread_Exit::~ACE_At_Thread_Exit (void) @@ -586,7 +588,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, ACE_NEW_RETURN (thread_args, ACE_Thread_Adapter (func, args, - (ACE_THR_C_FUNC) ace_thread_adapter, + (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, this, new_thr_desc.get (), ACE_OS_Object_Manager::seh_except_selector(), @@ -596,7 +598,7 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, ACE_NEW_RETURN (thread_args, ACE_Thread_Adapter (func, args, - (ACE_THR_C_FUNC) ace_thread_adapter, + (ACE_THR_C_FUNC) ACE_THREAD_ADAPTER_NAME, this, new_thr_desc.get ()), -1); @@ -636,15 +638,15 @@ ACE_Thread_Manager::spawn_i (ACE_THR_FUNC func, // removing this Thread Descriptor before it gets put into our // thread table. - int result = ACE_Thread::spawn (func, - args, - flags, - t_id, - &thr_handle, - priority, - stack, - stack_size, - thread_args); + int const result = ACE_Thread::spawn (func, + args, + flags, + t_id, + &thr_handle, + priority, + stack, + stack_size, + thread_args); if (result != 0) { @@ -1029,7 +1031,7 @@ ACE_Thread_Manager::suspend_thr (ACE_Thread_Descriptor *td, int) { ACE_TRACE ("ACE_Thread_Manager::suspend_thr"); - int result = ACE_Thread::suspend (td->thr_handle_); + int const result = ACE_Thread::suspend (td->thr_handle_); if (result == -1) { if (errno != ENOTSUP) this->thr_to_be_removed_.enqueue_tail (td); @@ -1046,7 +1048,7 @@ ACE_Thread_Manager::resume_thr (ACE_Thread_Descriptor *td, int) { ACE_TRACE ("ACE_Thread_Manager::resume_thr"); - int result = ACE_Thread::resume (td->thr_handle_); + int const result = ACE_Thread::resume (td->thr_handle_); if (result == -1) { if (errno != ENOTSUP) this->thr_to_be_removed_.enqueue_tail (td); @@ -1085,7 +1087,7 @@ ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum) tid += tid[0] == ACE_THR_ID_ALLOCATED ? 1 : 0; #endif /* VXWORKS */ - int result = ACE_Thread::kill (tid, signum); + int const result = ACE_Thread::kill (tid, signum); if (result != 0) { @@ -2329,47 +2331,4 @@ ACE_Thread_Manager::get_grp (ACE_Task_Base *task, int &grp_id) return 0; } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -# if defined (ACE_THREAD_MANAGER_LACKS_STATICS) -template class ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX>; -# endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ -# if defined (ACE_LACKS_AUTO_PTR) \ - || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \ - && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)) -template class ACE_Auto_Basic_Ptr<ACE_Thread_Descriptor>; -# endif /* ACE_LACKS_AUTO_PTR */ -template class auto_ptr<ACE_Thread_Descriptor>; -template class ACE_Double_Linked_List<ACE_Thread_Descriptor_Base>; -template class ACE_Double_Linked_List_Iterator_Base<ACE_Thread_Descriptor_Base>; -template class ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor_Base>; -template class ACE_Double_Linked_List<ACE_Thread_Descriptor>; -template class ACE_Double_Linked_List_Iterator_Base<ACE_Thread_Descriptor>; -template class ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor>; -template class ACE_Node<ACE_Thread_Descriptor*>; -template class ACE_Unbounded_Queue<ACE_Thread_Descriptor*>; -template class ACE_Unbounded_Queue_Iterator<ACE_Thread_Descriptor*>; -template class ACE_Free_List<ACE_Thread_Descriptor>; -template class ACE_Locked_Free_List<ACE_Thread_Descriptor, ACE_DEFAULT_THREAD_MANAGER_LOCK>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -# if defined (ACE_THREAD_MANAGER_LACKS_STATICS) -# pragma instantiate ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX> -# endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ - -# if defined (ACE_LACKS_AUTO_PTR) \ - || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \ - && (ACE_HAS_STANDARD_CPP_LIBRARY != 0)) -# pragma instantiate ACE_Auto_Basic_Ptr<ACE_Thread_Descriptor> -# endif /* ACE_LACKS_AUTO_PTR */ -# pragma instantiate auto_ptr<ACE_Thread_Descriptor> -# pragma instantiate ACE_Double_Linked_List<ACE_Thread_Descriptor_Base> -# pragma instantiate ACE_Double_Linked_List_Iterator_Base<ACE_Thread_Descriptor_Base> -# pragma instantiate ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor_Base> -# pragma instantiate ACE_Double_Linked_List<ACE_Thread_Descriptor> -# pragma instantiate ACE_Double_Linked_List_Iterator_Base<ACE_Thread_Descriptor> -# pragma instantiate ACE_Double_Linked_List_Iterator<ACE_Thread_Descriptor> -# pragma instantiate ACE_Node<ACE_Thread_Descriptor*> -# pragma instantiate ACE_Unbounded_Queue<ACE_Thread_Descriptor*> -# pragma instantiate ACE_Unbounded_Queue_Iterator<ACE_Thread_Descriptor*> -# pragma instantiate ACE_Free_List<ACE_Thread_Descriptor> -# pragma instantiate ACE_Locked_Free_List<ACE_Thread_Descriptor, ACE_DEFAULT_THREAD_MANAGER_LOCK> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h index 0b55ce84978..c42f7959f25 100644 --- a/ace/Thread_Manager.h +++ b/ace/Thread_Manager.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -74,6 +74,8 @@ # define ACE_DEFAULT_THREAD_MANAGER_LOCK ACE_SYNCH_MUTEX #endif /* ACE_DEFAULT_THREAD_MANAGER_LOCK */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. class ACE_Task_Base; class ACE_Thread_Manager; @@ -448,7 +450,7 @@ public: size_t lwm = ACE_DEFAULT_THREAD_MANAGER_LWM, size_t inc = ACE_DEFAULT_THREAD_MANAGER_INC, size_t hwm = ACE_DEFAULT_THREAD_MANAGER_HWM); - virtual ~ACE_Thread_Manager (void); + ~ACE_Thread_Manager (void); #if ! defined (ACE_THREAD_MANAGER_LACKS_STATICS) /// Get pointer to a process-wide <ACE_Thread_Manager>. @@ -979,16 +981,17 @@ protected: ACE_Thread_Descriptor *hthread_descriptor (ACE_hthread_t); /// Create a new thread (must be called with locks held). - virtual int spawn_i (ACE_THR_FUNC func, - void *arg, - long flags, - ACE_thread_t * = 0, - ACE_hthread_t *t_handle = 0, - long priority = ACE_DEFAULT_THREAD_PRIORITY, - int grp_id = -1, - void *stack = 0, - size_t stack_size = 0, - ACE_Task_Base *task = 0); + int spawn_i (ACE_THR_FUNC func, + void *arg, + long flags, + ACE_thread_t * = 0, + ACE_hthread_t *t_handle = 0, + long priority = ACE_DEFAULT_THREAD_PRIORITY, + int grp_id = -1, + void *stack = 0, + size_t stack_size = 0, + ACE_Task_Base *task = 0); + /// Run the registered hooks when the thread exits. void run_thread_exit_hooks (int i); @@ -1135,6 +1138,8 @@ private: typedef ACE_Singleton<ACE_Thread_Manager, ACE_SYNCH_MUTEX> ACE_THREAD_MANAGER_SINGLETON; #endif /* defined (ACE_THREAD_MANAGER_LACKS_STATICS) */ +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Thread_Manager.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Thread_Manager.inl b/ace/Thread_Manager.inl index cac2d176761..471c98e1b62 100644 --- a/ace/Thread_Manager.inl +++ b/ace/Thread_Manager.inl @@ -2,6 +2,7 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL #if !defined(ACE_USE_ONE_SHOT_AT_THREAD_EXIT) ACE_INLINE @@ -315,3 +316,5 @@ ACE_Thread_Manager::count_threads (void) const { return this->thr_list_.size (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Mutex.cpp b/ace/Thread_Mutex.cpp index 8a0af97ce10..6a7480902e2 100644 --- a/ace/Thread_Mutex.cpp +++ b/ace/Thread_Mutex.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file Thread_Mutex.cpp * @@ -23,6 +22,8 @@ ACE_RCSID(ace, Thread_Mutex, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_Thread_Mutex_Guard) #if defined (ACE_USES_OBSOLETE_GUARD_CLASSES) @@ -72,18 +73,6 @@ ACE_Thread_Mutex::ACE_Thread_Mutex (const ACE_TCHAR *name, ACE_mutexattr_t *arg) ACE_LIB_TEXT ("ACE_Thread_Mutex::ACE_Thread_Mutex"))); } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -// These are only instantiated with ACE_HAS_THREADS. -template class ACE_Guard<ACE_Thread_Mutex>; -template class ACE_Read_Guard<ACE_Thread_Mutex>; -template class ACE_Write_Guard<ACE_Thread_Mutex>; -template class ACE_Malloc_Lock_Adapter_T<ACE_Thread_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -// These are only instantiated with ACE_HAS_THREADS. -#pragma instantiate ACE_Guard<ACE_Thread_Mutex> -#pragma instantiate ACE_Read_Guard<ACE_Thread_Mutex> -#pragma instantiate ACE_Write_Guard<ACE_Thread_Mutex> -#pragma instantiate ACE_Malloc_Lock_Adapter_T<ACE_Thread_Mutex> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_THREADS */ diff --git a/ace/Thread_Mutex.h b/ace/Thread_Mutex.h index 2c7f32bf7f5..4da040a3296 100644 --- a/ace/Thread_Mutex.h +++ b/ace/Thread_Mutex.h @@ -30,21 +30,23 @@ #include "ace/ACE_export.h" #include "ace/OS_NS_Thread.h" - /** - * @class ACE_Thread_Mutex - * - * @brief ACE_Thread_Mutex wrapper (only valid for threads in the same - * process). - * - * This implementation is optimized for locking threads that are - * in the same process. It maps to <CRITICAL_SECTION>s on NT - * and <ACE_mutex_t> with <type> set to <USYNC_THREAD> on UNIX. - * ACE_Thread_Mutex is recursive on some platforms (like - * Win32). However, on most platforms (like Solaris) it is not - * recursive. To be totally safe and portable, developers - * should use <ACE_Recursive_Thread_Mutex> when they need a - * recursive mutex. - */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +/** + * @class ACE_Thread_Mutex + * + * @brief ACE_Thread_Mutex wrapper (only valid for threads in the same + * process). + * + * This implementation is optimized for locking threads that are + * in the same process. It maps to <CRITICAL_SECTION>s on NT + * and <ACE_mutex_t> with <type> set to <USYNC_THREAD> on UNIX. + * ACE_Thread_Mutex is recursive on some platforms (like + * Win32). However, on most platforms (like Solaris) it is not + * recursive. To be totally safe and portable, developers + * should use ACE_Recursive_Thread_Mutex when they need a + * recursive mutex. + */ class ACE_Export ACE_Thread_Mutex { friend class ACE_Condition_Thread_Mutex; @@ -67,16 +69,16 @@ public: int acquire (void); /** - * Block the thread until we acquire the mutex or until <tv> times + * Block the thread until we acquire the mutex or until @a tv times * out, in which case -1 is returned with <errno> == <ETIME>. Note - * that <tv> is assumed to be in "absolute" rather than "relative" - * time. The value of <tv> is updated upon return to show the + * that @a tv is assumed to be in "absolute" rather than "relative" + * time. The value of @a tv is updated upon return to show the * actual (absolute) acquisition time. */ int acquire (ACE_Time_Value &tv); /** - * If <tv> == 0 the call <acquire()> directly. Otherwise, Block the + * If @a tv == 0 the call <acquire()> directly. Otherwise, Block the * thread until we acquire the mutex or until <tv> times out, in * which case -1 is returned with <errno> == <ETIME>. Note that * <*tv> is assumed to be in "absolute" rather than "relative" time. @@ -97,21 +99,21 @@ public: /** * Acquire mutex ownership. This calls <acquire> and is only here - * to make the <ACE_Thread_Mutex> interface consistent with the + * to make the ACE_Thread_Mutex interface consistent with the * other synchronization APIs. */ int acquire_read (void); /** * Acquire mutex ownership. This calls <acquire> and is only here - * to make the <ACE_Thread_Mutex> interface consistent with the + * to make the ACE_Thread_Mutex interface consistent with the * other synchronization APIs. */ int acquire_write (void); /** * Conditionally acquire mutex (i.e., won't block). This calls - * <tryacquire> and is only here to make the <ACE_Thread_Mutex> + * <tryacquire> and is only here to make the ACE_Thread_Mutex * interface consistent with the other synchronization APIs. * Returns -1 on failure. If we "failed" because someone else * already had the lock, <errno> is set to <EBUSY>. @@ -120,7 +122,7 @@ public: /** * Conditionally acquire mutex (i.e., won't block). This calls - * <tryacquire> and is only here to make the <ACE_Thread_Mutex> + * <tryacquire> and is only here to make the ACE_Thread_Mutex * interface consistent with the other synchronization APIs. * Returns -1 on failure. If we "failed" because someone else * already had the lock, <errno> is set to <EBUSY>. @@ -128,7 +130,7 @@ public: int tryacquire_write (void); /** - * This is only here to make the <ACE_Thread_Mutex> + * This is only here to make the ACE_Thread_Mutex * interface consistent with the other synchronization APIs. * Assumes the caller has already acquired the mutex using one of * the above calls, and returns 0 (success) always. @@ -167,7 +169,7 @@ private: * * @brief This data structure is meant to be used within a method or * function... It performs automatic aquisition and release of - * an <ACE_Thread_Mutex>. + * an ACE_Thread_Mutex. * * This class is obsolete and should be replaced by * ACE_Guard<ACE_Thread_Mutex>. @@ -225,6 +227,8 @@ private: }; #endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */ +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Thread_Mutex.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Thread_Mutex.inl b/ace/Thread_Mutex.inl index f1031aafa48..7658522b38f 100644 --- a/ace/Thread_Mutex.inl +++ b/ace/Thread_Mutex.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE const ACE_thread_mutex_t & ACE_Thread_Mutex::lock (void) const { @@ -165,3 +168,5 @@ ACE_Thread_Mutex_Guard::remove (void) return this->release (); } #endif /* ACE_USES_OBSOLETE_GUARD_CLASSES */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Thread_Semaphore.cpp b/ace/Thread_Semaphore.cpp index 8c56a7e1c31..741c7c5ec99 100644 --- a/ace/Thread_Semaphore.cpp +++ b/ace/Thread_Semaphore.cpp @@ -1,4 +1,3 @@ -/* -*- C++ -*- */ /** * @file Thread_Semaphore.cpp * @@ -22,6 +21,8 @@ ACE_RCSID(ace, Thread_Semaphore, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + void ACE_Thread_Semaphore::dump (void) const { @@ -56,4 +57,6 @@ ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore>::operator () (const ACE_TCHAR *n return p; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/Thread_Semaphore.h b/ace/Thread_Semaphore.h index c99a60d3575..096dce3e93c 100644 --- a/ace/Thread_Semaphore.h +++ b/ace/Thread_Semaphore.h @@ -16,12 +16,7 @@ #define ACE_THREAD_SEMAPHORE_H #include /**/ "ace/pre.h" -#ifdef ACE_THREADS_BUILD_DLL -# include "ace/ACE_Threads_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Threads_Export ACE_Export -#endif /* ACE_THREADS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -34,13 +29,15 @@ #include "ace/Semaphore.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Thread_Semaphore * * @brief Wrapper for Dijkstra style general semaphores that work * only within one process. */ -class ACE_Threads_Export ACE_Thread_Semaphore : public ACE_Semaphore +class ACE_Export ACE_Thread_Semaphore : public ACE_Semaphore { public: /// Initialize the semaphore, with an initial value of @a count, @@ -74,12 +71,14 @@ template <class T> class ACE_Malloc_Lock_Adapter_T; * the standard form used by other lock strategy classes. */ template<> -class ACE_Threads_Export ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore> +class ACE_Export ACE_Malloc_Lock_Adapter_T<ACE_Thread_Semaphore> { public: ACE_Thread_Semaphore * operator () (const ACE_TCHAR *name); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Thread_Semaphore.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Thread_Semaphore.inl b/ace/Thread_Semaphore.inl index 8d2a9adf785..e9535ff088e 100644 --- a/ace/Thread_Semaphore.inl +++ b/ace/Thread_Semaphore.inl @@ -1,7 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_Thread_Semaphore::~ACE_Thread_Semaphore (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Time_Request_Reply.cpp b/ace/Time_Request_Reply.cpp index bf1586d7260..e7524ce6ce7 100644 --- a/ace/Time_Request_Reply.cpp +++ b/ace/Time_Request_Reply.cpp @@ -7,6 +7,8 @@ ACE_RCSID(ace, Time_Request_Reply, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Default "do nothing" constructor. ACE_Time_Request::ACE_Time_Request (void) @@ -190,3 +192,5 @@ ACE_Time_Request::dump (void) const ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("+++++++\n"))); #endif /* ACE_HAS_DUMP */ } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Time_Request_Reply.h b/ace/Time_Request_Reply.h index 551da8dfb82..8c062cbd9a5 100644 --- a/ace/Time_Request_Reply.h +++ b/ace/Time_Request_Reply.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file Time_Request_Reply.h @@ -23,6 +24,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Time_Request * @@ -130,6 +133,7 @@ private: ACE_UINT32 time_; }; +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ACE_TIME_REQUEST_REPLY_H */ diff --git a/ace/Time_Value.cpp b/ace/Time_Value.cpp index 2f8a9e67bff..8ce096055c8 100644 --- a/ace/Time_Value.cpp +++ b/ace/Time_Value.cpp @@ -9,6 +9,19 @@ ACE_RCSID (ace, #include "ace/Time_Value.inl" #endif /* __ACE_INLINE__ */ +#if !defined(ACE_LACKS_NUMERIC_LIMITS) +// some platforms pollute the namespace by defining max() and min() macros +#ifdef max +#undef max +#endif +#ifdef min +#undef min +#endif +#include <limits> +#endif /* ACE_LACKS_NUMERIC_LIMITS */ + + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Static constant representing `zero-time'. // Note: this object requires static construction. @@ -20,7 +33,14 @@ const ACE_Time_Value ACE_Time_Value::zero; // Its primary use is in time computations such as those used by the // dynamic subpriority strategies in the ACE_Dynamic_Message_Queue class. // Note: this object requires static construction. -const ACE_Time_Value ACE_Time_Value::max_time (LONG_MAX, +// Note: on platforms without std::numeric_limits<>, we assume time_t is +// a long, the historical type used for time. +const ACE_Time_Value ACE_Time_Value::max_time ( +#if !defined(ACE_LACKS_NUMERIC_LIMITS) && !defined (ACE_WIN64) + std::numeric_limits<time_t>::max (), +#else + LONG_MAX, +#endif ACE_ONE_SECOND_IN_USECS - 1); ACE_ALLOC_HOOK_DEFINE (ACE_Time_Value) @@ -100,7 +120,7 @@ void ACE_Time_Value::set (const FILETIME &file_time) // Convert 100ns units to seconds; this->tv_.tv_sec = (long) (LL_100ns / ((double) (10000 * 1000))); // Convert remainder to microseconds; - this->tv_.tv_usec = (long)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); + this->tv_.tv_usec = (suseconds_t)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); #else // Don't use a struct initializer, gcc don't like it. ULARGE_INTEGER _100ns; @@ -112,7 +132,7 @@ void ACE_Time_Value::set (const FILETIME &file_time) // Convert 100ns units to seconds; this->tv_.tv_sec = (long) (_100ns.QuadPart / (10000 * 1000)); // Convert remainder to microseconds; - this->tv_.tv_usec = (long) ((_100ns.QuadPart % (10000 * 1000)) / 10); + this->tv_.tv_usec = (suseconds_t) ((_100ns.QuadPart % (10000 * 1000)) / 10); #endif // ACE_LACKS_LONGLONG_T this->normalize (); } @@ -215,20 +235,25 @@ ACE_Time_Value::operator *= (double d) + static_cast<double> (this->usec ()) / ACE_ONE_SECOND_IN_USECS) * d; // shall we saturate the result? - static const double max_int = ACE_INT32_MAX + 0.999999; - static const double min_int = ACE_INT32_MIN - 0.999999; +#if !defined(ACE_LACKS_NUMERIC_LIMITS) && !defined (ACE_WIN64) + static const double max_int = std::numeric_limits<time_t>::max () + 0.999999; + static const double min_int = std::numeric_limits<time_t>::min () - 0.999999; +#else + static const double max_int = LONG_MAX + 0.999999; + static const double min_int = LONG_MIN - 0.999999; +#endif if (time_total > max_int) time_total = max_int; if (time_total < min_int) time_total = min_int; - const long time_sec = static_cast<long> (time_total); + const time_t time_sec = static_cast<time_t> (time_total); time_total -= time_sec; time_total *= ACE_ONE_SECOND_IN_USECS; - long time_usec = static_cast<long> (time_total); + suseconds_t time_usec = static_cast<suseconds_t> (time_total); // round up the result to save the last usec if (time_usec > 0 && (time_total - time_usec) >= 0.5) @@ -237,7 +262,8 @@ ACE_Time_Value::operator *= (double d) --time_usec; this->set (time_sec, time_usec); - this->normalize (); // protect against future changes in normalization return *this; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Time_Value.h b/ace/Time_Value.h index 86ed911bfa0..5216a56c676 100644 --- a/ace/Time_Value.h +++ b/ace/Time_Value.h @@ -21,9 +21,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#if !defined (ACE_HAS_WINCE) && !defined (ACE_PSOS_DIAB_MIPS) -# include "ace/os_include/sys/os_time.h" -#endif /* ACE_HAS_WINCE ACE_PSOS_DIAB_MIPS */ +# include "ace/os_include/os_time.h" // Define some helpful constants. // Not type-safe, and signed. For backward compatibility. @@ -31,32 +29,16 @@ #define ACE_ONE_SECOND_IN_USECS 1000000L #define ACE_ONE_SECOND_IN_NSECS 1000000000L +// needed for ACE_UINT64 +#include "ace/Basic_Types.h" + // This forward declaration is needed by the set() and FILETIME() functions #if defined (ACE_LACKS_LONGLONG_T) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Export ACE_U_LongLong; +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_LACKS_LONGLONG_T */ -# if !defined (ACE_HAS_POSIX_TIME) && !defined (ACE_PSOS) -// Definition per POSIX. -typedef struct timespec -{ - /// Seconds - time_t tv_sec; - /// Nanoseconds - long tv_nsec; -} timespec_t; -# elif defined (ACE_HAS_BROKEN_POSIX_TIME) -// OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs -# include /**/ <sys/timers.h> -# endif /* !ACE_HAS_POSIX_TIME */ - -# if defined(ACE_LACKS_TIMESPEC_T) -typedef struct timespec timespec_t; -# endif /* ACE_LACKS_TIMESPEC_T */ - -// needed for ACE_UINT64 -#include "ace/Basic_Types.h" - // ------------------------------------------------------------------- /** @@ -78,6 +60,9 @@ typedef struct timespec timespec_t; // - Steve Huston, 23-Aug-2004 extern "C++" { #endif + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Time_Value { public: @@ -101,23 +86,23 @@ public: ACE_Time_Value (void); /// Constructor. - ACE_Time_Value (long sec, long usec = 0); + explicit ACE_Time_Value (time_t sec, suseconds_t usec = 0); // = Methods for converting to/from various time formats. /// Construct the ACE_Time_Value from a timeval. - ACE_Time_Value (const struct timeval &t); + explicit ACE_Time_Value (const struct timeval &t); /// Construct the ACE_Time_Value object from a timespec_t. - ACE_Time_Value (const timespec_t &t); + explicit ACE_Time_Value (const timespec_t &t); # if defined (ACE_WIN32) /// Construct the ACE_Time_Value object from a Win32 FILETIME - ACE_Time_Value (const FILETIME &ft); + explicit ACE_Time_Value (const FILETIME &ft); # endif /* ACE_WIN32 */ - /// Initializes the ACE_Time_Value from two longs. - void set (long sec, long usec); + /// Initializes the ACE_Time_Value from seconds and useconds. + void set (time_t sec, suseconds_t usec); /// Initializes the ACE_Time_Value from a double, which is assumed to be /// in second format, with any remainder treated as microseconds. @@ -191,10 +176,10 @@ public: * @note The semantics of this method differs from the msec() * method. */ - long sec (void) const; + time_t sec (void) const; /// Set seconds. - void sec (long sec); + void sec (time_t sec); /// Get microseconds. /** @@ -203,10 +188,10 @@ public: * @note The semantics of this method differs from the msec() * method. */ - long usec (void) const; + suseconds_t usec (void) const; /// Set microseconds. - void usec (long usec); + void usec (suseconds_t usec); #if !defined (ACE_LACKS_LONGLONG_T) /** @@ -222,14 +207,23 @@ public: /// Add @a tv to this. ACE_Time_Value &operator += (const ACE_Time_Value &tv); + /// Add @a tv to this. + ACE_Time_Value &operator += (time_t tv); + /// Assign @ tv to this ACE_Time_Value &operator = (const ACE_Time_Value &tv); + /// Assign @ tv to this + ACE_Time_Value &operator = (time_t tv); + /// Subtract @a tv to this. ACE_Time_Value &operator -= (const ACE_Time_Value &tv); - /** \brief Multiply the time value by the @a d factor. + /// Substract @a tv to this. + ACE_Time_Value &operator -= (time_t tv); + /** + \brief Multiply the time value by the @a d factor. \note The result of the operator is valid for results from range < (ACE_INT32_MIN, -999999), (ACE_INT32_MAX, 999999) >. Result outside this range are saturated to a limit. @@ -266,11 +260,11 @@ public: /// Adds two ACE_Time_Value objects together, returns the sum. friend ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); + const ACE_Time_Value &tv2); /// Subtracts two ACE_Time_Value objects, returns the difference. friend ACE_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); + const ACE_Time_Value &tv2); /// True if @a tv1 < @a tv2. friend ACE_Export bool operator < (const ACE_Time_Value &tv1, @@ -299,10 +293,10 @@ public: //@{ /// Multiplies the time value by @a d friend ACE_Export ACE_Time_Value operator * (double d, - const ACE_Time_Value &tv); + const ACE_Time_Value &tv); friend ACE_Export ACE_Time_Value operator * (const ACE_Time_Value &tv, - double d); + double d); //@} /// Dump is a no-op. @@ -331,6 +325,8 @@ private: timeval tv_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Time_Value.inl" #endif /* __ACE_INLINE__ */ @@ -340,11 +336,13 @@ private: #endif #if defined (__MINGW32__) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // The MingW linker has problems with the exported statics // zero and max_time with these two statics the linker will be able to // resolve the static exported symbols. static const ACE_Time_Value& __zero_time = ACE_Time_Value::zero; static const ACE_Time_Value& __max_time = ACE_Time_Value::max_time; +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* __MINGW32__ */ #include /**/ "ace/post.h" diff --git a/ace/Time_Value.inl b/ace/Time_Value.inl index 298485d319c..75c34a2e2cc 100644 --- a/ace/Time_Value.inl +++ b/ace/Time_Value.inl @@ -2,6 +2,8 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + #if defined (ACE_WIN32) && defined (_WIN32_WCE) // Something is a bit brain-damaged here and I'm not sure what... this code // compiled before the OS reorg for ACE 5.4. Since then it hasn't - eVC @@ -47,11 +49,29 @@ ACE_Time_Value::operator const timeval * () const } ACE_INLINE void -ACE_Time_Value::set (long sec, long usec) +ACE_Time_Value::set (time_t sec, suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::set"); +#if defined (ACE_WIN64) \ + || (defined (ACE_WIN32) && !defined (_USE_32BIT_TIME_T)) + // Win64 uses 'long' (32 bit) timeval and 64-bit time_t, so we have + // to get these back in range. + if (sec > LONG_MAX) + this->tv_.tv_sec = LONG_MAX; + else if (sec < LONG_MIN) + this->tv_.tv_sec = LONG_MIN; + else + this->tv_.tv_sec = static_cast<long> (sec); +#else this->tv_.tv_sec = sec; +#endif this->tv_.tv_usec = usec; +#if __GNUC__ + if (__builtin_constant_p(sec) && + __builtin_constant_p(usec) && + (sec >= 0 && usec >= 0 && usec < ACE_ONE_SECOND_IN_USECS)) + return; +#endif this->normalize (); } @@ -61,7 +81,7 @@ ACE_Time_Value::set (double d) // ACE_OS_TRACE ("ACE_Time_Value::set"); long l = (long) d; this->tv_.tv_sec = l; - this->tv_.tv_usec = (long) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS + .5); + this->tv_.tv_usec = (suseconds_t) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS + .5); this->normalize (); } @@ -73,17 +93,9 @@ ACE_INLINE void ACE_Time_Value::set (const timespec_t &tv) { // ACE_OS_TRACE ("ACE_Time_Value::set"); -#if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) - this->tv_.tv_sec = static_cast<long> (tv.tv_sec); - // Convert nanoseconds into microseconds. - this->tv_.tv_usec = tv.tv_nsec / 1000; -#else - this->tv_.tv_sec = tv.ts_sec; - // Convert nanoseconds into microseconds. - this->tv_.tv_usec = tv.ts_nsec / 1000; -#endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ - this->normalize (); + this->set (tv.tv_sec, + tv.tv_nsec / 1000); // Convert nanoseconds into microseconds. } ACE_INLINE @@ -95,7 +107,7 @@ ACE_Time_Value::ACE_Time_Value (void) } ACE_INLINE -ACE_Time_Value::ACE_Time_Value (long sec, long usec) +ACE_Time_Value::ACE_Time_Value (time_t sec, suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); this->set (sec, usec); @@ -103,7 +115,7 @@ ACE_Time_Value::ACE_Time_Value (long sec, long usec) // Returns number of seconds. -ACE_INLINE long +ACE_INLINE time_t ACE_Time_Value::sec (void) const { // ACE_OS_TRACE ("ACE_Time_Value::sec"); @@ -113,10 +125,22 @@ ACE_Time_Value::sec (void) const // Sets the number of seconds. ACE_INLINE void -ACE_Time_Value::sec (long sec) +ACE_Time_Value::sec (time_t sec) { // ACE_OS_TRACE ("ACE_Time_Value::sec"); +#if defined (ACE_WIN64) \ + || (defined (ACE_WIN32) && !defined (_USE_32BIT_TIME_T)) + // Win64 uses 'long' (32 bit) timeval and 64-bit time_t, so we have + // to get these back in range. + if (sec > LONG_MAX) + this->tv_.tv_sec = LONG_MAX; + else if (sec < LONG_MIN) + this->tv_.tv_sec = LONG_MIN; + else + this->tv_.tv_sec = static_cast<long> (sec); +#else this->tv_.tv_sec = sec; +#endif } // Converts from Time_Value format into milli-seconds format. @@ -153,7 +177,7 @@ ACE_Time_Value::msec (long milliseconds) // Returns number of micro-seconds. -ACE_INLINE long +ACE_INLINE suseconds_t ACE_Time_Value::usec (void) const { // ACE_OS_TRACE ("ACE_Time_Value::usec"); @@ -163,7 +187,7 @@ ACE_Time_Value::usec (void) const // Sets the number of micro-seconds. ACE_INLINE void -ACE_Time_Value::usec (long usec) +ACE_Time_Value::usec (suseconds_t usec) { // ACE_OS_TRACE ("ACE_Time_Value::usec"); this->tv_.tv_usec = usec; @@ -231,15 +255,9 @@ ACE_Time_Value::operator timespec_t () const { // ACE_OS_TRACE ("ACE_Time_Value::operator timespec_t"); timespec_t tv; -#if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) tv.tv_sec = this->sec (); // Convert microseconds into nanoseconds. tv.tv_nsec = this->tv_.tv_usec * 1000; -#else - tv.ts_sec = this->sec (); - // Convert microseconds into nanoseconds. - tv.ts_nsec = this->tv_.tv_usec * 1000; -#endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ return tv; } @@ -307,12 +325,28 @@ ACE_Time_Value::operator+= (const ACE_Time_Value &tv) } ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator+= (time_t tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator+="); + this->sec (this->sec () + tv); + return *this; +} + +ACE_INLINE ACE_Time_Value & ACE_Time_Value::operator= (const ACE_Time_Value &tv) { // ACE_OS_TRACE ("ACE_Time_Value::operator="); this->sec (tv.sec ()); this->usec (tv.usec ()); - // this->normalize (); + return *this; +} + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator= (time_t tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator="); + this->sec (tv); + this->usec (0); return *this; } @@ -328,6 +362,14 @@ ACE_Time_Value::operator-= (const ACE_Time_Value &tv) return *this; } +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator-= (time_t tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator-="); + this->sec (this->sec () - tv); + return *this; +} + // Adds two ACE_Time_Value objects together, returns the sum. ACE_INLINE ACE_Time_Value @@ -357,3 +399,5 @@ operator - (const ACE_Time_Value &tv1, #if defined (ACE_WIN32) && defined (_WIN32_WCE) } #endif + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timeprobe.cpp b/ace/Timeprobe.cpp index 9fa83321885..4dd6962329d 100644 --- a/ace/Timeprobe.cpp +++ b/ace/Timeprobe.cpp @@ -6,43 +6,9 @@ ACE_RCSID(ace, Timeprobe, "$Id$") #if defined (ACE_COMPILE_TIMEPROBES) -#include "ace/Timeprobe.h" -#include "ace/Mutex.h" -#include "ace/Null_Mutex.h" - #if !defined (__ACE_INLINE__) #include "ace/Timeprobe.inl" #endif /* __ACE_INLINE__ */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Timeprobe_Ex<ACE_TIMEPROBE_MUTEX,ACE_TIMEPROBE_ALLOCATOR>; -template class ACE_Function_Timeprobe<ACE_Timeprobe_Ex<ACE_TIMEPROBE_MUTEX,ACE_TIMEPROBE_ALLOCATOR> >; -template class ACE_Unbounded_Set_Iterator<ACE_Event_Descriptions>; -template class ACE_Unbounded_Set<ACE_Event_Descriptions>; -template class ACE_Node<ACE_Event_Descriptions>; -template class ACE_Timeprobe_Ex<ACE_Thread_Mutex, ACE_New_Allocator>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Timeprobe_Ex<ACE_TIMEPROBE_MUTEX,ACE_TIMEPROBE_ALLOCATOR> -#pragma instantiate ACE_Function_Timeprobe<ACE_Timeprobe_Ex<ACE_TIMEPROBE_MUTEX,ACE_TIMEPROBE_ALLOCATOR> > -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Event_Descriptions> -#pragma instantiate ACE_Unbounded_Set<ACE_Event_Descriptions> -#pragma instantiate ACE_Node<ACE_Event_Descriptions> -#pragma instantiate ACE_Timeprobe_Ex<ACE_Thread_Mutex, ACE_New_Allocator> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -# if defined (ACE_TSS_TIMEPROBES) -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_TSS_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_NULL_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_TSS_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_NULL_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -# else /* ACE_TSS_TIMEPROBES */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<ACE_TIMEPROBE_WITH_LOCKING, ACE_SYNCH_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -# endif /* ACE_TSS_TIMEPROBES */ - #endif /* ACE_COMPILE_TIMEPROBES */ diff --git a/ace/Timeprobe.h b/ace/Timeprobe.h index 6eca046a631..a78619f6e76 100644 --- a/ace/Timeprobe.h +++ b/ace/Timeprobe.h @@ -58,6 +58,8 @@ #include "ace/OS_NS_time.h" #include "ace/OS_NS_Thread.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Event_Descriptions * @@ -111,6 +113,8 @@ public: ACE_thread_t thread_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Timeprobe.inl" #endif /* __ACE_INLINE__ */ @@ -120,6 +124,8 @@ public: #include "ace/Singleton.h" #include "ace/Timeprobe_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // If ACE_MT_TIMEPROBES is defined, use a Thread_Mutex to lock the // internal state of ACE_Timerprobe. This allows multiple threads to // use the same ACE_Timerprobe. @@ -148,12 +154,14 @@ typedef ACE_Timeprobe_Ex<ACE_TIMEPROBE_MUTEX, ACE_TIMEPROBE_ALLOCATOR> # endif /* ACE_TSS_TIMEPROBES */ ACE_SINGLETON_DECLARE (ACE_TIMEPROBE_SINGLETON_TYPE, \ - ACE_TIMEPROBE_WITH_LOCKING, \ - ACE_TIMEPROBE_SINGLETON_LOCK_TYPE) + ACE_TIMEPROBE_WITH_LOCKING, \ + ACE_TIMEPROBE_SINGLETON_LOCK_TYPE) typedef ACE_TIMEPROBE_SINGLETON_TYPE<ACE_TIMEPROBE_WITH_LOCKING, ACE_TIMEPROBE_SINGLETON_LOCK_TYPE> ACE_TIMEPROBE_SINGLETON; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_COMPILE_TIMEPROBES */ // If ACE_ENABLE_TIMEPROBES is defined, the macros below will diff --git a/ace/Timeprobe.inl b/ace/Timeprobe.inl index 2815dd56e0c..d25eb4b0cfa 100644 --- a/ace/Timeprobe.inl +++ b/ace/Timeprobe.inl @@ -1,9 +1,14 @@ // -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE bool ACE_Event_Descriptions::operator== (const ACE_Event_Descriptions &rhs) const { return this->minimum_id_ == rhs.minimum_id_ && this->descriptions_ == rhs.descriptions_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timeprobe_T.cpp b/ace/Timeprobe_T.cpp index bde2c1736dc..c148d3acdb9 100644 --- a/ace/Timeprobe_T.cpp +++ b/ace/Timeprobe_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_TIMEPROBE_T_C -#define ACE_TIMEPROBE_T_C +#ifndef ACE_TIMEPROBE_T_CPP +#define ACE_TIMEPROBE_T_CPP #include "ace/config-all.h" @@ -9,14 +9,14 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Timeprobe_T, "$Id$") - #if defined (ACE_COMPILE_TIMEPROBES) #include "ace/Timeprobe.h" #include "ace/High_Res_Timer.h" #include "ace/OS_NS_string.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class ACE_LOCK, class ALLOCATOR> ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::ACE_Timeprobe_Ex (u_long size) : timeprobes_ (0), @@ -47,7 +47,7 @@ ACE_Timeprobe_Ex (ALLOCATOR *allocator, report_buffer_full_ (0), allocator_ (allocator) { - ACE_timeprobe_t *temp; + ACE_timeprobe_t *temp = 0; ACE_NEW_MALLOC_ARRAY (temp, (ACE_timeprobe_t *) this->allocator ()-> malloc (this->max_size_*sizeof(ACE_timeprobe_t)), @@ -99,7 +99,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::timeprobe (u_long event) this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime (); this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self (); - this->current_size_++; + ++this->current_size_; } @@ -115,7 +115,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::timeprobe (const char *event) this->timeprobes_[this->current_size_].time_ = ACE_OS::gethrtime (); this->timeprobes_[this->current_size_].thread_ = ACE_OS::thr_self (); - this->current_size_++; + ++this->current_size_; } template <class ACE_LOCK, class ALLOCATOR> void @@ -134,7 +134,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::increase_size (u_long size) if (size > this->max_size_) { - ACE_timeprobe_t *temp; + ACE_timeprobe_t *temp = 0; ACE_NEW_MALLOC_ARRAY (temp, (ACE_timeprobe_t *) this->allocator ()-> malloc (this->max_size_ @@ -341,7 +341,7 @@ ACE_Timeprobe_Ex<ACE_LOCK, ALLOCATOR>::find_description_i (u_long i) iterator++, j++) { EVENT_DESCRIPTIONS::iterator next_event_descriptions = iterator; - next_event_descriptions++; + ++next_event_descriptions; if (this->timeprobes_[i].event_.event_number_ < (*next_event_descriptions).minimum_id_) break; @@ -394,5 +394,7 @@ ACE_Function_Timeprobe<Timeprobe>::~ACE_Function_Timeprobe (void) this->timeprobe_.timeprobe (this->event_ + 1); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_COMPILE_TIMEPROBES */ -#endif /* ACE_TIMEPROBE_T_C */ +#endif /* ACE_TIMEPROBE_T_CPP */ diff --git a/ace/Timeprobe_T.h b/ace/Timeprobe_T.h index e4d0acc7c33..32b5bae1448 100644 --- a/ace/Timeprobe_T.h +++ b/ace/Timeprobe_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -25,6 +25,8 @@ #include "ace/Unbounded_Set.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Timeprobe_Ex * @@ -205,6 +207,8 @@ protected: u_long event_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "ace/Timeprobe_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/ace/Timer_Hash.cpp b/ace/Timer_Hash.cpp index cfd39ae18e7..532f0d83c64 100644 --- a/ace/Timer_Hash.cpp +++ b/ace/Timer_Hash.cpp @@ -1,10 +1,5 @@ // $Id$ -// Timer_Hash.cpp - -#if !defined (ACE_TIMER_HASH_C) -#define ACE_TIMER_HASH_C - #include "ace/Timer_Hash.h" #include "ace/Synch_Traits.h" #include "ace/Recursive_Thread_Mutex.h" @@ -15,111 +10,3 @@ ACE_RCSID(ace, Timer_Hash, "$Id$") -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *> >; -template class ACE_Locked_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *>, - ACE_Null_Mutex>; -template class ACE_Timer_Hash_Upcall <ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX>; - -template class ACE_Timer_Queue_T <ACE_Event_Handler *, - ACE_Hash_Upcall, - ACE_Null_Mutex>; - -template class ACE_Timer_Queue_Iterator_T <ACE_Event_Handler *, - ACE_Hash_Upcall, - ACE_Null_Mutex>; - -template class ACE_Timer_List_T <ACE_Event_Handler *, - ACE_Hash_Upcall, - ACE_Null_Mutex>; - -template class ACE_Timer_List_Iterator_T <ACE_Event_Handler *, - ACE_Hash_Upcall, - ACE_Null_Mutex>; - -template class ACE_Timer_Heap_T <ACE_Event_Handler *, - ACE_Hash_Upcall, - ACE_Null_Mutex>; - -template class ACE_Timer_Heap_Iterator_T <ACE_Event_Handler *, - ACE_Hash_Upcall, - ACE_Null_Mutex>; - -template class ACE_Timer_Hash_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_List>; - -template class ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_List>; - -template class ACE_Timer_Hash_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_Heap>; - -template class ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, - ACE_SYNCH_RECURSIVE_MUTEX, - ACE_Hash_Timer_Heap>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *> > -#pragma instantiate ACE_Locked_Free_List<ACE_Timer_Node_T<ACE_Event_Handler *>, \ - ACE_Null_Mutex> -#pragma instantiate ACE_Timer_Hash_Upcall <ACE_Event_Handler *, \ - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ - ACE_SYNCH_RECURSIVE_MUTEX> - -#pragma instantiate ACE_Timer_Queue_T <ACE_Event_Handler *, \ - ACE_Hash_Upcall, \ - ACE_Null_Mutex> - -#pragma instantiate ACE_Timer_Queue_Iterator_T <ACE_Event_Handler *, \ - ACE_Hash_Upcall, \ - ACE_Null_Mutex> - -#pragma instantiate ACE_Timer_List_T <ACE_Event_Handler *, \ - ACE_Hash_Upcall, \ - ACE_Null_Mutex> - -#pragma instantiate ACE_Timer_List_Iterator_T <ACE_Event_Handler *, \ - ACE_Hash_Upcall, \ - ACE_Null_Mutex> - -#pragma instantiate ACE_Timer_Heap_T <ACE_Event_Handler *, \ - ACE_Hash_Upcall, \ - ACE_Null_Mutex> - -#pragma instantiate ACE_Timer_Heap_Iterator_T <ACE_Event_Handler *, \ - ACE_Hash_Upcall, \ - ACE_Null_Mutex> - -#pragma instantiate ACE_Timer_Hash_T<ACE_Event_Handler *, \ - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ - ACE_SYNCH_RECURSIVE_MUTEX, \ - ACE_Hash_Timer_List> - -#pragma instantiate ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, \ - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ - ACE_SYNCH_RECURSIVE_MUTEX, \ - ACE_Hash_Timer_List> - -#pragma instantiate ACE_Timer_Hash_T<ACE_Event_Handler *, \ - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ - ACE_SYNCH_RECURSIVE_MUTEX, \ - ACE_Hash_Timer_Heap> - -#pragma instantiate ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, \ - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, \ - ACE_SYNCH_RECURSIVE_MUTEX, \ - ACE_Hash_Timer_Heap> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - - -#endif /* ACE_TIMER_HASH_C */ diff --git a/ace/Timer_Hash.h b/ace/Timer_Hash.h index a457ba41207..2d959be39c5 100644 --- a/ace/Timer_Hash.h +++ b/ace/Timer_Hash.h @@ -24,6 +24,8 @@ #include "ace/Timer_Heap_T.h" #include "ace/Timer_List_T.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // The following typedef are here for ease of use typedef ACE_Timer_Hash_Upcall <ACE_Event_Handler *, @@ -67,5 +69,7 @@ typedef ACE_Timer_Hash_Iterator_T<ACE_Event_Handler *, ACE_Hash_Timer_Heap> ACE_Timer_Hash_Heap_Iterator; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TIMER_HASH_H */ diff --git a/ace/Timer_Hash_T.cpp b/ace/Timer_Hash_T.cpp index 92dc421dd6a..9f5d51fb8d6 100644 --- a/ace/Timer_Hash_T.cpp +++ b/ace/Timer_Hash_T.cpp @@ -514,9 +514,9 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (long timer_id, reinterpret_cast<Hash_Token<TYPE> *> (timer_id); #endif /* ACE_WIN64 */ - int result = this->table_[h->pos_]->cancel (h->orig_id_, - 0, - dont_call); + int const result = this->table_[h->pos_]->cancel (h->orig_id_, + 0, + dont_call); if (result == 1) { @@ -591,7 +591,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::cancel (const TYPE &type, for (i = 0; i < pos; ++i) { - int result = + int const result = this->table_[timer_ids[i]->pos_]->cancel (timer_ids[i]->orig_id_, 0, dont_call); @@ -678,7 +678,7 @@ template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> int ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::dispatch_info_i (const ACE_Time_Value &cur_time, ACE_Timer_Node_Dispatch_Info_T<TYPE> &info) { - int result = + int const result = ACE_Timer_Queue_T<TYPE,FUNCTOR,ACE_LOCK>::dispatch_info_i (cur_time, info); @@ -711,7 +711,7 @@ ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET>::expire (const ACE_Time_Value int number_of_timers_expired = 0; - ACE_Timer_Node_T<TYPE> *expired; + ACE_Timer_Node_T<TYPE> *expired = 0; // Go through the table and expire anything that can be expired diff --git a/ace/Timer_Hash_T.h b/ace/Timer_Hash_T.h index 2b6e7944438..c7eee094c63 100644 --- a/ace/Timer_Hash_T.h +++ b/ace/Timer_Hash_T.h @@ -22,6 +22,8 @@ #include "ace/Free_List.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration. template <class TYPE, class FUNCTOR, class ACE_LOCK, class BUCKET> class ACE_Timer_Hash_T; @@ -243,7 +245,7 @@ public: */ virtual int expire (const ACE_Time_Value ¤t_time); - /// Returns a pointer to this <ACE_Timer_Queue>'s iterator. + /// Returns a pointer to this ACE_Timer_Queue's iterator. virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> &iter (void); /// Removes the earliest node from the queue and returns it @@ -312,6 +314,8 @@ private: ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Hash_T<TYPE, FUNCTOR, ACE_LOCK, BUCKET> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) && !defined(ACE_HAS_BROKEN_HPUX_TEMPLATES) #include "ace/Timer_Hash_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE && !ACE_HAS_BROKEN_HPUX_TEMPLATES */ diff --git a/ace/Timer_Heap.cpp b/ace/Timer_Heap.cpp index de160f575eb..300859dba8f 100644 --- a/ace/Timer_Heap.cpp +++ b/ace/Timer_Heap.cpp @@ -1,44 +1,16 @@ // $Id$ -#if !defined (ACE_TIMER_HEAP_C) -#define ACE_TIMER_HEAP_C - #include "ace/Timer_Heap.h" #include "ace/Synch_Traits.h" #include "ace/Recursive_Thread_Mutex.h" -ACE_RCSID(ace, Timer_Heap, "$Id$") - #if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) #include "ace/Timer_Hash.h" #include "ace/Timer_Heap_T.cpp" -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class - ACE_Timer_Heap_T< - ACE_Event_Handler*, - ACE_Timer_Hash_Upcall< - ACE_Event_Handler*, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, - ACE_Null_Mutex>, - ACE_Null_Mutex>; -template class - ACE_Timer_Heap_Iterator_T< - ACE_Event_Handler*, - ACE_Timer_Hash_Upcall< - ACE_Event_Handler*, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, - ACE_Null_Mutex>, - ACE_Null_Mutex>; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ +ACE_RCSID(ace, + Timer_Heap, + "$Id$") -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ -#endif /* ACE_TIMER_HEAP_C */ diff --git a/ace/Timer_Heap.h b/ace/Timer_Heap.h index e40ca3f0f39..a0c9301ebc8 100644 --- a/ace/Timer_Heap.h +++ b/ace/Timer_Heap.h @@ -20,7 +20,9 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// The following typedef are here for ease of use and backward +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedefs are here for ease of use and backward // compatibility. typedef ACE_Timer_Heap_T<ACE_Event_Handler *, @@ -33,5 +35,7 @@ typedef ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_Heap_Iterator; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TIMER_HEAP_H */ diff --git a/ace/Timer_Heap_T.cpp b/ace/Timer_Heap_T.cpp index 8f777920706..644a13b90db 100644 --- a/ace/Timer_Heap_T.cpp +++ b/ace/Timer_Heap_T.cpp @@ -1,18 +1,37 @@ // $Id$ -#ifndef ACE_TIMER_HEAP_T_C -#define ACE_TIMER_HEAP_T_C +#ifndef ACE_TIMER_HEAP_T_CPP +#define ACE_TIMER_HEAP_T_CPP #include "ace/Timer_Heap_T.h" #include "ace/Log_Msg.h" #include "ace/Guard_T.h" +#include "ace/OS_NS_errno.h" #include "ace/OS_NS_string.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -ACE_RCSID(ace, Timer_Heap_T, "$Id$") +/* +** The ACE_Timer_Heap::max_size_ and array loops, checks, etc. are all size_t. +** The timer IDs are long, and since they are indices into the heap, we need +** to be sure that the timer heap size can fit in a long. Hence, when size +** is (re)set, limit it to the maximum long value. We use the C++ standard +** limits if available. +*/ +#if !defined(ACE_LACKS_NUMERIC_LIMITS) +// some platforms pollute the namespace by defining max() and min() macros +#ifdef max +#undef max +#endif +#ifdef min +#undef min +#endif +#include <limits> +#endif /* ACE_LACKS_NUMERIC_LIMITS */ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Define some simple macros to clarify the code. #define ACE_HEAP_PARENT(X) (X == 0 ? 0 : (((X) - 1) / 2)) @@ -89,6 +108,21 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Heap_T (size_t size, { ACE_TRACE ("ACE_Timer_Heap_T::ACE_Timer_Heap_T"); + // Possibly reduce size to fit in a long. +#if !defined(ACE_LACKS_NUMERIC_LIMITS) + if (size > static_cast<size_t> (std::numeric_limits<long>::max ())) + { + size = static_cast<size_t> (std::numeric_limits<long>::max ()); + this->max_size_ = size; + } +#else + if (size > LONG_MAX) + { + size = LONG_MAX; + this->max_size_ = size; + } +#endif /* ACE_LACKS_NUMERIC_LIMITS */ + // Create the heap array. ACE_NEW (this->heap_, ACE_Timer_Node_T<TYPE> *[size]); @@ -146,6 +180,15 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::ACE_Timer_Heap_T (FUNCTOR *upcall_fun { ACE_TRACE ("ACE_Timer_Heap_T::ACE_Timer_Heap_T"); + // Possibly reduce size to fit in a long. +#if !defined(ACE_LACKS_NUMERIC_LIMITS) + if (this->max_size_ > static_cast<size_t> (std::numeric_limits<long>::max ())) + this->max_size_ = static_cast<size_t> (std::numeric_limits<long>::max ()); +#else + if (this->max_size_ > LONG_MAX) + this->max_size_ = LONG_MAX; +#endif /* ACE_LACKS_NUMERIC_LIMITS */ + // Create the heap array. #if defined (__IBMCPP__) && (__IBMCPP__ >= 400) && defined (_WINDOWS) ACE_NEW (this->heap_, @@ -237,7 +280,7 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::pop_freelist (void) this->timer_ids_min_free_ = this->max_size_; } - return this->timer_ids_curr_; + return static_cast<long> (this->timer_ids_curr_); } template <class TYPE, class FUNCTOR, class ACE_LOCK> void @@ -474,9 +517,27 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::insert (ACE_Timer_Node_T<TYPE> *new_n template <class TYPE, class FUNCTOR, class ACE_LOCK> void ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::grow_heap (void) { - // All the containers will double in size from max_size_ + // All the containers will double in size from max_size_. size_t new_size = this->max_size_ * 2; +#if 0 + // Yikes - there's no way to flag a failure of going out of range of + // a 'long' - this is a problem that should be addressed at some point. +#if !defined(ACE_LACKS_NUMERIC_LIMITS) + if (new_size > std::numeric_limits<long>::max ()) + new_size = std::numeric_limits<long>::max (); +#else + if (new_size > LONG_MAX) + new_size = LONG_MAX; +#endif /* ACE_LACKS_NUMERIC_LIMITS */ + + if (new_size <= this->max_size_) // We are already at the limit + { + errno = ENOMEM; + return -1; + } +#endif /* 0 */ + // First grow the heap itself. ACE_Timer_Node_T<TYPE> **new_heap = 0; @@ -554,6 +615,9 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::grow_heap (void) } this->max_size_ = new_size; + // Force rescan of list from beginning for a free slot (I think...) + // This fixed Bugzilla #2447. + this->timer_ids_min_free_ = this->max_size_; } // Reschedule a periodic timer. This function must be called with the @@ -765,6 +829,11 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::cancel (const TYPE &type, number_of_cancellations++; this->free_node (temp); + + // We reset to zero so that we don't miss checking any nodes + // if a reheapify occurs when a node is removed. There + // may be a better fix than this, however. + i = 0; } else i++; @@ -814,4 +883,6 @@ ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK>::get_first (void) return this->cur_size_ == 0 ? 0 : this->heap_[0]; } -#endif /* ACE_TIMER_HEAP_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_HEAP_T_CPP */ diff --git a/ace/Timer_Heap_T.h b/ace/Timer_Heap_T.h index bf2147019cc..068aa0bfb67 100644 --- a/ace/Timer_Heap_T.h +++ b/ace/Timer_Heap_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,6 +23,8 @@ #include "ace/Free_List.h" #include "ace/Unbounded_Set.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Heap_T; @@ -160,7 +162,7 @@ public: const void **act = 0, int dont_call_handle_close = 1); - /// Returns a pointer to this <ACE_Timer_Queue>'s iterator. + /// Returns a pointer to this ACE_Timer_Queue's iterator. virtual ACE_Timer_Queue_Iterator_T<TYPE, FUNCTOR, ACE_LOCK> &iter (void); /** @@ -322,6 +324,8 @@ private: ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Heap_T<TYPE, FUNCTOR, ACE_LOCK> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) && !defined(ACE_HAS_BROKEN_HPUX_TEMPLATES) #include "ace/Timer_Heap_T.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE && !ACE_HAS_BROKEN_HPUX_TEMPLATES */ diff --git a/ace/Timer_List.cpp b/ace/Timer_List.cpp index 777091e5af1..d94976115b5 100644 --- a/ace/Timer_List.cpp +++ b/ace/Timer_List.cpp @@ -1,8 +1,5 @@ // $Id$ -#if !defined (ACE_TIMER_LIST_C) -#define ACE_TIMER_LIST_C - #include "ace/Timer_List.h" #include "ace/Synch_Traits.h" #include "ace/Recursive_Thread_Mutex.h" @@ -12,35 +9,5 @@ ACE_RCSID(ace, Timer_List, "$Id$") #if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) #include "ace/Timer_Hash.h" #include "ace/Timer_List_T.cpp" - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class - ACE_Timer_List_T< - ACE_Event_Handler*, - ACE_Timer_Hash_Upcall< - ACE_Event_Handler*, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, - ACE_Null_Mutex>, - ACE_Null_Mutex>; - -template class -ACE_Timer_List_Iterator_T< - ACE_Event_Handler*, - ACE_Timer_Hash_Upcall< - ACE_Event_Handler*, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, - ACE_Null_Mutex>, - ACE_Null_Mutex>; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Timer_List_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_List_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Timer_List_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_List_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - - -#endif /* ACE_TIMER_LIST_C */ diff --git a/ace/Timer_List.h b/ace/Timer_List.h index 571364742a8..0bc689465ea 100644 --- a/ace/Timer_List.h +++ b/ace/Timer_List.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,7 +21,9 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// The following typedef are here for ease of use and backward +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedefs are here for ease of use and backward // compatibility. typedef ACE_Timer_List_T<ACE_Event_Handler *, @@ -34,5 +36,7 @@ typedef ACE_Timer_List_Iterator_T<ACE_Event_Handler *, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_List_Iterator; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TIMER_LIST_H */ diff --git a/ace/Timer_List_T.cpp b/ace/Timer_List_T.cpp index 164e1aecb07..60a116bb835 100644 --- a/ace/Timer_List_T.cpp +++ b/ace/Timer_List_T.cpp @@ -162,7 +162,7 @@ ACE_Timer_List_T<TYPE, FUNCTOR, ACE_LOCK>::dump (void) const ACE_Timer_Node_T<TYPE>* n = this->get_first_i(); if (n != 0) { for (; n != this->head_; n = n->get_next()) { - count++; + ++count; } } diff --git a/ace/Timer_Queue.cpp b/ace/Timer_Queue.cpp index eadbf31c883..f3cf230e6e8 100644 --- a/ace/Timer_Queue.cpp +++ b/ace/Timer_Queue.cpp @@ -1,8 +1,5 @@ // $Id$ -#if !defined (ACE_TIMER_QUEUE_C) -#define ACE_TIMER_QUEUE_C - #include "ace/Containers.h" #include "ace/Timer_Queue.h" #include "ace/Synch_Traits.h" @@ -13,49 +10,5 @@ ACE_RCSID(ace, Timer_Queue, "$Id$") #if defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) #include "ace/Timer_Hash.h" #include "ace/Timer_Queue_T.cpp" - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class - ACE_Timer_Queue_T< - ACE_Event_Handler*, - ACE_Timer_Hash_Upcall< - ACE_Event_Handler*, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, - ACE_Null_Mutex>, - ACE_Null_Mutex>; - -template class - ACE_Timer_Queue_Iterator_T< - ACE_Event_Handler*, - ACE_Timer_Hash_Upcall< - ACE_Event_Handler*, - ACE_Event_Handler_Handle_Timeout_Upcall<ACE_Null_Mutex>, - ACE_Null_Mutex>, - ACE_Null_Mutex>; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ #endif /* ACE_HAS_BROKEN_HPUX_TEMPLATES */ -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Event_Handler *> *>; -template class ACE_Node<ACE_Timer_Node_T<ACE_Event_Handler *> *>; -template class ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Event_Handler *> *>; -template class ACE_Timer_Node_Dispatch_Info_T<ACE_Event_Handler *>; -template class ACE_Timer_Node_T<ACE_Event_Handler *>; -template class ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Event_Handler *> *> -#pragma instantiate ACE_Node<ACE_Timer_Node_T<ACE_Event_Handler *> *> -#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Event_Handler *> *> -#pragma instantiate ACE_Timer_Node_Dispatch_Info_T<ACE_Event_Handler *> -#pragma instantiate ACE_Timer_Node_T<ACE_Event_Handler *> -#pragma instantiate ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - -#endif /* ACE_TIMER_QUEUE_C */ diff --git a/ace/Timer_Queue.h b/ace/Timer_Queue.h index e697ee9213a..36182f15f95 100644 --- a/ace/Timer_Queue.h +++ b/ace/Timer_Queue.h @@ -30,6 +30,8 @@ # include "ace/Null_Mutex.h" #endif /* ACE_HAS_THREADS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // The following typedef are here for ease of use and backward // compatibility. typedef ACE_Timer_Node_Dispatch_Info_T<ACE_Event_Handler *> @@ -43,6 +45,8 @@ typedef ACE_Timer_Queue_Iterator_T<ACE_Event_Handler *, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_Queue_Iterator; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TIMER_QUEUE_H */ diff --git a/ace/Timer_Queue_Adapters.cpp b/ace/Timer_Queue_Adapters.cpp index 13489a858a2..00f21d10ff3 100644 --- a/ace/Timer_Queue_Adapters.cpp +++ b/ace/Timer_Queue_Adapters.cpp @@ -1,14 +1,14 @@ // $Id$ +#ifndef ACE_TIMER_QUEUE_ADAPTERS_CPP +#define ACE_TIMER_QUEUE_ADAPTERS_CPP + #include "ace/Timer_Queue_Adapters.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#ifndef ACE_TIMER_QUEUE_ADAPTERS_CPP -#define ACE_TIMER_QUEUE_ADAPTERS_CPP - # if !defined (__ACE_INLINE__) # include "ace/Timer_Queue_Adapters.inl" # endif /* __ACE_INLINE__ */ @@ -16,6 +16,8 @@ #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_time.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TQ> TQ & ACE_Async_Timer_Queue_Adapter<TQ>::timer_queue (void) { @@ -256,11 +258,19 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::svc (void) { // Compute the remaining time, being careful not to sleep // for "negative" amounts of time. - ACE_Time_Value tv = this->timer_queue_->earliest_time (); - - // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting until %u.%3.3u secs\n"), - // tv.sec(), tv.msec())); - this->condition_.wait (&tv); + const ACE_Time_Value tv_curr = this->timer_queue_->gettimeofday (); + const ACE_Time_Value tv_earl = this->timer_queue_->earliest_time (); + + if (tv_earl > tv_curr) + { + // The earliest time on the Timer_Queue is in future, so + // use ACE_OS::gettimeofday() to convert the tv to the + // absolute time. + const ACE_Time_Value tv = ACE_OS::gettimeofday () + (tv_earl - tv_curr); + // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting until %u.%3.3u secs\n"), + // tv.sec(), tv.msec())); + this->condition_.wait (&tv); + } } // Expire timers anyway, at worst this is a no-op. @@ -290,6 +300,9 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::activate (long flags, // Macros to avoid "warning: unused parameter" type warning. ACE_UNUSED_ARG (thread_handles); + // Make sure to set this flag in case we were deactivated earlier. + this->active_ = 1; + // Make sure that we only allow a single thread to be spawned for // our adapter. Otherwise, too many weird things can happen. return ACE_Task_Base::activate (flags, 1, 0, priority, grp_id, task, 0, @@ -340,4 +353,6 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::dispatch_commands (void) # endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_TIMER_QUEUE_ADAPTERS_CPP */ diff --git a/ace/Timer_Queue_Adapters.h b/ace/Timer_Queue_Adapters.h index ed8d0cd8ecc..d2ff5946c3a 100644 --- a/ace/Timer_Queue_Adapters.h +++ b/ace/Timer_Queue_Adapters.h @@ -26,9 +26,13 @@ #if defined (ACE_HAS_DEFERRED_TIMER_COMMANDS) # include "ace/Unbounded_Queue.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Command_Base; +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_DEFERRED_TIMER_COMMANDS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Async_Timer_Queue_Adapter * @@ -46,7 +50,7 @@ public: /// Constructor /** * Register the SIGALRM handler. If @a mask == 0 then block all - * signals when <SIGALRM> is run. Otherwise, just block the signals + * signals when @c SIGALRM is run. Otherwise, just block the signals * indicated in @a mask. */ ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask = 0); @@ -67,7 +71,7 @@ public: /// passed in. int cancel (long timer_id, const void **act = 0); - /// Dispatch all timers whose values are <= <cur_time>. Returns the + /// Dispatch all timers whose values are <= cur_time. Returns the /// number of timers canceled. int expire (void); @@ -230,6 +234,8 @@ private: ACE_thread_t thr_id_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) # include "ace/Timer_Queue_Adapters.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Timer_Queue_Adapters.inl b/ace/Timer_Queue_Adapters.inl index 547c693dd13..e66168bbe98 100644 --- a/ace/Timer_Queue_Adapters.inl +++ b/ace/Timer_Queue_Adapters.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template<class TQ> ACE_INLINE TQ * ACE_Thread_Timer_Queue_Adapter<TQ>::timer_queue (void) const { @@ -22,3 +25,5 @@ ACE_Thread_Timer_Queue_Adapter<TQ>::thr_id (void) const { return this->thr_id_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp index 4c125cfabcd..82030315aab 100644 --- a/ace/Timer_Queue_T.cpp +++ b/ace/Timer_Queue_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_TIMER_QUEUE_T_C -#define ACE_TIMER_QUEUE_T_C +#ifndef ACE_TIMER_QUEUE_T_CPP +#define ACE_TIMER_QUEUE_T_CPP #include "ace/config-all.h" @@ -20,10 +20,7 @@ #include "ace/Timer_Queue_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID (ace, - Timer_Queue_T, - "$Id$") - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // This fudge factor can be overriden for timers that need it, such as on // Solaris, by defining the ACE_TIMER_SKEW symbol in the appropriate config @@ -225,7 +222,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::schedule (const TYPE &type, ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, -1)); // Schedule the timer. - long result = + long const result = this->schedule_i (type, act, future_time, @@ -274,7 +271,7 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (const ACE_Time_Value &cur_ti this->postinvoke (info, cur_time, upcall_act); - number_of_timers_expired++; + ++number_of_timers_expired; } @@ -475,4 +472,6 @@ ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>::deletion (TIMER_QUEUE &timer_ return 0; } -#endif /* ACE_TIMER_QUEUE_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TIMER_QUEUE_T_CPP */ diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h index 50ed8ce99a8..604079a41da 100644 --- a/ace/Timer_Queue_T.h +++ b/ace/Timer_Queue_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -25,6 +25,8 @@ #include "ace/Event_Handler.h" #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Timer_Node_Dispatch_Info_T * @@ -162,7 +164,7 @@ private: * @class ACE_Timer_Queue_Iterator_T * * @brief Generic interface for iterating over a subclass of - * <ACE_Timer_Queue>. + * ACE_Timer_Queue. * * This is a generic iterator that can be used to visit every * node of a timer queue. Be aware that it isn't guaranteed @@ -378,7 +380,7 @@ public: /// Accessor to the upcall functor FUNCTOR &upcall_functor (void); - /// Returns a pointer to this <ACE_Timer_Queue>'s iterator. + /// Returns a pointer to this ACE_Timer_Queue's iterator. virtual ITERATOR &iter (void) = 0; /// Removes the earliest node from the queue and returns it @@ -429,8 +431,8 @@ protected: virtual int dispatch_info_i (const ACE_Time_Value ¤t_time, ACE_Timer_Node_Dispatch_Info_T<TYPE> &info); - /// Synchronization variable for <ACE_Timer_Queue>. - /// NOTE: the right name would be lock_, but HP/C++ will choke on that! + /// Synchronization variable for ACE_Timer_Queue. + /// @note The right name would be lock_, but HP/C++ will choke on that! ACE_LOCK mutex_; /// Class that implements a free list @@ -542,6 +544,8 @@ private: ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Timer_Queue_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Timer_Queue_T.inl b/ace/Timer_Queue_T.inl index 294433e8285..7275119e2e1 100644 --- a/ace/Timer_Queue_T.inl +++ b/ace/Timer_Queue_T.inl @@ -2,6 +2,7 @@ // // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL template <class TYPE> ACE_INLINE void ACE_Timer_Node_T<TYPE>::set (const TYPE &type, @@ -217,3 +218,5 @@ ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall_functor (void) { return *this->upcall_functor_; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Timer_Queuefwd.h b/ace/Timer_Queuefwd.h index 0f8ad0330c2..6e03204bdde 100644 --- a/ace/Timer_Queuefwd.h +++ b/ace/Timer_Queuefwd.h @@ -19,6 +19,8 @@ #include "ace/Synch_Traits.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Queue_T; template <class ACE_LOCK> class ACE_Event_Handler_Handle_Timeout_Upcall; @@ -29,6 +31,8 @@ typedef ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_Queue; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TIMER_QUEUE_FWD_H */ diff --git a/ace/Timer_Wheel.cpp b/ace/Timer_Wheel.cpp index 0675711f329..4bd16b73df4 100644 --- a/ace/Timer_Wheel.cpp +++ b/ace/Timer_Wheel.cpp @@ -1,8 +1,5 @@ // $Id$ -#if !defined (ACE_TIMER_WHEEL_C) -#define ACE_TIMER_WHEEL_C - #include "ace/Timer_Wheel.h" #include "ace/Synch_Traits.h" #include "ace/Recursive_Thread_Mutex.h" @@ -13,13 +10,3 @@ ACE_RCSID(ace, Timer_Wheel, "$Id$") -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Timer_Wheel_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -template class ACE_Timer_Wheel_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Timer_Wheel_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#pragma instantiate ACE_Timer_Wheel_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_SYNCH_RECURSIVE_MUTEX>, ACE_SYNCH_RECURSIVE_MUTEX> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ - - -#endif /* ACE_TIMER_WHEEL_C */ diff --git a/ace/Timer_Wheel.h b/ace/Timer_Wheel.h index cdd967bd9bd..307e56b5542 100644 --- a/ace/Timer_Wheel.h +++ b/ace/Timer_Wheel.h @@ -1,5 +1,4 @@ - -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,7 +21,9 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// The following typedef are here for ease of use and backward +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +// The following typedefs are here for ease of use and backward // compatibility. typedef ACE_Timer_Wheel_T<ACE_Event_Handler *, @@ -35,5 +36,7 @@ typedef ACE_Timer_Wheel_Iterator_T<ACE_Event_Handler *, ACE_SYNCH_RECURSIVE_MUTEX> ACE_Timer_Wheel_Iterator; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TIMER_WHEEL_H */ diff --git a/ace/Timer_Wheel_T.cpp b/ace/Timer_Wheel_T.cpp index f32b29b8853..149de55c520 100644 --- a/ace/Timer_Wheel_T.cpp +++ b/ace/Timer_Wheel_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_TIMER_WHEEL_T_C -#define ACE_TIMER_WHEEL_T_C +#ifndef ACE_TIMER_WHEEL_T_CPP +#define ACE_TIMER_WHEEL_T_CPP #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -12,8 +12,7 @@ #include "ace/Timer_Wheel_T.h" #include "ace/Log_Msg.h" -ACE_RCSID(ace, Timer_Wheel_T, "$Id$") - +ACE_BEGIN_VERSIONED_NAMESPACE_DECL // Design/implementation notes for ACE_Timer_Wheel_T. // @@ -941,7 +940,6 @@ ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::goto_next (u_int start_spok this->current_node_ = 0; } - /** * @return True when we there aren't any more items (when current_node_ == 0) */ @@ -951,7 +949,6 @@ ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::isdone (void) const return this->current_node_ == 0; } - /** * @return The node at the current spokeition in the sequence or 0 if the wheel * is empty @@ -962,5 +959,6 @@ ACE_Timer_Wheel_Iterator_T<TYPE, FUNCTOR, ACE_LOCK>::item (void) return this->current_node_; } +ACE_END_VERSIONED_NAMESPACE_DECL -#endif /* ACE_TIMER_WHEEL_T_C */ +#endif /* ACE_TIMER_WHEEL_T_CPP */ diff --git a/ace/Timer_Wheel_T.h b/ace/Timer_Wheel_T.h index 10bb65badd8..5c62a39dde0 100644 --- a/ace/Timer_Wheel_T.h +++ b/ace/Timer_Wheel_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -20,6 +20,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration template <class TYPE, class FUNCTOR, class ACE_LOCK> class ACE_Timer_Wheel_T; @@ -204,13 +206,14 @@ private: /// The total number of timers currently scheduled. u_int timer_count_; - // = Don't allow these operations for now. - ACE_UNIMPLEMENTED_FUNC ( - ACE_Timer_Wheel_T (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &)) - ACE_UNIMPLEMENTED_FUNC ( - void operator= (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &)) + // = Don't allow these operations for now, don't split into multiple lines + // breaks sun compilers + ACE_UNIMPLEMENTED_FUNC (ACE_Timer_Wheel_T (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &)) + ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Timer_Wheel_T<TYPE, FUNCTOR, ACE_LOCK> &)) }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #if !defined (ACE_HAS_BROKEN_HPUX_TEMPLATES) #include "ace/Timer_Wheel_T.cpp" diff --git a/ace/TkReactor.cpp b/ace/TkReactor.cpp index 5fb8b56db71..7f6ae69e320 100644 --- a/ace/TkReactor.cpp +++ b/ace/TkReactor.cpp @@ -5,12 +5,14 @@ ACE_RCSID(ace, TkReactor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_TkReactor) // Must be called with lock held ACE_TkReactor::ACE_TkReactor (size_t size, - int restart, - ACE_Sig_Handler *h) + int restart, + ACE_Sig_Handler *h) : ACE_Select_Reactor (size, restart, h), ids_ (0), timeout_ (0) @@ -49,7 +51,7 @@ ACE_TkReactor::~ACE_TkReactor (void) int ACE_TkReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, - ACE_Time_Value *max_wait_time) + ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_TkReactor::wait_for_multiple_events"); int nfound; @@ -63,8 +65,8 @@ ACE_TkReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_s handle_set.wr_mask_ = this->wait_set_.wr_mask_; handle_set.ex_mask_ = this->wait_set_.ex_mask_; nfound = TkWaitForMultipleEvents (width, - handle_set, - max_wait_time); + handle_set, + max_wait_time); } while (nfound == -1 && this->handle_error () > 0); @@ -101,7 +103,7 @@ ACE_TkReactor::TimerCallbackProc (ClientData cd) */ void ACE_TkReactor::InputCallbackProc (ClientData cd, - int /* mask */) + int /* mask */) { ACE_TkReactor_Input_Callback *callback = (ACE_TkReactor_Input_Callback *) cd; ACE_TkReactor *self = callback->reactor_; @@ -123,9 +125,9 @@ ACE_TkReactor::InputCallbackProc (ClientData cd, wait_set.ex_mask_.set_bit (handle); int result = ACE_OS::select (handle + 1, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, &zero); + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, &zero); ACE_Select_Reactor_Handle_Set dispatch_set; @@ -133,11 +135,11 @@ ACE_TkReactor::InputCallbackProc (ClientData cd, if (result > 0) { if (wait_set.rd_mask_.is_set (handle)) - dispatch_set.rd_mask_.set_bit (handle); + dispatch_set.rd_mask_.set_bit (handle); if (wait_set.wr_mask_.is_set (handle)) - dispatch_set.wr_mask_.set_bit (handle); + dispatch_set.wr_mask_.set_bit (handle); if (wait_set.ex_mask_.is_set (handle)) - dispatch_set.ex_mask_.set_bit (handle); + dispatch_set.ex_mask_.set_bit (handle); self->dispatch (1, dispatch_set); } @@ -145,17 +147,17 @@ ACE_TkReactor::InputCallbackProc (ClientData cd, int ACE_TkReactor::TkWaitForMultipleEvents (int width, - ACE_Select_Reactor_Handle_Set &wait_set, - ACE_Time_Value *) + ACE_Select_Reactor_Handle_Set &wait_set, + ACE_Time_Value *) { // Check to make sure our handle's are all usable. ACE_Select_Reactor_Handle_Set temp_set = wait_set; if (ACE_OS::select (width, - temp_set.rd_mask_, - temp_set.wr_mask_, - temp_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + temp_set.rd_mask_, + temp_set.wr_mask_, + temp_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) return -1; // Bad file arguments... // Instead of waiting using <select>, just use the Tk mechanism to @@ -170,16 +172,16 @@ ACE_TkReactor::TkWaitForMultipleEvents (int width, // Now actually read the result needed by the <Select_Reactor> using // <select>. return ACE_OS::select (width, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero); + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero); } int ACE_TkReactor::register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_TkReactor::register_handler_i"); @@ -267,8 +269,8 @@ ACE_TkReactor::register_handler_i (ACE_HANDLE handle, int ACE_TkReactor::register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) { return ACE_Select_Reactor::register_handler_i (handles, handler, @@ -277,7 +279,7 @@ ACE_TkReactor::register_handler_i (const ACE_Handle_Set &handles, int ACE_TkReactor::remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_TkReactor::remove_handler_i"); @@ -332,10 +334,10 @@ ACE_TkReactor::remove_TkFileHandler (ACE_HANDLE handle) int ACE_TkReactor::remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { return ACE_Select_Reactor::remove_handler_i (handles, - mask); + mask); } // The following functions ensure that there is an Tk timeout for the @@ -380,9 +382,9 @@ ACE_TkReactor::reset_timer_interval long ACE_TkReactor::schedule_timer (ACE_Event_Handler *event_handler, - const void *arg, + const void *arg, const ACE_Time_Value &delay, - const ACE_Time_Value &interval) + const ACE_Time_Value &interval) { ACE_TRACE ("ACE_TkReactor::schedule_timer"); ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); @@ -402,12 +404,12 @@ ACE_TkReactor::schedule_timer (ACE_Event_Handler *event_handler, int ACE_TkReactor::cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close) + int dont_call_handle_close) { ACE_TRACE ("ACE_TkReactor::cancel_timer"); if (ACE_Select_Reactor::cancel_timer (handler, - dont_call_handle_close) == -1) + dont_call_handle_close) == -1) return -1; else { @@ -418,14 +420,14 @@ ACE_TkReactor::cancel_timer (ACE_Event_Handler *handler, int ACE_TkReactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) + const void **arg, + int dont_call_handle_close) { ACE_TRACE ("ACE_TkReactor::cancel_timer"); if (ACE_Select_Reactor::cancel_timer (timer_id, - arg, - dont_call_handle_close) == -1) + arg, + dont_call_handle_close) == -1) return -1; else { @@ -434,3 +436,4 @@ ACE_TkReactor::cancel_timer (long timer_id, } } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/TkReactor.h b/ace/TkReactor.h index 024d341b937..0ae370c0687 100644 --- a/ace/TkReactor.h +++ b/ace/TkReactor.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file TkReactor.h @@ -24,6 +25,8 @@ #include "ace/Select_Reactor.h" #include /**/ <tk.h> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_TkReactorID * @@ -127,5 +130,7 @@ private: ACE_TkReactor &operator = (const ACE_TkReactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TK_REACTOR_H */ diff --git a/ace/Token.cpp b/ace/Token.cpp index d67e51e5bcb..1d4a3b3fe9d 100644 --- a/ace/Token.cpp +++ b/ace/Token.cpp @@ -1,7 +1,16 @@ // $Id$ -#include "ace/Thread.h" #include "ace/Token.h" + +#if !defined (__ACE_INLINE__) +#include "ace/Token.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Token, "$Id$") + +#if defined (ACE_HAS_THREADS) + +#include "ace/Thread.h" #include "ace/Log_Msg.h" #if defined (DEBUGGING) @@ -9,17 +18,10 @@ #include "ace/streams.h" #endif /* DEBUGGING */ -ACE_RCSID(ace, Token, "$Id$") - -#if !defined (__ACE_INLINE__) -#include "ace/Token.inl" -#endif /* __ACE_INLINE__ */ - -#if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Token) - void ACE_Token::dump (void) const { @@ -209,7 +211,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), // Check if it is us. if (ACE_OS::thr_equal (thr_id, this->owner_)) { - this->nesting_level_++; + ++this->nesting_level_; return 0; } @@ -235,7 +237,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), thr_id, this->attributes_); queue->insert_entry (my_entry, this->queueing_strategy_); - this->waiters_++; + ++this->waiters_; // Execute appropriate <sleep_hook> callback. (@@ should these // methods return a success/failure status, and if so, what should @@ -244,13 +246,13 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), if (sleep_hook_func) { (*sleep_hook_func) (arg); - ret++; + ++ret; } else { // Execute virtual method. this->sleep_hook (); - ret++; + ++ret; } int timed_out = 0; @@ -290,7 +292,7 @@ ACE_Token::shared_acquire (void (*sleep_hook_func)(void *), while (!ACE_OS::thr_equal (thr_id, this->owner_)); // Do this always and irrespective of the result of wait(). - this->waiters_--; + --this->waiters_; queue->remove_entry (&my_entry); #if defined (DEBUGGING) @@ -390,10 +392,10 @@ ACE_Token::renew (int requeue_position, // otherwise use the queueing strategy, which might also // happen to be 0. requeue_position == 0 ? 0 : this->queueing_strategy_); - this->waiters_++; + ++this->waiters_; // Remember nesting level... - int save_nesting_level_ = this->nesting_level_; + int const save_nesting_level_ = this->nesting_level_; // Reset state for new owner. this->nesting_level_ = 0; @@ -438,7 +440,7 @@ ACE_Token::renew (int requeue_position, while (!ACE_OS::thr_equal (my_entry.thread_id_, this->owner_)); // Do this always and irrespective of the result of wait(). - this->waiters_--; + --this->waiters_; this_threads_queue->remove_entry (&my_entry); #if defined (DEBUGGING) @@ -523,7 +525,7 @@ ACE_Token::wakeup_next_waiter (void) } // Wakeup next waiter. - ACE_Token_Queue *queue; + ACE_Token_Queue *queue = 0; // Writer threads get priority to run first. if (this->writers_.head_ != 0) @@ -544,8 +546,6 @@ ACE_Token::wakeup_next_waiter (void) this->owner_ = queue->head_->thread_id_; } -#endif /* ACE_HAS_THREADS */ +ACE_END_VERSIONED_NAMESPACE_DECL -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* ACE_HAS_THREADS */ diff --git a/ace/Token.h b/ace/Token.h index 0295133e542..f351bcab979 100644 --- a/ace/Token.h +++ b/ace/Token.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -34,14 +34,15 @@ # define ACE_TOKEN_USES_SEMAPHORE #endif /* (ACE_WIN32 && !ACE_HAS_WINCE) || VXWORKS || ACE_PSOS */ -class ACE_Time_Value; - #if defined (ACE_TOKEN_USES_SEMAPHORE) # include "ace/Semaphore.h" #endif /* ACE_TOKEN_USES_SEMAPHORE */ #include "ace/Condition_Thread_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +class ACE_Time_Value; /** * @class ACE_Token @@ -316,7 +317,12 @@ private: int queueing_strategy_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #else + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Token { public: @@ -327,8 +333,13 @@ public: int remove (void) { ACE_NOTSUP_RETURN (-1); } int release (void) { ACE_NOTSUP_RETURN (-1); } }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Export ACE_Noop_Token : public ACE_Null_Mutex { public: @@ -354,6 +365,8 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Token.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Token.inl b/ace/Token.inl index 5cea9866cea..d375789fbd1 100644 --- a/ace/Token.inl +++ b/ace/Token.inl @@ -1,14 +1,16 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -#include "ace/Guard_T.h" - -// Token.i +#include "ace/config-macros.h" #if defined (ACE_HAS_THREADS) +#include "ace/Guard_T.h" #include "ace/Time_Value.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_Token::queueing_strategy (void) { @@ -29,25 +31,25 @@ ACE_Token::remove (void) ACE_NOTSUP_RETURN (-1); } -ACE_INLINE int +ACE_INLINE int ACE_Token::tryacquire (void) { ACE_TRACE ("ACE_Token::tryacquire"); - return this->shared_acquire + return this->shared_acquire (0, 0, (ACE_Time_Value *) &ACE_Time_Value::zero, ACE_Token::WRITE_TOKEN); } -ACE_INLINE int +ACE_INLINE int ACE_Token::waiters (void) { ACE_TRACE ("ACE_Token::waiters"); ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1); - int ret = this->waiters_; + int const ret = this->waiters_; return ret; } -ACE_INLINE ACE_thread_t +ACE_INLINE ACE_thread_t ACE_Token::current_owner (void) { ACE_TRACE ("ACE_Token::current_owner"); @@ -118,9 +120,9 @@ ACE_Token::ACE_Token_Queue_Entry::wait (ACE_Time_Value *timeout, ACE_Thread_Mute { #if defined (ACE_TOKEN_USES_SEMAPHORE) lock.release (); - int retv = (timeout == 0 ? - this->cv_.acquire () : - this->cv_.acquire (*timeout)); + int const retv = (timeout == 0 ? + this->cv_.acquire () : + this->cv_.acquire (*timeout)); lock.acquire (); return retv; #else @@ -132,7 +134,7 @@ ACE_Token::ACE_Token_Queue_Entry::wait (ACE_Time_Value *timeout, ACE_Thread_Mute ACE_INLINE int ACE_Token::ACE_Token_Queue_Entry::signal (void) { - return + return #if defined (ACE_TOKEN_USES_SEMAPHORE) this->cv_.release (); #else @@ -140,8 +142,13 @@ ACE_Token::ACE_Token_Queue_Entry::signal (void) #endif /* ACE_TOKEN_USES_SEMAPHORE */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ -/******************************************************************************/ + +/*****************************************************************************/ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_Noop_Token::queueing_strategy (void) @@ -164,3 +171,6 @@ ACE_INLINE void ACE_Noop_Token::dump (void) const { } + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/ace/Token_Collection.cpp b/ace/Token_Collection.cpp index 5287cd6208a..7356844165e 100644 --- a/ace/Token_Collection.cpp +++ b/ace/Token_Collection.cpp @@ -1,19 +1,20 @@ #include "ace/Token_Collection.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + #if !defined (__ACE_INLINE__) #include "ace/Token_Collection.inl" #endif /* __ACE_INLINE__ */ -#if defined (ACE_HAS_TOKENS_LIBRARY) - ACE_RCSID (ace, Token_Collection, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Token_Collection::ACE_Token_Collection (int debug, - const ACE_TCHAR *name) + const ACE_TCHAR *name) : debug_ (debug) { ACE_TRACE ("ACE_Token_Collection::ACE_Token_Collection"); @@ -74,8 +75,8 @@ ACE_Token_Collection::is_member (const ACE_Token_Proxy &token) int ACE_Token_Collection::acquire (int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) + void (*sleep_hook)(void *), + ACE_Synch_Options &options) { ACE_TRACE ("ACE_Token_Collection::acquire"); @@ -86,18 +87,18 @@ ACE_Token_Collection::acquire (int notify, iterator.advance ()) { if (debug_) - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection acquiring %s\n"), - temp->int_id_->name ())); + temp->int_id_->name ())); if (temp->int_id_->acquire (notify, sleep_hook, options) == -1) - { + { // Save/restore errno. ACE_Errno_Guard error (errno); - this->release (); - ACE_RETURN (-1); - } + this->release (); + ACE_RETURN (-1); + } } return 0; @@ -105,9 +106,9 @@ ACE_Token_Collection::acquire (int notify, int ACE_Token_Collection::acquire (const ACE_TCHAR *token_name, - int notify, - void (*sleep_hook)(void *), - ACE_Synch_Options &options) + int notify, + void (*sleep_hook)(void *), + ACE_Synch_Options &options) { ACE_TRACE ("ACE_Token_Collection::acquire"); TOKEN_NAME name (token_name); @@ -124,7 +125,7 @@ ACE_Token_Collection::acquire (const ACE_TCHAR *token_name, int ACE_Token_Collection::tryacquire (const ACE_TCHAR *token_name, - void (*sleep_hook)(void *)) + void (*sleep_hook)(void *)) { ACE_TRACE ("ACE_Token_Collection::tryacquire"); TOKEN_NAME name (token_name); @@ -151,11 +152,11 @@ ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *)) iterator.advance ()) { if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection acquiring %s\n"), - temp->int_id_->name ())); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection acquiring %s\n"), + temp->int_id_->name ())); // We will fail if _any_ token is not free. if (temp->int_id_->tryacquire (sleep_hook) == -1) - return -1; + return -1; } return 0; @@ -163,7 +164,7 @@ ACE_Token_Collection::tryacquire (void (*sleep_hook)(void *)) int ACE_Token_Collection::renew (int requeue_position, - ACE_Synch_Options &options) + ACE_Synch_Options &options) { ACE_TRACE ("ACE_Token_Collection::renew"); @@ -174,10 +175,10 @@ ACE_Token_Collection::renew (int requeue_position, iterator.advance ()) { if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection renewing %s\n"), - temp->int_id_->name ())); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection renewing %s\n"), + temp->int_id_->name ())); if (temp->int_id_->renew (requeue_position, options) == -1) - return -1; + return -1; } return 0; @@ -185,8 +186,8 @@ ACE_Token_Collection::renew (int requeue_position, int ACE_Token_Collection::renew (const ACE_TCHAR *token_name, - int requeue_position, - ACE_Synch_Options &options) + int requeue_position, + ACE_Synch_Options &options) { ACE_TRACE ("ACE_Token_Collection::renew"); TOKEN_NAME name (token_name); @@ -198,8 +199,8 @@ ACE_Token_Collection::renew (const ACE_TCHAR *token_name, // Did we find it? if (result == -1) ACE_ERROR_RETURN ((LM_DEBUG, ACE_LIB_TEXT ("%p %s\n"), - ACE_LIB_TEXT ("not in collection "), - token_name), -1); + ACE_LIB_TEXT ("not in collection "), + token_name), -1); // perform the operation return temp->renew (requeue_position, options); } @@ -216,8 +217,8 @@ ACE_Token_Collection::release (ACE_Synch_Options &) iterator.advance ()) { if (debug_) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection releasing %s\n"), - temp->int_id_->name ())); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("collection releasing %s\n"), + temp->int_id_->name ())); temp->int_id_->release (); } @@ -226,7 +227,7 @@ ACE_Token_Collection::release (ACE_Synch_Options &) int ACE_Token_Collection::release (const ACE_TCHAR *token_name, - ACE_Synch_Options &options) + ACE_Synch_Options &options) { ACE_TRACE ("ACE_Token_Collection::release"); TOKEN_NAME name (token_name); @@ -288,18 +289,6 @@ ACE_Token_Collection::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Map_Manager<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; -template class ACE_Map_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex>; -template class ACE_Map_Entry<ACE_Token_Name, ACE_Token_Proxy *>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Map_Manager<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Token_Proxy *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_Token_Proxy *> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Collection.h b/ace/Token_Collection.h index 1f42c8406cf..0d57cc0ca58 100644 --- a/ace/Token_Collection.h +++ b/ace/Token_Collection.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -35,6 +35,8 @@ #include "ace/Local_Tokens.h" #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Token_Collection * @@ -229,11 +231,13 @@ protected: virtual ACE_Tokens *create_token (const ACE_TCHAR *name); }; -#endif /* ACE_HAS_TOKENS_LIBRARY */ +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Token_Collection.inl" #endif /* __ACE_INLINE__ */ +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #include /**/ "ace/post.h" #endif /* ACE_TOKEN_COLLECTION_H */ diff --git a/ace/Token_Collection.inl b/ace/Token_Collection.inl index fcab4df9b09..db86701a325 100644 --- a/ace/Token_Collection.inl +++ b/ace/Token_Collection.inl @@ -1,12 +1,17 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #if defined (ACE_HAS_TOKENS_LIBRARY) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE const ACE_TCHAR * ACE_Token_Collection::name (void) const { return name_; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Invariants.cpp b/ace/Token_Invariants.cpp index e59d28bd6ba..1c7ca9677d3 100644 --- a/ace/Token_Invariants.cpp +++ b/ace/Token_Invariants.cpp @@ -1,13 +1,14 @@ #include "ace/Token_Invariants.h" -#include "ace/Object_Manager.h" #if defined (ACE_HAS_TOKENS_LIBRARY) +#include "ace/Object_Manager.h" ACE_RCSID (ace, Token_Invariants, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_Token_Invariant_Manager *ACE_Token_Invariant_Manager::instance_ = 0; @@ -349,28 +350,6 @@ ACE_RWLock_Invariants::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Map_Manager<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Entry<ACE_Token_Name, ACE_Mutex_Invariants *>; -template class ACE_Map_Manager<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex>; -template class ACE_Map_Entry<ACE_Token_Name, ACE_RWLock_Invariants *>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Map_Manager<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Mutex_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_Mutex_Invariants *> -#pragma instantiate ACE_Map_Manager<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_RWLock_Invariants *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Entry<ACE_Token_Name, ACE_RWLock_Invariants *> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Invariants.h b/ace/Token_Invariants.h index c5b4fb42ffc..6816d209ab3 100644 --- a/ace/Token_Invariants.h +++ b/ace/Token_Invariants.h @@ -32,6 +32,7 @@ #include "ace/Local_Tokens.h" #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_Mutex_Invariants @@ -236,6 +237,8 @@ protected: static ACE_Token_Invariant_Manager *instance_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ #include /**/ "ace/post.h" diff --git a/ace/Token_Manager.cpp b/ace/Token_Manager.cpp index 24d79871448..a68ac717ebf 100644 --- a/ace/Token_Manager.cpp +++ b/ace/Token_Manager.cpp @@ -1,16 +1,19 @@ #include "ace/Token_Manager.h" + +#if defined (ACE_HAS_TOKENS_LIBRARY) + #include "ace/Object_Manager.h" #if !defined (__ACE_INLINE__) #include "ace/Token_Manager.inl" #endif /* __ACE_INLINE__ */ -#if defined (ACE_HAS_TOKENS_LIBRARY) - ACE_RCSID (ace, Token_Manager, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // singleton token manager ACE_Token_Manager *ACE_Token_Manager::token_manager_ = 0; @@ -265,18 +268,6 @@ ACE_Token_Manager::dump (void) const #endif /* ACE_HAS_DUMP */ } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Map_Manager <ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; -template class ACE_Map_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex>; -template class ACE_Map_Entry <ACE_Token_Name, ACE_Tokens *>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Map_Manager <ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_Token_Name, ACE_Tokens *, ACE_Null_Mutex> -#pragma instantiate ACE_Map_Entry <ACE_Token_Name, ACE_Tokens *> -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Manager.h b/ace/Token_Manager.h index c19b625116e..63c78712203 100644 --- a/ace/Token_Manager.h +++ b/ace/Token_Manager.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -27,6 +27,8 @@ #include "ace/Null_Mutex.h" #include "ace/Map_Manager.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Local_Mutex; class ACE_Mutex_Token; @@ -136,11 +138,13 @@ private: COLLECTION collection_; }; -#endif /* ACE_HAS_TOKENS_LIBRARY */ +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Token_Manager.inl" #endif /* __ACE_INLINE__ */ +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #include /**/ "ace/post.h" #endif /* ACE_TOKEN_MANAGER_H */ diff --git a/ace/Token_Manager.inl b/ace/Token_Manager.inl index 2ef2d7e1f53..b38c4b9e346 100644 --- a/ace/Token_Manager.inl +++ b/ace/Token_Manager.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #if defined (ACE_HAS_TOKENS_LIBRARY) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_TOKEN_CONST::MUTEX & ACE_Token_Manager::mutex (void) { @@ -17,4 +20,6 @@ ACE_Token_Manager::debug (int d) debug_ = d; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Request_Reply.cpp b/ace/Token_Request_Reply.cpp index 01ee4fb305d..802cbc5f697 100644 --- a/ace/Token_Request_Reply.cpp +++ b/ace/Token_Request_Reply.cpp @@ -2,14 +2,16 @@ #include "ace/Token_Request_Reply.h" +#if defined (ACE_HAS_TOKENS_LIBRARY) + #if !defined (__ACE_INLINE__) #include "ace/Token_Request_Reply.inl" #endif /* __ACE_INLINE__ */ -#if defined (ACE_HAS_TOKENS_LIBRARY) - ACE_RCSID(ace, Token_Request_Reply, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Default "do nothing" constructor. ACE_Token_Request::ACE_Token_Request (void) @@ -21,11 +23,11 @@ ACE_Token_Request::ACE_Token_Request (void) // Create a ACE_Token_Request message. ACE_Token_Request::ACE_Token_Request (int token_type, - int proxy_type, - ACE_UINT32 operation_type, - const ACE_TCHAR token_name[], - const ACE_TCHAR client_id[], - const ACE_Synch_Options &options) + int proxy_type, + ACE_UINT32 operation_type, + const ACE_TCHAR token_name[], + const ACE_TCHAR client_id[], + const ACE_Synch_Options &options) { this->token_type (token_type); this->proxy_type (proxy_type); @@ -57,11 +59,11 @@ ACE_Token_Request::decode (void) this->token_name_ = this->transfer_.data_; options_.set (transfer_.use_timeout_ == 1 ? ACE_Synch_Options::USE_TIMEOUT : 0, - ACE_Time_Value (transfer_.sec_, transfer_.usec_), - (void *) transfer_.arg_); + ACE_Time_Value (transfer_.sec_, transfer_.usec_), + (void *) transfer_.arg_); // Decode the variable-sized portion. - int token_len = ACE_OS::strlen (this->token_name_); + size_t token_len = ACE_OS::strlen (this->token_name_); // Check to make sure this->tokenName_ isn't too long! if (token_len >= ACE_MAXTOKENNAMELEN) @@ -79,8 +81,8 @@ ACE_Token_Request::decode (void) // client_id_ plus '\0' size_t data_size = ACE_TOKEN_REQUEST_HEADER_SIZE + ACE_OS::strlen (this->token_name_) + 1 - + ACE_OS::strlen (this->client_id_) + 1 - + 1; + + ACE_OS::strlen (this->client_id_) + 1 + + 1; // Make sure the message was correctly received and framed. return this->length () == data_size ? 0 : -1; @@ -94,7 +96,7 @@ ACE_Token_Request::dump (void) const #if defined (ACE_HAS_DUMP) ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\ntoken name = %s\nclient id = %s\n"), - this->length (), this->token_name (), this->client_id ())); + this->length (), this->token_name (), this->client_id ())); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("type = "))); if (this->token_type () == ACE_Tokens::MUTEX) @@ -102,9 +104,9 @@ ACE_Token_Request::dump (void) const else // == ACE_Tokens::RWLOCK { if (this->proxy_type () == ACE_RW_Token::READER) - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RLOCK\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("RLOCK\n"))); else // == WRITER - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("WLOCK\n"))); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("WLOCK\n"))); } ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("operation = "))); @@ -129,7 +131,7 @@ ACE_Token_Request::dump (void) const else { ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("waiting for %d secs and %d usecs\n"), - this->options ().timeout ().sec (), this->options ().timeout ().usec ())); + this->options ().timeout ().sec (), this->options ().timeout ().usec ())); } ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); #endif /* ACE_HAS_DUMP */ @@ -174,9 +176,11 @@ ACE_Token_Reply::dump (void) const { #if defined (ACE_HAS_DUMP) ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("*******\nlength = %d\nerrnum = %d"), - this->length (), this->errnum ())); + this->length (), this->errnum ())); ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("arg = %d"), this->arg ())); #endif /* ACE_HAS_DUMP */ } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Token_Request_Reply.h b/ace/Token_Request_Reply.h index 86f516a0203..15dea490bc7 100644 --- a/ace/Token_Request_Reply.h +++ b/ace/Token_Request_Reply.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -28,6 +28,8 @@ #if defined (ACE_HAS_TOKENS_LIBRARY) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /// Specifies the size of the fixed length portion of /// the Transfer structure in ACE_Token_Request #define ACE_TOKEN_REQUEST_HEADER_SIZE 40 @@ -62,12 +64,12 @@ public: ACE_Token_Request (void); /** - * token_type - MUTEX, RWLOCK - * proxy_type - MUTEX, RLOCK, WLOCK (acquires mean different things) - * operation - method - * token_name - * client_id - * options - we check USE_TIMEOUT and use the arg. + * @param token_type MUTEX, RWLOCK + * @param proxy_type MUTEX, RLOCK, WLOCK (acquires mean different things) + * @param operation method + * @param token_name + * @param client_id + * @param options We check USE_TIMEOUT and use the arg. */ ACE_Token_Request (int token_type, int proxy_type, @@ -256,11 +258,13 @@ private: } transfer_; }; -#endif /* ACE_HAS_TOKENS_LIBRARY */ +ACE_END_VERSIONED_NAMESPACE_DECL #if defined (__ACE_INLINE__) #include "ace/Token_Request_Reply.inl" #endif /* __ACE_INLINE__ */ +#endif /* ACE_HAS_TOKENS_LIBRARY */ + #include /**/ "ace/post.h" #endif /* ACE_TOKEN_REQUEST_REPLY_H */ diff --git a/ace/Token_Request_Reply.inl b/ace/Token_Request_Reply.inl index e1c8ace3ad5..34cfdd87f28 100644 --- a/ace/Token_Request_Reply.inl +++ b/ace/Token_Request_Reply.inl @@ -1,8 +1,13 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #if defined (ACE_HAS_TOKENS_LIBRARY) +#include "ace/Truncate.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // = Set/get the length of the encoded/decoded message. ACE_INLINE ACE_UINT32 @@ -11,7 +16,7 @@ ACE_Token_Request::length (void) const return ntohl (this->transfer_.length_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Request::length (ACE_UINT32 l) { this->transfer_.length_ = htonl (l); @@ -24,7 +29,7 @@ ACE_Token_Request::token_type (void) const return (int) ntohl (this->transfer_.token_type_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Request::token_type (int t) { this->transfer_.token_type_ = htonl ((ACE_UINT32) t); @@ -50,33 +55,33 @@ ACE_Token_Request::operation_type (void) const return ntohl (this->transfer_.operation_type_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Request::operation_type (ACE_UINT32 t) { this->transfer_.operation_type_ = htonl (t); } // = Set/get the requeue position -ACE_INLINE ACE_UINT32 +ACE_INLINE ACE_UINT32 ACE_Token_Request::requeue_position (void) const { return ntohl (this->transfer_.requeue_position_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Request::requeue_position (ACE_UINT32 rq) { this->transfer_.requeue_position_ = htonl (rq); } // = Set/get the requeue position -ACE_INLINE ACE_UINT32 +ACE_INLINE ACE_UINT32 ACE_Token_Request::notify (void) const { return ntohl (this->transfer_.notify_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Request::notify (ACE_UINT32 rq) { this->transfer_.notify_ = htonl (rq); @@ -89,7 +94,7 @@ ACE_Token_Request::options (void) const return (ACE_Synch_Options &) options_; } -ACE_INLINE void +ACE_INLINE void ACE_Token_Request::options (const ACE_Synch_Options &opt) { // fight the friggin const from hell @@ -99,7 +104,10 @@ ACE_Token_Request::options (const ACE_Synch_Options &opt) if (transfer_.use_timeout_ == 1) { transfer_.usec_ = options->timeout ().usec (); - transfer_.sec_ = options->timeout ().sec (); + if (options->timeout ().sec () > ACE_UINT32_MAX) + transfer_.sec_ = ACE_UINT32_MAX; + else + transfer_.sec_ = static_cast<ACE_UINT32> (options->timeout ().sec ()); } else { @@ -115,8 +123,8 @@ ACE_Token_Request::token_name (void) const return token_name_; } -ACE_INLINE void -ACE_Token_Request::token_name (const ACE_TCHAR *token_name, +ACE_INLINE void +ACE_Token_Request::token_name (const ACE_TCHAR *token_name, const ACE_TCHAR *client_id) { size_t token_name_length = ACE_OS::strlen (token_name) + 1; // Add 1 for '\0'. @@ -127,20 +135,20 @@ ACE_Token_Request::token_name (const ACE_TCHAR *token_name, client_id_ = &this->token_name_[token_name_length + 1]; // Add 1 for ':'; client_id_[-1] = ACE_LIB_TEXT (':'); // Insert the ':' before this->clientId_. - (void) ACE_OS::memcpy (this->token_name_, - token_name, + (void) ACE_OS::memcpy (this->token_name_, + token_name, token_name_length * sizeof (ACE_TCHAR)); - (void) ACE_OS::memcpy (this->client_id_, - client_id, + (void) ACE_OS::memcpy (this->client_id_, + client_id, client_id_length * sizeof (ACE_TCHAR)); // Fixed length header size size_t len = ACE_TOKEN_REQUEST_HEADER_SIZE; - // ... then add in the amount of the variable-sized portion. + // ... then add in the amount of the variable-sized portion. len += token_name_length + client_id_length + 1; - this->length (len); + this->length (ACE_Utils::Truncate (len)); } // = Set/get the id of the client. @@ -155,42 +163,44 @@ ACE_Token_Request::client_id (void) const // ************************************************************ // = Set/get the length of the encoded/decoded message. -ACE_INLINE ACE_UINT32 +ACE_INLINE ACE_UINT32 ACE_Token_Reply::length (void) const { return ntohl (this->transfer_.length_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Reply::length (ACE_UINT32 l) { this->transfer_.length_ = htonl (l); } // = Set/get the errno of a failed reply. -ACE_INLINE ACE_UINT32 +ACE_INLINE ACE_UINT32 ACE_Token_Reply::errnum (void) const { return ntohl (this->transfer_.errno_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Reply::errnum (ACE_UINT32 e) { this->transfer_.errno_ = htonl (e); } // = Set/get the length of the encoded/decoded message. -ACE_INLINE ACE_UINT32 +ACE_INLINE ACE_UINT32 ACE_Token_Reply::arg (void) const { return ntohl (this->transfer_.arg_); } -ACE_INLINE void +ACE_INLINE void ACE_Token_Reply::arg (ACE_UINT32 arg) { this->transfer_.arg_ = htonl (arg); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_TOKENS_LIBRARY */ diff --git a/ace/Trace.cpp b/ace/Trace.cpp index 5869f8bef45..63faa316d4e 100644 --- a/ace/Trace.cpp +++ b/ace/Trace.cpp @@ -16,6 +16,8 @@ ACE_RCSID (ace, #include "ace/Log_Msg.h" #include "ace/Object_Manager_Base.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // = Static initialization. // Keeps track of how far to indent per trace call. @@ -131,3 +133,5 @@ ACE_Trace::~ACE_Trace (void) } } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Trace.h b/ace/Trace.h index 67979f0287f..c473ee14014 100644 --- a/ace/Trace.h +++ b/ace/Trace.h @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Trace * @@ -87,6 +89,8 @@ private: }; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" #endif /* ACE_TRACE_H */ diff --git a/ace/Typed_SV_Message.cpp b/ace/Typed_SV_Message.cpp index 3062952d2b4..79f931b77df 100644 --- a/ace/Typed_SV_Message.cpp +++ b/ace/Typed_SV_Message.cpp @@ -1,8 +1,8 @@ -// Typed_SV_Message.cpp // $Id$ -#ifndef ACE_TYPED_SV_MESSAGE_C -#define ACE_TYPED_SV_MESSAGE_C +#ifndef ACE_TYPED_SV_MESSAGE_CPP +#define ACE_TYPED_SV_MESSAGE_CPP + #include "ace/Typed_SV_Message.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -13,7 +13,7 @@ #include "ace/Typed_SV_Message.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Typed_SV_Message, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Typed_SV_Message) @@ -25,4 +25,6 @@ ACE_Typed_SV_Message<T>::dump (void) const #endif /* ACE_HAS_DUMP */ } -#endif /* ACE_TYPED_SV_MESSAGE_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TYPED_SV_MESSAGE_CPP */ diff --git a/ace/Typed_SV_Message.h b/ace/Typed_SV_Message.h index 178cdfb8340..e88ddd6bf00 100644 --- a/ace/Typed_SV_Message.h +++ b/ace/Typed_SV_Message.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Typed_SV_Message * @@ -86,6 +88,8 @@ private: T data_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Typed_SV_Message.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Typed_SV_Message.inl b/ace/Typed_SV_Message.inl index a2dde0af39e..00ff07109ac 100644 --- a/ace/Typed_SV_Message.inl +++ b/ace/Typed_SV_Message.inl @@ -1,13 +1,16 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/config-all.h" #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE -ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (long t, - int l, - int m) +ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (long t, + int l, + int m) : type_ (t) { ACE_TRACE ("ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message"); @@ -16,10 +19,10 @@ ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (long t, } template <class T> ACE_INLINE -ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (const T &d, - long t, - int l, - int m) +ACE_Typed_SV_Message<T>::ACE_Typed_SV_Message (const T &d, + long t, + int l, + int m) : type_ (t), data_ (d) { @@ -90,3 +93,4 @@ ACE_Typed_SV_Message<T>::data (const T &d) this->data_ = d; } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Typed_SV_Message_Queue.cpp b/ace/Typed_SV_Message_Queue.cpp index c1d6bb6de39..7fc2b0fd38d 100644 --- a/ace/Typed_SV_Message_Queue.cpp +++ b/ace/Typed_SV_Message_Queue.cpp @@ -1,8 +1,7 @@ -// Typed_SV_Message_Queue.cpp // $Id$ -#ifndef ACE_TYPED_SV_MESSAGE_QUEUE_C -#define ACE_TYPED_SV_MESSAGE_QUEUE_C +#ifndef ACE_TYPED_SV_MESSAGE_QUEUE_CPP +#define ACE_TYPED_SV_MESSAGE_QUEUE_CPP #include "ace/Typed_SV_Message.h" @@ -17,7 +16,7 @@ #include "ace/Typed_SV_Message_Queue.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Typed_SV_Message_Queue, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Typed_SV_Message_Queue) @@ -52,4 +51,6 @@ ACE_Typed_SV_Message_Queue<T>::~ACE_Typed_SV_Message_Queue (void) ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::~ACE_Typed_SV_Message_Queue"); } -#endif /* ACE_TYPED_SV_MESSAGE_QUEUE_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_TYPED_SV_MESSAGE_QUEUE_CPP */ diff --git a/ace/Typed_SV_Message_Queue.h b/ace/Typed_SV_Message_Queue.h index 6c486197450..f7c2c066654 100644 --- a/ace/Typed_SV_Message_Queue.h +++ b/ace/Typed_SV_Message_Queue.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,6 +22,8 @@ #include "ace/Typed_SV_Message.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_Typed_SV_Message_Queue * @@ -72,6 +74,8 @@ private: ACE_SV_Message_Queue message_queue_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Typed_SV_Message_Queue.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Typed_SV_Message_Queue.inl b/ace/Typed_SV_Message_Queue.inl index aad60fd2055..21ae9536501 100644 --- a/ace/Typed_SV_Message_Queue.inl +++ b/ace/Typed_SV_Message_Queue.inl @@ -1,14 +1,15 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// Typed_SV_Message_Queue.i - #include "ace/SV_Message_Queue.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE int ACE_Typed_SV_Message_Queue<T>::open (key_t external_id, - int create, - int perms) + int create, + int perms) { ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::open"); return this->message_queue_.open (external_id, create, perms); @@ -25,7 +26,7 @@ ACE_Typed_SV_Message_Queue<T>::close (void) template <class T> ACE_INLINE int ACE_Typed_SV_Message_Queue<T>::recv (ACE_Typed_SV_Message<T> &mb, - int mflags) + int mflags) { ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::recv"); @@ -42,7 +43,7 @@ ACE_Typed_SV_Message_Queue<T>::recv (ACE_Typed_SV_Message<T> &mb, template <class T> ACE_INLINE int ACE_Typed_SV_Message_Queue<T>::send (const ACE_Typed_SV_Message<T> &mb, - int mflags) + int mflags) { ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::send"); return @@ -63,7 +64,7 @@ ACE_Typed_SV_Message_Queue<T>::remove (void) template <class T> ACE_INLINE int ACE_Typed_SV_Message_Queue<T>::control (int option, - void *arg) + void *arg) { ACE_TRACE ("ACE_Typed_SV_Message_Queue<T>::control"); @@ -75,3 +76,5 @@ ACE_Typed_SV_Message_Queue<T>::get_id (void) const { return this->message_queue_.get_id (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UNIX_Addr.cpp b/ace/UNIX_Addr.cpp index 043c8872217..cb23ba91ef5 100644 --- a/ace/UNIX_Addr.cpp +++ b/ace/UNIX_Addr.cpp @@ -10,6 +10,8 @@ ACE_RCSID(ace, UNIX_Addr, "$Id$") #include "ace/UNIX_Addr.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_UNIX_Addr) // Set a pointer to the address. @@ -20,8 +22,8 @@ ACE_UNIX_Addr::set_addr (void *addr, int len) this->ACE_Addr::base_set (AF_UNIX, len); ACE_OS::memcpy ((void *) &this->unix_addr_, - (void *) addr, - len); + (void *) addr, + len); } // Return a pointer to the underlying address. @@ -107,7 +109,7 @@ int ACE_UNIX_Addr::set (const sockaddr_un *un, int len) { (void) ACE_OS::memset ((void *) &this->unix_addr_, 0, - sizeof this->unix_addr_); + sizeof this->unix_addr_); this->unix_addr_.sun_family = AF_UNIX; ACE_OS::strcpy (this->unix_addr_.sun_path, un->sun_path); this->base_set (AF_UNIX, len); @@ -123,17 +125,17 @@ int ACE_UNIX_Addr::set (const char rendezvous_point[]) { (void) ACE_OS::memset ((void *) &this->unix_addr_, - 0, - sizeof this->unix_addr_); + 0, + sizeof this->unix_addr_); this->unix_addr_.sun_family = AF_UNIX; - (void) ACE_OS::strsncpy (this->unix_addr_.sun_path, + (void) ACE_OS::strsncpy (this->unix_addr_.sun_path, rendezvous_point, sizeof this->unix_addr_.sun_path); this->ACE_Addr::base_set (AF_UNIX, - sizeof this->unix_addr_ - - sizeof (this->unix_addr_.sun_path) + - ACE_OS::strlen (this->unix_addr_.sun_path)); + sizeof this->unix_addr_ - + sizeof (this->unix_addr_.sun_path) + + ACE_OS::strlen (this->unix_addr_.sun_path)); return 0; } @@ -144,4 +146,6 @@ ACE_UNIX_Addr::ACE_UNIX_Addr (const char rendezvous_point[]) this->set (rendezvous_point); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/UNIX_Addr.h b/ace/UNIX_Addr.h index c1218888d13..eacabcf0d90 100644 --- a/ace/UNIX_Addr.h +++ b/ace/UNIX_Addr.h @@ -16,12 +16,7 @@ #include /**/ "ace/pre.h" -#ifdef ACE_SOCKETS_BUILD_DLL -# include "ace/ACE_Sockets_export.h" -#else -# include "ace/ACE_export.h" -# define ACE_Sockets_Export ACE_Export -#endif /* ACE_SOCKETS_BUILD_DLL */ +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -34,12 +29,14 @@ #include "ace/ACE.h" #include "ace/os_include/sys/os_un.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_UNIX_Addr * * @brief Defines the ``UNIX domain address family'' address format. */ -class ACE_Sockets_Export ACE_UNIX_Addr : public ACE_Addr +class ACE_Export ACE_UNIX_Addr : public ACE_Addr { public: // = Initialization methods. @@ -105,10 +102,14 @@ private: sockaddr_un unix_addr_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/UNIX_Addr.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ + #include /**/ "ace/post.h" + #endif /* ACE_UNIX_ADDR_H */ diff --git a/ace/UNIX_Addr.inl b/ace/UNIX_Addr.inl index 4a5da40940c..4e9e369d8f0 100644 --- a/ace/UNIX_Addr.inl +++ b/ace/UNIX_Addr.inl @@ -8,7 +8,8 @@ #if !defined (ACE_LACKS_UNIX_DOMAIN_SOCKETS) -/// Creates an ACE_UNIX_Addr from a string. +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_UNIX_Addr::ACE_UNIX_Addr (const wchar_t rendezvous_point[]) { @@ -28,8 +29,8 @@ ACE_INLINE bool ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const { return ACE_OS::strncmp (this->unix_addr_.sun_path, - sap.unix_addr_.sun_path, - sizeof this->unix_addr_.sun_path) == 0; + sap.unix_addr_.sun_path, + sizeof this->unix_addr_.sun_path) == 0; } // Compare two addresses for inequality. @@ -37,7 +38,7 @@ ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const ACE_INLINE bool ACE_UNIX_Addr::operator != (const ACE_UNIX_Addr &sap) const { - return !((*this) == sap); // This is lazy, of course... ;-) + return !((*this) == sap); // This is lazy, of course... ;-) } // Return the path name used for the rendezvous point. @@ -48,4 +49,6 @@ ACE_UNIX_Addr::get_path_name (void) const return this->unix_addr_.sun_path; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_LACKS_UNIX_DOMAIN_SOCKETS */ diff --git a/ace/UPIPE_Acceptor.cpp b/ace/UPIPE_Acceptor.cpp index c7fa930f284..4b106b4a4be 100644 --- a/ace/UPIPE_Acceptor.cpp +++ b/ace/UPIPE_Acceptor.cpp @@ -1,4 +1,3 @@ -// UPIPE_Acceptor.cpp // $Id$ #include "ace/UPIPE_Acceptor.h" @@ -13,6 +12,8 @@ ACE_RCSID(ace, UPIPE_Acceptor, "$Id$") #include "ace/UPIPE_Acceptor.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Acceptor) void @@ -40,7 +41,7 @@ ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor (void) int ACE_UPIPE_Acceptor::open (const ACE_UPIPE_Addr &local_addr, - int reuse_addr) + int reuse_addr) { ACE_TRACE ("ACE_UPIPE_Acceptor::open"); return this->ACE_SPIPE_Acceptor::open (local_addr, reuse_addr); @@ -56,7 +57,7 @@ ACE_UPIPE_Acceptor::close (void) // General purpose routine for accepting new connections. ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_addr, - int reuse_addr) + int reuse_addr) : mb_ (sizeof (ACE_UPIPE_Stream *)) { ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor"); @@ -69,9 +70,9 @@ ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_addr, int ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream, - ACE_UPIPE_Addr *remote_addr, - ACE_Time_Value *timeout, - int restart, + ACE_UPIPE_Addr *remote_addr, + ACE_Time_Value *timeout, + int restart, int reset_new_handle) { ACE_TRACE ("ACE_UPIPE_Acceptor::accept"); @@ -80,7 +81,7 @@ ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream, ACE_SPIPE_Stream new_io; if (this->ACE_SPIPE_Acceptor::accept (new_io, remote_addr, - timeout, restart) == -1) + timeout, restart) == -1) return -1; else { @@ -100,20 +101,20 @@ ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream, // ACE_UPIPE_Stream to our ACE_UPIPE_Stream. if (ACE_OS::read (new_stream.get_handle (), - (char *) &remote_stream, - sizeof remote_stream) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), - ACE_LIB_TEXT ("read stream address failed"))); + (char *) &remote_stream, + sizeof remote_stream) == -1) + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), + ACE_LIB_TEXT ("read stream address failed"))); else if (new_stream.stream_.link (remote_stream->stream_) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), - ACE_LIB_TEXT ("link streams failed"))); + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), + ACE_LIB_TEXT ("link streams failed"))); // Send a message over the new streampipe to confirm acceptance. else if (new_stream.send (&mb_, 0) == -1) - ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), - ACE_LIB_TEXT ("linked stream.put failed"))); + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"), + ACE_LIB_TEXT ("linked stream.put failed"))); // Close down the new_stream at this point in order to conserve // handles. Note that we don't need the SPIPE connection @@ -123,4 +124,6 @@ ACE_UPIPE_Acceptor::accept (ACE_UPIPE_Stream &new_stream, } } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/UPIPE_Acceptor.h b/ace/UPIPE_Acceptor.h index 0f51b3253bb..b7b94179cb6 100644 --- a/ace/UPIPE_Acceptor.h +++ b/ace/UPIPE_Acceptor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -22,10 +22,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#if defined (ACE_HAS_THREADS) + #include "ace/SPIPE_Acceptor.h" #include "ace/Thread_Manager.h" -#if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_UPIPE_Acceptor @@ -84,10 +86,14 @@ private: ACE_Message_Block mb_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/UPIPE_Acceptor.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_THREADS */ + #include /**/ "ace/post.h" + #endif /* ACE_UPIPE_ACCEPTOR_H */ diff --git a/ace/UPIPE_Acceptor.inl b/ace/UPIPE_Acceptor.inl index 0e28e250ab0..731d6be4a6c 100644 --- a/ace/UPIPE_Acceptor.inl +++ b/ace/UPIPE_Acceptor.inl @@ -1,9 +1,14 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE int ACE_UPIPE_Acceptor::remove (void) { ACE_TRACE ("ACE_UPIPE_Acceptor::remove"); return this->ACE_SPIPE_Acceptor::remove (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UPIPE_Addr.h b/ace/UPIPE_Addr.h index 2b4d3040527..75f948c6bf5 100644 --- a/ace/UPIPE_Addr.h +++ b/ace/UPIPE_Addr.h @@ -1,5 +1,4 @@ -/* -*- C++ -*- */ - +// -*- C++ -*- //============================================================================= /** @@ -14,6 +13,7 @@ #ifndef ACE_UPIPE_ADDR_H #define ACE_UPIPE_ADDR_H + #include /**/ "ace/pre.h" #include "ace/SPIPE_Addr.h" @@ -22,7 +22,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + typedef ACE_SPIPE_Addr ACE_UPIPE_Addr; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" + #endif /* ACE_UPIPE_ADDR_H */ diff --git a/ace/UPIPE_Connector.cpp b/ace/UPIPE_Connector.cpp index 455d982e993..ba0b4592d2f 100644 --- a/ace/UPIPE_Connector.cpp +++ b/ace/UPIPE_Connector.cpp @@ -1,4 +1,3 @@ -// UPIPE_Connector.cpp // $Id$ #include "ace/UPIPE_Connector.h" @@ -7,12 +6,16 @@ ACE_RCSID(ace, UPIPE_Connector, "$Id$") #if defined (ACE_HAS_THREADS) +#include "ace/Handle_Ops.h" #include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_stropts.h" #if !defined (__ACE_INLINE__) #include "ace/UPIPE_Connector.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Connector) void @@ -89,7 +92,10 @@ ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream, // connection anymore since we're linked via the Message_Queue // now. new_stream.ACE_SPIPE::close (); - return result; + return static_cast<int> (result); } } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_THREADS */ diff --git a/ace/UPIPE_Connector.h b/ace/UPIPE_Connector.h index b98ab643c92..c2778f82a11 100644 --- a/ace/UPIPE_Connector.h +++ b/ace/UPIPE_Connector.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,10 +21,10 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/SPIPE_Stream.h" - #if defined (ACE_HAS_THREADS) +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_UPIPE_Connector * @@ -102,10 +102,14 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/UPIPE_Connector.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_THREADS */ + #include /**/ "ace/post.h" + #endif /* ACE_UPIPE_CONNECTOR_H */ diff --git a/ace/UPIPE_Connector.inl b/ace/UPIPE_Connector.inl index 980d8a28164..b45134f1067 100644 --- a/ace/UPIPE_Connector.inl +++ b/ace/UPIPE_Connector.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Creates a Local ACE_UPIPE. ACE_INLINE ACE_UPIPE_Connector::ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream, @@ -13,7 +16,7 @@ ACE_UPIPE_Connector::ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream, { ACE_TRACE ("ACE_UPIPE_Connector::ACE_UPIPE_Connector"); if (this->connect (new_stream, addr, timeout, local_sap, - reuse_addr, flags, perms) == -1 + reuse_addr, flags, perms) == -1 && timeout != 0 && !(errno == EWOULDBLOCK || errno == ETIME)) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("address %s, %p\n"), @@ -22,9 +25,10 @@ ACE_UPIPE_Connector::ACE_UPIPE_Connector (ACE_UPIPE_Stream &new_stream, } ACE_INLINE int -ACE_UPIPE_Connector::reset_new_handle (ACE_HANDLE handle) +ACE_UPIPE_Connector::reset_new_handle (ACE_HANDLE /* handle */) { - ACE_UNUSED_ARG (handle); // Nothing to do here since the handle is not a socket return 0; } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UPIPE_Stream.cpp b/ace/UPIPE_Stream.cpp index 4df8d5fc547..53b170d23cd 100644 --- a/ace/UPIPE_Stream.cpp +++ b/ace/UPIPE_Stream.cpp @@ -1,17 +1,18 @@ -// UPIPE_Stream.cpp // $Id$ #include "ace/UPIPE_Stream.h" -#include "ace/OS_NS_string.h" ACE_RCSID(ace, UPIPE_Stream, "$Id$") #if defined (ACE_HAS_THREADS) +#include "ace/OS_NS_string.h" + #if !defined (__ACE_INLINE__) #include "ace/UPIPE_Stream.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_UPIPE_Stream) @@ -225,5 +226,6 @@ ACE_UPIPE_Stream::recv_n (char *buf, return bytes_read; } +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_HAS_THREADS */ diff --git a/ace/UPIPE_Stream.h b/ace/UPIPE_Stream.h index f9002d2c255..98e31cf3349 100644 --- a/ace/UPIPE_Stream.h +++ b/ace/UPIPE_Stream.h @@ -22,14 +22,13 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#if defined (ACE_HAS_THREADS) + #include "ace/SPIPE.h" #include "ace/Message_Queue.h" #include "ace/UPIPE_Addr.h" -#if defined (ACE_HAS_THREADS) - -// Use a typedef to make life easier later on. -typedef ACE_Stream<ACE_SYNCH> MT_Stream; +ACE_BEGIN_VERSIONED_NAMESPACE_DECL /** * @class ACE_UPIPE_Stream @@ -42,6 +41,8 @@ public: friend class ACE_UPIPE_Acceptor; friend class ACE_UPIPE_Connector; + typedef ACE_Stream<ACE_SYNCH> MT_Stream; + // = Initialization and Termination. ACE_UPIPE_Stream (void); @@ -127,10 +128,14 @@ private: #endif /* ACE_MT_SAFE */ }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/UPIPE_Stream.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_THREADS */ + #include /**/ "ace/post.h" + #endif /*ACE_UPIPE_STREAM_H */ diff --git a/ace/UPIPE_Stream.inl b/ace/UPIPE_Stream.inl index 9bd3912d1ba..3a33d287b0b 100644 --- a/ace/UPIPE_Stream.inl +++ b/ace/UPIPE_Stream.inl @@ -1,6 +1,9 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_INLINE ACE_HANDLE ACE_UPIPE_Stream::get_handle (void) const { @@ -8,3 +11,4 @@ ACE_UPIPE_Stream::get_handle (void) const return this->ACE_SPIPE::get_handle (); } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UUID.cpp b/ace/UUID.cpp index 0873cc7d903..1a4d0386d40 100644 --- a/ace/UUID.cpp +++ b/ace/UUID.cpp @@ -20,6 +20,8 @@ ACE_RCSID (ace, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_Utils { @@ -369,8 +371,8 @@ namespace ACE_Utils u_char cseqHAV; { ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); - uuid.clockSeqLow (uuid_state_.clockSequence & 0xFF); - cseqHAV = (uuid_state_.clockSequence & 0x3f00) >> 8; + uuid.clockSeqLow (static_cast<u_char> (uuid_state_.clockSequence & 0xFF)); + cseqHAV = static_cast<u_char> ((uuid_state_.clockSequence & 0x3f00) >> 8); uuid_state_.timestamp = timestamp; } @@ -409,27 +411,19 @@ namespace ACE_Utils void UUID_Generator::get_timestamp (UUID_time& timestamp) { + ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); + this->get_systemtime(timestamp); - /// Account for the clock being set back. Increment the clock - /// sequence. + // Account for the clock being set back. Increment the clock / + // sequence. if (timestamp <= timeLast_) - { - { - ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); - uuid_state_.clockSequence = (uuid_state_.clockSequence + 1) & ACE_UUID_CLOCK_SEQ_MASK; - } - } + uuid_state_.clockSequence = static_cast<u_char> ((uuid_state_.clockSequence + 1) & ACE_UUID_CLOCK_SEQ_MASK); - /// If the system time ticked since the last UUID was generated. Set - /// the clock sequence back. + // If the system time ticked since the last UUID was + // generated. Set / the clock sequence back. else if (timestamp > timeLast_) - { - { - ACE_GUARD (ACE_SYNCH_MUTEX, mon, *lock_); - uuid_state_.clockSequence = 0; - } - } + uuid_state_.clockSequence = 0; timeLast_ = timestamp; } @@ -479,11 +473,9 @@ namespace ACE_Utils } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton <ACE_Utils::UUID_Generator, ACE_SYNCH_MUTEX>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton <ACE_Utils::UUID_Generator, ACE_SYNCH_MUTEX> -#elif defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) +#if defined (ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION) template ACE_Singleton<ACE_Utils::UUID_Generator, ACE_SYNCH_MUTEX> * ACE_Singleton<ACE_Utils::UUID_Generator, ACE_SYNCH_MUTEX>::singleton_; -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +#endif /* ACE_HAS_EXPLICIT_STATIC_TEMPLATE_MEMBER_INSTANTIATION */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/UUID.h b/ace/UUID.h index 9882c24cef5..9a1a9cce956 100644 --- a/ace/UUID.h +++ b/ace/UUID.h @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + //============================================================================= /** * @file UUID.h @@ -24,6 +25,8 @@ #include "ace/Singleton.h" #include "ace/Synch_Traits.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE_Utils { /// Class to hold a MAC address @@ -215,10 +218,12 @@ namespace ACE_Utils int destroy_lock_; }; - typedef ACE_Singleton <UUID_Generator, ACE_SYNCH_MUTEX> UUID_GENERATOR; + typedef ACE_Singleton<UUID_Generator, ACE_SYNCH_MUTEX> UUID_GENERATOR; } +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/UUID.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/UUID.inl b/ace/UUID.inl index 0bd9fc053c6..7eb8dd323de 100644 --- a/ace/UUID.inl +++ b/ace/UUID.inl @@ -1,5 +1,8 @@ -//$Id$ // -*- C++ -*- +// +//$Id$ + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL namespace ACE_Utils { @@ -194,3 +197,5 @@ namespace ACE_Utils // return false; // } } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Unbounded_Queue.cpp b/ace/Unbounded_Queue.cpp index 332fddb4428..cde3e6679b6 100644 --- a/ace/Unbounded_Queue.cpp +++ b/ace/Unbounded_Queue.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_UNBOUNDED_QUEUE_C -#define ACE_UNBOUNDED_QUEUE_C +#ifndef ACE_UNBOUNDED_QUEUE_CPP +#define ACE_UNBOUNDED_QUEUE_CPP #include "ace/Unbounded_Queue.h" @@ -17,7 +17,7 @@ #include "ace/Log_Msg.h" #include "ace/os_include/os_errno.h" -ACE_RCSID(ace, Unbounded_Queue, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Queue) @@ -134,7 +134,7 @@ ACE_Unbounded_Queue<T>::delete_nodes (void) this->allocator_->free, ACE_Node, <T>); - this->cur_size_--; + --this->cur_size_; // @@ Doesnt make sense to have this check since // this will always be true. // ACE_ASSERT (this->cur_size_ >= 0); @@ -174,7 +174,7 @@ ACE_Unbounded_Queue<T>::enqueue_head (const T &new_item) // just a pointer to the dummy node. this->head_->next_ = temp; - this->cur_size_++; + ++this->cur_size_; return 0; } @@ -201,7 +201,7 @@ ACE_Unbounded_Queue<T>::enqueue_tail (const T &new_item) // Point the head to the new dummy node. this->head_ = temp; - this->cur_size_++; + ++this->cur_size_; return 0; } @@ -429,4 +429,6 @@ ACE_Unbounded_Queue_Iterator<T>::next (T *&item) } } -#endif /* ACE_UNBOUNDED_QUEUE_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_UNBOUNDED_QUEUE_CPP */ diff --git a/ace/Unbounded_Queue.h b/ace/Unbounded_Queue.h index fca8b344d30..39314168da8 100644 --- a/ace/Unbounded_Queue.h +++ b/ace/Unbounded_Queue.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,6 +23,8 @@ // For size_t under Chorus #include "ace/os_include/os_stddef.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Allocator; template <class T> @@ -278,6 +280,8 @@ protected: ACE_Allocator *allocator_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Unbounded_Queue.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Unbounded_Queue.inl b/ace/Unbounded_Queue.inl index ea552e7d3d8..35bb7fb9cdf 100644 --- a/ace/Unbounded_Queue.inl +++ b/ace/Unbounded_Queue.inl @@ -1,5 +1,9 @@ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE size_t ACE_Unbounded_Queue<T>::size (void) const { @@ -19,3 +23,5 @@ ACE_Unbounded_Queue<T>::is_full (void) const // ACE_TRACE ("ACE_Unbounded_Queue<T>::is_full"); return 0; // We should implement a "node of last resort for this..." } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Unbounded_Set.cpp b/ace/Unbounded_Set.cpp index 54ffa30a0f2..c3a444ccd8a 100644 --- a/ace/Unbounded_Set.cpp +++ b/ace/Unbounded_Set.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_UNBOUNDED_SET_C -#define ACE_UNBOUNDED_SET_C +#ifndef ACE_UNBOUNDED_SET_CPP +#define ACE_UNBOUNDED_SET_CPP #include "ace/Unbounded_Set.h" #include "ace/Malloc_Base.h" @@ -15,7 +15,7 @@ #include "ace/Unbounded_Set.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Unbounded_Set, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set) @@ -46,7 +46,7 @@ ACE_Unbounded_Set<T>::insert_tail (const T &item) // Point the head to the new dummy node. this->head_ = temp; - this->cur_size_++; + ++this->cur_size_; return 0; } @@ -107,7 +107,7 @@ ACE_Unbounded_Set<T>::delete_nodes (void) this->allocator_->free, ACE_Node, <T>); - this->cur_size_--; + --this->cur_size_; } // Reset the list to be a circular list with just a dummy node. @@ -227,7 +227,7 @@ ACE_Unbounded_Set<T>::remove (const T &item) ACE_Node<T> *temp = curr->next_; // Skip over the node that we're deleting. curr->next_ = temp->next_; - this->cur_size_--; + --this->cur_size_; ACE_DES_FREE_TEMPLATE (temp, this->allocator_->free, ACE_Node, @@ -440,11 +440,13 @@ ACE_Unbounded_Set_Const_Iterator<T>::operator* (void) //ACE_TRACE ("ACE_Unbounded_Set_Const_Iterator<T>::operator*"); T *retv = 0; - int result = this->next (retv); + int const result = this->next (retv); ACE_ASSERT (result != 0); ACE_UNUSED_ARG (result); return *retv; } -#endif /* ACE_UNBOUNDED_SET_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_UNBOUNDED_SET_CPP */ diff --git a/ace/Unbounded_Set.h b/ace/Unbounded_Set.h index d4f2a957cdd..8cddab86f12 100644 --- a/ace/Unbounded_Set.h +++ b/ace/Unbounded_Set.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -21,6 +21,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + class ACE_Allocator; /** @@ -96,8 +98,8 @@ public: // = Iteration methods. - /// Pass back the <next_item> that hasn't been seen in the Set. - /// Returns 0 when all items have been seen, else 1. + /// Pass back the @a next_item that hasn't been seen in the Set. + /// @return Returns 0 when all items have been seen, else 1. int next (T *&next_item); /// Move forward by one element in the set. Returns 0 when all the @@ -299,6 +301,8 @@ private: ACE_Allocator *allocator_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Unbounded_Set.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Unbounded_Set.inl b/ace/Unbounded_Set.inl index 9aad60c4a08..363fe6e4a6d 100644 --- a/ace/Unbounded_Set.inl +++ b/ace/Unbounded_Set.inl @@ -1,8 +1,11 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Global_Macros.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T> ACE_INLINE int ACE_Unbounded_Set<T>::is_empty (void) const { @@ -16,3 +19,5 @@ ACE_Unbounded_Set<T>::is_full (void) const ACE_TRACE ("ACE_Unbounded_Set<T>::is_full"); return 0; // We should implement a "node of last resort for this..." } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Value_Ptr.h b/ace/Value_Ptr.h index 4c05f288409..70570f9c34b 100644 --- a/ace/Value_Ptr.h +++ b/ace/Value_Ptr.h @@ -16,8 +16,12 @@ #ifndef ACE_VALUE_PTR_H #define ACE_VALUE_PTR_H +#include "ace/config-lite.h" + #include <algorithm> +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + namespace ACE { /** @@ -158,4 +162,6 @@ namespace ACE } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_VALUE_PTR_H */ diff --git a/ace/Vector_T.cpp b/ace/Vector_T.cpp index 2dcbd96f67c..adf9727c6ff 100644 --- a/ace/Vector_T.cpp +++ b/ace/Vector_T.cpp @@ -1,7 +1,7 @@ // $Id$ -#ifndef ACE_VECTOR_T_C -#define ACE_VECTOR_T_C +#ifndef ACE_VECTOR_T_CPP +#define ACE_VECTOR_T_CPP #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -13,13 +13,13 @@ #include "ace/Vector_T.inl" #endif /* __ACE_INLINE__ */ -ACE_RCSID(ace, Vector_T, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ALLOC_HOOK_DEFINE(ACE_Vector) template <class T, size_t DEFAULT_SIZE> void ACE_Vector<T, DEFAULT_SIZE>::resize (const size_t new_size, - const T& t) + const T& t) { ACE_Array<T>::size (new_size); if (new_size > length_) @@ -101,9 +101,9 @@ int compare(const ACE_Vector<T>& v1, // cout<<", V2["<<i<<"]="<<v2[i]; // cout<<": NOT EQUAL == "<<(v1[i]!=v2[i])<<endl; if (v1[i] != v2[i]) - { - return false; - } + { + return false; + } } // cout<<"compare() ====================>"<<endl; return true; @@ -111,9 +111,9 @@ int compare(const ACE_Vector<T>& v1, template<class T> int partial_compare(const ACE_Vector<T>& v1, - const ACE_Vector<T>& v2, - const size_t from_ndx, - const size_t to_ndx) + const ACE_Vector<T>& v2, + const size_t from_ndx, + const size_t to_ndx) { size_t last1 = v1.size () - 1; size_t last2 = v2.size () - 1; @@ -132,9 +132,9 @@ int partial_compare(const ACE_Vector<T>& v1, // cout<<", V2["<<i<<"]="<<v2[i]; // cout<<": NOT EQUAL == "<<(v1[i]!=v2[i])<<endl; if (v1[i] != v2[i]) - { - return false; - } + { + return false; + } } // cout<<"partial_compare() ====================>"<<endl; return true; @@ -160,4 +160,6 @@ ACE_Vector_Iterator<T, DEFAULT_SIZE>::next (T *&item) } } -#endif /* ACE_VECTOR_T_C */ +ACE_END_VERSIONED_NAMESPACE_DECL + +#endif /* ACE_VECTOR_T_CPP */ diff --git a/ace/Vector_T.h b/ace/Vector_T.h index c6e5b60b074..b82ea62b90e 100644 --- a/ace/Vector_T.h +++ b/ace/Vector_T.h @@ -22,10 +22,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /* * Default size for an ACE_Vector. */ -const size_t ACE_VECTOR_DEFAULT_SIZE = 32; +static const size_t ACE_VECTOR_DEFAULT_SIZE = 32; // Forward declaration. template <class T, size_t DEFAULT_SIZE> class ACE_Vector_Iterator; @@ -83,7 +85,7 @@ public: * default ACE allocator is used */ ACE_Vector (const size_t init_size = DEFAULT_SIZE, - ACE_Allocator* alloc = 0); + ACE_Allocator* alloc = 0); /** * Destructor. @@ -128,7 +130,7 @@ public: * initialization clause for this parameter). */ void resize (const size_t new_size, - const T& t); + const T& t); /** * Appends a new element to the vector ("push back"). If the @@ -222,9 +224,9 @@ protected: */ template<class T> int compare (const ACE_Vector<T>& v1, - const ACE_Vector<T>& v2, - const size_t from_ndx, - const size_t to_ndx); + const ACE_Vector<T>& v2, + const size_t from_ndx, + const size_t to_ndx); /** * Does a partial comparison of two vectors in the range of @@ -244,9 +246,9 @@ int compare (const ACE_Vector<T>& v1, template<class T> int partial_compare (const ACE_Vector<T>& v1, - const ACE_Vector<T>& v2, - const size_t from_ndx, - const size_t to_ndx); + const ACE_Vector<T>& v2, + const size_t from_ndx, + const size_t to_ndx); #endif /* 0 */ // **************************************************************** @@ -293,6 +295,8 @@ private: ACE_Vector<T, DEFAULT_SIZE> &vector_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/Vector_T.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/Vector_T.inl b/ace/Vector_T.inl index a936c2bfe4d..aef981b447d 100644 --- a/ace/Vector_T.inl +++ b/ace/Vector_T.inl @@ -1,9 +1,12 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + template <class T, size_t DEFAULT_SIZE> ACE_INLINE ACE_Vector<T, DEFAULT_SIZE>::ACE_Vector (const size_t init_size, - ACE_Allocator* alloc) + ACE_Allocator* alloc) : ACE_Array<T> (init_size == 0 ? DEFAULT_SIZE : init_size, alloc) { length_ = 0; @@ -88,3 +91,5 @@ ACE_Vector_Iterator<T, DEFAULT_SIZE>::done (void) const return this->current_ >= vector_.size (); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/Version.h b/ace/Version.h index 0c8ed950821..5db74f85f8f 100644 --- a/ace/Version.h +++ b/ace/Version.h @@ -1,7 +1,10 @@ +// -*- C++ -*- // $Id$ -// This is an automatically generated file. + +// This is file was automatically generated by $ACE_ROOT/bin/make_release. #define ACE_MAJOR_VERSION 5 -#define ACE_MINOR_VERSION 4 -#define ACE_BETA_VERSION 7 -#define ACE_VERSION "5.4.7" +#define ACE_MINOR_VERSION 5 +#define ACE_BETA_VERSION 1 +#define ACE_VERSION "5.5.1" + diff --git a/ace/WFMO_Reactor.cpp b/ace/WFMO_Reactor.cpp index 2b3e3b86df5..ac4d9f88023 100644 --- a/ace/WFMO_Reactor.cpp +++ b/ace/WFMO_Reactor.cpp @@ -18,6 +18,8 @@ ACE_RCSID(ace, WFMO_Reactor, "$Id$") #include "ace/Auto_Ptr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_WFMO_Reactor_Handler_Repository::ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor) : wfmo_reactor_ (wfmo_reactor) { @@ -192,7 +194,7 @@ ACE_WFMO_Reactor_Handler_Repository::unbind_i (ACE_HANDLE handle, // Remember this value; only if it changes do we need to wakeup // the other threads - size_t original_handle_count = this->handles_to_be_deleted_; + size_t const original_handle_count = this->handles_to_be_deleted_; int result = 0; size_t i; @@ -2391,7 +2393,7 @@ ACE_WFMO_Reactor_Notify::handle_signal (int signum, else { ACE_Notification_Buffer *buffer = - (ACE_Notification_Buffer *) mb->base (); + reinterpret_cast <ACE_Notification_Buffer *> (mb->base ()); // If eh == 0 then we've got major problems! Otherwise, we // need to dispatch the appropriate handle_* method on the @@ -2555,7 +2557,7 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, for (index = 0; index < queue_size; ++index) { - ACE_Message_Block *mb; + ACE_Message_Block *mb = 0; if (-1 == this->message_queue_.dequeue_head (mb)) return -1; // This shouldn't happen... @@ -2604,7 +2606,7 @@ ACE_WFMO_Reactor_Notify::purge_pending_notifications (ACE_Event_Handler *eh, queue_size = local_queue.message_count (); for (index = 0; index < queue_size; ++index) { - ACE_Message_Block *mb; + ACE_Message_Block *mb = 0; if (-1 == local_queue.dequeue_head (mb)) { ACE_ASSERT (0); @@ -2676,28 +2678,22 @@ ACE_WFMO_Reactor::resumable_handler (void) // No-op WinSOCK2 methods to help WFMO_Reactor compile #if !defined (ACE_HAS_WINSOCK2) || (ACE_HAS_WINSOCK2 == 0) int -WSAEventSelect (SOCKET s, - WSAEVENT hEventObject, - long lNetworkEvents) +WSAEventSelect (SOCKET /* s */, + WSAEVENT /* hEventObject */, + long /* lNetworkEvents */) { - ACE_UNUSED_ARG (s); - ACE_UNUSED_ARG (hEventObject); - ACE_UNUSED_ARG (lNetworkEvents); - return -1; } int -WSAEnumNetworkEvents (SOCKET s, - WSAEVENT hEventObject, - LPWSANETWORKEVENTS lpNetworkEvents) +WSAEnumNetworkEvents (SOCKET /* s */, + WSAEVENT /* hEventObject */, + LPWSANETWORKEVENTS /* lpNetworkEvents */) { - ACE_UNUSED_ARG (s); - ACE_UNUSED_ARG (hEventObject); - ACE_UNUSED_ARG (lpNetworkEvents); - return -1; } #endif /* !defined ACE_HAS_WINSOCK2 */ +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 */ diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h index 7be1525ea8a..8e3cdb4cc28 100644 --- a/ace/WFMO_Reactor.h +++ b/ace/WFMO_Reactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -73,6 +73,10 @@ int WSAEnumNetworkEvents (SOCKET s, #endif /* !defined ACE_HAS_WINSOCK2 */ +class ACE_WFMO_Reactor_Test; // Must be out of versioned namespace. + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward decl. class ACE_WFMO_Reactor; class ACE_Handle_Set; @@ -93,8 +97,8 @@ public: /** * @class ACE_WFMO_Reactor_Handler_Repository * - * @brief Used to map <ACE_HANDLE>s onto the appropriate - * <ACE_Event_Handler> * and other information. + * @brief Used to map ACE_HANDLEs onto the appropriate + * ACE_Event_Handler * and other information. */ class ACE_Export ACE_WFMO_Reactor_Handler_Repository { @@ -304,7 +308,7 @@ public: // = Search structure operations. - /// Bind the <ACE_Event_Handler *> to the <ACE_HANDLE>. This is for + /// Bind the <ACE_Event_Handler *> to the ACE_HANDLE. This is for /// the simple event entry. int bind (ACE_HANDLE, ACE_Event_Handler *); @@ -317,7 +321,7 @@ public: ACE_HANDLE event_handle, int delete_event); - /// Remove the binding of <ACE_HANDLE> in accordance with the <mask>. + /// Remove the binding of ACE_HANDLE in accordance with the <mask>. int unbind (ACE_HANDLE, ACE_Reactor_Mask mask); @@ -338,12 +342,12 @@ public: /// Maximum ACE_HANDLE value, plus 1. DWORD max_handlep1 (void) const; - /// Pointer to the beginning of the current array of <ACE_HANDLE> + /// Pointer to the beginning of the current array of ACE_HANDLE /// *'s. ACE_HANDLE *handles (void) const; /// Pointer to the beginning of the current array of - /// <ACE_Event_Handler> *'s. + /// ACE_Event_Handler *'s. Current_Info *current_info (void) const; /// Check if changes to the handle set are required. @@ -393,15 +397,15 @@ public: /// current_suspended_info_ from to_be_added_info_ int make_changes_in_to_be_added_infos (void); - /// Removes the <ACE_Event_Handler> at <slot> from the table. + /// Removes the ACE_Event_Handler at <slot> from the table. int remove_handler_i (size_t slot, ACE_Reactor_Mask mask); - /// Removes the <ACE_Event_Handler> at <slot> from the table. + /// Removes the ACE_Event_Handler at <slot> from the table. int remove_suspended_handler_i (size_t slot, ACE_Reactor_Mask mask); - /// Removes the <ACE_Event_Handler> at <slot> from the table. + /// Removes the ACE_Event_Handler at <slot> from the table. int remove_to_be_added_handler_i (size_t slot, ACE_Reactor_Mask to_be_removed_masks); @@ -477,7 +481,7 @@ protected: * @class ACE_WFMO_Reactor_Notify * * @brief Unblock the <ACE_WFMO_Reactor> from its event loop, passing - * it an optional <ACE_Event_Handler> to dispatch. + * it an optional ACE_Event_Handler to dispatch. * * This implementation is necessary for cases where the * <ACE_WFMO_Reactor> is run in a multi-threaded program. In @@ -485,7 +489,7 @@ protected: * <WaitForMultipleObjects> when updates occur other than in the * main <ACE_WFMO_Reactor> thread. To do this, we signal an * auto-reset event the <ACE_WFMO_Reactor> is listening on. If - * an <ACE_Event_Handler> and <ACE_Reactor_Mask> is passed to + * an ACE_Event_Handler and <ACE_Reactor_Mask> is passed to * <notify>, the appropriate <handle_*> method is dispatched. */ class ACE_Export ACE_WFMO_Reactor_Notify : public ACE_Reactor_Notify @@ -505,7 +509,7 @@ public: /** * Special trick to unblock <WaitForMultipleObjects> when updates * occur. All we do is enqueue <event_handler> and <mask> onto the - * <ACE_Message_Queue> and wakeup the <WFMO_Reactor> by signaling + * ACE_Message_Queue and wakeup the <WFMO_Reactor> by signaling * its <ACE_Event> handle. The <ACE_Time_Value> indicates how long * to blocking trying to notify the <WFMO_Reactor>. If <timeout> == * 0, the caller will block until action is possible, else will wait @@ -564,7 +568,7 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. If <eh> == 0, all notifications for all + * ACE_Event_Handler object. If <eh> == 0, all notifications for all * handlers are removed (but not any notifications posted just to wake up * the reactor itself). Returns the number of notifications purged. * Returns -1 on error. @@ -732,7 +736,7 @@ public: * * <WaitForMultipleObjects> is used as the demultiplexing call * - * Returns the total number of I/O and timer <ACE_Event_Handler>s + * Returns the total number of I/O and timer ACE_Event_Handlers * that were dispatched, 0 if the <max_wait_time> elapsed without * dispatching any handlers, or -1 if an error occurs. * @@ -775,7 +779,7 @@ public: // = Register and remove Handlers. /** - * Register an <ACE_Event_Handler> <event_handler>. Since no Event + * Register an ACE_Event_Handler <event_handler>. Since no Event * Mask is passed through this interface, it is assumed that the * <handle> being passed in is an event handle and when the event * becomes signaled, <WFMO_Reactor> will call handle_signal on @@ -787,7 +791,7 @@ public: ACE_HANDLE event_handle = ACE_INVALID_HANDLE); /** - * Register an <ACE_Event_Handler> <event_handle>. <mask> specifies + * Register an ACE_Event_Handler <event_handle>. <mask> specifies * the network events that the <event_handler> is interested in. If * <io_handle> == <ACE_INVALID_HANDLE> the <ACE_WFMO_Reactor> will * call the <get_handle> method of <event_handler> to extract the @@ -1059,7 +1063,7 @@ public: /** * Purge any notifications pending in this reactor for the specified - * <ACE_Event_Handler> object. Returns the number of notifications + * ACE_Event_Handler object. Returns the number of notifications * purged. Returns -1 on error. */ virtual int purge_pending_notifications (ACE_Event_Handler * = 0, @@ -1342,6 +1346,8 @@ private: ACE_WFMO_Reactor &operator = (const ACE_WFMO_Reactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/WFMO_Reactor.inl" #endif /* __ACE_INLINE__ */ diff --git a/ace/WFMO_Reactor.inl b/ace/WFMO_Reactor.inl index e8893728b3a..bbfdcef7deb 100644 --- a/ace/WFMO_Reactor.inl +++ b/ace/WFMO_Reactor.inl @@ -1,4 +1,5 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ #include "ace/Handle_Set.h" @@ -6,16 +7,15 @@ #include "ace/Thread.h" #include "ace/OS_NS_errno.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /************************************************************/ ACE_INLINE int -ACE_Wakeup_All_Threads_Handler::handle_signal (int signum, - siginfo_t *siginfo, +ACE_Wakeup_All_Threads_Handler::handle_signal (int /* signum */, + siginfo_t * /* siginfo */, ucontext_t *) { - ACE_UNUSED_ARG (signum); - ACE_UNUSED_ARG (siginfo); - // This will get called when <WFMO_Reactor->wakeup_all_threads_> event // is signaled. There is nothing to be done here. // ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("(%t) waking up to get updated handle set info\n"))); @@ -432,9 +432,9 @@ ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle, ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1); int changes_required = 0; - int result = this->unbind_i (handle, - mask, - changes_required); + int const result = this->unbind_i (handle, + mask, + changes_required); if (changes_required) // Wake up all threads in WaitForMultipleObjects so that they can @@ -685,7 +685,7 @@ ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle) ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1); int changes_required = 0; - int result = + int const result = this->handler_rep_.suspend_handler_i (handle, changes_required); @@ -1168,3 +1168,5 @@ ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository (void) } #endif /* ACE_WIN32 */ + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp index 39e72b6f575..afe50d51c05 100644 --- a/ace/WIN32_Asynch_IO.cpp +++ b/ace/WIN32_Asynch_IO.cpp @@ -17,6 +17,8 @@ ACE_RCSID (ace, #include "ace/OS_NS_unistd.h" #include "ace/OS_NS_sys_socket.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + size_t ACE_WIN32_Asynch_Result::bytes_transferred (void) const { @@ -166,7 +168,7 @@ ACE_WIN32_Asynch_Operation::cancel (void) { #if (defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)) \ && ( (defined (_MSC_VER)) \ - || (defined (__BORLANDC__) && (__BORLANDC__ >= 0x530)) \ + || (defined (__BORLANDC__)) \ || (defined (__MINGW32))) // All I/O operations that are canceled will complete with the error // ERROR_OPERATION_ABORTED. All completion notifications for the I/O @@ -175,7 +177,7 @@ ACE_WIN32_Asynch_Operation::cancel (void) // @@ This API returns 0 on failure. So, I am returning -1 in that // case. Is that right? (Alex). - int result = (int) ::CancelIo (this->handle_); + int const result = (int) ::CancelIo (this->handle_); if (result == 0) // Couldnt cancel the operations. @@ -411,7 +413,7 @@ ACE_WIN32_Asynch_Read_Stream::read (ACE_Message_Block &message_block, -1); // Shared read - int return_val = this->shared_read (result); + int const return_val = this->shared_read (result); // Upon errors if (return_val == -1) @@ -468,7 +470,7 @@ ACE_WIN32_Asynch_Read_Stream::readv (ACE_Message_Block &message_block, // Increment iovec counter if there's more to do. if (msg_space > 0) - iovcnt++; + ++iovcnt; } if (msg_space > 0) // Ran out of iovecs before msg_space exhausted { @@ -594,6 +596,8 @@ ACE_WIN32_Asynch_Read_Stream::shared_read (ACE_WIN32_Asynch_Read_Stream_Result * switch (errno) { case ERROR_IO_PENDING: + /* FALLTHRU */ + case ERROR_MORE_DATA: // The IO will complete proactively: the OVERLAPPED will still // get queued. return 0; @@ -2575,8 +2579,6 @@ ACE_WIN32_Asynch_Connect::connect_i (ACE_WIN32_Asynch_Connect_Result *result, } return 1 ; // connect finished } - - ACE_NOTREACHED (return 0); } @@ -3336,15 +3338,15 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, -1); // do the scatter/gather recv - int initiate_result = ACE_OS::recvfrom (result->handle (), - iov, - iovcnt, - number_of_bytes_recvd, - result->flags_, - result->saddr (), - &(result->addr_len_), - result, - 0); + ssize_t initiate_result = ACE_OS::recvfrom (result->handle (), + iov, + iovcnt, + number_of_bytes_recvd, + result->flags_, + result->saddr (), + &(result->addr_len_), + result, + 0); if (initiate_result == SOCKET_ERROR) { // If initiate failed, check for a bad error. @@ -3663,15 +3665,15 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, // do the scatter/gather send - int initiate_result = ACE_OS::sendto (result->handle (), - iov, - iovcnt, - number_of_bytes_sent, - result->flags_, - (sockaddr *) addr.get_addr (), - addr.get_size(), - result, - 0); + ssize_t initiate_result = ACE_OS::sendto (result->handle (), + iov, + iovcnt, + number_of_bytes_sent, + result->flags_, + (sockaddr *) addr.get_addr (), + addr.get_size(), + result, + 0); if (initiate_result == SOCKET_ERROR) @@ -3748,26 +3750,6 @@ ACE_WIN32_Asynch_Write_Dgram::ACE_WIN32_Asynch_Write_Dgram (ACE_WIN32_Proactor * { } -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Map_Entry<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *>; -template class ACE_Map_Manager<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Iterator_Base<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Const_Iterator_Base<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Iterator<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Const_Iterator<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; -template class ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *> -#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Iterator_Base<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Const_Iterator_Base<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Const_Iterator<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_HANDLE, ACE_WIN32_Asynch_Connect_Result *, ACE_SYNCH_NULL_MUTEX> - -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ +ACE_END_VERSIONED_NAMESPACE_DECL #endif /* ACE_WIN32 || ACE_HAS_WINCE */ diff --git a/ace/WIN32_Asynch_IO.h b/ace/WIN32_Asynch_IO.h index f8683a7c24d..298563c7d88 100644 --- a/ace/WIN32_Asynch_IO.h +++ b/ace/WIN32_Asynch_IO.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -41,6 +41,8 @@ #include "ace/Map_Manager.h" #include "ace/Null_Mutex.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declaration class ACE_WIN32_Proactor; @@ -689,7 +691,7 @@ public: /** * Same as above but with scatter support, through chaining of * composite message blocks using the continuation field. - * NOTE: Each data block payload must be at least the size of a + * @note Each data block payload must be at least the size of a * system memory page and must be aligned on a system memory page * size boundary */ @@ -896,7 +898,7 @@ public: /** * Same as above but with gather support, through chaining of * composite message blocks using the continuation field. - * NOTE: Each data block payload must be at least the size of a + * @note Each data block payload must be at least the size of a * system memory page and must be aligned on a system memory page * size boundary */ @@ -1927,6 +1929,8 @@ protected: ACE_WIN32_Asynch_Write_Dgram (void); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 && !ACE_HAS_WINCE */ #include /**/ "ace/post.h" #endif /* ACE_WIN32_ASYNCH_IO_H */ diff --git a/ace/WIN32_Proactor.cpp b/ace/WIN32_Proactor.cpp index 56bd9ceb779..7ace0d987b0 100644 --- a/ace/WIN32_Proactor.cpp +++ b/ace/WIN32_Proactor.cpp @@ -12,6 +12,8 @@ #include "ace/OS_NS_errno.h" #include "ace/OS_NS_unistd.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_WIN32_Wakeup_Completion * @@ -19,7 +21,7 @@ * ACE_Proactor interface to wake up all the threads blocking * for completions. */ -class ACE_Export ACE_WIN32_Wakeup_Completion : public ACE_WIN32_Asynch_Result +class ACE_WIN32_Wakeup_Completion : public ACE_WIN32_Asynch_Result { public: @@ -85,11 +87,7 @@ ACE_WIN32_Proactor::close (void) { ACE_OVERLAPPED *overlapped = 0; u_long bytes_transferred = 0; -#if defined (ACE_WIN64) ULONG_PTR completion_key = 0; -#else - ULONG completion_key = 0; -#endif /* ACE_WIN64 */ // Get the next asynchronous operation that completes BOOL res = ::GetQueuedCompletionStatus @@ -120,11 +118,7 @@ int ACE_WIN32_Proactor::register_handle (ACE_HANDLE handle, const void *completion_key) { -#if defined (ACE_WIN64) ULONG_PTR comp_key (reinterpret_cast<ULONG_PTR> (completion_key)); -#else - ULONG comp_key (reinterpret_cast<ULONG> (completion_key)); -#endif /* ACE_WIN64 */ // No locking is needed here as no state changes. ACE_HANDLE cp = ::CreateIoCompletionPort (handle, @@ -568,11 +562,7 @@ ACE_WIN32_Proactor::handle_events (unsigned long milli_seconds) { ACE_OVERLAPPED *overlapped = 0; u_long bytes_transferred = 0; -#if defined (ACE_WIN64) - ULONG_PTR completion_key = 0; -#else - ULONG completion_key = 0; -#endif /* ACE_WIN64 */ + ULONG_PTR completion_key = 0; // Get the next asynchronous operation that completes BOOL result = ::GetQueuedCompletionStatus (this->completion_port_, @@ -685,11 +675,8 @@ ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result) bytes_transferred = static_cast<DWORD> (result->bytes_transferred ()); completion_key = result->completion_key(); } -#if defined (ACE_WIN64) + ULONG_PTR comp_key (reinterpret_cast<ULONG_PTR> (completion_key)); -#else - ULONG comp_key (reinterpret_cast<ULONG> (completion_key)); -#endif /* ACE_WIN64 */ // Post a completion if (::PostQueuedCompletionStatus (this->completion_port_, // completion port @@ -710,7 +697,7 @@ ACE_WIN32_Proactor::post_completion (ACE_WIN32_Asynch_Result *result) } // If Proactor event is valid, signal it - if (handle != ACE_INVALID_HANDLE + if (handle != ACE_INVALID_HANDLE && handle != 0) ACE_OS::event_signal (&handle); @@ -812,4 +799,6 @@ ACE_WIN32_Wakeup_Completion::complete (size_t /* bytes_transferred */, handler->handle_wakeup (); } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 */ diff --git a/ace/WIN32_Proactor.h b/ace/WIN32_Proactor.h index 27d78888459..fc4fd7312de 100644 --- a/ace/WIN32_Proactor.h +++ b/ace/WIN32_Proactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -34,6 +34,8 @@ #include "ace/Asynch_Pseudo_Task.h" #include "ace/Auto_Event.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Forward declarations. class ACE_WIN32_Asynch_Result; class ACE_WIN32_Proactor_Timer_Handler; @@ -65,7 +67,7 @@ public: /// This method adds the @a handle to the I/O completion port. This /// function is a no-op function for Unix systems. virtual int register_handle (ACE_HANDLE handle, - const void *completion_key); + const void *completion_key); /** * Dispatch a single set of events. If @a wait_time elapses before @@ -235,7 +237,7 @@ protected: /// Called when object is removed from the ACE_Reactor. virtual int handle_close (ACE_HANDLE handle, - ACE_Reactor_Mask close_mask); + ACE_Reactor_Mask close_mask); /** * Dispatch a single set of events. If @a milli_seconds elapses @@ -247,9 +249,9 @@ protected: /// Protect against structured exceptions caused by user code when /// dispatching handles. void application_specific_code (ACE_WIN32_Asynch_Result *asynch_result, - size_t bytes_transferred, - const void *completion_key, - u_long error); + size_t bytes_transferred, + const void *completion_key, + u_long error); /** * Post @a how_many completions to the completion port so that all @@ -291,7 +293,7 @@ protected: * called, the <handler>'s handle_timeout method will be * called. */ -class ACE_Export ACE_WIN32_Asynch_Timer : public ACE_WIN32_Asynch_Result +class ACE_WIN32_Asynch_Timer : public ACE_WIN32_Asynch_Result { /// The factory method for this class is with the POSIX_Proactor /// class. @@ -316,6 +318,8 @@ protected: ACE_Time_Value time_; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_WIN32 */ #include /**/ "ace/post.h" #endif /* ACE_PROACTOR_H */ diff --git a/ace/XML_Svc_Conf.cpp b/ace/XML_Svc_Conf.cpp index 76300b641d7..b81c9162076 100644 --- a/ace/XML_Svc_Conf.cpp +++ b/ace/XML_Svc_Conf.cpp @@ -3,7 +3,13 @@ #include "ace/XML_Svc_Conf.h" #if (ACE_USES_CLASSIC_SVC_CONF == 0) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_XML_Svc_Conf::~ACE_XML_Svc_Conf (void) { } + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ diff --git a/ace/XML_Svc_Conf.h b/ace/XML_Svc_Conf.h index c05e63babfd..a91594b6075 100644 --- a/ace/XML_Svc_Conf.h +++ b/ace/XML_Svc_Conf.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -23,6 +23,9 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #if (ACE_USES_CLASSIC_SVC_CONF==0) + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_XML_Svc_Conf * @@ -52,6 +55,9 @@ public: virtual int parse_string (const ACE_TCHAR str[]) = 0; }; + +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */ #include /**/ "ace/post.h" diff --git a/ace/XTI_ATM_Mcast.cpp b/ace/XTI_ATM_Mcast.cpp index a4524e248f9..854e2a36489 100644 --- a/ace/XTI_ATM_Mcast.cpp +++ b/ace/XTI_ATM_Mcast.cpp @@ -1,4 +1,3 @@ -// XTI_ATM_Mcast.cpp // $Id$ #include "ace/XTI_ATM_Mcast.h" @@ -11,6 +10,8 @@ ACE_RCSID(ace, XTI_ATM_Mcast, "$Id$") #include "ace/XTI_ATM_Mcast.inl" #endif /* __ACE_INLINE__ */ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE(ACE_XTI_ATM_Mcast) void @@ -30,8 +31,8 @@ ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (void) int ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream ¤t_stream, - const ACE_Addr &remote_sap, - ACE_INT32 leaf_id, + const ACE_Addr &remote_sap, + ACE_INT32 leaf_id, ACE_Time_Value *timeout) { ACE_TRACE ("ACE_XTI_ATM_Mcast::add_leaf"); @@ -48,8 +49,7 @@ ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream ¤t_stream, // Check for asynchronous event if (t_errno == TLOOK) { - int event; - event = ACE_OS::t_look(current_stream.get_handle()); + int const event = ACE_OS::t_look(current_stream.get_handle()); if (event != TNODATA && event != T_DATA) return -1; else @@ -65,4 +65,6 @@ ACE_XTI_ATM_Mcast::add_leaf (ACE_TLI_Stream ¤t_stream, return 0; } +ACE_END_VERSIONED_NAMESPACE_DECL + #endif /* ACE_HAS_XTI_ATM */ diff --git a/ace/XTI_ATM_Mcast.h b/ace/XTI_ATM_Mcast.h index ea2ba46739f..357af246784 100644 --- a/ace/XTI_ATM_Mcast.h +++ b/ace/XTI_ATM_Mcast.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -26,6 +26,8 @@ #include "ace/TLI_Connector.h" #include "ace/ATM_Addr.h" +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_XTI_ATM_Mcast * @@ -122,10 +124,14 @@ public: ACE_ALLOC_HOOK_DECLARE; }; +ACE_END_VERSIONED_NAMESPACE_DECL + #if defined (__ACE_INLINE__) #include "ace/XTI_ATM_Mcast.inl" #endif /* __ACE_INLINE__ */ #endif /* ACE_HAS_XTI_ATM */ + #include /**/ "ace/post.h" + #endif /* ACE_XTI_ATM_MCAST_H */ diff --git a/ace/XTI_ATM_Mcast.inl b/ace/XTI_ATM_Mcast.inl index 895f37f30ff..b062f8423b2 100644 --- a/ace/XTI_ATM_Mcast.inl +++ b/ace/XTI_ATM_Mcast.inl @@ -1,7 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ -// XTI_ATM_Mcast.i +ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_XTI_ATM_Mcast::ACE_XTI_ATM_Mcast (ACE_TLI_Stream &new_stream, @@ -60,3 +61,5 @@ ACE_XTI_ATM_Mcast::connect (ACE_TLI_Stream &new_stream, udata, opt); } + +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/XtReactor.cpp b/ace/XtReactor.cpp index 6fb2c898ba3..ab4612c9472 100644 --- a/ace/XtReactor.cpp +++ b/ace/XtReactor.cpp @@ -7,13 +7,15 @@ ACE_RCSID(ace, XtReactor, "$Id$") +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + ACE_ALLOC_HOOK_DEFINE (ACE_XtReactor) // Must be called with lock held ACE_XtReactor::ACE_XtReactor (XtAppContext context, - size_t size, - int restart, - ACE_Sig_Handler *h) + size_t size, + int restart, + ACE_Sig_Handler *h) : ACE_Select_Reactor (size, restart, h), context_ (context), ids_ (0), @@ -53,7 +55,7 @@ ACE_XtReactor::~ACE_XtReactor (void) int ACE_XtReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_set, - ACE_Time_Value *max_wait_time) + ACE_Time_Value *max_wait_time) { ACE_TRACE ("ACE_XtReactor::wait_for_multiple_events"); int nfound; @@ -67,8 +69,8 @@ ACE_XtReactor::wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &handle_s handle_set.wr_mask_ = this->wait_set_.wr_mask_; handle_set.ex_mask_ = this->wait_set_.ex_mask_; nfound = XtWaitForMultipleEvents (width, - handle_set, - max_wait_time); + handle_set, + max_wait_time); } while (nfound == -1 && this->handle_error () > 0); @@ -101,8 +103,8 @@ ACE_XtReactor::TimerCallbackProc (XtPointer closure, XtIntervalId * /* id */) void ACE_XtReactor::InputCallbackProc (XtPointer closure, - int *source, - XtInputId *) + int *source, + XtInputId *) { ACE_XtReactor *self = (ACE_XtReactor *) closure; ACE_HANDLE handle = (ACE_HANDLE) *source; @@ -123,9 +125,9 @@ ACE_XtReactor::InputCallbackProc (XtPointer closure, wait_set.ex_mask_.set_bit (handle); int result = ACE_OS::select (*source + 1, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, &zero); + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, &zero); ACE_Select_Reactor_Handle_Set dispatch_set; @@ -133,11 +135,11 @@ ACE_XtReactor::InputCallbackProc (XtPointer closure, if (result > 0) { if (wait_set.rd_mask_.is_set (handle)) - dispatch_set.rd_mask_.set_bit (handle); + dispatch_set.rd_mask_.set_bit (handle); if (wait_set.wr_mask_.is_set (handle)) - dispatch_set.wr_mask_.set_bit (handle); + dispatch_set.wr_mask_.set_bit (handle); if (wait_set.ex_mask_.is_set (handle)) - dispatch_set.ex_mask_.set_bit (handle); + dispatch_set.ex_mask_.set_bit (handle); self->dispatch (1, dispatch_set); } @@ -145,8 +147,8 @@ ACE_XtReactor::InputCallbackProc (XtPointer closure, int ACE_XtReactor::XtWaitForMultipleEvents (int width, - ACE_Select_Reactor_Handle_Set &wait_set, - ACE_Time_Value *) + ACE_Select_Reactor_Handle_Set &wait_set, + ACE_Time_Value *) { // Make sure we have a valid context ACE_ASSERT (this->context_ != 0); @@ -155,10 +157,10 @@ ACE_XtReactor::XtWaitForMultipleEvents (int width, ACE_Select_Reactor_Handle_Set temp_set = wait_set; if (ACE_OS::select (width, - temp_set.rd_mask_, - temp_set.wr_mask_, - temp_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + temp_set.rd_mask_, + temp_set.wr_mask_, + temp_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) return -1; // Bad file arguments... // Instead of waiting using <select>, just use the Xt mechanism to @@ -173,10 +175,10 @@ ACE_XtReactor::XtWaitForMultipleEvents (int width, // Now actually read the result needed by the <Select_Reactor> using // <select>. return ACE_OS::select (width, - wait_set.rd_mask_, - wait_set.wr_mask_, - wait_set.ex_mask_, - (ACE_Time_Value *) &ACE_Time_Value::zero); + wait_set.rd_mask_, + wait_set.wr_mask_, + wait_set.ex_mask_, + (ACE_Time_Value *) &ACE_Time_Value::zero); } XtAppContext @@ -193,8 +195,8 @@ ACE_XtReactor::context (XtAppContext context) int ACE_XtReactor::register_handler_i (ACE_HANDLE handle, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_XtReactor::register_handler_i"); @@ -263,10 +265,10 @@ ACE_XtReactor::register_handler_i (ACE_HANDLE handle, XtID->next_ = this->ids_; XtID->handle_ = handle; XtID->id_ = ::XtAppAddInput (this->context_, - (int) handle, - (XtPointer) condition, - InputCallbackProc, - (XtPointer) this); + (int) handle, + (XtPointer) condition, + InputCallbackProc, + (XtPointer) this); this->ids_ = XtID; } return 0; @@ -274,8 +276,8 @@ ACE_XtReactor::register_handler_i (ACE_HANDLE handle, int ACE_XtReactor::register_handler_i (const ACE_Handle_Set &handles, - ACE_Event_Handler *handler, - ACE_Reactor_Mask mask) + ACE_Event_Handler *handler, + ACE_Reactor_Mask mask) { return ACE_Select_Reactor::register_handler_i (handles, handler, @@ -284,7 +286,7 @@ ACE_XtReactor::register_handler_i (const ACE_Handle_Set &handles, int ACE_XtReactor::remove_handler_i (ACE_HANDLE handle, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { ACE_TRACE ("ACE_XtReactor::remove_handler_i"); @@ -339,10 +341,10 @@ ACE_XtReactor::remove_XtInput (ACE_HANDLE handle) int ACE_XtReactor::remove_handler_i (const ACE_Handle_Set &handles, - ACE_Reactor_Mask mask) + ACE_Reactor_Mask mask) { return ACE_Select_Reactor::remove_handler_i (handles, - mask); + mask); } // The following functions ensure that there is an Xt timeout for the @@ -376,7 +378,7 @@ ACE_XtReactor::reset_timer_interval ACE_TRACE ("ACE_XtReactor::reset_timer_interval"); ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); - int result = ACE_Select_Reactor::timer_queue_->reset_interval + int const result = ACE_Select_Reactor::timer_queue_->reset_interval (timer_id, interval); @@ -393,15 +395,15 @@ long ACE_XtReactor::schedule_timer (ACE_Event_Handler *event_handler, const void *arg, const ACE_Time_Value &delay, - const ACE_Time_Value &interval) + const ACE_Time_Value &interval) { ACE_TRACE ("ACE_XtReactor::schedule_timer"); ACE_MT (ACE_GUARD_RETURN (ACE_Select_Reactor_Token, ace_mon, this->token_, -1)); - long result = ACE_Select_Reactor::schedule_timer (event_handler, - arg, - delay, - interval); + long const result = ACE_Select_Reactor::schedule_timer (event_handler, + arg, + delay, + interval); if (result == -1) return -1; else @@ -413,12 +415,12 @@ ACE_XtReactor::schedule_timer (ACE_Event_Handler *event_handler, int ACE_XtReactor::cancel_timer (ACE_Event_Handler *handler, - int dont_call_handle_close) + int dont_call_handle_close) { ACE_TRACE ("ACE_XtReactor::cancel_timer"); if (ACE_Select_Reactor::cancel_timer (handler, - dont_call_handle_close) == -1) + dont_call_handle_close) == -1) return -1; else { @@ -429,14 +431,14 @@ ACE_XtReactor::cancel_timer (ACE_Event_Handler *handler, int ACE_XtReactor::cancel_timer (long timer_id, - const void **arg, - int dont_call_handle_close) + const void **arg, + int dont_call_handle_close) { ACE_TRACE ("ACE_XtReactor::cancel_timer"); if (ACE_Select_Reactor::cancel_timer (timer_id, - arg, - dont_call_handle_close) == -1) + arg, + dont_call_handle_close) == -1) return -1; else { @@ -445,3 +447,4 @@ ACE_XtReactor::cancel_timer (long timer_id, } } +ACE_END_VERSIONED_NAMESPACE_DECL diff --git a/ace/XtReactor.h b/ace/XtReactor.h index e51fc87722e..fdd0ccae273 100644 --- a/ace/XtReactor.h +++ b/ace/XtReactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -6,7 +6,7 @@ * * $Id$ * - * @author Eric C. Newton's <ecn@clark.net> + * @author Eric C. Newton <ecn@clark.net> * @author Kirill Rybaltchenko <Kirill.Rybaltchenko@cern.ch> * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> */ @@ -29,6 +29,8 @@ #include /**/ <X11/Intrinsic.h> //#undef String +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + /** * @class ACE_XtReactorID * @@ -131,5 +133,8 @@ private: ACE_XtReactor &operator = (const ACE_XtReactor &); }; +ACE_END_VERSIONED_NAMESPACE_DECL + #include /**/ "ace/post.h" + #endif /* ACE_XTREACTOR_H */ diff --git a/ace/ace.mpc b/ace/ace.mpc index 0f5930d7149..2df2829bd3a 100644 --- a/ace/ace.mpc +++ b/ace/ace.mpc @@ -1,21 +1,12 @@ // -*- MPC -*- now wouldn't this be cool... // $Id$ -project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache, pkgconfig { +project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache, versioned_namespace, pkgconfig { avoids = ace_for_tao libout = $(ACE_ROOT)/lib sharedname = ACE dynamicflags = ACE_BUILD_DLL - // Old OS files. put these back and remove the OS_NS*, Cleanup.cpp, and - // Object_Manager_Base.cpp to improve compile times at the cost of - // footprint. dhinton - //OS.cpp - //OS_Dirent.cpp - //OS_Memory.cpp - //OS_String.cpp - //Synch.cpp - Source_Files(ACE_COMPONENTS) { ACE.cpp ACE_crc_ccitt.cpp @@ -24,7 +15,9 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Active_Map_Manager.cpp Addr.cpp Arg_Shifter.cpp + ARGV.cpp Argv_Type_Converter.cpp + Assert.cpp Asynch_IO.cpp Asynch_IO_Impl.cpp Asynch_Pseudo_Task.cpp @@ -54,10 +47,9 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Configuration.cpp Configuration_Import_Export.cpp Connection_Recycling_Strategy.cpp - Container_Instantiations.cpp Containers.cpp - Countdown_Time.cpp Copy_Disabled.cpp + Countdown_Time.cpp Date_Time.cpp DEV.cpp DEV_Addr.cpp @@ -88,7 +80,6 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache gethrtime.cpp Handle_Ops.cpp Handle_Set.cpp - Hash_Map_Manager.cpp Hashable.cpp High_Res_Timer.cpp ICMP_Socket.cpp @@ -117,7 +108,6 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache LSOCK_Stream.cpp Malloc.cpp Malloc_Allocator.cpp - Malloc_Instantiations.cpp Manual_Event.cpp MEM_Acceptor.cpp MEM_Addr.cpp @@ -129,7 +119,6 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Message_Block.cpp Message_Queue.cpp Method_Request.cpp - Metrics_Cache.cpp MMAP_Memory_Pool.cpp Msg_WFMO_Reactor.cpp Multihomed_INET_Addr.cpp @@ -138,7 +127,6 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Obchunk.cpp Object_Manager.cpp Object_Manager_Base.cpp - Obstack.cpp OS_Errno.cpp OS_Log_Msg_Attributes.cpp OS_main.cpp @@ -163,6 +151,7 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache OS_NS_sys_msg.cpp OS_NS_sys_resource.cpp OS_NS_sys_select.cpp + OS_NS_sys_sendfile.cpp OS_NS_sys_shm.cpp OS_NS_sys_socket.cpp OS_NS_sys_stat.cpp @@ -208,7 +197,6 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Sample_History.cpp Sbrk_Memory_Pool.cpp Sched_Params.cpp - Select_Reactor.cpp Select_Reactor_Base.cpp Semaphore.cpp Shared_Memory.cpp @@ -345,7 +333,6 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache TSS_T.cpp Task_Ex_T.cpp Task_T.cpp - Template_Instantiations.cpp Test_and_Set.cpp Timeprobe_T.cpp Timer_Hash_T.cpp @@ -367,9 +354,6 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Guard_T.inl Handle_Gobbler.inl Lock_Adapter_T.inl - OS.inl - OS_Memory.inl - OS_String.inl Refcounted_Auto_Ptr.inl Reverse_Lock_T.inl Swap.inl @@ -387,6 +371,7 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Exception_Macros.h Global_Macros.h Guard_T.h + Hash_Map_Manager.h Handle_Gobbler.h If_Then_Else.h IO_Cntl_Msg.h @@ -423,14 +408,17 @@ project(ACE) : acedefaults, core, other, codecs, token, svcconf, uuid, filecache Synch_Traits.h TSS_T.h Timer_Queuefwd.h + Truncate.h UPIPE_Addr.h Value_Ptr.h Version.h + Versioned_Namespace.h ace_wchar.h config-WinCE.h config-all.h config-borland-common.h config-lite.h + config-macros.h config-minimal.h config-win32-borland.h config-win32-common.h diff --git a/ace/ace.mwc b/ace/ace.mwc index dadb95c37fd..60eecba03e4 100644 --- a/ace/ace.mwc +++ b/ace/ace.mwc @@ -1,13 +1,10 @@ // -*- MPC -*- +// // $Id$ workspace { ace.mpc ace_for_tao.mpc - ace_memory_for_tao.mpc - ace_reactor_for_tao.mpc - ace_sockets_for_tao.mpc - ace_threads_for_tao.mpc ace_flreactor.mpc ace_qtreactor.mpc ace_tkreactor.mpc diff --git a/ace/ace_for_tao.mpc b/ace/ace_for_tao.mpc index 580aab1a4d9..1e7a3704833 100644 --- a/ace/ace_for_tao.mpc +++ b/ace/ace_for_tao.mpc @@ -2,7 +2,7 @@ // // $Id$ -project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { +project(ACE_FOR_TAO) : acedefaults, core, svcconf, versioned_namespace, pkgconfig { requires = ace_for_tao libout = $(ACE_ROOT)/lib sharedname = ACE_FOR_TAO @@ -14,10 +14,14 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { Addr.cpp Arg_Shifter.cpp Argv_Type_Converter.cpp + Assert.cpp Atomic_Op.cpp Auto_Event.cpp + Barrier.cpp // Required by orbsvcs/tests/Notify/lib Base_Thread_Adapter.cpp + Basic_Stats.cpp // Required by ace/Stats Basic_Types.cpp + Capabilities.cpp // Required by TAO/orbsvcs/examples/ImR/Advanced CDR_Base.cpp CDR_Stream.cpp CDR_Size.cpp @@ -29,10 +33,14 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { Condition_Thread_Mutex.cpp Countdown_Time.cpp Copy_Disabled.cpp + Dirent.cpp // Required by TAO_IDL + Dirent_Selector.cpp Dump.cpp Dynamic.cpp Event.cpp Event_Handler.cpp + FILE.cpp + FILE_Addr.cpp Flag_Manip.cpp Framework_Component.cpp Functor.cpp @@ -41,6 +49,7 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { Handle_Ops.cpp Handle_Set.cpp Hashable.cpp + High_Res_Timer.cpp // Required by orbsvcs/tests/Notify/lib INET_Addr.cpp Init_ACE.cpp IO_SAP.cpp @@ -68,7 +77,6 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { Obchunk.cpp Object_Manager.cpp Object_Manager_Base.cpp - Obstack.cpp OS_Errno.cpp OS_Log_Msg_Attributes.cpp OS_main.cpp @@ -109,6 +117,7 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { OS_TLI.cpp Parse_Node.cpp Pipe.cpp + Process.cpp Reactor.cpp Reactor_Impl.cpp Reactor_Notification_Strategy.cpp @@ -119,7 +128,6 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { RW_Mutex.cpp RW_Thread_Mutex.cpp Sched_Params.cpp - Select_Reactor.cpp Select_Reactor_Base.cpp Signal.cpp SOCK.cpp @@ -127,9 +135,16 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { Sock_Connect.cpp SOCK_Connector.cpp SOCK_Dgram.cpp + SOCK_Dgram_Mcast.cpp SOCK_IO.cpp SOCK_Stream.cpp + SPIPE.cpp + SPIPE_Acceptor.cpp + SPIPE_Connector.cpp + SPIPE_Addr.cpp + SPIPE_Stream.cpp SString.cpp + Stats.cpp // Required by orbsvcs/tests/Notify String_Base_Const.cpp Synch_Options.cpp Task.cpp @@ -158,10 +173,13 @@ project(ACE_FOR_TAO) : acedefaults, core, svcconf, pkgconfig { } // ACE_Token implementation uses semaphores on Windows and VxWorks. - conditional(vc6,vc71,vc8,bmake) { + conditional(vc6,vc71,vc8,nmake,bmake) { + ACE_crc32.cpp // Required by SV_Semaphore_Simple Semaphore.cpp Process_Mutex.cpp WFMO_Reactor.cpp + SV_Semaphore_Simple.cpp + SV_Semaphore_Complex.cpp } } diff --git a/ace/ace_memory_for_tao.mpc b/ace/ace_memory_for_tao.mpc deleted file mode 100644 index 9d85e39e1e1..00000000000 --- a/ace/ace_memory_for_tao.mpc +++ /dev/null @@ -1,75 +0,0 @@ -// -*- MPC -*- -// -// $Id$ - -project(ACE_Memory_FOR_TAO) : acedefaults, core, pkgconfig, ace_for_tao, acethreadslib_for_tao { - - requires = ace_for_tao - libout = $(ACE_ROOT)/lib - sharedname = ACE_Memory_FOR_TAO - dynamicflags = ACE_MEMORY_BUILD_DLL - - Source_Files(ACE_COMPONENTS) { - Based_Pointer_Repository.cpp - MEM_Acceptor.cpp - MEM_Addr.cpp - MEM_Connector.cpp - MEM_IO.cpp // Requires ACE_Process_{Mutex,Semaphore} - MEM_SAP.cpp - MEM_Stream.cpp - MMAP_Memory_Pool.cpp - Mem_Map.cpp - PI_Malloc.cpp - Pagefile_Memory_Pool.cpp - SV_Shared_Memory.cpp - Sbrk_Memory_Pool.cpp - Shared_Memory.cpp - Shared_Memory_MM.cpp - Shared_Memory_Pool.cpp - Shared_Memory_SV.cpp - } - - Inline_Files { - Based_Pointer_Repository.inl - MEM_Acceptor.inl - MEM_Addr.inl - MEM_Connector.inl - MEM_IO.inl - MEM_SAP.inl - MEM_Stream.inl - MMAP_Memory_Pool.inl - Mem_Map.inl - PI_Malloc.inl - Pagefile_Memory_Pool.inl - SV_Shared_Memory.inl - Sbrk_Memory_Pool.inl - Shared_Memory.inl - Shared_Memory_MM.inl - Shared_Memory_Pool.inl - Shared_Memory_SV.inl - } - - Header_Files { - Based_Pointer_Repository.h - MEM_Acceptor.h - MEM_Addr.h - MEM_Connector.h - MEM_IO.h - MEM_SAP.h - MEM_Stream.h - MMAP_Memory_Pool.h - Mem_Map.h - PI_Malloc.h - Pagefile_Memory_Pool.h - SV_Shared_Memory.h - Sbrk_Memory_Pool.h - Shared_Memory.h - Shared_Memory_MM.h - Shared_Memory_Pool.h - Shared_Memory_SV.h - } - - Pkgconfig_Files { - ACE_Memory_FOR_TAO.pc.in - } -} diff --git a/ace/ace_reactor_for_tao.mpc b/ace/ace_reactor_for_tao.mpc deleted file mode 100644 index a4dfcad0260..00000000000 --- a/ace/ace_reactor_for_tao.mpc +++ /dev/null @@ -1,30 +0,0 @@ -// -*- MPC -*- -// -// $Id$ - -project(ACE_Reactor_FOR_TAO) : acedefaults, core, pkgconfig, ace_for_tao { - - requires = ace_for_tao - libout = $(ACE_ROOT)/lib - sharedname = ACE_Reactor_FOR_TAO - dynamicflags = ACE_REACTOR_BUILD_DLL - - Source_Files(ACE_COMPONENTS) { - Msg_WFMO_Reactor.cpp - Priority_Reactor.cpp - } - - Inline_Files { - Msg_WFMO_Reactor.inl - Priority_Reactor.inl - } - - Header_Files { - Msg_WFMO_Reactor.h - Priority_Reactor.h - } - - Pkgconfig_Files { - ACE_Reactor_FOR_TAO.pc.in - } -} diff --git a/ace/ace_sockets_for_tao.mpc b/ace/ace_sockets_for_tao.mpc deleted file mode 100644 index 991138c0361..00000000000 --- a/ace/ace_sockets_for_tao.mpc +++ /dev/null @@ -1,63 +0,0 @@ -// -*- MPC -*- -// -// $Id$ - -project(ACE_Sockets_FOR_TAO) : acedefaults, core, pkgconfig, ace_for_tao { - - requires = ace_for_tao - libout = $(ACE_ROOT)/lib - sharedname = ACE_Sockets_FOR_TAO - dynamicflags = ACE_SOCKETS_BUILD_DLL - - Source_Files(ACE_COMPONENTS) { - LSOCK.cpp - LSOCK_Acceptor.cpp - LSOCK_CODgram.cpp - LSOCK_Connector.cpp - LSOCK_Dgram.cpp - LSOCK_Stream.cpp - Multihomed_INET_Addr.cpp - SOCK_CODgram.cpp - SOCK_Dgram_Bcast.cpp - SOCK_Dgram_Mcast.cpp - SOCK_SEQPACK_Acceptor.cpp - SOCK_SEQPACK_Association.cpp - SOCK_SEQPACK_Connector.cpp - } - - Inline_Files { - LSOCK.inl - LSOCK_Acceptor.inl - LSOCK_CODgram.inl - LSOCK_Connector.inl - LSOCK_Dgram.inl - LSOCK_Stream.inl - Multihomed_INET_Addr.inl - SOCK_CODgram.inl - SOCK_Dgram_Bcast.inl - SOCK_Dgram_Mcast.inl - SOCK_SEQPACK_Acceptor.inl - SOCK_SEQPACK_Association.inl - SOCK_SEQPACK_Connector.inl - } - - Header_Files { - LSOCK.h - LSOCK_Acceptor.h - LSOCK_CODgram.h - LSOCK_Connector.h - LSOCK_Dgram.h - LSOCK_Stream.h - Multihomed_INET_Addr.h - SOCK_CODgram.h - SOCK_Dgram_Bcast.h - SOCK_Dgram_Mcast.h - SOCK_SEQPACK_Acceptor.h - SOCK_SEQPACK_Association.h - SOCK_SEQPACK_Connector.h - } - - Pkgconfig_Files { - ACE_Sockets_FOR_TAO.pc.in - } -} diff --git a/ace/ace_threads_for_tao.mpc b/ace/ace_threads_for_tao.mpc deleted file mode 100644 index 5ebb279bcbf..00000000000 --- a/ace/ace_threads_for_tao.mpc +++ /dev/null @@ -1,69 +0,0 @@ -// -*- MPC -*- -// -// $Id$ - -project(ACE_Threads_FOR_TAO) : acedefaults, core, pkgconfig, ace_for_tao { - - requires = ace_for_tao - libout = $(ACE_ROOT)/lib - sharedname = ACE_Threads_FOR_TAO - dynamicflags = ACE_THREADS_BUILD_DLL - - Source_Files(ACE_COMPONENTS) { - Activation_Queue.cpp - Barrier.cpp - File_Lock.cpp - Method_Request.cpp - Process.cpp - Process_Manager.cpp - Process_Semaphore.cpp - RW_Process_Mutex.cpp - Thread_Semaphore.cpp - - // ACE_Token implementation uses semaphores on Windows and VxWorks. - conditional(!vc6,!vc71,!vc8,!bmake) { - Semaphore.cpp - Process_Mutex.cpp - } - } - - Inline_Files { - Activation_Queue.inl - Barrier.inl - File_Lock.inl - Method_Request.inl - Process.inl - Process_Manager.inl - Process_Semaphore.inl - RW_Process_Mutex.inl - Thread_Semaphore.inl - - // ACE_Token implementation uses semaphores on Windows and VxWorks. - conditional(!vc6,!vc71,!vc8,!bmake) { - Semaphore.inl - Process_Mutex.inl - } - } - - Header_Files { - Activation_Queue.h - Barrier.h - File_Lock.h - Method_Request.h - Process.h - Process_Manager.h - Process_Semaphore.h - RW_Process_Mutex.h - Thread_Semaphore.h - - // ACE_Token implementation uses semaphores on Windows and VxWorks. - conditional(!vc6,!vc71,!vc8,!bmake) { - Semaphore.h - Process_Mutex.h - } - } - - Pkgconfig_Files { - ACE_Threads_FOR_TAO.pc.in - } -} diff --git a/ace/ace_wchar.h b/ace/ace_wchar.h index 32cfaafc838..740100eb671 100644 --- a/ace/ace_wchar.h +++ b/ace/ace_wchar.h @@ -107,7 +107,6 @@ using std::size_t; #endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */ -// ACE_TCHAR Macros #if defined (ACE_USES_WCHAR) typedef wchar_t ACE_TCHAR; typedef char ACE_ANTI_TCHAR; @@ -119,9 +118,9 @@ using std::size_t; #endif /* ACE_USES_WCHAR */ #if !defined (ACE_LACKS_DEPRECATED_MACROS) - // Via compiler, sys headers, config-platform.h, + // Via compiler, sys headers, config-platform.h, // or this header we have a wchar_t - #define ACE_HAS_WCHAR + #define ACE_HAS_WCHAR #undef ACE_LACKS_WCHAR_T // The wchar type is simpley wchar_t #define ACE_WCHAR_T wchar_t diff --git a/ace/config-WinCE.h b/ace/config-WinCE.h index e7611412a77..2b06b24ee43 100644 --- a/ace/config-WinCE.h +++ b/ace/config-WinCE.h @@ -69,22 +69,13 @@ #define ACE_USES_WINCE_SEMA_SIMULATION -#define ACE_LACKS_IOSTREAM_TOTALLY -#define ACE_LACKS_ACE_IOSTREAM -#define ACE_LACKS_AUTO_PTR - -#if defined (ACE_HAS_STRICT) -# undef ACE_HAS_STRICT -#endif // ACE_HAS_STRICT -#define ACE_HAS_STRICT 1 - #define ACE_HAS_NONSTATIC_OBJECT_MANAGER 1 // FILE stuff isn't always defined in CE -#ifndef _FILE_DEFINED +#if (_MSC_VER < 1400) && !defined (_FILE_DEFINED) typedef void FILE; # define _FILE_DEFINED -#endif // _FILE_DEFINED +#endif /* _MSC_VER < 1400 && !_FILE_DEFINED */ // This was defined in previous versions of CE, but not 2.11 #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION @@ -173,6 +164,9 @@ #define ACE_LACKS_SOCKET_BUFSIZ #define ACE_LACKS_ISATTY #define ACE_LACKS_STRERROR +#define ACE_LACKS_SYSTEM +#define ACE_LACKS_SIGACTION +#define ACE_LACKS_PIPE #define ACE_LACKS_CUSERID #define ACE_LACKS_CHDIR @@ -182,6 +176,8 @@ #define ACE_LACKS_READLINK #define ACE_LACKS_SWAB #define ACE_LACKS_TEMPNAM +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETPROTOBYNAME #if defined (_WIN32_WCE_EMULATION) // @@ For some reason, qsort isn't defined correctly (_stdcall vs _cdecl) @@ -189,36 +185,19 @@ # define ACE_LACKS_QSORT #endif // _WIN32_WCE_EMULATION -// @@ Followings are used to keep existing programs happy. - -#define ostream FILE -# if !defined (BUFSIZ) +#if !defined (BUFSIZ) # define BUFSIZ 1024 -#endif // BUFSIZ +#endif typedef void (__cdecl * __sighandler_t)(int); // keep Signal compilation happy typedef long off_t; #define ACE_LACKS_MALLOC_H // We do have malloc.h, but don't use it. -//#if (UNDER_CE < 300) // from prior ACE porting effort; left for future reference -//#define ACE_LACKS_STRPBRK -//#define ACE_LACKS_STRSPN -//#define ACE_LACKS_STRTOD -//#define ACE_LACKS_STRTOL -//#define ACE_LACKS_STRTOUL -//#endif // UNDER_CE < 300 - #define ACE_HAS_WINCE_BROKEN_ERRNO #define ACE_HAS_STRDUP_EMULATION -// CE doesn't have <sys/types.h> instead <types.h> -#define ACE_HAS_FLAT_TYPES_H - -// @@ This needs to be defined and initialized as a static. (Singleton?) -#define ACE_DEFAULT_LOG_STREAM 0 - // WinCE can't do fixed addresses for memory-mapped files. #if defined (ACE_DEFAULT_BASE_ADDR) # undef ACE_DEFAULT_BASE_ADDR @@ -227,9 +206,8 @@ typedef long off_t; #define ACE_HAS_TSS_EMULATION -// Not sure if this is true for all versions. dhinton +// This is still true up thru VC8... #define ACE_LACKS_ERRNO_H -#define ACE_LACKS_TIME_H #define ACE_LACKS_SIGNAL_H #define ACE_LACKS_SYS_STAT_H diff --git a/ace/config-aix-4.x.h b/ace/config-aix-4.x.h index 8d700706e7b..ad23c397ec6 100644 --- a/ace/config-aix-4.x.h +++ b/ace/config-aix-4.x.h @@ -54,12 +54,24 @@ # if defined (__IBMCPP__) && (__IBMCPP__ >= 400) # define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS # define ACE_HAS_TYPENAME_KEYWORD + // When using -qtempinc, we don't need to see template implementation + // source (though we do need a pragma to find the correct source file). + // However, without -qtempinc (either -qnotempinc or -qtemplateregistry) + // we do need to see the source. +# if defined (__TEMPINC__) +# if !defined ACE_TEMPLATES_REQUIRE_PRAGMA +# define ACE_TEMPLATES_REQUIRE_PRAGMA +# endif +# else +# if !defined (ACE_TEMPLATES_REQUIRE_SOURCE) +# define ACE_TEMPLATES_REQUIRE_SOURCE +# endif +# endif /* __TEMPINC__ */ + # undef WIFEXITED # undef WEXITSTATUS + # if (__IBMCPP__ >= 500) /* Visual Age C++ 5 */ -# if !defined (ACE_HAS_USING_KEYWORD) -# define ACE_HAS_USING_KEYWORD 1 -# endif /* ACE_HAS_USING_KEYWORD */ # define ACE_HAS_STANDARD_CPP_LIBRARY 1 # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 # endif /* __IBMCPP__ >= 500 */ @@ -86,7 +98,9 @@ # endif /* !ACE_MT_SAFE */ #else /* ! __xlC__ && ! __GNUG__ */ -# error unsupported compiler in ace/config-aix-4.x.h +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-aix-4.x.h +# endif /* __cplusplus */ #endif /* ! __xlC__ && ! __GNUG__ */ @@ -168,6 +182,7 @@ #define ACE_HAS_H_ERRNO #define ACE_LACKS_STDINT_H +#define ACE_LACKS_SYS_SYSCTL_H #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT #define ACE_HAS_NONCONST_SELECT_TIMEVAL @@ -214,7 +229,7 @@ #endif /* ACE_AIX_VERS >= 403 */ #define ACE_HAS_SIGWAIT -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_STRBUF_T // Compiler supports stropts.h diff --git a/ace/config-all.h b/ace/config-all.h index dba2349c254..3763d81dc8f 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -23,23 +23,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// ============================================================================ -// UNICODE macros (to be added later) -// ============================================================================ - -// Get the unicode (i.e. ACE_TCHAR) defines -# include "ace/ace_wchar.h" - -# if defined (VXWORKS) -# if defined (ghs) - // GreenHills 1.8.8 needs the stdarg.h #include before the #include of - // vxWorks.h. - // Also, be sure that these #includes come _after_ the key_t typedef, and - // before the #include of time.h. -# include "ace/os_include/os_stdarg.h" -# endif /* ghs */ -# endif /* VXWORKS */ - // This is used to indicate that a platform doesn't support a // particular feature. #if defined ACE_HAS_VERBOSE_NOTSUP diff --git a/ace/config-borland-common.h b/ace/config-borland-common.h index f53afcff76e..ab35738edca 100644 --- a/ace/config-borland-common.h +++ b/ace/config-borland-common.h @@ -56,14 +56,13 @@ # define ACE_HAS_TEMPLATE_TYPEDEFS 1 # define ACE_HAS_TYPENAME_KEYWORD 1 # define ACE_HAS_USER_MODE_MASKS 1 -# define ACE_HAS_USING_KEYWORD 1 # define ACE_LACKS_ACE_IOSTREAM 1 -# define ACE_LACKS_INLINE_ASSEMBLY 1 # define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 # define ACE_LACKS_NATIVE_STRPTIME 1 # define ACE_LACKS_PLACEMENT_OPERATOR_DELETE 1 # define ACE_LACKS_PRAGMA_ONCE 1 -# define ACE_NEW_THROWS_EXCEPTIONS 1 +# define ACE_HAS_NEW_NOTHROW +# define ACE_TEMPLATES_REQUIRE_SOURCE 1 # define ACE_SIZEOF_LONG_DOUBLE 10 # define ACE_TEMPLATES_REQUIRE_SOURCE 1 # define ACE_UINT64_FORMAT_SPECIFIER_A "%Lu" diff --git a/ace/config-chorus.h b/ace/config-chorus.h index 2081c84d0a2..5fa091bfff2 100644 --- a/ace/config-chorus.h +++ b/ace/config-chorus.h @@ -38,7 +38,9 @@ # define ACE_LACKS_ACE_IOSTREAM /* MVME lacks signed and unsigned char */ # define ACE_LACKS_FLOATING_POINT #else /* ! __GNUG__ && ! ghs */ -# error unsupported compiler for ACE on Chorus +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler for ACE on Chorus +# endif /* __cplusplus */ #endif /* ! __GNUG__ && ! ghs */ // OS-specific configuration @@ -88,6 +90,7 @@ #define ACE_HAS_STRDUP_EMULATION #define ACE_HAS_STRERROR #define ACE_HAS_TSS_EMULATION +#define ACE_LACKS_ALARM #define ACE_LACKS_CONDATTR_PSHARED #define ACE_LACKS_FORK #define ACE_LACKS_GETHOSTENT @@ -96,6 +99,14 @@ #define ACE_LACKS_SETPGID #define ACE_LACKS_SETREGID #define ACE_LACKS_SETREUID +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_SETGID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID #define ACE_LACKS_MADVISE #define ACE_LACKS_MALLOC_H #define ACE_LACKS_MEMORY_H @@ -112,12 +123,18 @@ #define ACE_LACKS_SIGSET #define ACE_LACKS_STRRECVFD #define ACE_LACKS_SYS_MSG_H +#define ACE_LACKS_SYSTEM #define ACE_LACKS_SYSV_SHMEM #define ACE_LACKS_UNIX_SIGNALS #define ACE_LACKS_UTSNAME_T +#define ACE_LACKS_UNAME #define ACE_LACKS_WRITEV #define ACE_LACKS_WAIT #define ACE_PAGE_SIZE 4096 +#define ACE_LACKS_KILL +#define ACE_LACKS_SIGACTION +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETPROTOBYNAME // Chorus has syslog, but doesn't have setlogmask() #define ACE_LACKS_SETLOGMASK diff --git a/ace/config-cray.h b/ace/config-cray.h index e4c18486f09..4ebb1ad830a 100644 --- a/ace/config-cray.h +++ b/ace/config-cray.h @@ -46,8 +46,6 @@ #define ACE_HAS_TEMPLATE_SPECIALIZATION -#define ACE_HAS_USING_KEYWORD - #define ACE_HAS_SSIZE_T #define ACE_HAS_SYSV_IPC @@ -87,7 +85,7 @@ #define ACE_HAS_POSIX_NONBLOCK // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS #define ACE_HAS_DIRENT @@ -95,7 +93,7 @@ #define ACE_HAS_IP_MULTICAST -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_NONCONST_SELECT_TIMEVAL diff --git a/ace/config-cxx-common.h b/ace/config-cxx-common.h index d118b6bb3f6..f4549840c55 100644 --- a/ace/config-cxx-common.h +++ b/ace/config-cxx-common.h @@ -37,7 +37,6 @@ # define ACE_HAS_TEMPLATE_SPECIALIZATION # define ACE_HAS_TEMPLATE_TYPEDEFS # define ACE_HAS_TYPENAME_KEYWORD -# define ACE_HAS_USING_KEYWORD # define ACE_ENDLESS_LOOP \ unsigned int ace_endless_loop____ = 0; if (ace_endless_loop____) break; diff --git a/ace/config-cygwin32.h b/ace/config-cygwin32.h index db16c7e3d6c..32537d1375c 100644 --- a/ace/config-cygwin32.h +++ b/ace/config-cygwin32.h @@ -33,8 +33,6 @@ #define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T #define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE <CLASS, LOCK>; -#define ACE_LACKS_SYSTIME_H - #define ACE_HAS_SELECT_H #define ACE_LACKS_PRAGMA_ONCE @@ -56,7 +54,9 @@ #if defined (__GNUG__) # include "ace/config-g++-common.h" #else -# error unsupported compiler in ace/config-cygwin32.h +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-cygwin32.h +# endif /* __cplusplus */ #endif /* __GNUG__ */ #define ACE_HAS_VOIDPTR_SOCKOPT 1 @@ -100,7 +100,7 @@ #define ACE_HAS_BIG_FD_SET // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS #define ACE_DEFAULT_MAX_SOCKET_BUFSIZ 65535 @@ -122,6 +122,7 @@ #define ACE_HAS_DIRENT #define ACE_HAS_STRPTIME +#define ACE_HAS_4_4BSD_SENDMSG_RECVMSG #define ACE_LACKS_MKFIFO #define ACE_LACKS_SIGINFO_H @@ -136,9 +137,10 @@ #define ACE_LACKS_ITOW 1 #define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS 1 -#define ACE_LACKS_READDIR_R #define ACE_LACKS_RLIMIT #define ACE_LACKS_RWLOCK_T 1 +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_SYS_SYSCTL_H #define ACE_LACKS_FGETWS 1 #define ACE_LACKS_FPUTWS 1 @@ -155,6 +157,8 @@ #define ACE_HAS_POSIX_SEM +#define ACE_HAS_P_READ_WRITE + #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R // Cygwin DLL suffix is .dll diff --git a/ace/config-dgux-4.11-epc.h b/ace/config-dgux-4.11-epc.h index a12225b5dc6..4ac2079a768 100644 --- a/ace/config-dgux-4.11-epc.h +++ b/ace/config-dgux-4.11-epc.h @@ -38,7 +38,7 @@ #define ACE_HAS_REENTRANT_FUNCTIONS // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS // Compiler/platform correctly calls init()/fini() for shared libraries. #define ACE_HAS_AUTOMATIC_INIT_FINI @@ -167,7 +167,6 @@ #define _DGUX_SOURCE // #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION #define ACE_HAS_UCONTEXT_T -#define ACE_LACKS_SYSTIME_H #define ACE_HAS_NONCONST_GETBY #define ACE_LACKS_MADVISE diff --git a/ace/config-dgux-4.x-ghs.h b/ace/config-dgux-4.x-ghs.h index ae662587d6b..67b028c3bf4 100644 --- a/ace/config-dgux-4.x-ghs.h +++ b/ace/config-dgux-4.x-ghs.h @@ -41,7 +41,7 @@ //#define ACE_HAS_REENTRANT_FUNCTIONS // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS // Compiler/platform correctly calls init()/fini() for shared libraries. #define ACE_HAS_AUTOMATIC_INIT_FINI @@ -187,7 +187,6 @@ #define ACE_TEMPLATES_REQUIRE_SOURCE #define ACE_HAS_UCONTEXT_T -#define ACE_LACKS_SYSTIME_H #define ACE_HAS_NONCONST_GETBY #define ACE_LACKS_MADVISE diff --git a/ace/config-doxygen.h b/ace/config-doxygen.h index d60eb0d5955..bb80a9c2b87 100644 --- a/ace/config-doxygen.h +++ b/ace/config-doxygen.h @@ -16,7 +16,7 @@ #define ACE_CONFIG_DOXYGEN_H /// Make sure that we always turn inlining on. -#defind __ACE_INLINE__ +#define __ACE_INLINE__ /// Make all the emulation versions of string operations visible // #define ACE_LACKS_WCSTOK @@ -97,9 +97,6 @@ /// Generate strptime documentation #define ACE_HAS_STRPTIME -/// Doxygen is capable of parsing using -#define ACE_HAS_USING_KEYWORD - /// Generate icmp documentation #define ACE_HAS_ICMP_SUPPORT 1 diff --git a/ace/config-freebsd.h b/ace/config-freebsd.h index fd1afe17751..e4bd5543a7c 100644 --- a/ace/config-freebsd.h +++ b/ace/config-freebsd.h @@ -103,15 +103,15 @@ extern "C" { char * cuserid (char *s); } // Platform defines struct timespec but not timespec_t #define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_SYSTIME_H - #if (__FreeBSD_version < 501000) #define ACE_LACKS_STDINT_H #endif +#define ACE_HAS_SYSCTL #define ACE_LACKS_STRRECVFD -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN // Platform supports System V IPC (most versions of UNIX, but not Win32) #define ACE_HAS_SYSV_IPC diff --git a/ace/config-g++-common.h b/ace/config-g++-common.h index 0428cf5f65f..0886e0442a0 100644 --- a/ace/config-g++-common.h +++ b/ace/config-g++-common.h @@ -16,7 +16,6 @@ #define ACE_HAS_TYPENAME_KEYWORD #define ACE_HAS_STANDARD_CPP_LIBRARY 1 #define ACE_HAS_TEMPLATE_SPECIALIZATION -#define ACE_HAS_USING_KEYWORD #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR #define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 #define ACE_TEMPLATES_REQUIRE_SOURCE diff --git a/ace/config-hpux-10.x-hpc++.h b/ace/config-hpux-10.x-hpc++.h index 32c62e416a6..2003350903b 100644 --- a/ace/config-hpux-10.x-hpc++.h +++ b/ace/config-hpux-10.x-hpc++.h @@ -98,10 +98,6 @@ // Compiler supports the 'typename' qualifier. # define ACE_HAS_TYPENAME_KEYWORD -// This is legit for A.01.12 and probably at least as far back as A.01.07. -// Before that, not sure. But you shouldn't be there anyway ;-) -# define ACE_HAS_USING_KEYWORD - // Platform lacks streambuf "linebuffered ()". # define ACE_LACKS_LINEBUFFERED_STREAMBUF diff --git a/ace/config-hpux-10.x.h b/ace/config-hpux-10.x.h index b67a98b60ae..7c6e7f00de9 100644 --- a/ace/config-hpux-10.x.h +++ b/ace/config-hpux-10.x.h @@ -145,6 +145,10 @@ extern int h_errno; /* This isn't declared in a header file on HP-UX */ #define ACE_DLL_SUFFIX ".sl" #define ACE_LD_SEARCH_PATH "SHLIB_PATH" +// lacks setegid and seteuid +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID + ////////////////////////////////////////////////////////////////////////// // // STREAMS information diff --git a/ace/config-hpux-11.00.h b/ace/config-hpux-11.00.h index ddc86e1ae7c..c40ada25f69 100644 --- a/ace/config-hpux-11.00.h +++ b/ace/config-hpux-11.00.h @@ -114,18 +114,16 @@ // used as formal arguments to a template class. # define ACE_HAS_TEMPLATE_TYPEDEFS -// This is legit for A.03.05 - not sure A.03.04, but it should be. -# define ACE_HAS_USING_KEYWORD - # define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR // Platform lacks streambuf "linebuffered ()". # define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 // Lack of (and broken) support for placement operator delete is a known -// bug by HP, at least as of aC++ A.03.10. It may be fixed later, and if so -// this would change to be a #if against an appropriate value of __HP_aCC -# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE +// bug by HP, up until aC++ A.03.55.02. +# if (__HP_aCC < 35502) +# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE +# endif /* __HP_aCC < 35502 */ // Compiler's 'new' throws exceptions on failure, regardless of whether or // not exception handling is enabled in the compiler options. Fortunately, @@ -274,6 +272,10 @@ // Platform supports IP multicast #define ACE_HAS_IP_MULTICAST +// At least for 11iv2, lacks perfect filtering. +#if (HPUX_VERS >= 1123) && !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) +# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 1 +#endif /* Platform defines MAP_FAILED as a long constant. */ #define ACE_HAS_LONG_MAP_FAILED 1 @@ -396,6 +398,13 @@ // dlopen() takes a char* instead of const char* #define ACE_HAS_CHARPTR_DL +// lacks setegid and seteuid +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID + +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_SYS_SYSCTL_H + // Shared library name/path components #define ACE_DLL_SUFFIX ".sl" #if defined (__LP64__) @@ -488,7 +497,7 @@ #define ACE_HAS_POSIX_SEM // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS #include /**/ "ace/post.h" #endif /* ACE_CONFIG_H */ diff --git a/ace/config-icc-common.h b/ace/config-icc-common.h index c52b7192188..6a37c13690e 100644 --- a/ace/config-icc-common.h +++ b/ace/config-icc-common.h @@ -12,11 +12,24 @@ # define ACE_HAS_TYPENAME_KEYWORD # define ACE_HAS_STANDARD_CPP_LIBRARY 1 # define ACE_HAS_TEMPLATE_SPECIALIZATION -# define ACE_HAS_USING_KEYWORD # define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 # define ACE_HAS_STRING_CLASS +#if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 +# undef ACE_HAS_CUSTOM_EXPORT_MACROS +#else +# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS +# define ACE_HAS_CUSTOM_EXPORT_MACROS +# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ +# define ACE_Proper_Export_Flag __attribute__ ((visibility("default"))) +# define ACE_Proper_Import_Flag +# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE <CLASS, LOCK>; +# define ACE_IMPORT_SINGLETON_DECLARATION(T) __extension__ extern template class T +# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE<CLASS, LOCK>; +#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ + // __EXCEPTIONS is defined with -fexceptions, the egcs default. It // is not defined with -fno-exceptions, the ACE default for g++. // ACE_HAS_EXCEPTIONS is defined in @@ -50,9 +63,5 @@ #define ACE_TEMPLATES_REQUIRE_SOURCE -# if defined (ACE_HAS_EXCEPTIONS) -# define ACE_NEW_THROWS_EXCEPTIONS -# endif /* ACE_HAS_EXCEPTIONS */ - #include /**/ "ace/post.h" #endif /* ACE_LINUX_ICC_COMMON_H */ diff --git a/ace/config-integritySCA.h b/ace/config-integritySCA.h index 3ea3325057a..4e68818b99b 100644 --- a/ace/config-integritySCA.h +++ b/ace/config-integritySCA.h @@ -18,6 +18,14 @@ #define ACE_LACKS_SETREUID #define ACE_LACKS_SETREGID #define ACE_LACKS_SETSID +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID + #ifndef ACE_HAS_EXCEPTIONS #define ACE_HAS_EXCEPTIONS #endif @@ -27,7 +35,6 @@ #define ACE_TEMPLATES_REQUIRE_SOURCE 1 #define ACE_HAS_TEMPLATE_TYPEDEFS #define TAO_USE_SEQUENCE_TEMPLATES -#define ACE_HAS_USING_KEYWORD #define ACE_NEEDS_FUNC_DEFINITIONS #define _REENTRANT #define ACE_MT_SAFE 1 @@ -109,9 +116,12 @@ #define ACE_LACKS_PID_STUFF #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS #define ACE_LACKS_IPC_H +#define ACE_LACKS_SETGID +#define ACE_LACKS_PIPE #define ACE_LACKS_SYS_PARAM_H #define ACE_LACKS_SYS_MSG_H #define ACE_LACKS_UTSNAME_T +#define ACE_LACKS_UNAME #define ACE_LACKS_UMASK #define ACE_LACKS_ISATTY #define ACE_LACKS_GETOPT @@ -130,6 +140,8 @@ #define ACE_LACKS_STRRECVFD #define ACE_LACKS_WRITEV #define ACE_LACKS_READV +#define ACE_LACKS_SYSCONF +#define ACE_LACKS_GETOPT /* below refers to fcntl style locking */ #define ACE_LACKS_FILELOCKS diff --git a/ace/config-irix5.3-g++.h b/ace/config-irix5.3-g++.h index a3034d95583..c9f3cc99773 100644 --- a/ace/config-irix5.3-g++.h +++ b/ace/config-irix5.3-g++.h @@ -16,7 +16,6 @@ #define ACE_SIZEOF_LONG_DOUBLE 8 -#define ACE_LACKS_SYSTIME_H // Platform supports getpagesize() call. #define ACE_HAS_GETPAGESIZE #define IRIX5 diff --git a/ace/config-irix5.3-sgic++.h b/ace/config-irix5.3-sgic++.h index 8be382ce9f4..b1a4e4cb13c 100644 --- a/ace/config-irix5.3-sgic++.h +++ b/ace/config-irix5.3-sgic++.h @@ -17,14 +17,12 @@ #define ACE_SIZEOF_LONG_DOUBLE 8 #define ACE_LACKS_STDINT_H -#define ACE_LACKS_SYSTIME_H // Optimize ACE_Handle_Set for select(). #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT // Platform supports getpagesize() call. #define ACE_HAS_GETPAGESIZE -#define ACE_LACKS_SYSTIME_H #define ACE_HAS_SIGWAIT // Platform supports System V IPC (most versions of UNIX, but not Win32) diff --git a/ace/config-irix6.x-common.h b/ace/config-irix6.x-common.h index c42bc6f83f2..904054c97d0 100644 --- a/ace/config-irix6.x-common.h +++ b/ace/config-irix6.x-common.h @@ -158,7 +158,6 @@ // Platform supports POSIX timers via timestruc_t. #define ACE_HAS_POSIX_TIME -#define ACE_LACKS_SYSTIME_H //************************************************************** @@ -184,7 +183,7 @@ #define ACE_PI_CONTROL_BLOCK_ALIGN_LONGS 2 // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS // IRIX 6.5 supports AIO #define ACE_HAS_AIO_CALLS diff --git a/ace/config-irix6.x-kcc.h b/ace/config-irix6.x-kcc.h deleted file mode 100644 index fba9cbafdea..00000000000 --- a/ace/config-irix6.x-kcc.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for the SGI -// Indigo2EX running Irix 6.5 platform using the KAI C++ compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#include "ace/config-kcc-common.h" -#include "ace/config-irix6.x-common.h" - -// Denotes that GNU has cstring.h as standard -// which redefines memchr() -#define ACE_HAS_GNU_CSTRING_H - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_IRIX_53_SIGNALS - -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform supports sys_siglist array. -//#define ACE_HAS_SYS_SIGLIST - -// This gets defined in config-irix6.x-common.h, but kcc does support this. -#undef ACE_LACKS_PLACEMENT_OPERATOR_DELETE - -// Shift this --- otherwise, it lands on top of libKCC. -#define ACE_DEFAULT_BASE_ADDR ((char*) 0x0500000) - -// kcc 4.0d miscompiles memchr_emulation on irix at +K3 optimization. -// So just use the library version instead. -#define ACE_HAS_MEMCHR - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-irix6.x-sgic++.h b/ace/config-irix6.x-sgic++.h index 0af266cd458..16e7d5e04fe 100644 --- a/ace/config-irix6.x-sgic++.h +++ b/ace/config-irix6.x-sgic++.h @@ -17,7 +17,6 @@ #if _COMPILER_VERSION >= 720 #define ACE_HAS_TEMPLATE_SPECIALIZATION #define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION -#define ACE_HAS_USING_KEYWORD # ifdef _STANDARD_C_PLUS_PLUS # define ACE_HAS_TYPENAME_KEYWORD # endif /* _STANDARD_C_PLUS_PLUS */ diff --git a/ace/config-kcc-common.h b/ace/config-kcc-common.h index 13eeea19663..8b290109a96 100644 --- a/ace/config-kcc-common.h +++ b/ace/config-kcc-common.h @@ -50,8 +50,6 @@ // Compiler doesn't support static data member templates. //#define ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES -#define ACE_HAS_USING_KEYWORD - // Define this if you want to use the standard C++ library #define ACE_HAS_STANDARD_CPP_LIBRARY 1 #define ACE_HAS_STRING_CLASS diff --git a/ace/config-linux-common.h b/ace/config-linux-common.h index 224cd7cd533..7323735b3de 100644 --- a/ace/config-linux-common.h +++ b/ace/config-linux-common.h @@ -110,18 +110,17 @@ // macros to make prototypes visible. # define ACE_LACKS_GETPGID_PROTOTYPE -// NOTE: the following defines are necessary with glibc 2.0 (0.961212-5) +// @note the following defines are necessary with glibc 2.0 (0.961212-5) // on Alpha. I assume that they're necessary on Intel as well, // but that may depend on the version of glibc that is used. //# define ACE_HAS_DLFCN_H_BROKEN_EXTERN_C # define ACE_HAS_VOIDPTR_SOCKOPT -# define ACE_LACKS_SYSTIME_H // Don't define _POSIX_SOURCE in ACE to make strtok() prototype // visible. ACE shouldn't depend on feature test macros to make // prototypes visible. # define ACE_LACKS_STRTOK_R_PROTOTYPE -// NOTE: end of glibc 2.0 (0.961212-5)-specific configuration. +// @note end of glibc 2.0 (0.961212-5)-specific configuration. // These macros determined by reading <stdio.h> on RH 7.1 and glibc's // <features.h>. @@ -174,11 +173,14 @@ #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) # define ACE_HAS_ISASTREAM_PROTO # define ACE_HAS_PTHREAD_SIGMASK_PROTO +# define ACE_HAS_CPU_SET_T #endif /* __GLIBC__ > 2 || __GLIBC__ === 2 && __GLIBC_MINOR__ >= 3) */ // Then the compiler specific parts -#if defined (__GNUG__) +#if defined (__INTEL_COMPILER) +# include "ace/config-icc-common.h" +#elif defined (__GNUG__) // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so // this must appear before its #include. # define ACE_HAS_STRING_CLASS @@ -197,8 +199,6 @@ #elif defined (__DECCXX) # define ACE_CONFIG_INCLUDE_CXX_COMMON # include "ace/config-cxx-common.h" -#elif defined (__INTEL_COMPILER) -# include "ace/config-icc-common.h" #elif defined (__BORLANDC__) # undef ACE_HAS_LLSEEK # undef ACE_HAS_LSEEK64 @@ -215,8 +215,19 @@ # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 # define ACE_LACKS_SWAB # undef ACE_HAS_CLOCK_GETTIME +#elif defined (__GNUC__) +/** + * GNU C compiler. + * + * We need to recognize the GNU C compiler since TAO has at least one + * C source header and file + * (TAO/orbsvcs/orbsvcs/SSLIOP/params_dup.{h,c}) that may indirectly + * include this + */ #else /* ! __GNUG__ && ! __KCC && !__DECCXX && !__INTEL_COMPILER && !__BORLANDC__ && !__PGI */ -# error unsupported compiler in ace/config-linux-common.h +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-linux-common.h +# endif /* __cplusplus */ #endif /* ! __GNUG__ && ! __KCC */ // Completely common part :-) @@ -226,6 +237,8 @@ # define ACE_HAS_SIGSUSPEND +# define ACE_HAS_UALARM + #if __GLIBC__ >= 2 #ifndef ACE_HAS_POSIX_REALTIME_SIGNALS #define ACE_HAS_POSIX_REALTIME_SIGNALS @@ -393,6 +406,9 @@ // Platform has POSIX terminal interface. #define ACE_HAS_TERMIOS +// Linux implements sendfile(). +#define ACE_HAS_SENDFILE + #if !defined (ACE_GETNAME_RETURNS_RANDOM_SIN_ZERO) // Detect if getsockname() and getpeername() returns random values in // the sockaddr_in::sin_zero field by evaluation of the kernel diff --git a/ace/config-lite.h b/ace/config-lite.h index abe7440b607..117933cbe61 100644 --- a/ace/config-lite.h +++ b/ace/config-lite.h @@ -21,356 +21,17 @@ #include /**/ "ace/pre.h" -#include "ace/config.h" +#include "ace/config-macros.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// ACE_HAS_TLI is used to decide whether to try any XTI/TLI functionality -// so if it isn't set, set it. Capabilities and differences between -// XTI and TLI favor XTI, but when deciding to do anything, as opposed to -// ACE_NOTSUP_RETURN for example, ACE_HAS_TLI is the deciding factor. -#if !defined (ACE_HAS_TLI) -# if defined (ACE_HAS_XTI) -# define ACE_HAS_TLI -# endif /* ACE_HAS_XTI */ -#endif /* ACE_HAS_TLI */ - -#define ACE_BITS_PER_ULONG (8 * sizeof (u_long)) - -#if !defined (ACE_OSTREAM_TYPE) -# if defined (ACE_LACKS_IOSTREAM_TOTALLY) -# define ACE_OSTREAM_TYPE FILE -# else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -# define ACE_OSTREAM_TYPE ostream -# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -#endif /* ! ACE_OSTREAM_TYPE */ - -#if !defined (ACE_DEFAULT_LOG_STREAM) -# if defined (ACE_LACKS_IOSTREAM_TOTALLY) -# define ACE_DEFAULT_LOG_STREAM 0 -# else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -# define ACE_DEFAULT_LOG_STREAM (&cerr) -# endif /* ! ACE_LACKS_IOSTREAM_TOTALLY */ -#endif /* ! ACE_DEFAULT_LOG_STREAM */ - -// These two are only for backward compatibility. You should avoid -// using them if not necessary. -# define ACE_SYNCH_1 ACE_SYNCH_DECL -# define ACE_SYNCH_2 ACE_SYNCH_USE - -// For Win32 compatibility... -# if !defined (ACE_WSOCK_VERSION) -# define ACE_WSOCK_VERSION 0, 0 -# endif /* ACE_WSOCK_VERSION */ - -# if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) -# define ACE_MT(X) X -# if !defined (_REENTRANT) -# define _REENTRANT -# endif /* _REENTRANT */ -# else -# define ACE_MT(X) -# endif /* ACE_MT_SAFE */ - -# if defined (ACE_HAS_PURIFY) -# define ACE_INITIALIZE_MEMORY_BEFORE_USE -# endif /* ACE_HAS_PURIFY */ - -# if defined (ACE_HAS_VALGRIND) -# define ACE_INITIALIZE_MEMORY_BEFORE_USE -# endif /* ACE_HAS_VALGRIND */ - -# if defined (ACE_HAS_USING_KEYWORD) -# define ACE_USING using -# else -# define ACE_USING -# endif /* ACE_HAS_USING_KEYWORD */ - -# if defined (ACE_HAS_TYPENAME_KEYWORD) -# define ACE_TYPENAME typename -# else -# define ACE_TYPENAME -# endif /* ACE_HAS_TYPENAME_KEYWORD */ - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) -/** - * @deprecated The @c ACE_TEMPLATE_SPECIALIZATION and - * @c ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION macros are - * deprecated. Use standard C++ template specialization - * syntax instead. - */ -# define ACE_TEMPLATE_SPECIALIZATION template<> -# define ACE_TEMPLATE_CLASS_MEMBER_SPECIALIZATION -#endif /* !ACE_LACKS_DEPRECATED_MACROS */ - -// ========================================================================= -// Perfect Multicast filting refers to RFC 3376, where a socket is only -// delivered dgrams for groups joined even if it didn't bind the group -// address. We turn this option off by default, although most OS's -// except for Windows and Solaris probably lack perfect filtering. -// ========================================================================= - -# if !defined (ACE_LACKS_PERFECT_MULTICAST_FILTERING) -# define ACE_LACKS_PERFECT_MULTICAST_FILTERING 0 -# endif /* ACE_LACKS_PERFECT_MULTICAST_FILTERING */ - -// ========================================================================= -// Enable/Disable Features By Default -// ========================================================================= - -# if !defined (ACE_HAS_POSITION_INDEPENDENT_POINTERS) -# define ACE_HAS_POSITION_INDEPENDENT_POINTERS 1 -# endif /* ACE_HAS_POSITION_INDEPENDENT_POINTERS */ - -# if !defined (ACE_HAS_PROCESS_SPAWN) -# if !defined (ACE_LACKS_FORK) || defined (ACE_WIN32) || defined (ACE_WINCE) || defined (ACE_OPENVMS) || defined (CHORUS) -# define ACE_HAS_PROCESS_SPAWN 1 -# endif -# endif /* ACE_HAS_PROCESS_SPAWN */ - -# if !defined (ACE_HAS_DYNAMIC_LINKING) -# if defined (ACE_HAS_SVR4_DYNAMIC_LINKING) || defined (ACE_WIN32) || defined (ACE_VXWORKS) || defined (__hpux) -# define ACE_HAS_DYNAMIC_LINKING 1 -# endif -# endif /* ACE_HAS_DYNAMIC_LINKING */ - -# if defined (ACE_USES_FIFO_SEM) -# if defined (ACE_HAS_POSIX_SEM) || defined (ACE_LACKS_MKFIFO) || defined (ACE_LACKS_FCNTL) -# undef ACE_USES_FIFO_SEM -# endif -# endif /* ACE_USES_FIFO_SEM */ - -// ========================================================================= -// RCSID Macros -// ========================================================================= - -// By default, DO NOT include RCS Id strings in object code. -#if ! defined (ACE_USE_RCSID) -# define ACE_USE_RCSID 0 -#endif /* #if ! defined (ACE_USE_RCSID) */ - -#if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0)) -# if ! defined (ACE_RCSID) - - // This hack has the following purposes: - // 1. To define the RCS id string variable as a static char*, so - // that there won't be any duplicate extern symbols at link - // time. - // 2. To have a RCS id string variable with a unique name for each - // file. - // 3. To avoid warnings of the type "variable declared and never - // used". - -# define ACE_RCSID(path, file, id) \ - static inline const char* get_rcsid_ ## path ## _ ## file (const char*) \ - { \ - return id ; \ - } \ - static const char* rcsid_ ## path ## _ ## file = \ - get_rcsid_ ## path ## _ ## file ( rcsid_ ## path ## _ ## file ) ; - -# endif /* #if ! defined (ACE_RCSID) */ -#else - - // RCS id strings are not wanted. -# if defined (ACE_RCSID) -# undef ACE_RCSID -# endif /* #if defined (ACE_RCSID) */ -# define ACE_RCSID(path, file, id) /* noop */ -#endif /* #if (defined (ACE_USE_RCSID) && (ACE_USE_RCSID != 0)) */ - -// ========================================================================= -// INLINE macros -// -// These macros handle all the inlining of code via the .i or .inl files -// ========================================================================= - -#if defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) -# define ACE_NO_INLINE -#endif /* defined (ACE_LACKS_INLINE_FUNCTIONS) && !defined (ACE_NO_INLINE) */ - -// ACE inlining has been explicitly disabled. Implement -// internally within ACE by undefining __ACE_INLINE__. -#if defined (ACE_NO_INLINE) -# undef __ACE_INLINE__ -#endif /* ! ACE_NO_INLINE */ - -#if defined (__ACE_INLINE__) -# define ACE_INLINE inline -# if !defined (ACE_HAS_INLINED_OSCALLS) -# define ACE_HAS_INLINED_OSCALLS -# endif /* !ACE_HAS_INLINED_OSCALLS */ -#else -# define ACE_INLINE -#endif /* __ACE_INLINE__ */ - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) - // ========================================================================= - // EXPLICIT macro - // ========================================================================= - - /** - * @deprecated explicit is deprecated. ACE requires C++ - * "explicit" keyword support. - */ - # define ACE_EXPLICIT explicit -#endif /* ACE_LACKS_DEPRECATED_MACROS */ - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) - // ========================================================================= - // MUTABLE macro - // ========================================================================= - - /** - * @deprecated ACE_MUTABLE is deprecated. ACE requires C++ "mutable" - * keyword support. - */ - # define ACE_MUTABLE mutable - # define ACE_CONST_WHEN_MUTABLE const -#endif /* ACE_LACKS_DEPRECATED_MACROS */ - -// ============================================================================ -// EXPORT macros -// -// Since Win32 DLL's do not export all symbols by default, they must be -// explicitly exported (which is done by *_Export macros). -// ============================================================================ - -// Win32 should have already defined the macros in config-win32-common.h -#if !defined (ACE_HAS_CUSTOM_EXPORT_MACROS) -# define ACE_Proper_Export_Flag -# define ACE_Proper_Import_Flag -# define ACE_EXPORT_SINGLETON_DECLARATION(T) -# define ACE_IMPORT_SINGLETON_DECLARATION(T) -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#else -// An export macro should at the very least have been defined. - -# ifndef ACE_Proper_Import_Flag -# define ACE_Proper_Import_Flag -# endif /* !ACE_Proper_Import_Flag */ - -# ifndef ACE_EXPORT_SINGLETON_DECLARATION -# define ACE_EXPORT_SINGLETON_DECLARATION(T) -# endif /* !ACE_EXPORT_SINGLETON_DECLARATION */ - -# ifndef ACE_IMPORT_SINGLETON_DECLARATION -# define ACE_IMPORT_SINGLETON_DECLARATION(T) -# endif /* !ACE_IMPORT_SINGLETON_DECLARATION */ - -# ifndef ACE_EXPORT_SINGLETON_DECLARE -# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* !ACE_EXPORT_SINGLETON_DECLARE */ - -# ifndef ACE_IMPORT_SINGLETON_DECLARE -# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* !ACE_IMPORT_SINGLETON_DECLARE */ - -#endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ - -// This is a whim of mine -- that instead of annotating a class with -// ACE_Export in its declaration, we make the declaration near the TOP -// of the file with ACE_DECLARE_EXPORT. -// TS = type specifier (e.g., class, struct, int, etc.) -// ID = identifier -// So, how do you use it? Most of the time, just use ... -// ACE_DECLARE_EXPORT(class, someobject); -// If there are global functions to be exported, then use ... -// ACE_DECLARE_EXPORT(void, globalfunction) (int, ...); -// Someday, when template libraries are supported, we made need ... -// ACE_DECLARE_EXPORT(template class, sometemplate) <class TYPE, class LOCK>; -# define ACE_DECLARE_EXPORT(TS,ID) TS ACE_Export ID - -// ============================================================================ -// Cast macros -// -// These macros are used to choose between the old cast style and the new -// *_cast<> operators -// ============================================================================ - -# define ACE_sap_any_cast(TYPE) reinterpret_cast<TYPE> (const_cast<ACE_Addr &> (ACE_Addr::sap_any)) - -#if !defined (ACE_LACKS_DEPRECATED_MACROS) - /** - * @deprecated ACE_{static,reinterpret,dynamic,const}_cast@<@> is - * deprecated. Directly use standard C++ casts instead. - */ - # define ACE_static_cast(TYPE, EXPR) static_cast<TYPE> (EXPR) - # define ACE_static_cast_1_ptr(TYPE, T1, EXPR) static_cast<TYPE<T1> *> (EXPR) - # define ACE_static_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> *> (EXPR) - # define ACE_static_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> *> (EXPR) - # define ACE_static_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> *> (EXPR) - # define ACE_static_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR) - # define ACE_static_cast_1_ref(TYPE, T1, EXPR) static_cast<TYPE<T1> &> (EXPR) - # define ACE_static_cast_2_ref(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> &> (EXPR) - # define ACE_static_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> &> (EXPR) - # define ACE_static_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> &> (EXPR) - # define ACE_static_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR) - - # define ACE_const_cast(TYPE, EXPR) const_cast<TYPE> (EXPR) - # define ACE_const_cast_1_ptr(TYPE, T1, EXPR) const_cast<TYPE<T1> *> (EXPR) - # define ACE_const_cast_2_ptr(TYPE, T1, T2, EXPR) const_cast<TYPE<T1, T2> *> (EXPR) - # define ACE_const_cast_3_ptr(TYPE, T1, T2, T3, EXPR) const_cast<TYPE<T1, T2, T3> *> (EXPR) - # define ACE_const_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) const_cast<TYPE<T1, T2, T3, T4> *> (EXPR) - # define ACE_const_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR) - # define ACE_const_cast_1_ref(TYPE, T1, EXPR) const_cast<TYPE<T1> &> (EXPR) - # define ACE_const_cast_2_ref(TYPE, T1, T2, EXPR) const_cast<TYPE<T1, T2> &> (EXPR) - # define ACE_const_cast_3_ref(TYPE, T1, T2, T3, EXPR) const_cast<TYPE<T1, T2, T3> &> (EXPR) - # define ACE_const_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) const_cast<TYPE<T1, T2, T3, T4> &> (EXPR) - # define ACE_const_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) const_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR) - - # define ACE_reinterpret_cast(TYPE, EXPR) reinterpret_cast<TYPE> (EXPR) - # define ACE_reinterpret_cast_1_ptr(TYPE, T1, EXPR) reinterpret_cast<TYPE<T1> *> (EXPR) - # define ACE_reinterpret_cast_2_ptr(TYPE, T1, T2, EXPR) reinterpret_cast<TYPE<T1, T2> *> (EXPR) - # define ACE_reinterpret_cast_3_ptr(TYPE, T1, T2, T3, EXPR) reinterpret_cast<TYPE<T1, T2, T3> *> (EXPR) - # define ACE_reinterpret_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4> *> (EXPR) - # define ACE_reinterpret_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR) - # define ACE_reinterpret_cast_1_ref(TYPE, T1, EXPR) reinterpret_cast<TYPE<T1> &> (EXPR) - # define ACE_reinterpret_cast_2_ref(TYPE, T1, T2, EXPR) reinterpret_cast<TYPE<T1, T2> &> (EXPR) - # define ACE_reinterpret_cast_3_ref(TYPE, T1, T2, T3, EXPR) reinterpret_cast<TYPE<T1, T2, T3> &> (EXPR) - # define ACE_reinterpret_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4> &> (EXPR) - # define ACE_reinterpret_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) reinterpret_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR) - - # if defined (ACE_LACKS_RTTI) - # define ACE_dynamic_cast(TYPE, EXPR) static_cast<TYPE> (EXPR) - # define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) static_cast<TYPE<T1> *> (EXPR) - # define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> *> (EXPR) - # define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> *> (EXPR) - # define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> *> (EXPR) - # define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR) - # define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) static_cast<TYPE<T1> &> (EXPR) - # define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) static_cast<TYPE<T1, T2> &> (EXPR) - # define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) static_cast<TYPE<T1, T2, T3> &> (EXPR) - # define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) static_cast<TYPE<T1, T2, T3, T4> &> (EXPR) - # define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) static_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR) - # else /* ! ACE_LACKS_RTTI */ - # define ACE_dynamic_cast(TYPE, EXPR) dynamic_cast<TYPE> (EXPR) - # define ACE_dynamic_cast_1_ptr(TYPE, T1, EXPR) dynamic_cast<TYPE<T1> *> (EXPR) - # define ACE_dynamic_cast_2_ptr(TYPE, T1, T2, EXPR) dynamic_cast<TYPE<T1, T2> *> (EXPR) - # define ACE_dynamic_cast_3_ptr(TYPE, T1, T2, T3, EXPR) dynamic_cast<TYPE<T1, T2, T3> *> (EXPR) - # define ACE_dynamic_cast_4_ptr(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4> *> (EXPR) - # define ACE_dynamic_cast_5_ptr(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4, T5> *> (EXPR) - # define ACE_dynamic_cast_1_ref(TYPE, T1, EXPR) dynamic_cast<TYPE<T1> &> (EXPR) - # define ACE_dynamic_cast_2_ref(TYPE, T1, T2, EXPR) dynamic_cast<TYPE<T1, T2> &> (EXPR) - # define ACE_dynamic_cast_3_ref(TYPE, T1, T2, T3, EXPR) dynamic_cast<TYPE<T1, T2, T3> &> (EXPR) - # define ACE_dynamic_cast_4_ref(TYPE, T1, T2, T3, T4, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4> &> (EXPR) - # define ACE_dynamic_cast_5_ref(TYPE, T1, T2, T3, T4, T5, EXPR) dynamic_cast<TYPE<T1, T2, T3, T4, T5> &> (EXPR) - # endif /* ! ACE_LACKS_RTTI */ -#endif /* ACE_LACKS_DEPRECATED_MACROS */ - -# if !defined (ACE_CAST_CONST) - // Sun CC 4.2, for example, requires const in reinterpret casts of - // data members in const member functions. But, other compilers - // complain about the useless const. This keeps everyone happy. -# if defined (__SUNPRO_CC) -# define ACE_CAST_CONST const -# else /* ! __SUNPRO_CC */ -# define ACE_CAST_CONST -# endif /* ! __SUNPRO_CC */ -# endif /* ! ACE_CAST_CONST */ +// Empty ACE_OS namespace to help identify compiler errors more +// easily. -- @@ Do we really need this? +ACE_BEGIN_VERSIONED_NAMESPACE_DECL +namespace ACE_OS {} +ACE_END_VERSIONED_NAMESPACE_DECL // ============================================================================ // UNICODE macros (to be added later) @@ -380,118 +41,16 @@ # include "ace/ace_wchar.h" // ============================================================================ -// Compiler Silencing macros -// -// Some compilers complain about parameters that are not used. This macro -// should keep them quiet. -// ============================================================================ - -#if defined (ghs) || defined (__GNUC__) || defined (__hpux) || defined (__sgi) || defined (__DECCXX) || defined (__KCC) || defined (__rational__) || defined (__USLC__) || defined (ACE_RM544) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) -// Some compilers complain about "statement with no effect" with (a). -// This eliminates the warnings, and no code is generated for the null -// conditional statement. NOTE: that may only be true if -O is enabled, -// such as with GreenHills (ghs) 1.8.8. -# define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0) -#elif defined (__DMC__) - #define ACE_UNUSED_ID(identifier) - template <class T> - inline void ACE_UNUSED_ARG(const T& ACE_UNUSED_ID(t)) { } -#else /* ghs || __GNUC__ || ..... */ -# define ACE_UNUSED_ARG(a) (a) -#endif /* ghs || __GNUC__ || ..... */ - -#if defined (__sgi) || defined (ghs) || defined (__DECCXX) || defined(__BORLANDC__) || defined (__KCC) || defined (ACE_RM544) || defined (__USLC__) || defined (__DCC__) || defined (__PGI) || defined (__TANDEM) -# define ACE_NOTREACHED(a) -#else /* __sgi || ghs || ..... */ -# define ACE_NOTREACHED(a) a -#endif /* __sgi || ghs || ..... */ - -// ============================================================================ -// ACE_ALLOC_HOOK* macros -// -// Macros to declare and define class-specific allocation operators. -// ============================================================================ - -# if defined (ACE_HAS_ALLOC_HOOKS) -# define ACE_ALLOC_HOOK_DECLARE \ - void *operator new (size_t bytes); \ - void operator delete (void *ptr); - - // Note that these are just place holders for now. Some day they - // may be be replaced by <ACE_Malloc>. -# define ACE_ALLOC_HOOK_DEFINE(CLASS) \ - void *CLASS::operator new (size_t bytes) { return ::new char[bytes]; } \ - void CLASS::operator delete (void *ptr) { delete [] ((char *) ptr); } -# else -# define ACE_ALLOC_HOOK_DECLARE struct __Ace {} /* Just need a dummy... */ -# define ACE_ALLOC_HOOK_DEFINE(CLASS) -# endif /* ACE_HAS_ALLOC_HOOKS */ - -// ============================================================================ -/** - * ACE_OSCALL* macros - * - * @deprecated ACE_OSCALL_RETURN and ACE_OSCALL should not be used. - * Please restart system calls in your application code. - * See the @c sigaction(2) man page for documentation - * regarding enabling restartable system calls across - * signals via the @c SA_RESTART flag. - * - * The following two macros used ensure that system calls are properly - * restarted (if necessary) when interrupts occur. However, that - * capability was never enabled by any of our supported platforms. - * In fact, some parts of ACE would not function properly when that - * ability was enabled. Furthermore, they assumed that ability to - * restart system calls was determined statically. That assumption - * does not hold for modern platforms, where that ability is - * determined dynamically at run-time. - */ -// ============================================================================ - -#define ACE_OSCALL_RETURN(X,TYPE,FAILVALUE) \ - do \ - return (TYPE) (X); \ - while (0) -#define ACE_OSCALL(X,TYPE,FAILVALUE,RESULT) \ - do \ - RESULT = (TYPE) (X); \ - while (0) - -#if defined (ACE_WIN32) -# if defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) -# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ - do { \ - TYPE ace_result_; \ - TYPE ace_local_result_ = (TYPE) X; \ - ace_result_ = ace_local_result_; \ - if (ace_result_ == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - return ace_result_; \ - } while (0) -# else -# define ACE_WIN32CALL_RETURN(X,TYPE,FAILVALUE) \ - do { \ - TYPE ace_result_ = (TYPE) X; \ - if (ace_result_ == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - return ace_result_; \ - } while (0) -# endif /* defined (__BORLANDC__) && (__BORLANDC__ <= 0x550) */ -# define ACE_WIN32CALL(X,TYPE,FAILVALUE,RESULT) \ - do { \ - RESULT = (TYPE) X; \ - if (RESULT == FAILVALUE) \ - ACE_OS::set_errno_to_last_error (); \ - } while (0) -#endif /* ACE_WIN32 */ - -// ============================================================================ // at_exit declarations // ============================================================================ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + // Marker for cleanup, used by ACE_Exit_Info. extern int ace_exit_hook_marker; +ACE_END_VERSIONED_NAMESPACE_DECL + // For use by <ACE_OS::exit>. extern "C" { @@ -512,6 +71,8 @@ typedef void (*ACE_CLEANUP_FUNC)(void *object, void *param) /* throw () */; // log_msg declarations // ============================================================================ +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + # if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS) typedef int (*ACE_SEH_EXCEPT_HANDLER)(void *); // Prototype of win32 structured exception handler functions. @@ -536,149 +97,7 @@ typedef void (*ACE_SYNC_LOG_MSG_HOOK) (const ACE_TCHAR *prog_name); typedef ACE_OS_Thread_Descriptor *(*ACE_THR_DESC_LOG_MSG_HOOK) (void); -// ============================================================================ -// Fundamental types -// ============================================================================ - -#if defined (ACE_WIN32) - -typedef HANDLE ACE_HANDLE; -typedef SOCKET ACE_SOCKET; -# define ACE_INVALID_HANDLE INVALID_HANDLE_VALUE - -#else /* ! ACE_WIN32 */ - -typedef int ACE_HANDLE; -typedef ACE_HANDLE ACE_SOCKET; -# define ACE_INVALID_HANDLE -1 - -#endif /* ACE_WIN32 */ - -// Define the type that's returned from the platform's native thread -// functions. ACE_THR_FUNC_RETURN is the type defined as the thread -// function's return type, except when the thread function doesn't return -// anything (pSoS). The ACE_THR_FUNC_NO_RETURN_VAL macro is used to -// indicate that the actual thread function doesn't return anything. The -// rest of ACE uses a real type so there's no a ton of conditional code -// everywhere to deal with the possibility of no return type. -# if defined (VXWORKS) && !defined (ACE_HAS_PTHREADS) -# include /**/ <taskLib.h> -typedef int ACE_THR_FUNC_RETURN; -# elif defined (ACE_PSOS) -typedef int ACE_THR_FUNC_RETURN; -// pSOS task functions don't really return anything... this just makes it -// easier to deal with declaring variables internally in ACE. -# elif defined (ACE_WIN32) -typedef DWORD ACE_THR_FUNC_RETURN; -# else -typedef void* ACE_THR_FUNC_RETURN; -# endif /* VXWORKS */ -typedef ACE_THR_FUNC_RETURN (*ACE_THR_FUNC)(void *); - -extern "C" { -typedef void (*ACE_THR_C_DEST)(void *); -} -typedef void (*ACE_THR_DEST)(void *); - -// Now some platforms have special requirements... -# if defined (VXWORKS) && !defined (ACE_HAS_PTHREADS) -typedef FUNCPTR ACE_THR_FUNC_INTERNAL; // where typedef int (*FUNCPTR) (...) -# elif defined (ACE_PSOS) -typedef void (*ACE_THR_FUNC_INTERNAL)(void *); -# else -typedef ACE_THR_FUNC ACE_THR_FUNC_INTERNAL; -# endif /* VXWORKS */ - -extern "C" -{ -# if defined (VXWORKS) && !defined (ACE_HAS_PTHREADS) -typedef FUNCPTR ACE_THR_C_FUNC; // where typedef int (*FUNCPTR) (...) -# elif defined (ACE_PSOS) -// needed to handle task entry point type inconsistencies in pSOS+ -typedef void (*PSOS_TASK_ENTRY_POINT)(); -typedef void (*ACE_THR_C_FUNC)(void *); -# else -typedef ACE_THR_FUNC_RETURN (*ACE_THR_C_FUNC)(void *); -# endif /* VXWORKS */ -} - -// ============================================================================ -// Macros for controlling the lifetimes of dlls loaded by ACE_DLL--including -// all dlls loaded via the ACE Service Config framework. -// -// Please don't change these values or add new ones wantonly, since we use -// the ACE_BIT_ENABLED, etc..., macros to test them. -// ============================================================================ - -// Per-process policy that unloads dlls eagerly. -#define ACE_DLL_UNLOAD_POLICY_PER_PROCESS 0 -// Apply policy on a per-dll basis. If the dll doesn't use one of the macros -// below, the current per-process policy will be used. -#define ACE_DLL_UNLOAD_POLICY_PER_DLL 1 -// Don't unload dll when refcount reaches zero, i.e., wait for either an -// explicit unload request or program exit. -#define ACE_DLL_UNLOAD_POLICY_LAZY 2 -// Default policy allows dlls to control their own destinies, but will -// unload those that don't make a choice eagerly. -#define ACE_DLL_UNLOAD_POLICY_DEFAULT ACE_DLL_UNLOAD_POLICY_PER_DLL - -// Add this macro you one of your cpp file in your dll. X should -// be either ACE_DLL_UNLOAD_POLICY_DEFAULT or ACE_DLL_UNLOAD_POLICY_LAZY. -#define ACE_DLL_UNLOAD_POLICY(CLS,X) \ -extern "C" u_long CLS##_Export _get_dll_unload_policy (void) \ - { return X;} - -// ============================================================================ -// ACE_USES_CLASSIC_SVC_CONF macro -// ============================================================================ - -// For now, default is to use the classic svc.conf format. -#if !defined (ACE_USES_CLASSIC_SVC_CONF) -# if defined (ACE_HAS_CLASSIC_SVC_CONF) && defined (ACE_HAS_XML_SVC_CONF) -# error You can only use either CLASSIC or XML svc.conf, not both. -# endif -// Change the ACE_HAS_XML_SVC_CONF to ACE_HAS_CLASSIC_SVC_CONF when -// we switch ACE to use XML svc.conf as default format. -# if defined (ACE_HAS_XML_SVC_CONF) -# define ACE_USES_CLASSIC_SVC_CONF 0 -# else -# define ACE_USES_CLASSIC_SVC_CONF 1 -# endif /* ACE_HAS_XML_SVC_CONF */ -#endif /* ACE_USES_CLASSIC_SVC_CONF */ - -// ============================================================================ -// Default svc.conf file extension. -// ============================================================================ -#if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) -# define ACE_DEFAULT_SVC_CONF_EXT ".conf" -#else -# define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml" -#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ - -// ============================================================================ -// Miscellaneous macros -// ============================================================================ - -#if defined (ACE_USES_EXPLICIT_STD_NAMESPACE) -# define ACE_STD_NAMESPACE std -#else -# define ACE_STD_NAMESPACE -#endif - -// empty ACE_OS namespace to help identify compiler errors more easily. -namespace ACE_OS {} -#if !defined (ACE_OS_String) -# define ACE_OS_String ACE_OS -#endif /* ACE_OS_String */ -#if !defined (ACE_OS_Memory) -# define ACE_OS_Memory ACE_OS -#endif /* ACE_OS_Memory */ -#if !defined (ACE_OS_Dirent) -# define ACE_OS_Dirent ACE_OS -#endif /* ACE_OS_Dirent */ -#if !defined (ACE_OS_TLI) -# define ACE_OS_TLI ACE_OS -#endif /* ACE_OS_TLI */ +ACE_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" diff --git a/ace/config-lynxos.h b/ace/config-lynxos.h index b2d723daa10..6f837b09f50 100644 --- a/ace/config-lynxos.h +++ b/ace/config-lynxos.h @@ -3,13 +3,6 @@ // The following configuration file is designed to work for LynxOS, // version 3.0.0 and later, using the GNU g++ compiler. -// Note on why ACE_HAS_POSIX_SEM is not #defined: -// ACE_HAS_POSIX_SEM would cause native LynxOS mutexes and condition -// variables to be used. But, they don't appear to be intended to be -// used between processes. Without ACE_HAS_POSIX_SEM, ACE uses -// semaphores for all synchronization. Those can be used between -// processes - #ifndef ACE_CONFIG_H #define ACE_CONFIG_H #include /**/ "ace/pre.h" @@ -48,6 +41,8 @@ #define ACE_HAS_ALLOCA #define ACE_HAS_ALLOCA_H #define ACE_HAS_AUTOMATIC_INIT_FINI +#define ACE_HAS_CHARPTR_SHMAT +#define ACE_HAS_CHARPTR_SHMDT #define ACE_HAS_CLOCK_GETTIME #define ACE_HAS_CLOCK_SETTIME #define ACE_HAS_CPLUSPLUS_HEADERS @@ -58,7 +53,6 @@ #define ACE_HAS_GPERF #define ACE_HAS_ICMP_SUPPORT 1 #define ACE_HAS_IP_MULTICAST -#define ACE_HAS_LYNXOS_BROKEN_MMAP #define ACE_HAS_LYNXOS_SIGNALS #define ACE_HAS_MEMCHR #define ACE_HAS_MSG @@ -70,8 +64,8 @@ #define ACE_HAS_NONCONST_SETRLIMIT #define ACE_HAS_NONCONST_WRITEV #define ACE_HAS_POSIX_NONBLOCK +#define ACE_HAS_POSIX_REALTIME_SIGNALS #define ACE_HAS_POSIX_TIME -#define ACE_HAS_PREDEFINED_THREAD_CANCELLED_MACRO #define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS #define ACE_HAS_SCANDIR #define ACE_HAS_SEMUN @@ -90,7 +84,6 @@ #define ACE_HAS_TIMEZONE_GETTIMEOFDAY #define ACE_HAS_TYPENAME_KEYWORD #define ACE_LACKS_CONST_TIMESPEC_PTR -#define ACE_LACKS_DLFCN_H #define ACE_LACKS_GETOPT_PROTOTYPE #define ACE_LACKS_GETPGID #define ACE_LACKS_INET_ATON_PROTOTYPE @@ -102,14 +95,13 @@ #define ACE_LACKS_REGEX_H #define ACE_LACKS_RWLOCK_T #define ACE_LACKS_SCANDIR_PROTOTYPE -#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETEUID #define ACE_LACKS_SIGINFO_H -#define ACE_LACKS_SI_ADDR #define ACE_LACKS_STRCASECMP_PROTOTYPE #define ACE_LACKS_STRNCASECMP_PROTOTYPE #define ACE_LACKS_SWAB_PROTOTYPE #define ACE_LACKS_SYS_SELECT_H -#define ACE_LACKS_TCP_NODELAY #define ACE_LACKS_TIMESPEC_T #define ACE_LACKS_UCONTEXT_H #define ACE_LACKS_WCHAR_H @@ -139,15 +131,11 @@ #define ACE_LACKS_FPUTWS #define ACE_LACKS_WCSICMP #define ACE_LACKS_WCSNICMP +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_USECONDS_T #define ACE_MALLOC_ALIGN 8 -#define ACE_SCANDIR_CMP_USES_VOIDPTR - -// Don't use MAP_FIXED, at least for now. -#define ACE_MAP_FIXED 0 -// LynxOS, through 3.0.0, does not support MAP_PRIVATE, so map it to -// MAP_SHARED. -#define ACE_MAP_PRIVATE ACE_MAP_SHARED #define ACE_PAGE_SIZE 4096 +#define ACE_SCANDIR_CMP_USES_VOIDPTR // Compile using multi-thread libraries. #if !defined (ACE_MT_SAFE) @@ -175,8 +163,6 @@ # define ACE_LACKS_SETDETACH # define ACE_LACKS_THREAD_PROCESS_SCOPING # define ACE_LACKS_THREAD_STACK_ADDR - // This gets around Lynx broken macro calls resulting in "::0" -# define _POSIX_THREADS_CALLS #endif /* ACE_MT_SAFE */ #define ACE_HAS_AIO_CALLS @@ -190,11 +176,6 @@ #define ACE_HAS_BROKEN_PREALLOCATED_OBJECTS_AFTER_FORK 1 -// Looks like the modern compilers have support for namespaces. Or -// rather we dont support any compiler without this support. Need to -// get this macro off of ACE. -#define ACE_HAS_USING_KEYWORD - #if __GNUC__ == 2 && __GNUC_MINOR__ == 9 // config-g++-common.h defines these incorrectly for LynxOS 3.x // with G++ version 2.9-gnupro-98r2 @@ -203,6 +184,10 @@ # undef ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES #endif /* __GNUC__ == 2 && __GNUC_MINOR__ == 9 */ +#if __GNUC__ < 3 +# define ACE_LACKS_NUMERIC_LIMITS +#endif /* __GNUC__ < 3 */ + // By default, don't include RCS Id strings in object code. #if !defined (ACE_USE_RCSID) # define ACE_USE_RCSID 0 @@ -212,16 +197,40 @@ #define __NO_INCLUDE_WARN__ #if ACE_LYNXOS_MAJOR > 3 /* LynxOS 4.x */ +# define ACE_HAS_POSIX_SEM // "changes signedness" error (OS.i and many other files) # define ACE_HAS_SOCKLEN_T // LSOCK.cpp uses a macro from param.h, not included # define ALIGNBYTES (sizeof(int) - 1) # define ALIGN(p) (((unsigned)p + ALIGNBYTES) & ~ALIGNBYTES) #else /* LynxOS 3.x */ + // Note on why ACE_HAS_POSIX_SEM is not #defined: + // ACE_HAS_POSIX_SEM would cause native LynxOS mutexes and condition + // variables to be used. But, they don't appear to be intended to be + // used between processes. Without ACE_HAS_POSIX_SEM, ACE uses + // semaphores for all synchronization. Those can be used between + // processes + //# define ACE_HAS_POSIX_SEM + + // Don't use MAP_FIXED, at least for now. +# define ACE_MAP_FIXED 0 + // LynxOS, through 3.0.0, does not support MAP_PRIVATE, + // so map it to MAP_SHARED. +# define ACE_MAP_PRIVATE ACE_MAP_SHARED + + // This gets around Lynx broken macro calls resulting in "::0" +# define _POSIX_THREADS_CALLS + +# define ACE_HAS_LYNXOS_BROKEN_MMAP # define ACE_HAS_POLL # define ACE_LACKS_AUTO_PTR +# define ACE_LACKS_DLFCN_H +# define ACE_LACKS_SETPGID # define ACE_LACKS_SETREGID # define ACE_LACKS_SETREUID +# define ACE_LACKS_SETUID +# define ACE_LACKS_SI_ADDR +# define ACE_LACKS_TCP_NODELAY #endif /* ACE_LYNXOS_MAJOR > 3 */ #include /**/ "ace/post.h" diff --git a/ace/config-macosx-panther.h b/ace/config-macosx-panther.h index e308cc09f05..c8308edb975 100644 --- a/ace/config-macosx-panther.h +++ b/ace/config-macosx-panther.h @@ -18,6 +18,7 @@ #define ACE_SIZE_T_FORMAT_SPECIFIER_A "%lu" #define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A) +#define ACE_LACKS_SUSECONDS_T #if defined (ACE_HAS_PENTIUM) # undef ACE_HAS_PENTIUM @@ -81,7 +82,8 @@ #define ACE_LACKS_STRRECVFD -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN // Platform supports System V IPC (most versions of UNIX, but not Win32) #define ACE_HAS_SYSV_IPC @@ -149,11 +151,9 @@ #endif /* ! ACE_MT_SAFE */ #define ACE_HAS_PTHREADS #define ACE_HAS_PTHREADS_STD -#define ACE_HAS_PTHREAD_SIGMASK #define ACE_LACKS_THREAD_PROCESS_SCOPING #define ACE_HAS_THREAD_SPECIFIC_STORAGE #define ACE_HAS_DIRENT -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_POLL_H #define ACE_LACKS_SEARCH_H @@ -162,7 +162,7 @@ //#define ACE_HAS_RECURSIVE_MUTEXES // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS #define ACE_HAS_SEMUN #define ACE_HAS_SIGINFO_T diff --git a/ace/config-macosx-tiger.h b/ace/config-macosx-tiger.h index 9484e261304..5b897b6d9ba 100644 --- a/ace/config-macosx-tiger.h +++ b/ace/config-macosx-tiger.h @@ -14,14 +14,22 @@ # include "ace/config-g++-common.h" #endif /* __GNUG__ */ -#undef ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR +// #undef ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR +#define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR #undef ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION #define ACE_SIZE_T_FORMAT_SPECIFIER_A "%lu" #define ACE_SIZE_T_FORMAT_SPECIFIER ACE_LIB_TEXT (ACE_SIZE_T_FORMAT_SPECIFIER_A) -// Proper size of long double on both G4/G5 is 16 -#define ACE_SIZEOF_LONG_DOUBLE 16 +#if !defined (ACE_SIZEOF_LONG_DOUBLE) +# if (__GNUC__ == 3 && __GNUC_MINOR__ == 3) + // Size of long double in GCC 3.3 is 8. +# define ACE_SIZEOF_LONG_DOUBLE 8 +# else // Else, the compiler is GCC4 + // For GCC4, the size is 16. +# define ACE_SIZEOF_LONG_DOUBLE 16 +# endif // GCC 3.3 +#endif // ACE_SIZEOF_LONG_DOUBLE #if defined (ACE_HAS_PENTIUM) # undef ACE_HAS_PENTIUM @@ -40,7 +48,19 @@ #define ACE_HAS_MEMCHR #define ACE_LACKS_STROPTS_H -#define ACE_LACKS_WCHAR_H + +// Wcharness.... +//#define ACE_LACKS_WCHAR_H +#define ACE_HAS_WCHAR +#define ACE_SIZEOF_WCHAR 4 + + +#define ACE_HAS_3_PARAM_WCSTOK +#define ACE_LACKS_ITOW +#define ACE_LACKS_WCSICMP +#define ACE_LACKS_WCSNICMP +#define ACE_LACKS_WCSDUP +// #define ACE_LACKS_WCSLEN // Mac lacks the following pthread features #define ACE_LACKS_MUTEXATTR_PSHARED @@ -55,6 +75,8 @@ //Platform/compiler has the sigwait(2) prototype #define ACE_HAS_SIGWAIT +#define ACE_HAS_AIO_CALLS + //Platform supports sigsuspend() #define ACE_HAS_SIGSUSPEND @@ -89,7 +111,7 @@ #define ACE_LACKS_STRRECVFD -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN // Platform supports System V IPC (most versions of UNIX, but not Win32) #define ACE_HAS_SYSV_IPC @@ -160,11 +182,9 @@ #endif /* ! ACE_MT_SAFE */ #define ACE_HAS_PTHREADS #define ACE_HAS_PTHREADS_STD -#define ACE_HAS_PTHREAD_SIGMASK #define ACE_LACKS_THREAD_PROCESS_SCOPING #define ACE_HAS_THREAD_SPECIFIC_STORAGE #define ACE_HAS_DIRENT -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_POLL_H #define ACE_LACKS_SEARCH_H @@ -173,7 +193,7 @@ //#define ACE_HAS_RECURSIVE_MUTEXES // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS #define ACE_HAS_SEMUN #define ACE_HAS_SIGINFO_T diff --git a/ace/config-macosx.h b/ace/config-macosx.h index ec570d4001d..a6d1f1d7521 100644 --- a/ace/config-macosx.h +++ b/ace/config-macosx.h @@ -64,6 +64,8 @@ #define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_SYSCTL + //? #define ACE_LACKS_SIGSET @@ -83,7 +85,7 @@ #define ACE_LACKS_STRRECVFD -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN // Platform supports System V IPC (most versions of UNIX, but not Win32) //#define ACE_HAS_SYSV_IPC @@ -151,11 +153,9 @@ #endif /* ! ACE_MT_SAFE */ #define ACE_HAS_PTHREADS #define ACE_HAS_PTHREADS_STD -#define ACE_HAS_PTHREAD_SIGMASK #define ACE_LACKS_THREAD_PROCESS_SCOPING #define ACE_HAS_THREAD_SPECIFIC_STORAGE #define ACE_HAS_DIRENT -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_POLL_H #define ACE_LACKS_SEARCH_H @@ -163,7 +163,7 @@ //#define ACE_HAS_RECURSIVE_MUTEXES // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS #define ACE_HAS_SEMUN #define ACE_HAS_SIGINFO_T diff --git a/ace/config-mit-pthread.h b/ace/config-mit-pthread.h index 111d711c394..afaf665c383 100644 --- a/ace/config-mit-pthread.h +++ b/ace/config-mit-pthread.h @@ -18,7 +18,6 @@ #define ACE_HAS_PTHREADS #define ACE_HAS_PTHREADS_STD #define ACE_LACKS_PTHREAD_CANCEL -#define ACE_HAS_PTHREAD_SIGMASK #define ACE_HAS_SIGWAIT #define ACE_LACKS_THREAD_PROCESS_SCOPING //#define ACE_LACKS_THREAD_STACK_ADDR diff --git a/ace/config-mvs.h b/ace/config-mvs.h index f3982f72e7b..7f490764501 100644 --- a/ace/config-mvs.h +++ b/ace/config-mvs.h @@ -61,7 +61,7 @@ #define ACE_HAS_SIGWAIT #define ACE_HAS_SIG_ATOMIC_T #define ACE_HAS_SIG_C_FUNC -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_SIZET_SOCKET_LEN #define ACE_HAS_SSIZE_T #define ACE_HAS_STRERROR @@ -93,7 +93,6 @@ #define ACE_LACKS_SETSCHED #define ACE_LACKS_SIGINFO_H #define ACE_LACKS_STRRECVFD -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_NETINET_TCP_H #define ACE_LACKS_THREAD_PROCESS_SCOPING #define ACE_LACKS_THREAD_STACK_ADDR diff --git a/ace/config-netbsd.h b/ace/config-netbsd.h index 821ab46c4c1..d92e16c32e4 100644 --- a/ace/config-netbsd.h +++ b/ace/config-netbsd.h @@ -51,7 +51,8 @@ #define ACE_HAS_SIGWAIT 1 #define ACE_HAS_SIG_ATOMIC_T 1 #define ACE_HAS_SIG_C_FUNC 1 -#define ACE_HAS_SIN_LEN 1 +#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN 1 #define ACE_HAS_SNPRINTF 1 #define ACE_HAS_SOCKADDR_MSG_NAME 1 #define ACE_HAS_SOCKLEN_T 1 @@ -70,6 +71,7 @@ #define ACE_HAS_SYS_SIGLIST 1 #define ACE_HAS_SYS_SOCKIO_H 1 #define ACE_HAS_SYS_SYSCALL_H 1 +#define ACE_HAS_SYSCTL #define ACE_HAS_TEMPLATE_SPECIALIZATION 1 #define ACE_HAS_TEMPLATE_TYPEDEFS 1 #define ACE_HAS_TERMIOS 1 @@ -80,7 +82,6 @@ #define ACE_HAS_TYPENAME_KEYWORD 1 #define ACE_HAS_UALARM 1 #define ACE_HAS_UCONTEXT_T 1 -#define ACE_HAS_USING_KEYWORD 1 #define ACE_HAS_VOIDPTR_MMAP 1 #define ACE_HAS_VOIDPTR_SOCKOPT 1 #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR 1 diff --git a/ace/config-openbsd.h b/ace/config-openbsd.h index 37c066f3382..ff5de9d77dd 100644 --- a/ace/config-openbsd.h +++ b/ace/config-openbsd.h @@ -97,15 +97,14 @@ // Platform defines struct timespec but not timespec_t #define ACE_LACKS_TIMESPEC_T -#define ACE_LACKS_SYSTIME_H - #define ACE_LACKS_STDINT_H #define ACE_LACKS_STROPTS_H #define ACE_LACKS_WCHAR_H #define ACE_LACKS_STRRECVFD -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN +#define ACE_HAS_SOCKADDR_IN6_SIN6_LEN // Platform supports System V IPC (most versions of UNIX, but not Win32) #define ACE_HAS_SYSV_IPC @@ -177,6 +176,8 @@ // Platform provides <sys/filio.h> header. #define ACE_HAS_SYS_FILIO_H +#define ACE_HAS_SYSCTL + // Platform/compiler supports timezone * as second parameter to gettimeofday(). #define ACE_HAS_TIMEZONE_GETTIMEOFDAY @@ -222,7 +223,7 @@ #endif /* ! ACE_HAD_THREADS */ // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS // OpenBSD actually has the clearerr call, but it causes a // bogus compiler syntax error. diff --git a/ace/config-openvms.h b/ace/config-openvms.h index 759f338f113..2b62888e805 100644 --- a/ace/config-openvms.h +++ b/ace/config-openvms.h @@ -266,10 +266,6 @@ functions.*/ #define ACE_HAS_UALARM 1 /*Platform supports ualarm()*/ -#define ACE_HAS_USING_KEYWORD 1 - /*Compiler supports the new - using keyword for C++ - namespaces.*/ #define ACE_HAS_VOIDPTR_MMAP 1 /*Platform requires void * for mmap().*/ diff --git a/ace/config-osf1-3.2.h b/ace/config-osf1-3.2.h deleted file mode 100644 index b5369247a2d..00000000000 --- a/ace/config-osf1-3.2.h +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - -// The following configuration file is designed to work for OSF1 3.2 -// platforms with the DEC 5.1 C++ compiler. - -#ifndef ACE_CONFIG_H -#define ACE_CONFIG_H -#include /**/ "ace/pre.h" - -#define ACE_LACKS_SETSCHED -#define ACE_LACKS_RWLOCK_T -// DF: this platform uses Digital's CXX compiler -#define DEC_CXX - -// DF: DEC's CXX supports explicit template specialization. -#define ACE_HAS_TEMPLATE_SPECIALIZATION - -// DF: 3.2 has getpgid but no prototype defined anywhere. So we cheat -// and declare it here. -extern "C" pid_t getpgid (pid_t); - -// DF: ACE_HAS_STRING_CLASS seems the right thing to do... -#define ACE_HAS_STRING_CLASS - -// DF: Seems apropriate since this is a new compiler... -#if !defined (__ACE_INLINE__) -# define __ACE_INLINE__ -#endif /* ! __ACE_INLINE__ */ - -#define ACE_HAS_BROKEN_MSG_H -#define ACE_LACKS_SYSV_MSQ_PROTOS - -// Optimize ACE_Handle_Set for select(). -#define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT - -// Platform supports <sys/procfs.h> -#define ACE_HAS_PROC_FS - -#define ACE_HAS_UALARM - -// If ACE doesn't compile due to the lack of these methods, please -// send email to schmidt@cs.wustl.edu reporting this. -// #define ACE_LACKS_CONDATTR_PSHARED -// #define ACE_LACKS_MUTEXATTR_PSHARED - -// Platform lacks support for stack address information -#define ACE_LACKS_THREAD_STACK_ADDR - -// Platform lacks thread process scoping -#define ACE_LACKS_THREAD_PROCESS_SCOPING - -// Platform has non-POSIX setkind and other functions. -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK -#define ACE_HAS_SETKIND_NP - -// Platform supports POSIX.1b clock_gettime () -#define ACE_HAS_CLOCK_GETTIME -#define ACE_HAS_CLOCK_SETTIME - -// Platform defines MAP_FAILED as a long constant. -#define ACE_HAS_LONG_MAP_FAILED - -// Platform's implementation of sendmsg() has a non-const msgheader parameter. -#define ACE_HAS_NONCONST_SENDMSG - -// Platform's implementation of writev() has a non-const iovec parameter. -#define ACE_HAS_NONCONST_WRITEV - -// Platform's implementation of setlrmit() has a non-const rlimit parameter. -#define ACE_HAS_NONCONST_SETRLIMIT - -// Platform supports System V IPC (most versions of UNIX, but not Win32) -#define ACE_HAS_SYSV_IPC - -// Platform supports recvmsg and sendmsg. -#define ACE_HAS_MSG - -// Compiler/platform contains the <sys/syscall.h> file. -#define ACE_HAS_SYS_SYSCALL_H - -// Compiler/platform correctly calls init()/fini(). -#define ACE_HAS_AUTOMATIC_INIT_FINI - -// Prototypes for both signal() and struct sigaction are consistent. -#define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES - -// Compiler/platform has thread-specific storage -#define ACE_HAS_THREAD_SPECIFIC_STORAGE - -// Platform supports C++ headers -#define ACE_HAS_CPLUSPLUS_HEADERS - -// Compiler/platform has the getrusage() system call. -#define ACE_HAS_GETRUSAGE - -// Platform supports the OSF ACE_TLI timod STREAMS module. -#define ACE_HAS_OSF_TIMOD_H - -// Platform supports IP multicast -#define ACE_HAS_IP_MULTICAST - -// Platform contains <poll.h>. -#define ACE_HAS_POLL - -// Platform supports POSIX timers via timestruc_t. -#define ACE_HAS_POSIX_TIME - -// Platform defines struct timespec in <sys/timers.h> -#define ACE_HAS_BROKEN_POSIX_TIME - -// Platform supports POSIX O_NONBLOCK semantics. -#define ACE_HAS_POSIX_NONBLOCK - -#define ACE_LACKS_PTHREAD_THR_SIGSETMASK - -// ACE supports POSIX Pthreads. OSF/1 3.2 has draft 4 -#define ACE_HAS_PTHREADS -#define ACE_HAS_PTHREADS_DRAFT4 -#define ACE_HAS_THREAD_SELF - -// Compiler/platform defines the sig_atomic_t typedef. -#define ACE_HAS_SIG_ATOMIC_T - -// Added 6/13/95, 1 line -#define ACE_HAS_SIGINFO_T -#define ACE_HAS_UCONTEXT_T - -// Compiler/platform has ssize_t. -#define ACE_HAS_SSIZE_T - -// Compiler/platform supports struct strbuf. -#define ACE_HAS_STRBUF_T - -// Platform supports STREAMS. -#define ACE_HAS_STREAMS - -// Platform has 64bit longs and 32bit ints... -#define ACE_SIZEOF_LONG 8 - -// Platform supports STREAM pipes. -// #define ACE_HAS_STREAM_PIPES - -// Compiler/platform supports SVR4 dynamic linking semantics. -#define ACE_HAS_SVR4_DYNAMIC_LINKING - -// Platform support OSF1 gettimeofday -#define ACE_HAS_OSF1_GETTIMEOFDAY - -// Compiler/platform supports SVR4 signal typedef. -#define ACE_HAS_SVR4_SIGNAL_T - -// Compiler/platform has strerror(). -#define ACE_HAS_STRERROR - -// ACE supports threads. -#define ACE_HAS_THREADS - -// Platform supports ACE_TLI tiuser header. -#define ACE_HAS_TIUSER_H - -// Platform supports ACE_TLI timod STREAMS module. -// #define ACE_HAS_TIMOD_H - -// Platform provides ACE_TLI function prototypes. -#define ACE_HAS_TLI_PROTOTYPES - -// Platform supports ACE_TLI. -#define ACE_HAS_TLI - -// Compile using multi-thread libraries. -#if !defined (ACE_MT_SAFE) -# define ACE_MT_SAFE 1 -#endif - -#define ACE_NEEDS_DEV_IO_CONVERSION - -// Defines the page size of the system. -#define ACE_PAGE_SIZE 8192 -#define ACE_HAS_GETPAGESIZE - -#include /**/ "ace/post.h" -#endif /* ACE_CONFIG_H */ diff --git a/ace/config-osf1-4.0.h b/ace/config-osf1-4.0.h index af0b4545ff9..2be213db3af 100644 --- a/ace/config-osf1-4.0.h +++ b/ace/config-osf1-4.0.h @@ -1,13 +1,13 @@ /* -*- C++ -*- */ // $Id$ -// NOTE: if you are using Digital UNIX V4.0f or later, you must +// @note If you are using Digital UNIX V4.0f or later, you must // use config-tru64.h instead of directly using this config file. // The following configuration file is designed to work for the // Digital UNIX V4.0a through V4.0d with either the GNU g++, DEC -// cxx 5.4 and later, Rational RCC (2.4.1) compilers, or KAI 3.3 -// compilers. It is configured to use the IEEE Std 1003.1c-1995, +// cxx 5.4 and later, Rational RCC (2.4.1) compilers/ +// It is configured to use the IEEE Std 1003.1c-1995, // POSIX System Application Program Interface, or DCE threads (with // cxx only); it automatically selects the proper thread interface // depending on whether the cxx -pthread or -threads option was @@ -64,12 +64,13 @@ # define ACE_HAS_STDCPP_STL_INCLUDES # define ACE_HAS_TEMPLATE_SPECIALIZATION # define ACE_HAS_TYPENAME_KEYWORD -# define ACE_HAS_USING_KEYWORD #elif defined (__KCC) # define ACE_HAS_STRING_CLASS # include "ace/config-kcc-common.h" #else -# error unsupported compiler on Digital Unix +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler on Digital Unix +# endif /* __cplusplus */ #endif /* ! __GNUG__ && ! __DECCXX && ! __rational__ && !_KCC */ #if (DIGITAL_UNIX >= 0x400) && (DIGITAL_UNIX < 0x500) @@ -138,6 +139,7 @@ #define ACE_HAS_LONG_MAP_FAILED #define ACE_HAS_MSG #define ACE_HAS_NONCONST_SELECT_TIMEVAL +#define ACE_HAS_NONCONST_SENDMSG #define ACE_HAS_OSF1_GETTIMEOFDAY #define ACE_HAS_OSF_TIMOD_H #define ACE_HAS_POLL diff --git a/ace/config-psos-diab-mips.h b/ace/config-psos-diab-mips.h index 9427fa7962b..8e827eabea3 100644 --- a/ace/config-psos-diab-mips.h +++ b/ace/config-psos-diab-mips.h @@ -34,8 +34,24 @@ #define ACE_USE_RCSID 0 #endif /* #if !defined (ACE_USE_RCSID) */ +#define ACE_LACKS_ENV +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETPGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID + #define ACE_LACKS_ASSERT_MACRO +#define ACE_LACKS_KILL +#define ACE_LACKS_SIGACTION +#define ACE_LACKS_GETOPT +#define ACE_LACKS_SYSCONF #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID #define ACE_LACKS_SIGSET @@ -44,8 +60,13 @@ #define ACE_LACKS_FILELOCKS #define ACE_LACKS_TRUNCATE #define ACE_LACKS_PRAGMA_ONCE +#define ACE_LACKS_SYSTEM #define ACE_NLOGGING #define ACE_NDEBUG +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETHOSTBYADDR +#define ACE_LACKS_GETPROTOBYNAME +#define ACE_LACKS_GETHOSTBYNAME #define ACE_PSOS_LACKS_PREPC @@ -66,6 +87,8 @@ # define ACE_LACKS_TELLDIR # define ACE_LACKS_SEEKDIR # define ACE_LACKS_REWINDDIR +#define ACE_LACKS_SETGID +#define ACE_LACKS_PIPE # define ACE_THREADS_DONT_INHERIT_LOG_MSG @@ -213,8 +236,6 @@ #define ACE_LACKS_UNIX_SIGNALS -// #define ACE_LACKS_SYSTIME_H - // @todo: (dhinton) Not sure about this, but the following was in ace/OS_String.h // #if !defined (ACE_PSOS_DIAB_MIPS) // # include /**/ <stdlib.h> diff --git a/ace/config-psos-diab-ppc.h b/ace/config-psos-diab-ppc.h index a73d96aecdf..213a0193dc4 100644 --- a/ace/config-psos-diab-ppc.h +++ b/ace/config-psos-diab-ppc.h @@ -41,6 +41,31 @@ # define ACE_HAS_EXCEPTIONS #endif /* __GNUG__ */ +#define ACE_LACKS_ENV +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_SETGID +#define ACE_LACKS_PIPE +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETPGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID +#define ACE_LACKS_SYSTEM +#define ACE_LACKS_KILL +#define ACE_LACKS_SIGACTION +#define ACE_LACKS_GETHOSTBYADDR +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETPROTOBYNAME +#define ACE_LACKS_GETHOSTBYNAME + +#define ACE_LACKS_GETOPT +#define ACE_LACKS_SYSCONF #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID #define ACE_PSOS_LACKS_PREPC @@ -226,7 +251,6 @@ #define ACE_THREADS_LACK_SHARED_SOCKETS // #define ACE_MALLOC_ALIGN 8 -// #define ACE_LACKS_SYSTIME_H #define ACE_PAGE_SIZE 4096 diff --git a/ace/config-psos-diab.h b/ace/config-psos-diab.h index f7a4b804164..6e7ba0e87ad 100644 --- a/ace/config-psos-diab.h +++ b/ace/config-psos-diab.h @@ -15,12 +15,17 @@ # undef __ACE_INLINE__ #endif /* __ACE_INLINE__ */ +#define ACE_LACKS_ENV +#define ACE_LACKS_ALARM #define ACE_LACKS_ISATTY #define ACE_LACKS_UMASK #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID #define ACE_LACKS_DIFFTIME #define ACE_LACKS_DUP2 +#define ACE_LACKS_SYSTEM +#define ACE_LACKS_KILL +#define ACE_LACKS_SIGACTION #define ACE_LACKS_FCNTL @@ -36,7 +41,27 @@ # include "ace/config-g++-common.h" #endif /* __GNUG__ */ +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_SETGID +#define ACE_LACKS_PIPE +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETPGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID +#define ACE_LACKS_GETHOSTBYADDR +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETPROTOBYNAME +#define ACE_LACKS_GETHOSTBYNAME + #define ACE_PSOS_LACKS_PREPC +#define ACE_LACKS_SYSCONF #define ACE_PSOS_HAS_TIME @@ -159,6 +184,7 @@ #define ACE_LACKS_LONGLONG_T +#define ACE_LACKS_GETOPT #define ACE_LACKS_LSTAT #define ACE_LACKS_MADVISE @@ -205,8 +231,6 @@ #define ACE_LACKS_UNIX_SIGNALS -// #define ACE_LACKS_SYSTIME_H - #define ACE_PAGE_SIZE 4096 #define ACE_PSOS_CANT_USE_SYS_TYPES diff --git a/ace/config-psos-tm.h b/ace/config-psos-tm.h index 02c510f016d..ae9d9649a98 100644 --- a/ace/config-psos-tm.h +++ b/ace/config-psos-tm.h @@ -19,9 +19,13 @@ # include "ace/config-g++-common.h" #endif /* __GNUG__ */ +#define ACE_LACKS_ENV #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID #define ACE_HAS_STRDUP_EMULATION +#define ACE_LACKS_SYSTEM +#define ACE_LACKS_KILL +#define ACE_LACKS_SIGACTION #define ACE_HAS_IP_MULTICAST @@ -43,14 +47,29 @@ #define ACE_LACKS_HRTIME_T #define ACE_LACKS_UMASK -// #define ACE_LACKS_EVENT_T +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_SETGID +#define ACE_LACKS_PIPE +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETPGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID +#define ACE_LACKS_GETPROTOBYNAME +#define ACE_LACKS_GETHOSTBYNAME #define ACE_HAS_VERBOSE_NOTSUP #define ACE_LACKS_MEMORY_H -// #define ACE_LACKS_MALLOC_H - +#define ACE_LACKS_GETHOSTBYADDR +#define ACE_LACKS_GETPROTOBYNUMBER #define ACE_LACKS_MMAP #define ACE_LACKS_UNIX_DOMAIN_SOCKETS @@ -173,8 +192,8 @@ #define ACE_LACKS_UCONTEXT_H #define ACE_LACKS_UNIX_SIGNALS - -// #define ACE_LACKS_SYSTIME_H +#define ACE_LACKS_SYSCONF +#define ACE_LACKS_GETOPT #define ACE_PAGE_SIZE 4096 diff --git a/ace/config-psosim-g++.h b/ace/config-psosim-g++.h index 703edc1c950..3642dc93460 100644 --- a/ace/config-psosim-g++.h +++ b/ace/config-psosim-g++.h @@ -53,17 +53,21 @@ #endif /* __GNUG__ */ #define ACE_HAS_IP_MULTICAST +#define ACE_LACKS_ENV #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID #define ACE_HAS_CPLUSPLUS_HEADERS - -// #define ACE_LACKS_U_LONG_LONG +#define ACE_LACKS_SYSTEM +#define ACE_LACKS_KILL +#define ACE_LACKS_GETHOSTBYADDR +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETPROTOBYNAME +#define ACE_LACKS_GETHOSTBYNAME #define ACE_LACKS_HRTIME_T -// #define ACE_LACKS_EVENT_T - #define ACE_HAS_VERBOSE_NOTSUP +#define ACE_LACKS_SIGACTION #define ACE_LACKS_MEMORY_H @@ -82,6 +86,20 @@ #define ACE_LACKS_FORK +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_SETGID +#define ACE_LACKS_PIPE +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETPGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID // rename the main entry point #define ACE_MAIN extern "C" void root @@ -217,8 +235,7 @@ #define ACE_LACKS_UNIX_SIGNALS #define ACE_LACKS_UTSNAME_T - -// #define ACE_LACKS_SYSTIME_H +#define ACE_LACKS_UNAME #define ACE_PAGE_SIZE 4096 diff --git a/ace/config-qnx-neutrino.h b/ace/config-qnx-neutrino.h index d041a02cf20..32549c1aa87 100644 --- a/ace/config-qnx-neutrino.h +++ b/ace/config-qnx-neutrino.h @@ -75,7 +75,6 @@ #define ACE_HAS_POSIX_TIME #define ACE_HAS_PTHREADS #define ACE_HAS_PTHREADS_STD -#define ACE_HAS_PTHREAD_SIGMASK #define ACE_HAS_P_READ_WRITE #define ACE_HAS_REENTRANT_FUNCTIONS #define ACE_HAS_SELECT_H @@ -84,7 +83,7 @@ #define ACE_HAS_SIGWAIT #define ACE_HAS_SIG_ATOMIC_T #define ACE_HAS_SIG_MACROS -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_SIZET_SOCKET_LEN #define ACE_HAS_SSIZE_T #define ACE_HAS_STRERROR @@ -120,7 +119,6 @@ #define ACE_LACKS_STREAM_MODULES #define ACE_LACKS_STRRECVFD #define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_SYS_MSG_H #define ACE_LACKS_SYSV_SHMEM #define ACE_LACKS_TCP_NODELAY diff --git a/ace/config-qnx-rtp-62x.h b/ace/config-qnx-rtp-62x.h index 49f31b6cda1..a54bc100225 100644 --- a/ace/config-qnx-rtp-62x.h +++ b/ace/config-qnx-rtp-62x.h @@ -14,6 +14,7 @@ // ACE_HAS Section ///////////////////////////////////////////////////////////////// #define ACE_HAS_2_PARAM_ASCTIME_R_AND_CTIME_R +#define ACE_HAS_3_PARAM_WCSTOK #define ACE_HAS_4_4BSD_SENDMSG_RECVMSG // Although ACE does have alloca() on this compiler/platform combination, it is // disabled by default since it can be dangerous. Uncomment the following line @@ -41,7 +42,6 @@ #define ACE_HAS_POSIX_TIME #define ACE_HAS_PTHREADS #define ACE_HAS_PTHREADS_STD -#define ACE_HAS_PTHREAD_SIGMASK #define ACE_HAS_P_READ_WRITE #define ACE_HAS_REENTRANT_FUNCTIONS #define ACE_HAS_SELECT_H @@ -51,7 +51,7 @@ #define ACE_HAS_SIGWAIT #define ACE_HAS_SIG_ATOMIC_T #define ACE_HAS_SIG_MACROS -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_SNPRINTF #define ACE_HAS_SOCKLEN_T #define ACE_HAS_SSIZE_T @@ -92,7 +92,6 @@ #define ACE_LACKS_STROPTS_H #define ACE_LACKS_STRRECVFD #define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_SYS_MSG_H #define ACE_LACKS_SYSV_SHMEM #define ACE_LACKS_SYS_SHM_H diff --git a/ace/config-qnx-rtp-pre62x.h b/ace/config-qnx-rtp-pre62x.h index 0d3a64cd7f8..46734ef8670 100644 --- a/ace/config-qnx-rtp-pre62x.h +++ b/ace/config-qnx-rtp-pre62x.h @@ -42,7 +42,6 @@ #define ACE_HAS_POSIX_TIME #define ACE_HAS_PTHREADS #define ACE_HAS_PTHREADS_STD -#define ACE_HAS_PTHREAD_SIGMASK #define ACE_HAS_P_READ_WRITE #define ACE_HAS_REENTRANT_FUNCTIONS #define ACE_HAS_SELECT_H @@ -51,7 +50,7 @@ #define ACE_HAS_SIGWAIT #define ACE_HAS_SIG_ATOMIC_T #define ACE_HAS_SIG_MACROS -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN // #define ACE_HAS_SIZET_SOCKET_LEN #define ACE_HAS_SOCKLEN_T #define ACE_HAS_SSIZE_T @@ -96,7 +95,6 @@ #define ACE_LACKS_STREAM_MODULES #define ACE_LACKS_STRRECVFD #define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_SYS_MSG_H #define ACE_LACKS_SYSV_SHMEM //#define ACE_LACKS_TCP_NODELAY // Based on the QNX RTP documentation, this option seems to diff --git a/ace/config-rtems.h b/ace/config-rtems.h index 7917c0c6dfd..81cb8778a8f 100644 --- a/ace/config-rtems.h +++ b/ace/config-rtems.h @@ -38,7 +38,9 @@ # define ACE_CONFIG_INCLUDE_CXX_COMMON # include "ace/config-cxx-common.h" #else /* ! __GNUG__ && ! __KCC && !__DECCXX */ -# error unsupported compiler in ace/config-linux-common.h +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-rtems.h +# endif /* __cplusplus */ #endif /* ! __GNUG__ && ! __KCC */ // Completely common part :-) diff --git a/ace/config-sco-5.0.0-mit-pthread.h b/ace/config-sco-5.0.0-mit-pthread.h index c938cf165cb..55cbe40d5a0 100644 --- a/ace/config-sco-5.0.0-mit-pthread.h +++ b/ace/config-sco-5.0.0-mit-pthread.h @@ -52,7 +52,7 @@ #define ACE_HAS_AUTOMATIC_INIT_FINI // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS // Platform supports recvmsg and sendmsg. #define ACE_HAS_MSG @@ -118,7 +118,6 @@ #define ACE_HAS_SIGINFO_T #define ACE_HAS_UCONTEXT_T -#define ACE_LACKS_SYSTIME_H #define ACE_HAS_INLINED_OSCALLS #define ACE_HAS_STRBUF_T diff --git a/ace/config-sco-5.0.0.h b/ace/config-sco-5.0.0.h index 34687bfb369..c155651a29a 100644 --- a/ace/config-sco-5.0.0.h +++ b/ace/config-sco-5.0.0.h @@ -36,7 +36,7 @@ #define ACE_HAS_AUTOMATIC_INIT_FINI // Platform has POSIX terminal interface. -#define ACE_HAS_TERMIOS +#define ACE_HAS_TERMIOS // Compiler/platform contains the <sys/syscall.h> file. //#define ACE_HAS_SYS_SYSCALL_H @@ -88,7 +88,6 @@ #define ACE_HAS_SIGINFO_T #define ACE_HAS_UCONTEXT_T -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_STRCASECMP // #define ACE_HAS_POSIX_TIME diff --git a/ace/config-sunos4-g++.h b/ace/config-sunos4-g++.h index 29e62b6dc69..76eb7d0e0e5 100644 --- a/ace/config-sunos4-g++.h +++ b/ace/config-sunos4-g++.h @@ -22,7 +22,6 @@ #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_GETPGID #define ACE_LACKS_SETPGID #define ACE_LACKS_SETREGID diff --git a/ace/config-sunos4-sun4.1.4.h b/ace/config-sunos4-sun4.1.4.h index 2783cd42875..ea612d66b70 100644 --- a/ace/config-sunos4-sun4.1.4.h +++ b/ace/config-sunos4-sun4.1.4.h @@ -16,7 +16,6 @@ #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT #define ACE_HAS_CHARPTR_SPRINTF -#define ACE_LACKS_SYSTIME_H #define ACE_HAS_UNION_WAIT // Platform supports System V IPC (most versions of UNIX, but not Win32) diff --git a/ace/config-sunos4-sun4.x.h b/ace/config-sunos4-sun4.x.h index f3ed77a046d..034b6011315 100644 --- a/ace/config-sunos4-sun4.x.h +++ b/ace/config-sunos4-sun4.x.h @@ -8,14 +8,12 @@ #define ACE_CONFIG_H #include /**/ "ace/pre.h" -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_GETPGID #define ACE_LACKS_SETPGID #define ACE_LACKS_SETREGID #define ACE_LACKS_SETREUID #define ACE_HAS_CHARPTR_SPRINTF -// #define ACE_HAS_UNION_WAIT // Maximum compensation (10 ms) for early return from timed ::select (). #if !defined (ACE_TIMER_SKEW) diff --git a/ace/config-sunos5.5.h b/ace/config-sunos5.5.h index 7dbd005d6cf..df0d32c6e0e 100644 --- a/ace/config-sunos5.5.h +++ b/ace/config-sunos5.5.h @@ -38,8 +38,7 @@ // If -compat=4 is turned on, the old 4.2 settings for iostreams are used, // but the newer, explicit instantiation is used (above) # if (__SUNPRO_CC_COMPAT >= 5) -# define ACE_HAS_USING_KEYWORD -# define ACE_HAS_TEMPLATE_TYPEDEFS +# define ACE_HAS_TEMPLATE_TYPEDEFS # define ACE_HAS_STANDARD_CPP_LIBRARY 1 # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 # define ACE_HAS_THR_C_DEST @@ -83,6 +82,29 @@ /* If you want to disable threading with Sun CC, remove -mt from your CFLAGS, e.g., using make threads=0. */ + +// Take advantage of Sun Studio 8 (Sun C++ 5.5) or better symbol +// visibility to generate improved shared library binaries. +# if (__SUNPRO_CC > 0x540) + +# if defined (ACE_HAS_CUSTOM_EXPORT_MACROS) && ACE_HAS_CUSTOM_EXPORT_MACROS == 0 +# undef ACE_HAS_CUSTOM_EXPORT_MACROS +# else +# ifndef ACE_HAS_CUSTOM_EXPORT_MACROS +# define ACE_HAS_CUSTOM_EXPORT_MACROS +# endif /* !ACE_HAS_CUSTOM_EXPORT_MACROS */ +# define ACE_Proper_Export_Flag __symbolic +# define ACE_Proper_Import_Flag __global + +# define ACE_EXPORT_SINGLETON_DECLARATION(T) template class ACE_Proper_Export_Flag T +# define ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) template class ACE_Proper_Export_Flag SINGLETON_TYPE <CLASS, LOCK>; + +// # define ACE_IMPORT_SINGLETON_DECLARATION(T) extern template class T +// # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) extern template class SINGLETON_TYPE<CLASS, LOCK>; + +# endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */ +# endif /* __SUNPRO_CC > 0x540 (> Sun C++ 5.4) */ + #elif defined (__GNUG__) // config-g++-common.h undef's ACE_HAS_STRING_CLASS with -frepo, so // this must appear before its #include. @@ -125,23 +147,21 @@ // IOStream_Test never halts with Green Hills 1.8.9. # define ACE_LACKS_ACE_IOSTREAM -#elif defined (__KCC) /* KAI compiler */ - -# include "ace/config-kcc-common.h" - #else /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ -# error unsupported compiler in ace/config-sunos5.5.h +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler in ace/config-sunos5.5.h +# endif /* __cplusplus */ #endif /* ! __SUNPRO_CC && ! __GNUG__ && ! ghs */ #if !defined (__ACE_INLINE__) -// NOTE: if you have link problems with undefined inline template +// @note If you have link problems with undefined inline template // functions with Sun C++, be sure that the #define of __ACE_INLINE__ // below is not commented out. # define __ACE_INLINE__ #endif /* ! __ACE_INLINE__ */ // Platform supports the POSIX regular expression library. -// NOTE: please comment out the ACE_HAS_REGEX #define if you +// @note Please comment out the ACE_HAS_REGEX #define if you // have link problems with g++ or egcs on SunOS 5.5. #define ACE_HAS_REGEX @@ -258,6 +278,11 @@ // SunOS 5.5.x does not support mkstemp #define ACE_LACKS_MKSTEMP +#define ACE_LACKS_SYS_SYSCTL_H + +#if !(defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4)) +# define ACE_HAS_CHARPTR_SHMDT +#endif // Platform has posix getpwnam_r #if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE - 0 >= 199506L) || \ diff --git a/ace/config-sunos5.6.h b/ace/config-sunos5.6.h index 8a846c577ef..c0904971830 100644 --- a/ace/config-sunos5.6.h +++ b/ace/config-sunos5.6.h @@ -54,9 +54,6 @@ #ifndef ACE_HAS_TYPENAME_KEYWORD #define ACE_HAS_TYPENAME_KEYWORD 1 #endif /* ACE_HAS_TYPENAME_KEYWORD */ -#ifndef ACE_HAS_USING_KEYWORD -#define ACE_HAS_USING_KEYWORD 1 -#endif /* ACE_HAS_USING_KEYWORD */ #ifndef ACE_HAS_THR_C_DEST #define ACE_HAS_THR_C_DEST 1 #endif /* ACE_HAS_THR_C_DEST */ diff --git a/ace/config-sunos5.8.h b/ace/config-sunos5.8.h index 423fb1de7c4..3d87e08d32b 100644 --- a/ace/config-sunos5.8.h +++ b/ace/config-sunos5.8.h @@ -19,6 +19,8 @@ # define ACE_HAS_TIMEZONE #endif +#define ACE_HAS_SENDFILE + // The range of thread priorities for 5.8 differs from 5.7 in the // minimum priority for the SCHED_OTHER policy (i.e., // ACE_THR_PRI_OTHER_MIN) diff --git a/ace/config-tandem-nsk-mips-v2.h b/ace/config-tandem-nsk-mips-v2.h index 814a85ac625..fe35e30ba68 100644 --- a/ace/config-tandem-nsk-mips-v2.h +++ b/ace/config-tandem-nsk-mips-v2.h @@ -28,7 +28,7 @@ // Use all available T1248 thread aware wrapper functions for providing // non-blocking I/O. -// [Note: this causes a significant performance degradation] +// [@note this causes a significant performance degradation] //#define ACE_TANDEM_T1248_PTHREADS_ALL_IO_WRAPPERS @@ -316,9 +316,6 @@ extern int cma_sigwait (sigset_t *); // Platform lacks malloc.h #define ACE_LACKS_MALLOC_H -// <time.h> doesn't automatically #include /**/ <sys/time.h> -#define ACE_LACKS_SYSTIME_H - // Platform lacks the siginfo.h include file #define ACE_LACKS_SIGINFO_H @@ -403,9 +400,6 @@ extern int cma_sigwait (sigset_t *); // Following will not be needed if use standard c library (G06.20 and later) #define ACE_LACKS_SIGNED_CHAR -// Compiler supports the new using keyword for C++ namespaces. -#define ACE_HAS_USING_KEYWORD - //========================================================================= // Build options //========================================================================= diff --git a/ace/config-tandem-nsk-mips-v3.h b/ace/config-tandem-nsk-mips-v3.h index b4a4805b988..c98533aff5d 100644 --- a/ace/config-tandem-nsk-mips-v3.h +++ b/ace/config-tandem-nsk-mips-v3.h @@ -330,9 +330,6 @@ extern int cma_sigwait (sigset_t *); // Platform lacks malloc.h #define ACE_LACKS_MALLOC_H -// <time.h> doesn't automatically #include /**/ <sys/time.h> -#define ACE_LACKS_SYSTIME_H - // Platform lacks the siginfo.h include file #define ACE_LACKS_SIGINFO_H @@ -421,9 +418,6 @@ extern int cma_sigwait (sigset_t *); // Following will not be needed if use standard c library (G06.20 and later) #define ACE_LACKS_SIGNED_CHAR -// Compiler supports the new using keyword for C++ namespaces. -#define ACE_HAS_USING_KEYWORD - // Compiler supports the typename keyword for templates #define ACE_HAS_TYPENAME_KEYWORD diff --git a/ace/config-tandem.h b/ace/config-tandem.h index c74cf133d1e..7b2867a0fda 100644 --- a/ace/config-tandem.h +++ b/ace/config-tandem.h @@ -184,8 +184,6 @@ #define ACE_LACKS_MADVISE //Compiler/platform lacks strcasecmp() (e.g., DG/UX, UNIXWARE, VXWORKS) #define ACE_LACKS_STRCASECMP -//<time.h> doesn't automatically #include /**/ <sys/time.h> -#define ACE_LACKS_SYSTIME_H // Defines the page size of the system. #define ACE_PAGE_SIZE 4096 diff --git a/ace/config-tru64.h b/ace/config-tru64.h index df7e073deee..23af0e4cf8e 100644 --- a/ace/config-tru64.h +++ b/ace/config-tru64.h @@ -27,14 +27,9 @@ Interface wide-character classification.*/ # endif /* DIGITAL_UNIX >= 0x500 */ -# if DIGITAL_UNIX >= 0x40D -# define ACE_LACKS_SYSTIME_H -# endif /* DIGITAL_UNIX >= 0x40D */ # if DIGITAL_UNIX >= 0x40E # define ACE_LACKS_STDINT_H # endif /* DIGITAL_UNIX >= 0x40E */ -#else /* ! DIGITAL_UNIX */ -# include "ace/config-osf1-3.2.h" #endif /* ! DIGITAL_UNIX */ #include /**/ "ace/post.h" diff --git a/ace/config-unixware-2.1.2-g++.h b/ace/config-unixware-2.1.2-g++.h index f4b3960d65e..32536ce3003 100644 --- a/ace/config-unixware-2.1.2-g++.h +++ b/ace/config-unixware-2.1.2-g++.h @@ -25,7 +25,6 @@ // Optimize ACE_Handle_Set for select(). #define ACE_HAS_HANDLE_SET_OPTIMIZED_FOR_SELECT -#define ACE_LACKS_SYSTIME_H // ualarm is only in BSD compatibility lib, but no header is provided // #define ACE_HAS_UALARM #define ACE_HAS_SIZET_SOCKET_LEN diff --git a/ace/config-unixware-7.1.0.h b/ace/config-unixware-7.1.0.h index ea92a0a0393..667b93db8b0 100644 --- a/ace/config-unixware-7.1.0.h +++ b/ace/config-unixware-7.1.0.h @@ -171,9 +171,6 @@ PTHREAD_PROCESS_SHARED values */ #define ACE_HAS_PTHREAD_PROCESS_ENUM 1 -/* Platform has pthread_sigmask() defined. */ -#define ACE_HAS_PTHREAD_SIGMASK 1 - /* Platform will recurse infinitely on thread exits from TSS cleanup routines (e.g., AIX) */ #define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS 1 @@ -209,7 +206,7 @@ #define ACE_HAS_SIG_ATOMIC_T 1 /* Platform supports new BSD inet_addr len field. */ -#define ACE_HAS_SIN_LEN 1 +#define ACE_HAS_SOCKADDR_IN_SIN_LEN 1 /* OS/compiler uses size_t * rather than int * for socket lengths */ #define ACE_HAS_SIZET_SOCKET_LEN 1 @@ -342,9 +339,6 @@ /* Platform needs to #include <sched.h> to get thread scheduling defs. */ #define ACE_NEEDS_SCHED_H 1 -/* <time.h> doesn't automatically #include <sys/time.h> */ -#define ACE_LACKS_SYSTIME_H 1 - /*********************************************************************/ /* Compiler's template mechanim must see source code (i.e., .cpp files). This is used for GNU G++. */ diff --git a/ace/config-unixware-7.1.0.udk.h b/ace/config-unixware-7.1.0.udk.h index 9481dc88a2c..f449152026d 100644 --- a/ace/config-unixware-7.1.0.udk.h +++ b/ace/config-unixware-7.1.0.udk.h @@ -223,9 +223,6 @@ PTHREAD_PROCESS_SHARED values */ #define ACE_HAS_PTHREAD_PROCESS_ENUM -/* Platform has pthread_sigmask() defined. */ -#define ACE_HAS_PTHREAD_SIGMASK - /* Platform will recurse infinitely on thread exits from TSS cleanup routines (e.g., AIX) */ #define ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS @@ -261,7 +258,7 @@ #define ACE_HAS_SIG_ATOMIC_T /* Platform supports new BSD inet_addr len field. */ -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN /* OS/compiler uses size_t * rather than int * for socket lengths */ #define ACE_HAS_SIZET_SOCKET_LEN @@ -366,9 +363,6 @@ /* Compiler supports the C++ typename keyword */ #define ACE_HAS_TYPENAME_KEYWORD 1 -/* Compiler supports the new using keyword for C++ namespaces. */ -#define ACE_HAS_USING_KEYWORD 1 - /* Prints out console message in ACE_NOTSUP. Useful for tracking down origin of ACE_NOTSUP. */ /* #undef ACE_HAS_VERBOSE_NOTSUP */ @@ -417,9 +411,6 @@ /* Platform needs to #include <sched.h> to get thread scheduling defs. */ #define ACE_NEEDS_SCHED_H 1 -/* <time.h> doesn't automatically #include <sys/time.h> */ -#define ACE_LACKS_SYSTIME_H 1 - /* Turns off the LM_DEBUG and LM_ERROR logging macros... */ /* #undef ACE_NLOGGING */ diff --git a/ace/config-vxworks5.x.h b/ace/config-vxworks5.x.h index 1d78f5df97c..146c5d65e86 100644 --- a/ace/config-vxworks5.x.h +++ b/ace/config-vxworks5.x.h @@ -95,12 +95,12 @@ # define ACE_HAS_STANDARD_CPP_LIBRARY 1 # define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 0 -# define ACE_HAS_USING_KEYWORD - # define ACE_TEMPLATES_REQUIRE_SOURCE #else /* ! __GNUG__ && ! ghs && !__DCC__ */ -# error unsupported compiler on VxWorks +# ifdef __cplusplus /* Let it slide for C compilers. */ +# error unsupported compiler on VxWorks +# endif /* __cplusplus */ #endif /* ! __GNUG__ && ! ghs */ // OS-specific configuration @@ -152,6 +152,9 @@ #define ACE_LACKS_FPUTWS #define ACE_LACKS_FSYNC #define ACE_LACKS_GETHOSTENT +#define ACE_LACKS_GETOPT +#define ACE_LACKS_GETPID +#define ACE_LACKS_GETPPID #define ACE_LACKS_GETSERVBYNAME #define ACE_LACKS_KEY_T #define ACE_LACKS_LSTAT @@ -164,6 +167,11 @@ #define ACE_LACKS_MMAP #define ACE_LACKS_MPROTECT #define ACE_LACKS_MSYNC +#define ACE_LACKS_NUMERIC_LIMITS +#define ACE_LACKS_GETPROTOBYNAME +#define ACE_LACKS_GETPROTOBYNUMBER +#define ACE_LACKS_GETHOSTBYADDR +#define ACE_LACKS_GETHOSTBYNAME #define ACE_LACKS_NETDB_REENTRANT_FUNCTIONS #define ACE_LACKS_SYS_PARAM_H #define ACE_LACKS_PWD_FUNCTIONS @@ -182,7 +190,8 @@ #define ACE_LACKS_STRCASECMP #define ACE_LACKS_STRRECVFD #define ACE_LACKS_SYSCALL -#define ACE_LACKS_SYSTIME_H +#define ACE_LACKS_SYSCONF +#define ACE_LACKS_SYS_SYSCTL_H #define ACE_LACKS_SYSV_SHMEM #define ACE_LACKS_TELLDIR #define ACE_LACKS_TEMPNAM @@ -191,11 +200,15 @@ #define ACE_LACKS_UCONTEXT_H #define ACE_LACKS_UMASK #define ACE_LACKS_UTSNAME_T +#define ACE_LACKS_UNAME #define ACE_LACKS_NATIVE_STRPTIME #define ACE_LACKS_WAIT #define ACE_LACKS_WAITPID #define ACE_LACKS_WCTYPE_H #define ACE_LACKS_DUP2 +#define ACE_LACKS_DUP +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_USECONDS_T #define ACE_PAGE_SIZE 4096 #define ACE_THR_PRI_FIFO_DEF 101 #define ACE_THR_PRI_OTHER_DEF ACE_THR_PRI_FIFO_DEF @@ -205,6 +218,21 @@ # define ACE_VXWORKS_SPARE spare4 #endif /* ! ACE_VXWORKS_SPARE */ +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETPGID +#define ACE_LACKS_SETREGID +#define ACE_LACKS_SETREUID +#define ACE_LACKS_SETSID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETGID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_GETUID +#define ACE_LACKS_SETGID +#define ACE_LACKS_GETPGID + +#define ACE_LACKS_PIPE #define ACE_LACKS_STDINT_H #define ACE_LACKS_INTTYPES_H #define ACE_LACKS_UNISTD_H @@ -224,6 +252,7 @@ #define ACE_LACKS_STRINGS_H #define ACE_LACKS_TERMIOS_H #define ACE_LACKS_POLL_H +#define ACE_LACKS_WCTYPE_H // Not sure if these should always be defined. #define ACE_LACKS_SYS_UN_H @@ -252,7 +281,11 @@ #define ACE_LACKS_WCSTOL #define ACE_LACKS_WCSTOUL #define ACE_LACKS_WCSDUP + #define ACE_LACKS_SYMLINKS +#define ACE_LACKS_FGETWC +#define ACE_LACKS_FGETWS +#define ACE_LACKS_FPUTWS // It is possible to enable pthread support with VxWorks, when the user decides // to use this, we need some more defines diff --git a/ace/config-win32-borland.h b/ace/config-win32-borland.h index 6f87f84ffc2..91b81ece8a1 100644 --- a/ace/config-win32-borland.h +++ b/ace/config-win32-borland.h @@ -67,11 +67,20 @@ #define ACE_LACKS_NET_IF_H #define ACE_LACKS_SYS_IPC_H #define ACE_LACKS_SYS_SEM_H -#define ACE_LACKS_STDINT_H -#define ACE_LACKS_DIRENT_H #define ACE_LACKS_SYS_IOCTL_H #define ACE_LACKS_STROPTS_H +#undef ACE_LACKS_STRUCT_DIR +#undef ACE_LACKS_CLOSEDIR +#undef ACE_LACKS_OPENDIR +#undef ACE_LACKS_READDIR +#undef ACE_LACKS_REWINDDIR + +#define ACE_HAS_WOPENDIR +#define ACE_HAS_WCLOSEDIR +#define ACE_HAS_WREADDIR +#define ACE_HAS_WREWINDDIR + #define ACE_LACKS_STRRECVFD #define ACE_USES_EXPLICIT_STD_NAMESPACE @@ -86,8 +95,19 @@ # endif /* !_MT && !ACE_HAS_WINCE */ #endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */ -#if (__BORLANDC__ < 0x570) +#if (__BORLANDC__ < 0x580) # define ACE_LACKS_INTPTR_T +# define ACE_HAS_NONCONST_SWAB +# define ACE_HAS_NONCONST_FDOPEN +#endif + +#define ACE_HAS_NONCONST_TEMPNAM + +// The Borland compiler can't handle assembly in inline methods or +// templates (E2211). When we build for pentium optimized and we are inlining +// then we disable inline assembly +#if defined (ACE_HAS_PENTIUM) && defined(__ACE_INLINE__) +# define ACE_LACKS_INLINE_ASSEMBLY #endif #if (__BORLANDC__ >= 0x600) @@ -104,7 +124,6 @@ # define ACE_STRCASECMP_EQUIVALENT ::stricmp # define ACE_STRNCASECMP_EQUIVALENT ::strnicmp # define ACE_HAS_ITOA 1 -# define ACE_HAS_NONCONST_SWAB #endif #include /**/ "ace/post.h" diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 7b171b5d98d..bc8964d2ab9 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -232,12 +232,23 @@ #define ACE_LACKS_SETREGID #define ACE_LACKS_SETREUID #define ACE_LACKS_SETSID +#define ACE_LACKS_SETEGID +#define ACE_LACKS_SETUID +#define ACE_LACKS_SETEUID +#define ACE_LACKS_GETGID +#define ACE_LACKS_GETEGID +#define ACE_LACKS_GETUID +#define ACE_LACKS_GETEUID +#define ACE_LACKS_SETGID /* LACKS miscellaneous */ +#define ACE_LACKS_ALARM #define ACE_LACKS_ARPA_INET_H #define ACE_LACKS_DUP2 #define ACE_LACKS_FORK #define ACE_LACKS_GETHOSTENT +#define ACE_LACKS_GETOPT +#define ACE_LACKS_KILL #define ACE_LACKS_INET_ATON #define ACE_LACKS_MADVISE #define ACE_LACKS_MKFIFO @@ -247,16 +258,22 @@ #define ACE_LACKS_READLINK #define ACE_LACKS_RLIMIT #define ACE_LACKS_SBRK +#define ACE_LACKS_SCHED_H #define ACE_LACKS_SEMBUF_T #define ACE_LACKS_SIGACTION #define ACE_LACKS_SIGSET #define ACE_LACKS_SOCKETPAIR +#define ACE_LACKS_SUSECONDS_T +#define ACE_LACKS_USECONDS_T #define ACE_LACKS_SYS_PARAM_H +#define ACE_LACKS_SYS_SYSCTL_H +#define ACE_LACKS_SYSCONF #define ACE_LACKS_SYSV_SHMEM #define ACE_LACKS_UNISTD_H #define ACE_LACKS_UNIX_SIGNALS #define ACE_LACKS_UNIX_SYSLOG #define ACE_LACKS_UTSNAME_T +#define ACE_LACKS_UNAME #define ACE_LACKS_WAIT #define ACE_HAS_SNPRINTF diff --git a/ace/config-win32-dmc.h b/ace/config-win32-dmc.h index 3b330431fed..fa623098e74 100644 --- a/ace/config-win32-dmc.h +++ b/ace/config-win32-dmc.h @@ -59,10 +59,8 @@ # define ACE_HAS_TYPENAME_KEYWORD 1 //# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION # define ACE_HAS_USER_MODE_MASKS 1 -# define ACE_HAS_USING_KEYWORD 1 //# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 # define ACE_LACKS_NATIVE_STRPTIME 1 -//# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE 1 //# define ACE_LACKS_PRAGMA_ONCE 1 //# define ACE_NEW_THROWS_EXCEPTIONS 1 # define ACE_SIZEOF_LONG_DOUBLE 10 @@ -94,6 +92,7 @@ #define ACE_LACKS_UNISTD_H #define ACE_LACKS_TERMIOS_H #define ACE_LACKS_ACE_IOSTREAM +#define ACE_HAS_NONCONST_TEMPNAM // Typedefs which we expect DMC to do, but they don't do that typedef long o_uid_t; diff --git a/ace/config-win32-ghs.h b/ace/config-win32-ghs.h index 8d43e1ab9fd..e4c2ef327f4 100644 --- a/ace/config-win32-ghs.h +++ b/ace/config-win32-ghs.h @@ -66,11 +66,9 @@ # define ACE_HAS_TYPENAME_KEYWORD 1 //# define ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION # define ACE_HAS_USER_MODE_MASKS 1 -# define ACE_HAS_USING_KEYWORD 1 # define ACE_LACKS_ACE_IOSTREAM 1 //# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 # define ACE_LACKS_NATIVE_STRPTIME 1 -//# define ACE_LACKS_PLACEMENT_OPERATOR_DELETE 1 //# define ACE_LACKS_PRAGMA_ONCE 1 # define ACE_LACKS_STRRECVFD 1 //# define ACE_NEW_THROWS_EXCEPTIONS 1 diff --git a/ace/config-win32-interix.h b/ace/config-win32-interix.h index 9d9f25ee7a3..53ace409799 100644 --- a/ace/config-win32-interix.h +++ b/ace/config-win32-interix.h @@ -60,10 +60,9 @@ #define ACE_HAS_SVR4_DYNAMIC_LINKING #define ACE_HAS_POSIX_TIME // Supports POSIX timers via struct timespec. #define ACE_LACKS_TIMESPEC_T // Defines struct timespec but not timespec_t. -#define ACE_LACKS_SYSTIME_H #define ACE_LACKS_STRRECVFD #define ACE_LACKS_SETSCHED -#define ACE_HAS_SIN_LEN +#define ACE_HAS_SOCKADDR_IN_SIN_LEN #define ACE_HAS_RTLD_LAZY_V #define ACE_HAS_POSIX_NONBLOCK #define ACE_HAS_GETRUSAGE diff --git a/ace/config-win32-mingw.h b/ace/config-win32-mingw.h index d8675574213..c49dcd97115 100644 --- a/ace/config-win32-mingw.h +++ b/ace/config-win32-mingw.h @@ -81,6 +81,7 @@ #define ACE_LACKS_SYS_SEM_H #define ACE_LACKS_STROPTS_H #define ACE_LACKS_SYS_IOCTL_H +#define ACE_HAS_NONCONST_WCSDUP // We trust the user: He must have used -mpentiumpro or -mpentium // if that is what he wants. diff --git a/ace/config-win32-msvc-6.h b/ace/config-win32-msvc-6.h index 842e7c91b5d..221a4989d43 100644 --- a/ace/config-win32-msvc-6.h +++ b/ace/config-win32-msvc-6.h @@ -44,7 +44,6 @@ // Keywords # define ACE_HAS_TYPENAME_KEYWORD -# define ACE_HAS_USING_KEYWORD // No support for member templates. #define ACE_LACKS_MEMBER_TEMPLATES diff --git a/ace/config-win32-msvc-7.h b/ace/config-win32-msvc-7.h index e1c57096a6a..2fbae1e20aa 100644 --- a/ace/config-win32-msvc-7.h +++ b/ace/config-win32-msvc-7.h @@ -38,11 +38,9 @@ #endif #define ACE_HAS_TYPENAME_KEYWORD -#define ACE_HAS_USING_KEYWORD #define ACE_HAS_ITOA -#define ACE_HAS_BROKEN_IMPLICIT_CONST_CAST #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR #define ACE_ITOA_EQUIVALENT ::_itoa @@ -63,9 +61,7 @@ #define ACE_LACKS_STRRECVFD #define ACE_HAS_CPLUSPLUS_HEADERS -#if (_MSC_VER >= 1310) -# define ACE_HAS_TEMPLATE_TYPEDEFS -#endif +#define ACE_HAS_TEMPLATE_TYPEDEFS #define ACE_TEMPLATES_REQUIRE_SOURCE #define ACE_HAS_TEMPLATE_SPECIALIZATION diff --git a/ace/config-win32-msvc-8.h b/ace/config-win32-msvc-8.h index bdad809bff9..897bf4b44f4 100644 --- a/ace/config-win32-msvc-8.h +++ b/ace/config-win32-msvc-8.h @@ -32,17 +32,10 @@ #define ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB 1 #endif -// Win64 SDK compiler claims std::auto_ptr<>::reset not available. -#if defined (_WIN64) || defined (WIN64) -#define ACE_AUTO_PTR_LACKS_RESET -#endif - #define ACE_HAS_TYPENAME_KEYWORD -#define ACE_HAS_USING_KEYWORD #define ACE_HAS_ITOA -#define ACE_HAS_BROKEN_IMPLICIT_CONST_CAST #define ACE_HAS_WORKING_EXPLICIT_TEMPLATE_DESTRUCTOR #define ACE_ITOA_EQUIVALENT ::_itoa @@ -50,15 +43,13 @@ #define ACE_STRNCASECMP_EQUIVALENT ::_strnicmp #define ACE_WCSDUP_EQUIVALENT ::_wcsdup -//#if defined (_WIN32_WCE) && (_WIN32_WCE < 0x500) -//# define ACE_LACKS_RTTI -//#else -# define ACE_HAS_EXCEPTIONS +#define ACE_HAS_EXCEPTIONS +#define ACE_HAS_NEW_NOTHROW + // Windows Mobile 5 doesn't do sig_atomic_t, but maybe future versions will. # if !defined (_WIN32_WCE) || (_WIN32_WCE > 0x501) # define ACE_HAS_SIG_ATOMIC_T # endif /* !Win CE 5.0 or less */ -//#endif /* _WIN32_WCE && _WIN32_WCE < 500 */ #define ACE_HAS_STRERROR #define ACE_HAS_STRPTIME diff --git a/ace/config-win32-msvc.h b/ace/config-win32-msvc.h index dd280d0cfaf..d9168124756 100644 --- a/ace/config-win32-msvc.h +++ b/ace/config-win32-msvc.h @@ -67,13 +67,10 @@ #if (_MSC_VER >= 1400) # include "ace/config-win32-msvc-8.h" -#elif (_MSC_VER >= 1300) +#elif (_MSC_VER >= 1310) # include "ace/config-win32-msvc-7.h" -// FUZZ: disable check_for_msc_ver -#elif (_MSC_VER >= 1200) -# include "ace/config-win32-msvc-6.h" #else -# error This version of Microsoft Visual C++ not supported. +# error This version of Microsoft Visual C++ is not supported. #endif #if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0) diff --git a/ace/config-win32-visualage.h b/ace/config-win32-visualage.h index cf20e3e2496..1a3ac304e0c 100644 --- a/ace/config-win32-visualage.h +++ b/ace/config-win32-visualage.h @@ -52,7 +52,6 @@ #define ACE_LACKS_MKTEMP #define ACE_HAS_CONSISTENT_SIGNAL_PROTOTYPES #define NSIG 23 /* Maximum no. of signals + 1 */ -#define ACE_HAS_BROKEN_NESTED_TEMPLATES 1 #define ACE_HAS_CPLUSPLUS_HEADERS 1 #define ACE_HAS_EXCEPTIONS 1 #define ACE_HAS_GNU_CSTRING_H 1 @@ -66,7 +65,6 @@ #define ACE_HAS_TEMPLATE_SPECIALIZATION 1 #define ACE_HAS_TEMPLATE_TYPEDEFS 1 #define ACE_HAS_TYPENAME_KEYWORD 1 -#define ACE_HAS_USING_KEYWORD 1 #define ACE_LACKS_ACE_IOSTREAM 1 #define ACE_LACKS_LINEBUFFERED_STREAMBUF 1 #define ACE_LACKS_NATIVE_STRPTIME 1 diff --git a/ace/gethrtime.cpp b/ace/gethrtime.cpp index b242ef2db27..74dbb62b689 100644 --- a/ace/gethrtime.cpp +++ b/ace/gethrtime.cpp @@ -10,12 +10,15 @@ ACE_RCSID(ace, gethrtime, "$Id$") #if defined (ghs) && (defined (i386) || defined(__i386__)) + +#include "ace/OS_NS_time.h" + extern "C" ACE_hrtime_t -ACE_gethrtime (void) +ACE_GETHRTIME_NAME (void) { #if defined (ACE_HAS_PENTIUM) - // ACE_TRACE ("ACE_gethrtime"); + // ACE_TRACE ("ACE_GETHRTIME_NAME"); #if defined (ACE_LACKS_LONGLONG_T) double now; diff --git a/ace/iosfwd.h b/ace/iosfwd.h index 75550a57c16..4da758caa8f 100644 --- a/ace/iosfwd.h +++ b/ace/iosfwd.h @@ -42,10 +42,10 @@ #if defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \ (ACE_HAS_STANDARD_CPP_LIBRARY != 0) -# if !defined (ACE_USES_OLD_IOSTREAMS) +# if !defined (ACE_USES_OLD_IOSTREAMS) # include /**/ <iosfwd> # else - // NOTE: If these forward declarations don't work (e.g. aren't + // @note If these forward declarations don't work (e.g. aren't // portable), we may have to include "ace/streams.h" as a last // resort. Doing so would defeat the purpose of this header, // unfortunately. diff --git a/ace/os_include/os_dirent.h b/ace/os_include/os_dirent.h index 9564634348e..fc2bcb18575 100644 --- a/ace/os_include/os_dirent.h +++ b/ace/os_include/os_dirent.h @@ -27,7 +27,7 @@ #include "ace/os_include/sys/os_types.h" #include "ace/os_include/os_limits.h" -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) # include "ace/os_include/os_unistd.h" // VxWorks needs this to compile #endif /* VXWORKS */ @@ -70,6 +70,8 @@ struct dirent { ACE_TCHAR *d_name; }; +#define ACE_DIRENT dirent + struct ACE_DIR { /// The name of the directory we are looking into ACE_TCHAR *directory_name_; @@ -78,7 +80,7 @@ struct ACE_DIR { HANDLE current_handle_; /// The struct for the results - dirent *dirent_; + ACE_DIRENT *dirent_; /// The struct for intermediate results. ACE_TEXT_WIN32_FIND_DATA fdata_; @@ -97,9 +99,16 @@ struct ACE_DIR /// The directory entry struct dirent dirent; }; + +#define ACE_DIRENT dirent + +#elif defined (ACE_WIN32) && (__BORLANDC__) && defined (ACE_USES_WCHAR) +#define ACE_DIRENT wdirent +typedef wDIR ACE_DIR; #else +#define ACE_DIRENT dirent typedef DIR ACE_DIR; -# endif /* ACE_LACKS_STRUCT_DIR */ +#endif /* ACE_LACKS_STRUCT_DIR */ #if defined rewinddir # undef rewinddir @@ -111,7 +120,7 @@ int scandir (const char *, int (*) (const struct dirent *), int (*) (const void *, const void *)); #endif /* ACE_LACKS_SCANDIR_PROTOTYPE */ - + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/os_dlfcn.h b/ace/os_include/os_dlfcn.h index 91864eae5e0..bda2ca52acc 100644 --- a/ace/os_include/os_dlfcn.h +++ b/ace/os_include/os_dlfcn.h @@ -42,7 +42,7 @@ # endif /* (g++ || HP aC++) vs. HP C++ */ #endif /* __hpux */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && !defined (__RTP__) # include /**/ <loadLib.h> /* for module load */ # include /**/ <unldLib.h> /* for module unload */ # include /**/ <symLib.h> /* for findSymbol */ diff --git a/ace/os_include/os_errno.h b/ace/os_include/os_errno.h index e633a7a4fb9..b55cc024d31 100644 --- a/ace/os_include/os_errno.h +++ b/ace/os_include/os_errno.h @@ -29,9 +29,9 @@ #endif /* !ACE_LACKS_ERRNO_H */ // Needed for VxWorks to pickup errnoSet() -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) #include /**/ <errnoLib.h> -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus diff --git a/ace/os_include/os_fcntl.h b/ace/os_include/os_fcntl.h index 0d456c06043..275d131bb8f 100644 --- a/ace/os_include/os_fcntl.h +++ b/ace/os_include/os_fcntl.h @@ -31,10 +31,10 @@ # include /**/ <fcntl.h> #endif /* !ACE_LACKS_FCNTL_H */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) // for creat(), open() # include /**/ <ioLib.h> -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus diff --git a/ace/os_include/os_limits.h b/ace/os_include/os_limits.h index 27be31af2b4..17dba75622a 100644 --- a/ace/os_include/os_limits.h +++ b/ace/os_include/os_limits.h @@ -35,11 +35,10 @@ # include /**/ <sys/param.h> #endif /* ACE_LACKS_SYS_PARAM_H */ -// On VxWorks _POSIX_TIMER_MAX is defined in time.h, report this to WindRiver -// support. -#if defined (VXWORKS) +// On VxWorks 5.5.1 _POSIX_TIMER_MAX is defined in time.h +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) # include /**/ <time.h> -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus @@ -103,6 +102,12 @@ extern "C" # define ACE_IOV_MAX IOV_MAX #endif /* ACE_IOV_MAX */ +#if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) +# if defined (PIPE_BUF) && (PIPE_BUF == -1) +# undef PIPE_BUF +# endif +#endif /* ACE_VXWORKS == 0x620 */ + #if !defined (PIPE_BUF) # define PIPE_BUF 5120 #endif /* PIPE_BUF */ diff --git a/ace/os_include/os_netdb.h b/ace/os_include/os_netdb.h index fb220a0b518..b02ff121d63 100644 --- a/ace/os_include/os_netdb.h +++ b/ace/os_include/os_netdb.h @@ -39,9 +39,9 @@ # endif /* ACE_HAS_STL_QUEUE_CONFLICT */ #endif /* !ACE_LACKS_NETDB_H */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) # include /**/ <hostLib.h> -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus @@ -49,9 +49,7 @@ extern "C" { #endif /* __cplusplus */ -// VxWorks does define these, at least on a Sun cross compile, so this -// may need to be added back for windows. -#if defined (ACE_PSOS) //|| defined (VXWORKS) +#if defined (ACE_PSOS) struct hostent { char *h_name; /* official name of host */ char **h_aliases; /* alias list */ diff --git a/ace/os_include/os_sched.h b/ace/os_include/os_sched.h index ad5f0b2c4d6..4a536703218 100644 --- a/ace/os_include/os_sched.h +++ b/ace/os_include/os_sched.h @@ -36,6 +36,14 @@ extern "C" { #endif /* __cplusplus */ +#if !defined (__cpu_set_t_defined) || !defined (ACE_HAS_CPU_SET_T) +# define ACE_CPU_SETSIZE 1024 + typedef struct + { + ACE_UINT32 bit_array_[ACE_CPU_SETSIZE / (8 * sizeof (ACE_UINT32))]; + } cpu_set_t; +#endif /* !ACE_HAS_CPU_SET_T || !__cpu_set_t_defined */ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/os_semaphore.h b/ace/os_include/os_semaphore.h index a1905169249..a703c55d368 100644 --- a/ace/os_include/os_semaphore.h +++ b/ace/os_include/os_semaphore.h @@ -58,6 +58,14 @@ extern "C" /// remember if we need to delete <sema_> or not. int new_sema_; # endif /* ACE_LACKS_NAMED_POSIX_SEM */ + +# if !defined (ACE_HAS_POSIX_SEM_TIMEOUT) + /// Serialize access to internal state. + ACE_mutex_t lock_; + + /// Block until there are no waiters. + ACE_cond_t count_nonzero_; +# endif /* !ACE_HAS_POSIX_SEM_TIMEOUT */ } ACE_sema_t; #endif /* ACE_HAS_POSIX_SEM */ diff --git a/ace/os_include/os_signal.h b/ace/os_include/os_signal.h index 058fa57fcb5..a38dcbfe754 100644 --- a/ace/os_include/os_signal.h +++ b/ace/os_include/os_signal.h @@ -48,9 +48,9 @@ # endif /* ACE_LACKS_SIGINFO_H */ #endif /* ACE_HAS_SIGINFO_T */ -#if defined (VXWORKS) && !defined (ACE_HAS_PTHREADS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) && !defined (__RTP__) # include /**/ <sigLib.h> -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ // should this be extern "C" {}? #if defined (CHORUS) diff --git a/ace/os_include/os_stdio.h b/ace/os_include/os_stdio.h index 95ff455e14c..1a977f784d9 100644 --- a/ace/os_include/os_stdio.h +++ b/ace/os_include/os_stdio.h @@ -32,12 +32,15 @@ # include /**/ <stdio.h> #endif /* !ACE_LACKS_STDIO_H */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) // for remove(), rename() # include /**/ <ioLib.h> // for remCurIdGet() # include /**/ <remLib.h> -#endif /* VXWORKS */ +# if defined (__RTP__) && (ACE_VXWORKS == 0x620) +# define L_cuserid _PARM_L_cuserid +# endif +#endif /* ACE_VXWORKS */ // Undefine "functions" that may be implemented as macros. #ifdef fgetc diff --git a/ace/os_include/os_stdlib.h b/ace/os_include/os_stdlib.h index 5bcb77f430c..91324a4f890 100644 --- a/ace/os_include/os_stdlib.h +++ b/ace/os_include/os_stdlib.h @@ -35,7 +35,7 @@ # include /**/ <stdlib.h> #endif /* !ACE_LACKS_STDLIB_H */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && !defined (__RTP__) # include /**/ <envLib.h> #endif /* VXWORKS */ diff --git a/ace/os_include/os_string.h b/ace/os_include/os_string.h index 2af1d2901f8..8fc7d30bb40 100644 --- a/ace/os_include/os_string.h +++ b/ace/os_include/os_string.h @@ -59,7 +59,7 @@ extern "C" char *strtok_r (char *s, const char *delim, char **save_ptr); #endif /* ACE_LACKS_STRTOK_R_PROTOTYPE */ -#if defined (__BORLANDC__) +#if defined (__BORLANDC__) && (__BORLANDC__ < 0x560) # define _stricmp stricmp # define _strnicmp strnicmp #endif /* __BORLANDC__ */ diff --git a/ace/os_include/os_stropts.h b/ace/os_include/os_stropts.h index e28b672f560..b63cf5d964a 100644 --- a/ace/os_include/os_stropts.h +++ b/ace/os_include/os_stropts.h @@ -72,10 +72,10 @@ # endif /* AIX */ #endif /* ACE_HAS_STREAMS */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) // for ioctl() # include /**/ <ioLib.h> -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus diff --git a/ace/os_include/os_time.h b/ace/os_include/os_time.h index 78300ba24be..a6a4fabe69e 100644 --- a/ace/os_include/os_time.h +++ b/ace/os_include/os_time.h @@ -53,6 +53,24 @@ using std::timezone; using std::difftime; # endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ +# if !defined (ACE_HAS_POSIX_TIME) && !defined (ACE_PSOS) +// Definition per POSIX. +typedef struct timespec +{ + /// Seconds + time_t tv_sec; + /// Nanoseconds + long tv_nsec; +} timespec_t; +# elif defined (ACE_HAS_BROKEN_POSIX_TIME) +// OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs +# include /**/ <sys/timers.h> +# endif /* !ACE_HAS_POSIX_TIME */ + +# if defined(ACE_LACKS_TIMESPEC_T) +typedef struct timespec timespec_t; +# endif /* ACE_LACKS_TIMESPEC_T */ + // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus extern "C" diff --git a/ace/os_include/os_unistd.h b/ace/os_include/os_unistd.h index 8a9324cd741..a60a3b18595 100644 --- a/ace/os_include/os_unistd.h +++ b/ace/os_include/os_unistd.h @@ -44,13 +44,15 @@ # include /**/ <unistd.h> #endif /* !ACE_LACKS_UNISTD_H */ -#if defined (VXWORKS) -// for unlink(), close(), read(), write(), lseek(), chdir(), getcwd(), -// getwd(), and isatty() -# include /**/ <ioLib.h> +#if defined (ACE_VXWORKS) +# if !defined (__RTP__) + // for unlink(), close(), read(), write(), lseek(), chdir(), getcwd(), + // getwd(), and isatty() + # include /**/ <ioLib.h> +# endif // for gethostname() # include /**/ <hostLib.h> -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus @@ -134,11 +136,11 @@ extern "C" #endif /* _LARGEFILE64_SOURCE */ #if defined (__BORLANDC__) -# define _chdir chdir -# undef _access -# define _access access # if (__BORLANDC__ <= 0x540) # define _getcwd getcwd +# define _chdir chdir +# undef _access +# define _access access # endif # define _isatty isatty #endif /* __BORLANDC__ */ @@ -169,11 +171,11 @@ extern "C" #if defined (ACE_LACKS_SWAB_PROTOTYPE) void swab(const void *, void *, ssize_t); #endif /* ACE_LACKS_SWAB_PROTOTYPE */ - + #if defined (ACE_LACKS_GETOPT_PROTOTYPE) int getopt(int, char * const [], const char *); #endif /* ACE_LACKS_GETOPT_PROTOTYPE */ - + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/sys/os_mman.h b/ace/os_include/sys/os_mman.h index 6ccb58d548f..fea2f3e5a5e 100644 --- a/ace/os_include/sys/os_mman.h +++ b/ace/os_include/sys/os_mman.h @@ -110,6 +110,10 @@ PAGE_NOCACHE */ # define MS_SYNC 0x0 # endif /* !MS_SYNC */ +#if defined (ACE_LACKS_MADVISE_PROTOTYPE) + int madvise(caddr_t, size_t, int); +#endif + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ace/os_include/sys/os_select.h b/ace/os_include/sys/os_select.h index f8da718e6a9..b2a09b3f34d 100644 --- a/ace/os_include/sys/os_select.h +++ b/ace/os_include/sys/os_select.h @@ -32,7 +32,7 @@ # include /**/ <sys/select.h> #endif /* !ACE_LACKS_SYS_SELECT_H */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && defined (ACE_LACKS_SYS_SELECT_H) # include /**/ <selectLib.h> #endif /* VXWORKS */ diff --git a/ace/os_include/sys/os_socket.h b/ace/os_include/sys/os_socket.h index c2000721289..422ed15dec7 100644 --- a/ace/os_include/sys/os_socket.h +++ b/ace/os_include/sys/os_socket.h @@ -36,7 +36,7 @@ # endif /* ACE_HAS_AIX_BROKEN_SOCKET_HEADER */ #endif /* !ACE_LACKS_SYS_SOCKET_H */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS < 0x620) # include /**/ <sockLib.h> #endif /* VXWORKS */ diff --git a/ace/os_include/sys/os_stat.h b/ace/os_include/sys/os_stat.h index 536d1ce8ff0..605148b3b52 100644 --- a/ace/os_include/sys/os_stat.h +++ b/ace/os_include/sys/os_stat.h @@ -130,8 +130,10 @@ extern "C" # if (__BORLANDC__ <= 0x540) # define _stat stat # endif -# define _umask umask -# define _fstat fstat +# if (__BORLANDC__ < 0x560) +# define _umask umask +# define _fstat fstat +# endif #endif /* __BORLANDC__ */ #if defined (ACE_PSOS_SNARFS_HEADER_INFO) diff --git a/ace/os_include/sys/os_time.h b/ace/os_include/sys/os_time.h index 4fb260bcd7e..7f65f5cb568 100644 --- a/ace/os_include/sys/os_time.h +++ b/ace/os_include/sys/os_time.h @@ -2,7 +2,7 @@ //============================================================================= /** - * @file os_time.h + * @file os_time.h * * time types * @@ -30,6 +30,10 @@ # include /**/ <sys/time.h> #endif /* !ACE_LACKS_SYS_TIME_H */ +#if defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) +# include /**/ <time.h> // VxWorks 6.2 defined timeval in time.h +#endif + // Place all additions (especially function declarations) within extern "C" {} #ifdef __cplusplus extern "C" diff --git a/ace/os_include/sys/os_timeb.h b/ace/os_include/sys/os_timeb.h index c3b3559269b..2495097d344 100644 --- a/ace/os_include/sys/os_timeb.h +++ b/ace/os_include/sys/os_timeb.h @@ -36,7 +36,7 @@ extern "C" { #endif /* __cplusplus */ -#if defined (__BORLANDC__) +#if defined (__BORLANDC__) && (__BORLANDC__ <= 0x560) # define _ftime ftime # define _timeb timeb #endif /* __BORLANDC__ */ diff --git a/ace/os_include/sys/os_types.h b/ace/os_include/sys/os_types.h index da7cb514c75..fcc3610b074 100644 --- a/ace/os_include/sys/os_types.h +++ b/ace/os_include/sys/os_types.h @@ -76,21 +76,25 @@ typedef double ACE_timer_t; typedef unsigned int dev_t; #endif /* ACE_HAS_WINCE */ -/* This should work for linux, solaris 5.6 and above, IRIX, OSF */ -#if defined (ACE_HAS_LLSEEK) || defined (ACE_HAS_LSEEK64) -# if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8 - typedef off_t ACE_LOFF_T; -# elif defined (__sgi) || defined (AIX) || defined (HPUX) \ - || defined (__QNX__) - typedef off64_t ACE_LOFF_T; -# elif defined (__sun) - typedef offset_t ACE_LOFF_T; -# elif defined (WIN32) //Add by Nick Lin -- for win32 llseek - typedef __int64 ACE_LOFF_T; //Add by Nick Lin -- for win32 llseek -# else - typedef loff_t ACE_LOFF_T; -# endif -#endif /* ACE_HAS_LLSEEK || ACE_HAS_LSEEK64 */ +#if defined (ACE_SIZEOF_LONG) && ACE_SIZEOF_LONG == 8 + typedef off_t ACE_LOFF_T; +#elif defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__APPLE__) + typedef off_t ACE_LOFF_T; +#elif defined (__sgi) || defined (AIX) || defined (HPUX) || defined (__QNX__) + typedef off64_t ACE_LOFF_T; +#elif defined (__sun) + typedef offset_t ACE_LOFF_T; +#elif defined (WIN32) + typedef __int64 ACE_LOFF_T; +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x620) + typedef long long ACE_LOFF_T; +#elif defined (ACE_VXWORKS) && (ACE_VXWORKS == 0x551) + typedef long long ACE_LOFF_T; +#elif defined (ACE_LYNXOS_MAJOR) + typedef long long ACE_LOFF_T; +#else + typedef loff_t ACE_LOFF_T; +#endif #if defined (ACE_WIN32) # if !defined (__BORLANDC__) @@ -133,6 +137,14 @@ typedef double ACE_timer_t; typedef int ACE_exitcode; #endif /* ACE_WIN32 */ +#if defined (ACE_LACKS_SUSECONDS_T) + typedef long suseconds_t; +#endif + +#if defined (ACE_LACKS_USECONDS_T) + typedef unsigned long useconds_t; +#endif + #if defined (ACE_WIN32) && !defined(__MINGW32__) typedef long pid_t; #elif defined (ACE_PSOS) && (!defined (ACE_PSOSIM) && defined (ACE_PSOS_CANT_USE_SYS_TYPES)) diff --git a/ace/os_include/sys/os_un.h b/ace/os_include/sys/os_un.h index 1b2e5aca9ef..a9bf2457dc1 100644 --- a/ace/os_include/sys/os_un.h +++ b/ace/os_include/sys/os_un.h @@ -36,12 +36,12 @@ extern "C" { #endif /* __cplusplus */ -#if defined (VXWORKS) +#if defined (ACE_VXWORKS) && (ACE_VXWORKS <= 0x600) struct sockaddr_un { short sun_family; // AF_UNIX. char sun_path[108]; // path name. }; -#endif /* VXWORKS */ +#endif /* ACE_VXWORKS */ #ifdef __cplusplus diff --git a/ace/post.h b/ace/post.h index 748605d7012..e39a3f9fa24 100644 --- a/ace/post.h +++ b/ace/post.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -9,11 +9,9 @@ * @author Christopher Kohlhoff <chris@kohlhoff.com> * * This file restores the original alignment rules. - * */ //============================================================================= - // No header guard #if defined (_MSC_VER) # pragma pack (pop) diff --git a/ace/pre.h b/ace/pre.h index 5645562c8e9..8a7d7774c64 100644 --- a/ace/pre.h +++ b/ace/pre.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -10,11 +10,9 @@ * * This file saves the original alignment rules and changes the alignment * boundary to ACE's default. - * */ //============================================================================= - // No header guard #if defined (_MSC_VER) # pragma warning (disable:4103) diff --git a/ace/svcconf.mpb b/ace/svcconf.mpb index ff8a4a1f017..7627592eb7c 100644 --- a/ace/svcconf.mpb +++ b/ace/svcconf.mpb @@ -14,11 +14,14 @@ feature(ace_svcconf) { Service_Object.cpp Service_Repository.cpp Service_Types.cpp - Service_Templates.cpp Shared_Object.cpp - Svc_Conf_l.cpp + Svc_Conf_Lexer.cpp Svc_Conf_y.cpp - Svc_Conf_Lexer_Guard.cpp + Encoding_Converter.cpp + Encoding_Converter_Factory.cpp + UTF8_Encoding_Converter.cpp + UTF16_Encoding_Converter.cpp + UTF32_Encoding_Converter.cpp XML_Svc_Conf.cpp } @@ -50,55 +53,5 @@ feature(ace_svcconf) { " @echo 'ERROR: You must use bison 1.35 or higher to process this file'" " @/bin/false" "endif" - - "Svc_Conf_l.cpp: Svc_Conf.l" - "ifeq ($(notdir $(LEX)), flex)" - " echo '#define YY_NO_UNPUT' > $@" - " echo >> $@" - " echo '#include \"ace/Object_Manager.h\"' >> $@" - " echo '#include \"ace/Guard_T.h\"' >> $@" - " echo '#include \"ace/Recursive_Thread_Mutex.h\"' >> $@" - " echo '#include \"ace/Synch_Traits.h\"' >> $@" - " echo '#include \"ace/OS_NS_ctype.h\"' >> $@" - " echo '#include \"ace/OS_NS_string.h\"' >> $@" - " $(LEX) -L -t -I Svc_Conf.l >> $@" - " echo '#endif /* ACE_USES_CLASSIC_SVC_CONF = 1 */' >> $@" - " sed -e 's/yy/ace_yy/g' \\" - " -e 's/YY/ACE_YY/g' \\" - " -e 's@#define unput.*@#if (ACE_USES_CLASSIC_SVC_CONF == 1)@' \\" - " -e 's/typedef unsigned char/typedef char/g' \\" - " -e 's/ / /g' \\" - " -e 's/^char /ACE_TCHAR /g' \\" - " -e 's/ char / ACE_TCHAR /g' \\" - " -e 's/(char/(ACE_TCHAR/g' \\" - " -e 's/ NULL/ 0/g' \\" - " -e 's/->ace_yyerrno/->yyerrno/g' \\" - " -e 's/->ace_yylineno/->yylineno/g' \\" - " -e 's/free( ptr );/free( ACE_MALLOC_T (ptr) );/g' \\" - " -e 's/exit(/ACE_OS::exit(/g' \\" - " -e 's/isatty( fileno(file)/ACE_OS::isatty( fileno (file)/g' \\" - " -e 's/int isatty/int nop_isatty/g' \\" - " -e 's/realloc( (ACE_TCHAR \\*) ptr/realloc( (char *) ptr/g' \\" - " -e 's/unsigned ACE_TCHAR/unsigned char/g' \\" - " -e 's/ACE_TCHAR msg\\[\\]/char msg[]/g' \\" - " -e 's/fprintf/ACE_OS::fprintf/g' \\" - " -e 's/if[ ]*([ ]*num_to_read/if ( num_to_read * sizeof (ACE_TCHAR)/g' \\" - " -e 's/b->ace_yy_buf_size + 2/(&) * sizeof (ACE_TCHAR)/g' \\" - " -e 's@= ACE_YY_READ_BUF_SIZE@& / sizeof (ACE_TCHAR)@g' \\" - " -e 's/ace_yy_flex_alloc( n /&* sizeof (ACE_TCHAR)/g' \\" - " -e 's@#include <stdio\.h>@#include \"ace/OS_NS_stdio.h\"@' \\" - " -e 's@#include <unistd\.h>@#include \"ace/OS_NS_unistd.h\"@' \\" - " -e 's@#include <stdlib\.h>@#include \"ace/OS_NS_stdlib.h\"@' \\" - " -e 's@#include <@#include /**/ <@' \\" - " -e 's@ECHO@ACE_SVC_CONF_ECHO@' < $@ > /tmp/$@" - " cp /tmp/$@ $@" - " patch < ../etc/Svc_Conf_l.cpp.diff" - " $(RM) -f /tmp/$@ Svc_Conf_l.cpp.orig" - "else" - " @echo 'ERROR: You must use flex 2.5.4 or higher to process this file'" - " @/bin/false" - "endif" - } - } |