diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-08-14 07:03:12 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2004-08-14 07:03:12 +0000 |
commit | be31abeeb9bd47cea6406f48a12b005e1f81ad78 (patch) | |
tree | bd0d1a3d7e80466e5e8e99720d5dd1495ea99040 | |
parent | 2a2b0abf3e8aa1340381a9270ecabc563e767e8a (diff) | |
download | ATCD-be31abeeb9bd47cea6406f48a12b005e1f81ad78.tar.gz |
ChangeLogTag:Fri Aug 13 23:26:56 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
47 files changed, 869 insertions, 674 deletions
diff --git a/ChangeLog b/ChangeLog index 0635cd1fe78..3a7fc14dfcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,14 +1,91 @@ +Fri Aug 13 23:26:56 2004 Ossama Othman <ossama@dre.vanderbilt.edu> + + * ace/IfThenElse.h: + + New template that allows one to choose between two types at + compile-time based on a boolean value. This is basically the + IfThenElse template described in the book "C++ Templates" by + Vandevoorde and Josuttis. + + * ace/CDR_Base.h (ACE_CDR::Boolean): + + Detect at compile-time whether the C++ "bool" type can be used + as the underlying ACE_CDR::Boolean type using the new + ACE::IfThenElse template. + + * ace/ACE.h: + * ace/Flag_Manip.cpp: + * ace/Flag_Manip.h: + * ace/Flag_Manip.inl: + * ace/Handle_Ops.cpp: + * ace/Handle_Ops.h: + * ace/Init_ACE.cpp: + * ace/Init_ACE.h: + * ace/Lib_Find.cpp: + * ace/Lib_Find.h: + * ace/Sock_Connect.cpp: + * ace/Sock_Connect.h: + + Functions that were in the pseudo "ACE" namespace are now in a + true "ACE" C++ namespace. + + * ace/ACE.inl (log2): + + Use the prefix increment operator when incrementing the loop + index. It is generally more efficient than the postfix + increment operator. + + * ace/Asynch_Acceptor.cpp: + * ace/Asynch_Connector.cpp: + * ace/DEV_Connector.cpp: + * ace/DLL_Manager.cpp: + * ace/FILE_Addr.cpp: + * ace/FILE_Connector.cpp: + * ace/INET_Addr.inl: + * ace/IO_SAP.cpp: + * ace/IPC_SAP.cpp: + * ace/Logging_Strategy.cpp: + * ace/MEM_Acceptor.cpp: + * ace/Memory_Pool.cpp: + * ace/Naming_Context.cpp: + * ace/POSIX_Asynch_IO.cpp: + * ace/POSIX_Proactor.cpp: + * ace/SOCK_Acceptor.cpp: + * ace/SOCK_Dgram.cpp: + * ace/SOCK_Dgram_Mcast.cpp: + * ace/SOCK_SEQPACK_Acceptor.cpp: + * ace/SPIPE_Connector.cpp: + * ace/System_Time.cpp: + * ace/UPIPE_Connector.cpp: + * tests/Enum_Interfaces_Test.cpp: + * tests/FIFO_Test.cpp: + * tests/INET_Addr_Test.cpp: + * tests/INET_Addr_Test_IPV6.cpp: + + Updated all calls to functions that were in the pseudo "ACE" + namespace through a former ACE class base class + (e.g. ACE_Sock_Connect, ACE_Flag_Manip, etc) to use the correct + "ACE" namespace. Use of the base class names should never have + been used since it was known long ago that the "ACE" pseudo + namespace would be changed to true C++ namespace. + + * ace/Basic_Types.h: + * ace/OS_NS_fcntl.inl: + * ace/OS_NS_stdio.h: + * ace/OS_NS_stdlib.h: + + Nuked trailing whitespace. + Sat Aug 14 03:44:02 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> * ace/TSS_T.cpp: - Fixed compilation errors in the SIngleThreaded builds. - + Fixed compilation errors in the SingleThreaded builds. Sat Aug 14 03:37:44 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> * ace/OS_NS_Thread.cpp: - + Fixed a unused variable warning in the daily builds. Sat Aug 14 01:58:32 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> @@ -20,11 +97,11 @@ Sat Aug 14 01:58:32 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> Fri Aug 13 16:17:32 2004 Douglas C. Schmidt <schmidt@cs.wustl.edu> - * ace/Module.h (class ACE_Module): - * ace/Task.h (ACE_Task_Base): + * ace/Module.h (class ACE_Module): + * ace/Task.h (ACE_Task_Base): Updated the documentation so it's more clear. Thanks to Andrew - Athan <aathan-ace-bugs-1524@cloakmail.com> for motivating this. - + Athan <aathan-ace-bugs-1524@cloakmail.com> for motivating this. + * ace/Stream.h: Updated the documentation for push() and pop() to clarify how it affects open() and close() hooks on the tasks. Thanks to Andrew Athan <aathan-ace-bugs-1524@cloakmail.com> for diff --git a/ace/ACE.h b/ace/ACE.h index ac389a9e7f3..c97de84555f 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -46,52 +46,52 @@ class ACE_Handle_Set; # undef log2 #endif /* log2 */ +#if defined (ACE_EXPORT_MACRO) +# undef ACE_EXPORT_MACRO +#endif +#define ACE_EXPORT_MACRO ACE_Export + + /** - * @class ACE + * @namespace ACE * - * @brief Contains value added ACE methods that extend the behavior + * @brief Contains value added ACE functions that extend the behavior * of the UNIX and Win32 OS calls. * - * This class consolidates all these ACE static methods in a + * This namespace consolidates all these ACE static functions in a * single place in order to manage the namespace better. These - * methods are put here rather than in ACE_OS in order to - * separate concerns. + * functions are put here rather than in ACE_OS in order to separate + * concerns. */ -class ACE_Export ACE : public ACE_Flag_Manip, public ACE_Handle_Ops, - public ACE_Lib_Find, public ACE_Init_ACE, - public ACE_Sock_Connect +namespace ACE { - - ACE_CLASS_IS_NAMESPACE (ACE); -public: - // = ACE version information. /// e.g., the "5" in ACE 5.1.12. - static u_int major_version (void); + extern ACE_Export u_int major_version (void); /// e.g., the "1" in ACE 5.1.12. - static u_int minor_version (void); + extern ACE_Export u_int minor_version (void); /// e.g., the "12" in ACE 5.1.12. /// Returns 0 for "stable" (non-beta) releases. - static u_int beta_version (void); + extern ACE_Export u_int beta_version (void); // = C++ compiler version information. /// E.g., the "SunPro C++" in SunPro C++ 4.32.0 - static const ACE_TCHAR * compiler_name (void); + extern ACE_Export const ACE_TCHAR * compiler_name (void); /// E.g., the "4" in SunPro C++ 4.32.0 - static u_int compiler_major_version (void); + extern ACE_Export u_int compiler_major_version (void); /// E.g., the "32" in SunPro C++ 4.32.0 - static u_int compiler_minor_version (void); + extern ACE_Export u_int compiler_minor_version (void); /// E.g., the "0" in SunPro C++ 4.32.0 - static u_int compiler_beta_version (void); + extern ACE_Export u_int compiler_beta_version (void); /// Check if error indicates the process being out of handles (file /// descriptors). - static int out_of_handles (int error); + extern ACE_Export int out_of_handles (int error); /** * @name I/O operations @@ -142,63 +142,68 @@ public: * <write> getting called on non-Win32 platforms. */ //@{ - static ssize_t recv (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); + extern ACE_Export ssize_t recv (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0); #if defined (ACE_HAS_TLI) - static ssize_t t_rcv (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout = 0); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t t_rcv (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout = 0); #endif /* ACE_HAS_TLI */ - static ssize_t recv (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout = 0); - - static ssize_t recvmsg (ACE_HANDLE handle, - struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout = 0); - - static ssize_t recvfrom (ACE_HANDLE handle, - char *buf, - int len, - int flags, - struct sockaddr *addr, - int *addrlen, - const ACE_Time_Value *timeout = 0); - - static ssize_t recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t recv (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t recvmsg (ACE_HANDLE handle, + struct msghdr *msg, + int flags, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t recvfrom (ACE_HANDLE handle, + char *buf, + int len, + int flags, + struct sockaddr *addr, + int *addrlen, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); #if defined (ACE_HAS_TLI) - static ssize_t t_rcv_n (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t t_rcv_n (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); #endif /* ACE_HAS_TLI */ - static ssize_t recv_n (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t recv_n (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); /// Receive into a variable number of pieces. /** @@ -210,166 +215,174 @@ public: * * @return -1 on error, else total number of bytes received. */ - static ssize_t recv (ACE_HANDLE handle, size_t n, ...); - - static ssize_t recvv (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0); - - static ssize_t recvv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - static ssize_t recv_n (ACE_HANDLE handle, - ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - static ssize_t send (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); + extern ACE_Export ssize_t recv (ACE_HANDLE handle, size_t n, ...); + + extern ACE_Export ssize_t recvv (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t recvv_n (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t recv_n (ACE_HANDLE handle, + ACE_Message_Block *message_block, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t send (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0); #if defined (ACE_HAS_TLI) - static ssize_t t_snd (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0); + extern ACE_Export ssize_t t_snd (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0); #endif /* ACE_HAS_TLI */ - static ssize_t send (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0); - - static ssize_t sendmsg (ACE_HANDLE handle, - const struct msghdr *msg, - int flags, - const ACE_Time_Value *timeout = 0); - - static ssize_t sendto (ACE_HANDLE handle, - const char *buf, - int len, - int flags, - const struct sockaddr *addr, - int addrlen, - const ACE_Time_Value *timeout = 0); - - static ssize_t send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); + extern ACE_Export ssize_t send (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t sendmsg (ACE_HANDLE handle, + const struct msghdr *msg, + int flags, + const ACE_Time_Value *timeout = 0); + + extern ACE_Export ssize_t sendto (ACE_HANDLE handle, + const char *buf, + int len, + int flags, + const struct sockaddr *addr, + int addrlen, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); #if defined (ACE_HAS_TLI) - static ssize_t t_snd_n (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t t_snd_n (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); #endif /* ACE_HAS_TLI */ - static ssize_t send_n (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t send_n (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); /// Varargs variant. - static ssize_t send (ACE_HANDLE handle, size_t n, ...); - - static ssize_t sendv (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0); - - static ssize_t sendv_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); - - /// Send all the <message_block>s chained through their <next> and - /// <cont> pointers. This call uses the underlying OS gather-write + extern ACE_Export ssize_t send (ACE_HANDLE handle, size_t n, ...); + + extern ACE_Export ssize_t sendv (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t sendv_n (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + + /// Send all the @a message_blocks chained through their @c next and + /// @c cont pointers. This call uses the underlying OS gather-write /// operation to reduce the domain-crossing penalty. - static ssize_t send_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - const ACE_Time_Value *timeout = 0, - size_t *bytes_transferred = 0); + extern ACE_Export ssize_t send_n (ACE_HANDLE handle, + const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); // = File system I/O functions (these don't support timeouts). - static ssize_t read_n (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred = 0); - - static ssize_t write_n (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred = 0); - - /// Write all the <message_block>s chained through their <next> and - /// <cont> pointers. This call uses the underlying OS gather-write - /// operation to reduce the domain-crossing penalty. - static ssize_t write_n (ACE_HANDLE handle, - const ACE_Message_Block *message_block, - size_t *bytes_transferred = 0); - - static ssize_t readv_n (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bytes_transferred = 0); - - static ssize_t writev_n (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - size_t *bytes_transferred = 0); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t read_n (ACE_HANDLE handle, + void *buf, + size_t len, + size_t *bytes_transferred = 0); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t write_n (ACE_HANDLE handle, + const void *buf, + size_t len, + size_t *bytes_transferred = 0); + + /// Write all the @a message_blocks chained through their @c next + /// and @c cont pointers. This call uses the underlying OS + /// gather-write operation to reduce the domain-crossing penalty. + extern ACE_Export ssize_t write_n (ACE_HANDLE handle, + const ACE_Message_Block *message_block, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t readv_n (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + size_t *bytes_transferred = 0); + + extern ACE_Export ssize_t writev_n (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + size_t *bytes_transferred = 0); //@} /** - * Wait up to <timeout> amount of time to passively establish a - * connection. This method doesn't perform the <accept>, it just - * does the timed wait... + * Wait up to @a timeout amount of time to passively establish a + * connection. This method doesn't perform the @c accept, it just + * does the timed wait. */ - static int handle_timed_accept (ACE_HANDLE listener, - ACE_Time_Value *timeout, - int restart); + extern ACE_Export int handle_timed_accept (ACE_HANDLE listener, + ACE_Time_Value *timeout, + int restart); /** - * Wait up to <timeout> amount of time to complete an actively - * established non-blocking connection. If <is_tli> is non-0 then + * Wait up to @a timeout> amount of time to complete an actively + * established non-blocking connection. If @a is_tli is non-0 then * we are being called by a TLI wrapper (which behaves slightly * differently from a socket wrapper). */ - static ACE_HANDLE handle_timed_complete (ACE_HANDLE listener, - const ACE_Time_Value *timeout, - int is_tli = 0); + extern ACE_Export ACE_HANDLE handle_timed_complete ( + ACE_HANDLE listener, + const ACE_Time_Value *timeout, + int is_tli = 0); /** - * Reset the limit on the number of open handles. If <new_limit> == - * -1 set the limit to the maximum allowable. Otherwise, set it to - * be the value of <new_limit>. + * Reset the limit on the number of open handles. If @a new_limit + * == -1 set the limit to the maximum allowable. Otherwise, set it to + * be the value of @a new_limit. */ - static int set_handle_limit (int new_limit = -1); + extern ACE_Export int set_handle_limit (int new_limit = -1); /** * Returns the maximum number of open handles currently permitted in * this process. This maximum may be extended using - * <ACE::set_handle_limit>. + * @c ACE::set_handle_limit. */ - static int max_handles (void); + extern ACE_Export int max_handles (void); // = String functions #if !defined (ACE_HAS_WINCE) @@ -379,39 +392,39 @@ public: * pointer is allocated with <ACE_OS::malloc> and must be freed by * <ACE_OS::free>. */ - static ACE_TCHAR *strenvdup (const ACE_TCHAR *str); + extern ACE_Export ACE_TCHAR *strenvdup (const ACE_TCHAR *str); #endif /* ACE_HAS_WINCE */ /// Returns a pointer to the "end" of the string, i.e., the character /// past the '\0'. - static const char *strend (const char *s); + extern ACE_Export const char *strend (const char *s); - /// This method is just like <strdup>, except that it uses <operator - /// new> rather than <malloc>. If <s> is NULL returns NULL rather than - /// segfaulting... - static char *strnew (const char *s); + /// This method is just like @c strdup>, except that it uses + /// @c operator @c new rather than @c malloc. If @a s is NULL + /// returns NULL rather than segfaulting. + extern ACE_Export char *strnew (const char *s); - /// Delete the memory allocated by <strnew>. - static void strdelete (char *s); + /// Delete the memory allocated by @c strnew. + extern ACE_Export void strdelete (char *s); - /// Create a fresh new copy of <str>, up to <n> chars long. Uses - /// <ACE_OS::malloc> to allocate the new string. - static char *strndup (const char *str, size_t n); + /// Create a fresh new copy of @a str, up to @a n chars long. Uses + /// @c ACE_OS::malloc to allocate the new string. + extern ACE_Export char *strndup (const char *str, size_t n); - /// Create a fresh new copy of <str>, up to <n> chars long. Uses - /// <ACE_OS::malloc> to allocate the new string. - static char *strnnew (const char *str, size_t n); + /// Create a fresh new copy of @a str, up to @a n chars long. Uses + /// @c ACE_OS::malloc to allocate the new string. + extern ACE_Export char *strnnew (const char *str, size_t n); #if defined (ACE_HAS_WCHAR) - static const wchar_t *strend (const wchar_t *s); + extern ACE_Export const wchar_t *strend (const wchar_t *s); - static wchar_t *strnew (const wchar_t *s); + extern ACE_Export wchar_t *strnew (const wchar_t *s); - static void strdelete (wchar_t *s); + extern ACE_Export void strdelete (wchar_t *s); - static wchar_t *strndup (const wchar_t *str, size_t n); + extern ACE_Export wchar_t *strndup (const wchar_t *str, size_t n); - static wchar_t *strnnew (const wchar_t *str, size_t n); + extern ACE_Export wchar_t *strnnew (const wchar_t *str, size_t n); #endif /* ACE_HAS_WCHAR */ @@ -431,130 +444,135 @@ public: * a ".exe" suffix. The caller is responsible for freeing the * memory using delete []. */ - static const ACE_TCHAR *execname (const ACE_TCHAR *pathname); + extern ACE_Export const ACE_TCHAR *execname (const ACE_TCHAR *pathname); /** - * Returns the "basename" of a <pathname> separated by <delim>. For - * instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when - * <delim> is '/'. + * Returns the "basename" of a @a pathname separated by @a delim. + * For instance, the basename of "/tmp/foo.cpp" is "foo.cpp" when + * @a delim is @a '/'. */ - static const ACE_TCHAR *basename (const ACE_TCHAR *pathname, - ACE_TCHAR delim = - ACE_DIRECTORY_SEPARATOR_CHAR); + extern ACE_Export const ACE_TCHAR *basename (const ACE_TCHAR *pathname, + ACE_TCHAR delim = + ACE_DIRECTORY_SEPARATOR_CHAR); /** - * Returns the "dirname" of a <pathname>. For instance, the dirname - * of "/tmp/foo.cpp" is "/tmp" when <delim> is '/'. If <pathname> - * has no <delim> ".\0" is returned. This method does not modify - * <pathname> and is not reentrant. + * Returns the "dirname" of a @a pathname. For instance, the + * dirname of "/tmp/foo.cpp" is "/tmp" when @a delim is @a '/'. If + * @a pathname has no @a delim ".\0" is returned. This method does + * not modify @a pathname and is not reentrant. */ - static const ACE_TCHAR *dirname (const ACE_TCHAR *pathname, - ACE_TCHAR delim = ACE_DIRECTORY_SEPARATOR_CHAR); + extern ACE_Export const ACE_TCHAR *dirname (const ACE_TCHAR *pathname, + ACE_TCHAR delim = + ACE_DIRECTORY_SEPARATOR_CHAR); /** * Returns the current timestamp in the form * "hour:minute:second:microsecond." The month, day, and year are - * also stored in the beginning of the <date_and_time> array, which - * is a user-supplied array of size <time_len> <ACE_TCHAR>s. Returns - * 0 if unsuccessful, else returns pointer to beginning of the - * "time" portion of <date_and_time>. If - * <return_pointer_to_first_digit> is 0 then return a pointer to the + * also stored in the beginning of the @a date_and_time array, which + * is a user-supplied array of size @a time_len> @c ACE_TCHARs. + * Returns 0 if unsuccessful, else returns pointer to beginning of the + * "time" portion of @a date_and_time. If @a + * return_pointer_to_first_digit is 0 then return a pointer to the * space before the time, else return a pointer to the beginning of * the time portion. */ - static ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[], - int time_len, - int return_pointer_to_first_digit = 0); + extern ACE_Export ACE_TCHAR *timestamp (ACE_TCHAR date_and_time[], + int time_len, + int return_pointer_to_first_digit = + 0); /** - * if <avoid_zombies> == 0 call <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. + * 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. */ - static pid_t fork (const ACE_TCHAR *program_name = ACE_LIB_TEXT ("<unknown>"), - int avoid_zombies = 0); + extern ACE_Export pid_t fork ( + const ACE_TCHAR *program_name = ACE_LIB_TEXT ("<unknown>"), + int avoid_zombies = 0); /** * Become a daemon process using the algorithm in Richard Stevens * "Advanced Programming in the UNIX Environment." If - * <close_all_handles> is non-zero then all open file handles are + * @a close_all_handles is non-zero then all open file handles are * closed. */ - static int daemonize (const ACE_TCHAR pathname[] = ACE_LIB_TEXT ("/"), - int close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES, - const ACE_TCHAR program_name[] = ACE_LIB_TEXT ("<unknown>")); + extern ACE_Export int daemonize ( + const ACE_TCHAR pathname[] = ACE_LIB_TEXT ("/"), + int close_all_handles = ACE_DEFAULT_CLOSE_ALL_HANDLES, + const ACE_TCHAR program_name[] = ACE_LIB_TEXT ("<unknown>")); - // = Miscelleous functions. + // = Miscellaneous functions. /// Rounds the request to a multiple of the page size. - static size_t round_to_pagesize (off_t length); + extern ACE_Export size_t round_to_pagesize (off_t length); /// Rounds the request to a multiple of the allocation granularity. - static size_t round_to_allocation_granularity (off_t len); + extern ACE_Export size_t round_to_allocation_granularity (off_t len); // @@ UNICODE what about buffer? /// Format buffer into printable format. This is useful for /// debugging. - static size_t format_hexdump (const char *buffer, size_t size, - ACE_TCHAR *obuf, size_t obuf_sz); + extern ACE_Export size_t format_hexdump (const char *buffer, size_t size, + ACE_TCHAR *obuf, size_t obuf_sz); /// Computes the hash value of <str> using the "Hash PJW" routine. - static u_long hash_pjw (const char *str); + extern ACE_Export u_long hash_pjw (const char *str); /// Computes the hash value of <str> using the "Hash PJW" routine. - static u_long hash_pjw (const char *str, size_t len); + extern ACE_Export u_long hash_pjw (const char *str, size_t len); #if defined (ACE_HAS_WCHAR) /// Computes the hash value of <str> using the "Hash PJW" routine. - static u_long hash_pjw (const wchar_t *str); + extern ACE_Export u_long hash_pjw (const wchar_t *str); /// Computes the hash value of <str> using the "Hash PJW" routine. - static u_long hash_pjw (const wchar_t *str, size_t len); + extern ACE_Export u_long hash_pjw (const wchar_t *str, size_t len); #endif /* ACE_HAS_WCHAR */ /// Computes the ISO 8802-3 standard 32 bits CRC for the string /// (not for a file). - static u_long crc32 (const char *str); + extern ACE_Export u_long crc32 (const char *str); /// Computes the ISO 8802-3 standard 32 bits CRC for the given /// buffer (the length is included in the CRC). - static u_long crc32 (const char *buf, ACE_UINT32 len); + extern ACE_Export u_long crc32 (const char *buf, ACE_UINT32 len); /// Computes the ISO 8802-3 standard 32 bits CRC for the /// @ len iovec buffers. - static u_long crc32 (iovec *iov, int len); + extern ACE_Export u_long crc32 (iovec *iov, int len); /// Euclid's greatest common divisor algorithm. - static u_long gcd (u_long x, u_long y); + extern ACE_Export u_long gcd (u_long x, u_long y); /// Calculates the minimum enclosing frame size for the given values. - static u_long minimum_frame_size (u_long period1, u_long period2); + extern ACE_Export u_long minimum_frame_size (u_long period1, u_long period2); /** * Function that can burn up noticeable CPU time: brute-force - * determination of whether number "n" is prime. Returns 0 if - * it is prime, or the smallest factor if it is not prime. min_factor - * and max_factor can be used to partition the work among threads. - * For just one thread, typical values are 2 and n/2. + * determination of whether number @a n is prime. Returns 0 if + * it is prime, or the smallest factor if it is not prime. + * @a min_factor and @a max_factor can be used to partition the work + * among threads. For just one thread, typical values are 2 and + * n/2. */ - static u_long is_prime (const u_long n, - const u_long min_factor, - const u_long max_factor); + extern ACE_Export u_long is_prime (const u_long n, + const u_long min_factor, + const u_long max_factor); /// Map troublesome win32 errno values to values that standard C /// strerr function understands. Thank you Microsoft. - static int map_errno (int error); + extern ACE_Export int map_errno (int error); /// Returns a string containing the error message corresponding to a - /// WinSock error. This works around an omission in the Win32 API... - static const ACE_TCHAR *sock_error (int error); + /// WinSock error. This works around an omission in the Win32 API. + extern ACE_Export const ACE_TCHAR * sock_error (int error); /** * Checks if process with <pid> is still alive. Returns 1 if it is * still alive, 0 if it isn't alive, and -1 if something weird * happened. */ - static int process_active (pid_t pid); + extern ACE_Export int process_active (pid_t pid); /** * Terminate the process abruptly with id <pid>. On Win32 platforms @@ -564,7 +582,7 @@ public: * since the process being terminated may not have a chance to * cleanup before it shuts down. */ - static int terminate_process (pid_t pid); + extern ACE_Export int terminate_process (pid_t pid); /** * This method uses process id and object pointer to come up with a @@ -574,214 +592,223 @@ public: * the same process. The uniqueness of this name is therefore only * valid for the life of <object>. */ - static void unique_name (const void *object, - ACE_TCHAR *name, - size_t length); + ACE_NAMESPACE_INLINE_FUNCTION void unique_name (const void *object, + ACE_TCHAR *name, + size_t length); /// Computes the base 2 logarithm of <num>. - static u_long log2 (u_long num); + ACE_NAMESPACE_INLINE_FUNCTION u_long log2 (u_long num); /// Hex conversion utility. - static ACE_TCHAR nibble2hex (u_int n); + ACE_NAMESPACE_INLINE_FUNCTION ACE_TCHAR nibble2hex (u_int n); /// Convert a hex character to its byte representation. - static u_char hex2byte (ACE_TCHAR c); + ACE_NAMESPACE_INLINE_FUNCTION u_char hex2byte (ACE_TCHAR c); // = Set/get the debug level. - static char debug (void); - static void debug (char d); - - /// Wrapper facade for <select> that uses <ACE_Handle_Set>s. - static int select (int width, - ACE_Handle_Set *readfds, - ACE_Handle_Set *writefds = 0, - ACE_Handle_Set *exceptfds = 0, - const ACE_Time_Value *timeout = 0); - - /// Wrapper facade for the most common use of <select> that uses - /// <ACE_Handle_Set>s. - static int select (int width, - ACE_Handle_Set &readfds, - const ACE_Time_Value *timeout = 0); + ACE_NAMESPACE_INLINE_FUNCTION char debug (void); + ACE_NAMESPACE_INLINE_FUNCTION void debug (char d); + + /// Wrapper facade for @c select that uses @c ACE_Handle_Sets. + extern ACE_Export int select (int width, + ACE_Handle_Set *readfds, + ACE_Handle_Set *writefds = 0, + ACE_Handle_Set *exceptfds = 0, + const ACE_Time_Value *timeout = 0); + + /// Wrapper facade for the most common use of @c select that uses + /// @c ACE_Handle_Sets. + extern ACE_Export int select (int width, + ACE_Handle_Set &readfds, + const ACE_Time_Value *timeout = 0); /// Timed wait for handle to get read ready. - static int handle_read_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); + ACE_NAMESPACE_INLINE_FUNCTION + int handle_read_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout); /// Timed wait for handle to get write ready. - static int handle_write_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); + ACE_NAMESPACE_INLINE_FUNCTION + int handle_write_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout); /// Timed wait for handle to get exception ready. - static int handle_exception_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout); + ACE_NAMESPACE_INLINE_FUNCTION + int handle_exception_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout); /// Timed wait for handle to get read, write, or exception ready. - static int handle_ready (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int read_ready, - int write_ready, - int exception_ready); - - /// Wait for <timeout> before proceeding to a <recv> operation. - /// <val> keeps track of whether we're in non-blocking mode or not. - static int enter_recv_timedwait (ACE_HANDLE handle, - const ACE_Time_Value *timeout, - int &val); - - /// Wait for <timeout> before proceeding to a <send> operation. - /// <val> keeps track of whether we're in non-blocking mode or not. - static int enter_send_timedwait (ACE_HANDLE handle, - const ACE_Time_Value* timeout, - int &val); - - /// This makes sure that <handle> is set into non-blocking mode. - /// <val> keeps track of whether were in non-blocking mode or not. - static void record_and_set_non_blocking_mode (ACE_HANDLE handle, - int &val); + extern ACE_Export int handle_ready (ACE_HANDLE handle, + const ACE_Time_Value *timeout, + int read_ready, + int write_ready, + int exception_ready); + + /// Wait for @a timeout before proceeding to a @c recv operation. + /// @a val keeps track of whether we're in non-blocking mode or + /// not. + extern ACE_Export int enter_recv_timedwait (ACE_HANDLE handle, + const ACE_Time_Value *timeout, + int &val); + + /// Wait for @a timeout before proceeding to a @c send operation. + /// @a val keeps track of whether we're in non-blocking mode or + /// not. + extern ACE_Export int enter_send_timedwait (ACE_HANDLE handle, + const ACE_Time_Value* timeout, + int &val); + + /// This makes sure that @a handle is set into non-blocking mode. + /// @a val keeps track of whether were in non-blocking mode or not. + extern ACE_Export void record_and_set_non_blocking_mode (ACE_HANDLE handle, + int &val); /// Cleanup after a timed operation, restore the appropriate - /// non-blocking status of <handle>. - static void restore_non_blocking_mode (ACE_HANDLE handle, - int val); + /// non-blocking status of @a handle. + extern ACE_Export void restore_non_blocking_mode (ACE_HANDLE handle, + int val); -private: + // private: + // These functions aren't meant to be used internally, so they are + // not exported. // // = Recv_n helpers // - static ssize_t recv_i (ACE_HANDLE handle, - void *buf, - size_t len); + ACE_NAMESPACE_INLINE_FUNCTION ssize_t recv_i (ACE_HANDLE handle, + void *buf, + size_t len); - static ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - size_t *bytes_transferred); + ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + size_t *bytes_transferred); - static ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); #if defined (ACE_HAS_TLI) - static ssize_t t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - size_t *bytes_transferred); - - static ssize_t t_rcv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - int *flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t t_rcv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + size_t *bytes_transferred); + + ACE_NAMESPACE_INLINE_FUNCTION + ssize_t t_rcv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + int *flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); #endif /* ACE_HAS_TLI */ - static ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - size_t *bytes_transferred); + ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + size_t *bytes_transferred); - static ssize_t recv_n_i (ACE_HANDLE handle, - void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ssize_t recv_n_i (ACE_HANDLE handle, + void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); - static ssize_t recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - size_t *bytes_transferred); + ssize_t recvv_n_i (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + size_t *bytes_transferred); - static ssize_t recvv_n_i (ACE_HANDLE handle, - iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ssize_t recvv_n_i (ACE_HANDLE handle, + iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); // // = Send_n helpers // - static ssize_t send_i (ACE_HANDLE handle, - const void *buf, - size_t len); + ACE_NAMESPACE_INLINE_FUNCTION ssize_t send_i (ACE_HANDLE handle, + const void *buf, + size_t len); - static ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bytes_transferred); + ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + size_t *bytes_transferred); - static ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); #if defined (ACE_HAS_TLI) - static ssize_t t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - size_t *bytes_transferred); + ssize_t t_snd_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + size_t *bytes_transferred); - static ssize_t t_snd_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - int flags, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ssize_t t_snd_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + int flags, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); #endif /* ACE_HAS_TLI */ - static ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - size_t *bytes_transferred); + ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + size_t *bytes_transferred); - static ssize_t send_n_i (ACE_HANDLE handle, - const void *buf, - size_t len, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ssize_t send_n_i (ACE_HANDLE handle, + const void *buf, + size_t len, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); - static ssize_t sendv_n_i (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - size_t *bytes_transferred); + ssize_t sendv_n_i (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + size_t *bytes_transferred); - static ssize_t sendv_n_i (ACE_HANDLE handle, - const iovec *iov, - int iovcnt, - const ACE_Time_Value *timeout, - size_t *bytes_transferred); + ssize_t sendv_n_i (ACE_HANDLE handle, + const iovec *iov, + int iovcnt, + const ACE_Time_Value *timeout, + size_t *bytes_transferred); /// Size of a VM page. - static size_t pagesize_; + extern size_t pagesize_; /// Size of allocation granularity. - static size_t allocation_granularity_; + extern size_t allocation_granularity_; /// CRC table. - static u_long crc_table_[]; + extern unsigned long crc_table_[]; /// Hex characters. - static const ACE_TCHAR hex_chars_[]; + extern const ACE_TCHAR hex_chars_[]; /// Are we debugging ACE? - static char debug_; -}; + extern char debug_; +} #if defined (__ACE_INLINE__) #include "ace/ACE.inl" diff --git a/ace/ACE.inl b/ace/ACE.inl index 9e28d4ea321..722363549f0 100644 --- a/ace/ACE.inl +++ b/ace/ACE.inl @@ -278,9 +278,7 @@ ACE::log2 (u_long num) { u_long log = 0; - for (; - num > 0; - log++) + for (; num > 0; ++log) num >>= 1; return log; diff --git a/ace/Asynch_Acceptor.cpp b/ace/Asynch_Acceptor.cpp index 719af603aa1..4a310f2a215 100644 --- a/ace/Asynch_Acceptor.cpp +++ b/ace/Asynch_Acceptor.cpp @@ -109,7 +109,7 @@ ACE_Asynch_Acceptor<HANDLER>::open (const ACE_INET_Addr &address, static ACE_INET_Addr sa (ACE_sap_any_cast (const ACE_INET_Addr &)); if (address == sa && - ACE_Sock_Connect::bind_port (this->listen_handle_, + ACE::bind_port (this->listen_handle_, INADDR_ANY, address.get_type()) == -1) { diff --git a/ace/Asynch_Connector.cpp b/ace/Asynch_Connector.cpp index 927a70e6aa8..e13bdc6bfa7 100644 --- a/ace/Asynch_Connector.cpp +++ b/ace/Asynch_Connector.cpp @@ -96,7 +96,7 @@ ACE_Asynch_Connector<HANDLER>::handle_connect (const ACE_Asynch_Connect::Result // set blocking mode if (!error && - ACE_Flag_Manip::clr_flags + ACE::clr_flags (result.connect_handle (), ACE_NONBLOCK) != 0) { error = 1; diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index e55ef5e933f..21922c008af 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -559,17 +559,17 @@ typedef ptrdiff_t ptr_arith_t; # endif /* ! ACE_WIN32 && ! ACE_LACKS_LONGLONG_T */ #if !defined (ACE_UINT64_FORMAT_SPECIFIER) -# if ACE_SIZEOF_LONG == 8 -# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") -# else +# if ACE_SIZEOF_LONG == 8 +# define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lu") +# else # define ACE_UINT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%llu") # endif /* ACE_SIZEOF_LONG == 8*/ #endif /* ACE_UINT64_FORMAT_SPECIFIER */ #if !defined (ACE_INT64_FORMAT_SPECIFIER) -# if ACE_SIZEOF_LONG == 8 -# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld") -# else +# if ACE_SIZEOF_LONG == 8 +# define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%ld") +# else # define ACE_INT64_FORMAT_SPECIFIER ACE_LIB_TEXT ("%lld") # endif /* ACE_SIZEOF_LONG == 8 */ #endif /* ACE_INT64_FORMAT_SPECIFIER */ diff --git a/ace/CDR_Base.h b/ace/CDR_Base.h index 22192c25f15..c2635e56929 100644 --- a/ace/CDR_Base.h +++ b/ace/CDR_Base.h @@ -38,6 +38,7 @@ #include "ace/Basic_Types.h" #include "ace/Default_Constants.h" +#include "ace/IfThenElse.h" class ACE_Message_Block; @@ -165,8 +166,9 @@ public: * avoid complaints from all compilers is to define them all. */ //@{ - - typedef unsigned char Boolean; + typedef ACE::IfThenElse<sizeof (bool) == 1, + bool, + unsigned char>::result_type Boolean; typedef unsigned char Octet; typedef char Char; typedef ACE_WCHAR_T WChar; diff --git a/ace/DEV_Connector.cpp b/ace/DEV_Connector.cpp index 3bb63a3aae1..48ada1e9b8b 100644 --- a/ace/DEV_Connector.cpp +++ b/ace/DEV_Connector.cpp @@ -37,7 +37,7 @@ ACE_DEV_Connector::connect (ACE_DEV_IO &new_io, { ACE_TRACE ("ACE_DEV_Connector::connect"); - ACE_HANDLE handle = ACE_Handle_Ops::handle_timed_open (timeout, + ACE_HANDLE handle = ACE::handle_timed_open (timeout, remote_sap.get_path_name (), flags, perms); new_io.set_handle (handle); diff --git a/ace/DLL_Manager.cpp b/ace/DLL_Manager.cpp index 204d1f5ebb9..89fadcd2ceb 100644 --- a/ace/DLL_Manager.cpp +++ b/ace/DLL_Manager.cpp @@ -91,7 +91,7 @@ ACE_DLL_Handle::open (const ACE_TCHAR *dll_name, // Transform the pathname into the appropriate dynamic link library // by searching the ACE_LD_SEARCH_PATH. - ACE_Lib_Find::ldfind (dll_name, + ACE::ldfind (dll_name, dll_pathname, (sizeof dll_pathname / sizeof (ACE_TCHAR))); @@ -193,7 +193,7 @@ ACE_DLL_Handle::symbol (const ACE_TCHAR *sym_name, int ignore_errors) ACE_TRACE ("ACE_DLL_Handle::symbol"); ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, 0)); - ACE_Auto_Array_Ptr <ACE_TCHAR> auto_name (ACE_Lib_Find::ldname (sym_name)); + ACE_Auto_Array_Ptr <ACE_TCHAR> auto_name (ACE::ldname (sym_name)); // handle_ can be invalid especially when ACE_DLL_Handle resigned ownership // BTW. Handle lifecycle management is a little crazy in ACE if ( this->handle_ != ACE_SHLIB_INVALID_HANDLE ) diff --git a/ace/FILE_Addr.cpp b/ace/FILE_Addr.cpp index 5109e375253..8a44c0757c5 100644 --- a/ace/FILE_Addr.cpp +++ b/ace/FILE_Addr.cpp @@ -31,7 +31,7 @@ ACE_FILE_Addr::set (const ACE_FILE_Addr &sa) ACE_OS::strcpy (this->filename_, ACE_DEFAULT_TEMP_FILE); #else /* ACE_DEFAULT_TEMP_FILE */ - if (ACE_Lib_Find::get_temp_dir (this->filename_, + if (ACE::get_temp_dir (this->filename_, MAXPATHLEN - 15) == -1) // -15 for ace-file-XXXXXX { diff --git a/ace/FILE_Connector.cpp b/ace/FILE_Connector.cpp index 665deb3c077..677f2bc4c2b 100644 --- a/ace/FILE_Connector.cpp +++ b/ace/FILE_Connector.cpp @@ -76,7 +76,7 @@ ACE_FILE_Connector::connect (ACE_FILE_IO &new_io, else new_io.addr_ = remote_sap; // class copy. - handle = ACE_Handle_Ops::handle_timed_open (timeout, + handle = ACE::handle_timed_open (timeout, new_io.addr_.get_path_name (), flags, perms); diff --git a/ace/Flag_Manip.cpp b/ace/Flag_Manip.cpp index fcd7fa450a5..50df345d56a 100644 --- a/ace/Flag_Manip.cpp +++ b/ace/Flag_Manip.cpp @@ -15,14 +15,16 @@ # include "ace/os_include/os_termios.h" #endif /* CYGWIN32 */ -ACE_RCSID(ace, Flag_Manip, "$Id$") +ACE_RCSID (ace, + Flag_Manip, + "$Id$") // Flags are file status flags to turn on. int -ACE_Flag_Manip::set_flags (ACE_HANDLE handle, int flags) +ACE::set_flags (ACE_HANDLE handle, int flags) { - ACE_TRACE ("ACE_Flag_Manip::set_flags"); + ACE_TRACE ("ACE::set_flags"); #if defined (ACE_WIN32) || defined (VXWORKS) || defined (ACE_LACKS_FCNTL) switch (flags) { @@ -55,9 +57,9 @@ ACE_Flag_Manip::set_flags (ACE_HANDLE handle, int flags) // Flags are the file status flags to turn off. int -ACE_Flag_Manip::clr_flags (ACE_HANDLE handle, int flags) +ACE::clr_flags (ACE_HANDLE handle, int flags) { - ACE_TRACE ("ACE_Flag_Manip::clr_flags"); + ACE_TRACE ("ACE::clr_flags"); #if defined (ACE_WIN32) || defined (VXWORKS) || defined (ACE_LACKS_FCNTL) switch (flags) diff --git a/ace/Flag_Manip.h b/ace/Flag_Manip.h index 5357a798a5f..28646f98350 100644 --- a/ace/Flag_Manip.h +++ b/ace/Flag_Manip.h @@ -26,22 +26,26 @@ #include "ace/Global_Macros.h" #include "ace/os_include/os_fcntl.h" /* For values passed to these methods */ -class ACE_Export ACE_Flag_Manip -{ - public: +#if defined (ACE_EXPORT_MACRO) +# undef ACE_EXPORT_MACRO +#endif +#define ACE_EXPORT_MACRO ACE_Export + +namespace ACE +{ // = Set/get/clear various flags related to I/O HANDLE. - /// Set flags associated with <handle>. - static int set_flags (ACE_HANDLE handle, - int flags); + /// Set flags associated with @a handle. + extern ACE_Export int set_flags (ACE_HANDLE handle, + int flags); - /// Clear flags associated with <handle>. - static int clr_flags (ACE_HANDLE handle, - int flags); + /// Clear flags associated with @a handle. + extern ACE_Export int clr_flags (ACE_HANDLE handle, + int flags); - /// Return the current setting of flags associated with <handle>. - static int get_flags (ACE_HANDLE handle); -}; + /// Return the current setting of flags associated with @a handle. + ACE_NAMESPACE_INLINE_FUNCTION int get_flags (ACE_HANDLE handle); +} #if defined (__ACE_INLINE__) #include "ace/Flag_Manip.inl" diff --git a/ace/Flag_Manip.inl b/ace/Flag_Manip.inl index 3eb4b236023..0009be56695 100644 --- a/ace/Flag_Manip.inl +++ b/ace/Flag_Manip.inl @@ -6,9 +6,9 @@ #include "ace/OS_NS_fcntl.h" ACE_INLINE int -ACE_Flag_Manip::get_flags (ACE_HANDLE handle) +ACE::get_flags (ACE_HANDLE handle) { - ACE_TRACE ("ACE_Flag_Manip::get_flags"); + ACE_TRACE ("ACE::get_flags"); #if defined (ACE_LACKS_FCNTL) // ACE_OS::fcntl is not supported, e.g., on VxWorks. It diff --git a/ace/Handle_Ops.cpp b/ace/Handle_Ops.cpp index e58ebfb6f26..eb373af8020 100644 --- a/ace/Handle_Ops.cpp +++ b/ace/Handle_Ops.cpp @@ -6,16 +6,18 @@ #include "ace/OS_NS_fcntl.h" #include "ace/Time_Value.h" -ACE_RCSID(ace, Handle_Ops, "$Id$") +ACE_RCSID (ace, + Handle_Ops, + "$Id$") ACE_HANDLE -ACE_Handle_Ops::handle_timed_open (ACE_Time_Value *timeout, - const ACE_TCHAR *name, - int flags, - int perms, - LPSECURITY_ATTRIBUTES sa) +ACE::handle_timed_open (ACE_Time_Value *timeout, + const ACE_TCHAR *name, + int flags, + int perms, + LPSECURITY_ATTRIBUTES sa) { - ACE_TRACE ("ACE_Handle_Ops::handle_timed_open"); + ACE_TRACE ("ACE::handle_timed_open"); if (timeout != 0) { diff --git a/ace/Handle_Ops.h b/ace/Handle_Ops.h index 66bdf4dfa34..7f50eba8270 100644 --- a/ace/Handle_Ops.h +++ b/ace/Handle_Ops.h @@ -6,8 +6,7 @@ * * $Id$ * - * This class consolidates the operations on the Handles. - * + * This class consolidates the operations on the Handles. * * @author Priyanka Gontla <pgontla@ece.uci.edu> */ @@ -28,22 +27,21 @@ class ACE_Time_Value; -class ACE_Export ACE_Handle_Ops +// = Operations on HANDLEs. +namespace ACE { -public: - // = Operations on HANDLEs. - /** - * Wait up to <timeout> amount of time to actively open a device. - * This method doesn't perform the <connect>, it just does the timed - * wait... + * Wait up to @a timeout> amount of time to actively open a device. + * This method doesn't perform the @c connect, it just does the + * timed wait. */ - static ACE_HANDLE handle_timed_open (ACE_Time_Value *timeout, - const ACE_TCHAR *name, - int flags, - int perms, - LPSECURITY_ATTRIBUTES sa = 0); -}; + extern ACE_Export ACE_HANDLE handle_timed_open ( + ACE_Time_Value *timeout, + const ACE_TCHAR *name, + int flags, + int perms, + LPSECURITY_ATTRIBUTES sa = 0); +} #include /**/ "ace/post.h" diff --git a/ace/INET_Addr.inl b/ace/INET_Addr.inl index 2f1b4f6c968..41743b5ae7f 100644 --- a/ace/INET_Addr.inl +++ b/ace/INET_Addr.inl @@ -30,7 +30,7 @@ ACE_INET_Addr::determine_type (void) const { #if defined (ACE_HAS_IPV6) # if defined (ACE_USES_IPV4_IPV6_MIGRATION) - return ACE_Sock_Connect::ipv6_enabled () ? AF_INET6 : AF_INET; + return ACE::ipv6_enabled () ? AF_INET6 : AF_INET; # else return AF_INET6; # endif /* ACE_USES_IPV4_IPV6_MIGRATION */ diff --git a/ace/IO_SAP.cpp b/ace/IO_SAP.cpp index 1a92cb8ad66..295b88c9698 100644 --- a/ace/IO_SAP.cpp +++ b/ace/IO_SAP.cpp @@ -72,7 +72,7 @@ ACE_IO_SAP::enable (int value) const if (ACE_OS::fcntl (this->handle_, F_SETOWN, ACE_IO_SAP::pid_) == -1 - || ACE_Flag_Manip::set_flags (this->handle_, + || ACE::set_flags (this->handle_, FASYNC) == -1) return -1; break; @@ -83,7 +83,7 @@ ACE_IO_SAP::enable (int value) const ACE_NOTSUP_RETURN (-1); #endif /* SIGIO <== */ case ACE_NONBLOCK: - if (ACE_Flag_Manip::set_flags (this->handle_, + if (ACE::set_flags (this->handle_, ACE_NONBLOCK) == -1) return -1; break; @@ -124,7 +124,7 @@ ACE_IO_SAP::disable (int value) const if (ACE_OS::fcntl (this->handle_, F_SETOWN, 0) == -1 - || ACE_Flag_Manip::clr_flags (this->handle_, FASYNC) == -1) + || ACE::clr_flags (this->handle_, FASYNC) == -1) return -1; break; #else @@ -134,7 +134,7 @@ ACE_IO_SAP::disable (int value) const ACE_NOTSUP_RETURN (-1); #endif /* SIGIO <== */ case ACE_NONBLOCK: - if (ACE_Flag_Manip::clr_flags (this->handle_, + if (ACE::clr_flags (this->handle_, ACE_NONBLOCK) == -1) return -1; break; diff --git a/ace/IPC_SAP.cpp b/ace/IPC_SAP.cpp index 7bf4b6f0110..a67e8a2bd95 100644 --- a/ace/IPC_SAP.cpp +++ b/ace/IPC_SAP.cpp @@ -86,7 +86,7 @@ ACE_IPC_SAP::enable (int value) const if (ACE_OS::fcntl (this->handle_, F_SETOWN, ACE_IPC_SAP::pid_) == -1 - || ACE_Flag_Manip::set_flags (this->handle_, + || ACE::set_flags (this->handle_, FASYNC) == -1) return -1; break; @@ -104,7 +104,7 @@ ACE_IPC_SAP::enable (int value) const break; #endif /* F_SETFD */ case ACE_NONBLOCK: - if (ACE_Flag_Manip::set_flags (this->handle_, + if (ACE::set_flags (this->handle_, ACE_NONBLOCK) == ACE_INVALID_HANDLE) return -1; break; @@ -158,7 +158,7 @@ ACE_IPC_SAP::disable (int value) const if (ACE_OS::fcntl (this->handle_, F_SETOWN, 0) == -1 - || ACE_Flag_Manip::clr_flags (this->handle_, + || ACE::clr_flags (this->handle_, FASYNC) == -1) return -1; break; @@ -176,7 +176,7 @@ ACE_IPC_SAP::disable (int value) const break; #endif /* F_SETFD */ case ACE_NONBLOCK: - if (ACE_Flag_Manip::clr_flags (this->handle_, + if (ACE::clr_flags (this->handle_, ACE_NONBLOCK) == -1) return -1; break; diff --git a/ace/IfThenElse.h b/ace/IfThenElse.h new file mode 100644 index 00000000000..6a65c636058 --- /dev/null +++ b/ace/IfThenElse.h @@ -0,0 +1,80 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file IfThenElse.h + * + * ACE::IfThenElse traits template based on the IfThenElse template + * described in the book "C++ Templates" by Vandevoorde and + * Josuttis. + * + * $Id$ + * + * @author Ossama Othman <ossama@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef ACE_IF_THEN_ELSE_H +#define ACE_IF_THEN_ELSE_H + +namespace ACE +{ + + /** + * @struct IfThenElse + * + * @brief Compile-time selection of type based on a boolean value. + * + * This primary template selects the second or third argument based + * on the value of the boolean first argument. + * + * Usage example: + * + * template <typename T> + * class Foo + * { + * public: + * // Set @c TheType to be the larger of @a T and @a int. + * typedef typename IfThenElse<(sizeof (T) > sizeof (int)), + * T, + * int>::result_type TheType; + * }; + * + * You will of course need to + * @note This merely a forward declaration since we really only care + * about the partial specializations below. + */ + template <bool C, typename Ta, typename Tb> + struct IfThenElse; + + /** + * @struct IfThenElse + * + * @brief Select of type @a Ta if boolean value is @c true. + * + * This partial specialization selects the type @a Ta if the boolean + * first argument is @c true. + */ + template <typename Ta, typename Tb> + struct IfThenElse<true, Ta, Tb> + { + typedef Ta result_type; + }; + + /** + * @struct IfThenElse + * + * @brief Select of type @a Tb if boolean value is @c false. + * + * This partial specialization selects the type @a Tb if the boolean + * first argument is @c false. + */ + template <typename Ta, typename Tb> + struct IfThenElse<false, Ta, Tb> + { + typedef Tb result_type; + }; + +} + +#endif /* ACE_IF_THEN_ELSE_H */ diff --git a/ace/Init_ACE.cpp b/ace/Init_ACE.cpp index d58574d07c3..d1f098438bc 100644 --- a/ace/Init_ACE.cpp +++ b/ace/Init_ACE.cpp @@ -6,36 +6,36 @@ ACE_RCSID (ace, Init_ACE, "$Id$") -// Static data members. -unsigned int ACE_Init_ACE::init_fini_count_ = 0; + +unsigned int ACE::init_fini_count_ = 0; int -ACE_Init_ACE::init (void) +ACE::init (void) { // Don't use ACE_TRACE, because Object_Manager might not have been // instantiated yet. - // ACE_TRACE ("ACE_Init_ACE::init"); + // ACE_TRACE ("ACE::init"); - ++init_fini_count_; + ++ACE::init_fini_count_; return ACE_Object_Manager::instance ()->init (); } int -ACE_Init_ACE::fini (void) +ACE::fini (void) { - ACE_TRACE ("ACE_Init_ACE::fini"); + ACE_TRACE ("ACE::fini"); - if (init_fini_count_ > 0) + if (ACE::init_fini_count_ > 0) { - if (--init_fini_count_ == 0) + if (--ACE::init_fini_count_ == 0) return ACE_Object_Manager::instance ()->fini (); else // Wait for remaining fini () calls. return 1; } else - // More ACE_Init_ACE::fini () calls than ACE_Init_ACE::init () calls. Bad + // More ACE::fini () calls than ACE::init () calls. Bad // application! return -1; } diff --git a/ace/Init_ACE.h b/ace/Init_ACE.h index 487fe4da176..d653fa67a2e 100644 --- a/ace/Init_ACE.h +++ b/ace/Init_ACE.h @@ -6,7 +6,8 @@ * * $Id$ * - * This class consolidates the operations on the Handles. + * Initialize ACE library services. Can be called only once per + * program invocation. * * @author Priyanka Gontla <pgontla@ece.uci.edu> */ @@ -27,13 +28,11 @@ /** * @class ACE_Init_ACE * - * @brief Initialize ACE library services. Can be called only once - * per program invocation. + * @brief * */ -class ACE_Export ACE_Init_ACE +namespace ACE { -public: /** * This class implements the functions for the initialization and * shutting down ACE. These functions are called only once per ACE @@ -41,7 +40,7 @@ public: * @return Returns 0 on success, -1 on failure, and 1 if it had already been * called. */ - static int init (void); + extern ACE_Export int init (void); /** * Shut down ACE library services. Can be called only once per @@ -49,16 +48,18 @@ public: * @return Returns 0 on success, -1 on failure, and 1 if it had already been * called. */ - static int fini (void); + extern ACE_Export int fini (void); + + // private: + // Used internally, so not exported. -private: /** * Counter to match <init()>/<fini()> calls. <init()> must increment it; * <fini()> must decrement it. <fini()> then does nothing until it * reaches 0. */ - static unsigned int init_fini_count_; -}; + extern unsigned int init_fini_count_; +} #include /**/ "ace/post.h" diff --git a/ace/Lib_Find.cpp b/ace/Lib_Find.cpp index 8b634773273..429d9a4784b 100644 --- a/ace/Lib_Find.cpp +++ b/ace/Lib_Find.cpp @@ -27,11 +27,11 @@ ACE_RCSID(ace, Lib_Find, "$Id$") #if ! defined (ACE_PSOS_DIAB_MIPS) int -ACE_Lib_Find::ldfind (const ACE_TCHAR* filename, - ACE_TCHAR pathname[], - size_t maxpathnamelen) +ACE::ldfind (const ACE_TCHAR* filename, + ACE_TCHAR pathname[], + size_t maxpathnamelen) { - ACE_TRACE ("ACE_Lib_Find::ldfind"); + ACE_TRACE ("ACE::ldfind"); #if defined (ACE_OPENVMS) if (strlen(filename) >= maxpathnamelen) { @@ -138,7 +138,7 @@ ACE_Lib_Find::ldfind (const ACE_TCHAR* filename, #if (ACE_DIRECTORY_SEPARATOR_CHAR != '/') // Make all the directory separators "canonical" to simplify // subsequent code. - ACE_Lib_Find::strrepl (tempcopy, ACE_DIRECTORY_SEPARATOR_CHAR, '/'); + ACE::strrepl (tempcopy, ACE_DIRECTORY_SEPARATOR_CHAR, '/'); #endif /* ACE_DIRECTORY_SEPARATOR_CHAR */ // Separate filename from pathname. @@ -222,9 +222,9 @@ ACE_Lib_Find::ldfind (const ACE_TCHAR* filename, { #if (ACE_DIRECTORY_SEPARATOR_CHAR != '/') // Revert to native path name separators. - ACE_Lib_Find::strrepl (searchpathname, - '/', - ACE_DIRECTORY_SEPARATOR_CHAR); + ACE::strrepl (searchpathname, + '/', + ACE_DIRECTORY_SEPARATOR_CHAR); #endif /* ACE_DIRECTORY_SEPARATOR_CHAR */ // First, try matching the filename *without* adding a // prefix. @@ -359,9 +359,9 @@ ACE_Lib_Find::ldfind (const ACE_TCHAR* filename, ACE_TCHAR *nextholder = 0; const ACE_TCHAR *path_entry = - ACE_Lib_Find::strsplit_r (ld_path, - ACE_LD_SEARCH_PATH_SEPARATOR_STR, - nextholder); + ACE::strsplit_r (ld_path, + ACE_LD_SEARCH_PATH_SEPARATOR_STR, + nextholder); int result = 0; for (;;) @@ -436,9 +436,10 @@ ACE_Lib_Find::ldfind (const ACE_TCHAR* filename, break; // Fetch the next item in the path - path_entry = ACE_Lib_Find::strsplit_r (0, - ACE_LD_SEARCH_PATH_SEPARATOR_STR, - nextholder); + path_entry = + ACE::strsplit_r (0, + ACE_LD_SEARCH_PATH_SEPARATOR_STR, + nextholder); } #if defined (ACE_HAS_WINCE) @@ -463,13 +464,13 @@ ACE_Lib_Find::ldfind (const ACE_TCHAR* filename, } FILE * -ACE_Lib_Find::ldopen (const ACE_TCHAR *filename, +ACE::ldopen (const ACE_TCHAR *filename, const ACE_TCHAR *type) { - ACE_TRACE ("ACE_Lib_Find::ldopen"); + ACE_TRACE ("ACE::ldopen"); ACE_TCHAR buf[MAXPATHLEN + 1]; - if (ACE_Lib_Find::ldfind (filename, + if (ACE::ldfind (filename, buf, sizeof (buf) /sizeof (ACE_TCHAR)) == -1) return 0; @@ -478,9 +479,9 @@ ACE_Lib_Find::ldopen (const ACE_TCHAR *filename, } ACE_TCHAR * -ACE_Lib_Find::ldname (const ACE_TCHAR *entry_point) +ACE::ldname (const ACE_TCHAR *entry_point) { - ACE_TRACE ("ACE_Lib_Find::ldname"); + ACE_TRACE ("ACE::ldname"); #if defined(ACE_NEEDS_DL_UNDERSCORE) size_t size = @@ -517,7 +518,7 @@ ACE_Lib_Find::ldname (const ACE_TCHAR *entry_point) } int -ACE_Lib_Find::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len) +ACE::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len) { int result; #if defined (ACE_WIN32) @@ -561,7 +562,7 @@ ACE_Lib_Find::get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len) } ACE_HANDLE -ACE_Lib_Find::open_temp_file (const ACE_TCHAR *name, int mode, int perm) +ACE::open_temp_file (const ACE_TCHAR *name, int mode, int perm) { #if defined (ACE_WIN32) ACE_UNUSED_ARG(perm); @@ -586,9 +587,9 @@ ACE_Lib_Find::open_temp_file (const ACE_TCHAR *name, int mode, int perm) #endif /* ! ACE_PSOS_DIAB_MIPS */ size_t -ACE_Lib_Find::strrepl (char *s, char search, char replace) +ACE::strrepl (char *s, char search, char replace) { - ACE_TRACE ("ACE_Lib_Find::strrepl"); + ACE_TRACE ("ACE::strrepl"); size_t replaced = 0; @@ -607,9 +608,9 @@ ACE_Lib_Find::strrepl (char *s, char search, char replace) // "split". char * -ACE_Lib_Find::strsplit_r (char *str, - const char *token, - char *&next_start) +ACE::strsplit_r (char *str, + const char *token, + char *&next_start) { char *result = 0; @@ -641,9 +642,9 @@ ACE_Lib_Find::strsplit_r (char *str, #if defined (ACE_HAS_WCHAR) wchar_t * -ACE_Lib_Find::strsplit_r (wchar_t *str, - const wchar_t *token, - wchar_t *&next_start) +ACE::strsplit_r (wchar_t *str, + const wchar_t *token, + wchar_t *&next_start) { wchar_t *result = 0; @@ -674,9 +675,9 @@ ACE_Lib_Find::strsplit_r (wchar_t *str, } size_t -ACE_Lib_Find::strrepl (wchar_t *s, wchar_t search, wchar_t replace) +ACE::strrepl (wchar_t *s, wchar_t search, wchar_t replace) { - ACE_TRACE ("ACE_Lib_Find::strrepl"); + ACE_TRACE ("ACE::strrepl"); size_t replaced = 0; diff --git a/ace/Lib_Find.h b/ace/Lib_Find.h index fefcce6439b..2de7541eb62 100644 --- a/ace/Lib_Find.h +++ b/ace/Lib_Find.h @@ -1,7 +1,12 @@ +// -*- C++ -*- + //============================================================================= /** * @file Lib_Find.h * + * All the static function calls needed to search and open shared + * libraries. + * * $Id$ * * @author Priyanka Gontla <pgontla@ece.uci.edu> @@ -16,39 +21,32 @@ #include "ace/ACE_export.h" #include "ace/os_include/os_stdio.h" -/** - * @class ACE_Lib_Find - * - * This class includes all the static function calls needed to search - * and open shared libraries. - */ -class ACE_Export ACE_Lib_Find -{ - public: +namespace ACE +{ // = Methods for searching and opening shared libraries. /** - * Finds the file <filename> either using an absolute path or using + * Finds the file @a filename either using an absolute path or using * a relative path in conjunction with ACE_LD_SEARCH_PATH (e.g., * $LD_LIBRARY_PATH on UNIX or the directories scaned by Win32 API * SearchPath on Win32). This function will add appropriate suffix * (e.g., .dll on Win32 or .so on UNIX) according to the OS * platform. In addition, this function will apply the appropriate - * prefix (e.g., "lib" on UNIX and "" on Win32) if the <filename> + * prefix (e.g., "lib" on UNIX and "" on Win32) if the @a filename * doesn't match directly. */ - static int ldfind (const ACE_TCHAR* filename, - ACE_TCHAR pathname[], - size_t maxpathnamelen); + extern ACE_Export int ldfind (const ACE_TCHAR* filename, + ACE_TCHAR pathname[], + size_t maxpathnamelen); /** - * Uses <ldfind> to locate and open the appropriate <filename> and + * Uses @c ldfind to locate and open the appropriate @a filename and * returns a pointer to the file, else it returns a NULL - * pointer. <type> specifies how the file should be open. + * pointer. @a type specifies how the file should be open. */ - static FILE *ldopen (const ACE_TCHAR *filename, - const ACE_TCHAR *type); + extern ACE_Export FILE *ldopen (const ACE_TCHAR *filename, + const ACE_TCHAR *type); /** * Transforms <entry_point> into a form that can be located in a @@ -57,20 +55,20 @@ class ACE_Export ACE_Lib_Find * have a '_' prepended. Always returns a buffer that has been * dynamically allocated using <operator new>. */ - static ACE_TCHAR *ldname (const ACE_TCHAR *entry_point); + extern ACE_Export ACE_TCHAR *ldname (const ACE_TCHAR *entry_point); /** * Returns the temporary directory including the trailing slash in * <buffer>. Returns -1 for an error or if the buffer_len is not * long enough. */ - static int get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len); - + extern ACE_Export int get_temp_dir (ACE_TCHAR *buffer, size_t buffer_len); + /// Opening the temp file. File is automagically unlinked when it is /// closed. This is useful for have temp files. - static ACE_HANDLE open_temp_file (const ACE_TCHAR *name, - int mode, - int perm = 0); + extern ACE_Export ACE_HANDLE open_temp_file (const ACE_TCHAR *name, + int mode, + int perm = 0); // @@ Though the following functions dont come under the same category as // above, these are used only in the functions in this class. So it makes @@ -78,7 +76,7 @@ class ACE_Export ACE_Lib_Find // /// Replace all instances of <search> in <s> with <replace>. Returns /// the number of replacements made. - static size_t strrepl (char *s, char search, char replace); + extern ACE_Export size_t strrepl (char *s, char search, char replace); /** * Splits string <s> into pieces separated by the string <token>. @@ -87,17 +85,22 @@ class ACE_Export ACE_Lib_Find * This operates very similar to Perl's <split> function except that * it returns pieces one at a time instead of into an array. */ - static char *strsplit_r (char *s, const char *token, char *&next_start); + extern ACE_Export char *strsplit_r (char *s, + const char *token, + char *&next_start); #if defined (ACE_HAS_WCHAR) /// As strrepl, but for wide characters. - static size_t strrepl (wchar_t *s, wchar_t search, wchar_t replace); + extern ACE_Export size_t strrepl (wchar_t *s, + wchar_t search, + wchar_t replace); /// As strsplit_r, but for wide characters. - static wchar_t *strsplit_r (wchar_t *s, const wchar_t *token, - wchar_t *&next_start); + extern ACE_Export wchar_t *strsplit_r (wchar_t *s, + const wchar_t *token, + wchar_t *&next_start); #endif /* ACE_HAS_WCHAR */ -}; +} #include /**/ "ace/post.h" #endif /* ACE_LIB_FIND_H */ diff --git a/ace/Logging_Strategy.cpp b/ace/Logging_Strategy.cpp index e6082f71397..73acccd0e0e 100644 --- a/ace/Logging_Strategy.cpp +++ b/ace/Logging_Strategy.cpp @@ -232,7 +232,7 @@ ACE_Logging_Strategy::ACE_Logging_Strategy (void) ACE_TCHAR[MAXPATHLEN + 1]); // Get the temporary directory - if (ACE_Lib_Find::get_temp_dir + if (ACE::get_temp_dir (this->filename_, MAXPATHLEN - 7) == -1) // 7 for "logfile" { diff --git a/ace/MEM_Acceptor.cpp b/ace/MEM_Acceptor.cpp index e2e7de19f38..adfb7e84945 100644 --- a/ace/MEM_Acceptor.cpp +++ b/ace/MEM_Acceptor.cpp @@ -148,7 +148,7 @@ ACE_MEM_Acceptor::accept (ACE_MEM_Stream &new_stream, { ACE_TCHAR name[25]; // - 24 is so we can append name to the end. - if (ACE_Lib_Find::get_temp_dir (buf, MAXPATHLEN - 24) == -1) + if (ACE::get_temp_dir (buf, MAXPATHLEN - 24) == -1) { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("Temporary path too long, ") @@ -237,9 +237,9 @@ ACE_MEM_Acceptor::shared_accept_finish (ACE_MEM_Stream new_stream, // Only disable ACE_NONBLOCK if we weren't in non-blocking mode // originally. - ACE_Flag_Manip::clr_flags (this->get_handle (), + ACE::clr_flags (this->get_handle (), ACE_NONBLOCK); - ACE_Flag_Manip::clr_flags (new_handle, + ACE::clr_flags (new_handle, ACE_NONBLOCK); } diff --git a/ace/Memory_Pool.cpp b/ace/Memory_Pool.cpp index 053fa58749f..72bfd262693 100644 --- a/ace/Memory_Pool.cpp +++ b/ace/Memory_Pool.cpp @@ -216,7 +216,7 @@ ACE_MMAP_Memory_Pool::ACE_MMAP_Memory_Pool (const ACE_TCHAR *backing_store_name, ACE_OS::strcpy (this->backing_store_name_, ACE_DEFAULT_BACKING_STORE); #else /* ACE_DEFAULT_BACKING_STORE */ - if (ACE_Lib_Find::get_temp_dir (this->backing_store_name_, + if (ACE::get_temp_dir (this->backing_store_name_, MAXPATHLEN - 17) == -1) // -17 for ace-malloc-XXXXXX { diff --git a/ace/Naming_Context.cpp b/ace/Naming_Context.cpp index a490e919ed4..d700b592158 100644 --- a/ace/Naming_Context.cpp +++ b/ace/Naming_Context.cpp @@ -436,7 +436,7 @@ ACE_Name_Options::ACE_Name_Options (void) size_t pathsize = (MAXPATHLEN + 1) * sizeof (ACE_TCHAR); this->namespace_dir_ = ACE_static_cast (ACE_TCHAR *, ACE_OS::malloc (pathsize)); - if (ACE_Lib_Find::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1) + if (ACE::get_temp_dir (this->namespace_dir_, MAXPATHLEN) == -1) { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("Temporary path too long, ") diff --git a/ace/OS_NS_fcntl.inl b/ace/OS_NS_fcntl.inl index ca18bb9250b..0e541c90575 100644 --- a/ace/OS_NS_fcntl.inl +++ b/ace/OS_NS_fcntl.inl @@ -16,4 +16,3 @@ ACE_OS::fcntl (ACE_HANDLE handle, int cmd, long arg) ACE_OSCALL_RETURN (::fcntl (handle, cmd, arg), int, -1); # endif /* ACE_LACKS_FCNTL */ } - diff --git a/ace/OS_NS_stdio.h b/ace/OS_NS_stdio.h index 5ffe25db3ed..6d2596a12a4 100644 --- a/ace/OS_NS_stdio.h +++ b/ace/OS_NS_stdio.h @@ -252,7 +252,7 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION LPSECURITY_ATTRIBUTES default_win32_security_attributes (LPSECURITY_ATTRIBUTES); ACE_NAMESPACE_INLINE_FUNCTION - LPSECURITY_ATTRIBUTES default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES, + LPSECURITY_ATTRIBUTES default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES, SECURITY_DESCRIPTOR*); diff --git a/ace/OS_NS_stdlib.h b/ace/OS_NS_stdlib.h index 161f39ed902..7ec04d9962c 100644 --- a/ace/OS_NS_stdlib.h +++ b/ace/OS_NS_stdlib.h @@ -97,13 +97,13 @@ namespace ACE_OS { size_t size, ACE_COMPARE_FUNC); - extern ACE_Export + extern ACE_Export void *calloc (size_t elements, size_t sizeof_elements); - extern ACE_Export + extern ACE_Export void exit (int status = 0); - extern ACE_Export + extern ACE_Export void free (void *); ACE_NAMESPACE_INLINE_FUNCTION @@ -115,7 +115,7 @@ namespace ACE_OS { # endif /* ACE_HAS_WCHAR && ACE_WIN32 */ // not in spec - extern ACE_Export + extern ACE_Export ACE_TCHAR *getenvstrings (void); // itoa not in spec @@ -131,30 +131,30 @@ namespace ACE_OS { #if !defined (ACE_HAS_ITOA) /// Emulated itoa - Converts an integer to a string. - extern ACE_Export + extern ACE_Export char *itoa_emulation (int value, char *string, int radix); #endif /* !ACE_HAS_ITOA */ #if defined (ACE_HAS_WCHAR) && defined (ACE_LACKS_ITOW) /// Emulated itow - Converts an integer to a string. - extern ACE_Export + extern ACE_Export wchar_t *itow_emulation (int value, wchar_t *string, int radix); #endif /* ACE_HAS_WCHAR && ACE_LACKS_ITOW */ - extern ACE_Export + extern ACE_Export void *malloc (size_t); #if !defined (ACE_LACKS_MKSTEMP) ACE_NAMESPACE_INLINE_FUNCTION #else - extern ACE_Export + extern ACE_Export #endif /* !ACE_LACKS_MKSTEMP */ ACE_HANDLE mkstemp (ACE_TCHAR *t); #if !defined (ACE_LACKS_MKTEMP) ACE_NAMESPACE_INLINE_FUNCTION #else - extern ACE_Export + extern ACE_Export #endif /* !ACE_LACKS_MSTEMP */ ACE_TCHAR *mktemp (ACE_TCHAR *t); @@ -182,16 +182,16 @@ namespace ACE_OS { ACE_NAMESPACE_INLINE_FUNCTION int rand_r (ACE_RANDR_TYPE &seed); - extern ACE_Export + extern ACE_Export void *realloc (void *, size_t); #if !defined (ACE_LACKS_REALPATH) ACE_NAMESPACE_INLINE_FUNCTION #else - extern ACE_Export + extern ACE_Export #endif /* !ACE_LACKS_REALPATH */ ACE_TCHAR *realpath (const ACE_TCHAR *file_name, ACE_TCHAR *resolved_name); - + // exit_hook and set_exit_hook not in spec /// Function that is called by <ACE_OS::exit>, if non-null. extern ACE_Export ACE_EXIT_HOOK exit_hook_; @@ -230,7 +230,7 @@ namespace ACE_OS { #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOL */ #if defined (ACE_LACKS_STRTOL) - extern ACE_Export + extern ACE_Export long strtol_emulation (const char *nptr, char **endptr, int base); #endif /* ACE_LACKS_STRTOL */ @@ -245,7 +245,7 @@ namespace ACE_OS { #endif /* ACE_HAS_WCHAR && !ACE_LACKS_WCSTOUL */ #if defined (ACE_LACKS_STRTOUL) - extern ACE_Export + extern ACE_Export unsigned long strtoul_emulation (const char *nptr, char **endptr, int base); diff --git a/ace/POSIX_Asynch_IO.cpp b/ace/POSIX_Asynch_IO.cpp index d601ed0763e..ebe935058b2 100644 --- a/ace/POSIX_Asynch_IO.cpp +++ b/ace/POSIX_Asynch_IO.cpp @@ -1529,14 +1529,14 @@ ACE_POSIX_Asynch_Connect::connect_i (ACE_POSIX_Asynch_Connect_Result *result, } // set non blocking mode - if (ACE_Flag_Manip::set_flags (handle, ACE_NONBLOCK) != 0) + if (ACE::set_flags (handle, ACE_NONBLOCK) != 0) { result->set_error (errno); ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT("ACE_POSIX_Asynch_Connect::connect_i, %p\n") - ACE_LIB_TEXT("ACE_Flag_Manip::set_flags failed")), + ACE_LIB_TEXT("ACE::set_flags failed")), -1); } diff --git a/ace/POSIX_Proactor.cpp b/ace/POSIX_Proactor.cpp index 72004069c8e..af93e541c3d 100644 --- a/ace/POSIX_Proactor.cpp +++ b/ace/POSIX_Proactor.cpp @@ -650,7 +650,7 @@ ACE_AIOCB_Notify_Pipe_Manager::ACE_AIOCB_Notify_Pipe_Manager (ACE_POSIX_AIOCB_Pr this->pipe_.open (); // Set write side in NONBLOCK mode - ACE_Flag_Manip::set_flags (this->pipe_.write_handle (), ACE_NONBLOCK); + ACE::set_flags (this->pipe_.write_handle (), ACE_NONBLOCK); // Let AIOCB_Proactor know about our handle posix_aiocb_proactor_->set_notify_handle (this->pipe_.read_handle ()); diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp index 87a7f34f1fb..151c29b3ce0 100644 --- a/ace/SOCK_Acceptor.cpp +++ b/ace/SOCK_Acceptor.cpp @@ -366,7 +366,7 @@ ACE_SOCK_Acceptor::open (const ACE_Addr &local_sap, else if (protocol_family == PF_UNSPEC) { #if defined (ACE_HAS_IPV6) - protocol_family = ACE_Sock_Connect::ipv6_enabled () ? PF_INET6 : PF_INET; + protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; #else protocol_family = PF_INET; #endif /* ACE_HAS_IPV6 */ diff --git a/ace/SOCK_Dgram.cpp b/ace/SOCK_Dgram.cpp index 50c5f571f5b..f45093faa62 100644 --- a/ace/SOCK_Dgram.cpp +++ b/ace/SOCK_Dgram.cpp @@ -179,7 +179,7 @@ ACE_SOCK_Dgram::open (const ACE_Addr &local, else if (protocol_family == PF_UNSPEC) { #if defined (ACE_HAS_IPV6) - protocol_family = ACE_Sock_Connect::ipv6_enabled () ? PF_INET6 : PF_INET; + protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; #else protocol_family = PF_INET; #endif /* ACE_HAS_IPV6 */ diff --git a/ace/SOCK_Dgram_Mcast.cpp b/ace/SOCK_Dgram_Mcast.cpp index aa1d96803fa..cbbe9b27f8c 100644 --- a/ace/SOCK_Dgram_Mcast.cpp +++ b/ace/SOCK_Dgram_Mcast.cpp @@ -332,7 +332,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, ACE_INET_Addr *if_addrs = 0; size_t if_cnt; - if (ACE_Sock_Connect::get_ip_interfaces (if_cnt, if_addrs) != 0) + if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; size_t nr_subscribed = 0; @@ -383,7 +383,7 @@ ACE_SOCK_Dgram_Mcast::subscribe_ifs (const ACE_INET_Addr &mcast_addr, ACE_INET_Addr *if_addrs = 0; size_t if_cnt; - if (ACE_Sock_Connect::get_ip_interfaces (if_cnt, if_addrs) != 0) + if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; size_t nr_subscribed = 0; @@ -692,7 +692,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, // is a limitation of the way <get_ip_interfaces> works with // old versions of MSVC. The reliable way of getting the interface // list is available only with MSVC 5 and newer. - if (ACE_Sock_Connect::get_ip_interfaces (if_cnt, if_addrs) != 0) + if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; size_t nr_unsubscribed = 0; @@ -741,7 +741,7 @@ ACE_SOCK_Dgram_Mcast::unsubscribe_ifs (const ACE_INET_Addr &mcast_addr, // is a limitation of the way <get_ip_interfaces> works with // old versions of MSVC. The reliable way of getting the interface list // is available only with MSVC 5 and newer. - if (ACE_Sock_Connect::get_ip_interfaces (if_cnt, if_addrs) != 0) + if (ACE::get_ip_interfaces (if_cnt, if_addrs) != 0) return -1; size_t nr_unsubscribed = 0; diff --git a/ace/SOCK_SEQPACK_Acceptor.cpp b/ace/SOCK_SEQPACK_Acceptor.cpp index 8744185f52e..fa45e5d83a0 100644 --- a/ace/SOCK_SEQPACK_Acceptor.cpp +++ b/ace/SOCK_SEQPACK_Acceptor.cpp @@ -503,7 +503,7 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Addr &local_sap, else if (protocol_family == PF_UNSPEC) { #if defined (ACE_HAS_IPV6) - protocol_family = ACE_Sock_Connect::ipv6_enabled () ? PF_INET6 : PF_INET; + protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; #else protocol_family = PF_INET; #endif /* ACE_HAS_IPV6 */ @@ -540,7 +540,7 @@ ACE_SOCK_SEQPACK_Acceptor::open (const ACE_Multihomed_INET_Addr &local_sap, else if (protocol_family == PF_UNSPEC) { #if defined (ACE_HAS_IPV6) - protocol_family = ACE_Sock_Connect::ipv6_enabled () ? PF_INET6 : PF_INET; + protocol_family = ACE::ipv6_enabled () ? PF_INET6 : PF_INET; #else protocol_family = PF_INET; #endif /* ACE_HAS_IPV6 */ diff --git a/ace/SPIPE_Connector.cpp b/ace/SPIPE_Connector.cpp index ffc975cc805..b715aa67690 100644 --- a/ace/SPIPE_Connector.cpp +++ b/ace/SPIPE_Connector.cpp @@ -104,7 +104,7 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io, if (relative_time <= ACE_Time_Value::zero) { // Mimick the errno value returned by - // ACE_Handle_Ops::handle_timed_open. + // ACE::handle_timed_open. if (*timeout == ACE_Time_Value::zero) errno = EWOULDBLOCK; else @@ -146,7 +146,7 @@ ACE_SPIPE_Connector::connect (ACE_SPIPE_Stream &new_io, } } #else /* ACE_WIN32 && !ACE_HAS_PHARLAP */ - handle = ACE_Handle_Ops::handle_timed_open (timeout, + handle = ACE::handle_timed_open (timeout, remote_sap.get_path_name (), flags, perms, sa); #endif /* !ACE_WIN32 || ACE_HAS_PHARLAP || ACE_HAS_WINCE */ diff --git a/ace/Sock_Connect.cpp b/ace/Sock_Connect.cpp index 1c17500470c..c037f9bea67 100644 --- a/ace/Sock_Connect.cpp +++ b/ace/Sock_Connect.cpp @@ -45,8 +45,14 @@ extern "C" { # include "ace/Object_Manager.h" # endif /* ACE_HAS_THREADS */ -// Whether or not ipv6 is turned on in this box -int ACE_Sock_Connect::ipv6_enabled_ = -1; +namespace ACE +{ + // private: + // Used internally so not exported. + + /// Does this box have ipv6 turned on? + int ipv6_enabled_-1; +} #endif /* ACE_HAS_IPV6 */ // This is a hack to work around a problem with Visual Age C++ 5 and 6 on AIX. @@ -62,7 +68,11 @@ int ACE_Sock_Connect::ipv6_enabled_ = -1; static ACE_Auto_Array_Ptr<sockaddr> force_compiler_to_include_socket_h; #endif /* AIX && __IBMCPP__ >= 500 */ -ACE_RCSID(ace, Sock_Connect, "$Id$") + +ACE_RCSID (ace, + Sock_Connect, + "$Id$") + #if defined (ACE_WIN32) && \ (!defined (ACE_HAS_WINSOCK2) \ @@ -262,11 +272,11 @@ get_windows_version() // Bind socket to an unused port. int -ACE_Sock_Connect::bind_port (ACE_HANDLE handle, +ACE::bind_port (ACE_HANDLE handle, ACE_UINT32 ip_addr, int address_family) { - ACE_TRACE ("ACE_Sock_Connect::bind_port"); + ACE_TRACE ("ACE::bind_port"); ACE_INET_Addr addr; @@ -332,12 +342,12 @@ ACE_Sock_Connect::bind_port (ACE_HANDLE handle, } int -ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, +ACE::get_bcast_addr (ACE_UINT32 &bcast_addr, const ACE_TCHAR *host_name, ACE_UINT32 host_addr, ACE_HANDLE handle) { - ACE_TRACE ("ACE_Sock_Connect::get_bcast_addr"); + ACE_TRACE ("ACE::get_bcast_addr"); #if !defined(ACE_WIN32) ACE_HANDLE s = handle; @@ -367,7 +377,7 @@ ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, if (ACE_OS::ioctl (s, cmd, (char *) &ifc) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_bcast_addr:") + ACE_LIB_TEXT ("ACE::get_bcast_addr:") ACE_LIB_TEXT ("ioctl (get interface configuration)")), -1); @@ -437,7 +447,7 @@ ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_bcast_addr:") + ACE_LIB_TEXT ("ACE::get_bcast_addr:") ACE_LIB_TEXT ("Not AF_INET"))); continue; } @@ -449,7 +459,7 @@ ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_bcast_addr:") + ACE_LIB_TEXT ("ACE::get_bcast_addr:") ACE_LIB_TEXT (" ioctl (get interface flags)"))); continue; } @@ -458,7 +468,7 @@ ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, { ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_bcast_addr:") + ACE_LIB_TEXT ("ACE::get_bcast_addr:") ACE_LIB_TEXT ("Network interface is not up"))); continue; } @@ -473,7 +483,7 @@ ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, (char *) &if_req) == -1) ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_bcast_addr:") + ACE_LIB_TEXT ("ACE::get_bcast_addr:") ACE_LIB_TEXT ("ioctl (get broadaddr)"))); else { @@ -495,7 +505,7 @@ ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, else ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_bcast_addr:") + ACE_LIB_TEXT ("ACE::get_bcast_addr:") ACE_LIB_TEXT ("Broadcast is not enable for this interface."))); if (handle == ACE_INVALID_HANDLE) @@ -520,10 +530,10 @@ ACE_Sock_Connect::get_bcast_addr (ACE_UINT32 &bcast_addr, // responsible for calling delete [] on parray int -ACE_Sock_Connect::get_ip_interfaces (size_t &count, - ACE_INET_Addr *&addrs) +ACE::get_ip_interfaces (size_t &count, + ACE_INET_Addr *&addrs) { - ACE_TRACE ("ACE_Sock_Connect::get_ip_interfaces"); + ACE_TRACE ("ACE::get_ip_interfaces"); count = 0; addrs = 0; @@ -721,7 +731,7 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, } if (n_interfaces == 0) { ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\nACE_Sock_Connect::get_ip_interfaces - "), + ACE_LIB_TEXT ("%p\nACE::get_ip_interfaces - "), ACE_LIB_TEXT ("No adapter found.")), -1); } @@ -746,28 +756,28 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, case ERROR_NOT_SUPPORTED: // OS does not support this method ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\nACE_Sock_Connect::get_ip_interfaces - "), + ACE_LIB_TEXT ("%p\nACE::get_ip_interfaces - "), ACE_LIB_TEXT ("This version of WinCE does not support GetAdapterInfo.")), -1); break; case ERROR_NO_DATA: // no adapter installed ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\nACE_Sock_Connect::get_ip_interfaces - "), + ACE_LIB_TEXT ("%p\nACE::get_ip_interfaces - "), ACE_LIB_TEXT ("No network adapter installed.")), -1); break; case ERROR_INVALID_PARAMETER: ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\nACE_Sock_Connect::get_ip_interfaces - "), + ACE_LIB_TEXT ("%p\nACE::get_ip_interfaces - "), ACE_LIB_TEXT ("Invalid parameter.")), -1); break; default: ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT ("%p\nACE_Sock_Connect::get_ip_interfaces - "), + ACE_LIB_TEXT ("%p\nACE::get_ip_interfaces - "), ACE_LIB_TEXT ("Adapter info access permission denied.")), -1); break; @@ -1015,9 +1025,9 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, if (handle == ACE_INVALID_HANDLE) ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_ip_interfaces:open")), + ACE_LIB_TEXT ("ACE::get_ip_interfaces:open")), -1); - if (ACE_Sock_Connect::count_interfaces (handle, num_ifs)) + if (ACE::count_interfaces (handle, num_ifs)) { ACE_OS::close (handle); return -1; @@ -1059,7 +1069,7 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, ACE_OS::close (handle); ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::get_ip_interfaces:") + ACE_LIB_TEXT ("ACE::get_ip_interfaces:") ACE_LIB_TEXT ("ioctl - SIOCGIFCONF failed")), -1); } @@ -1191,7 +1201,7 @@ ACE_Sock_Connect::get_ip_interfaces (size_t &count, // list of ifreq structs. int -ACE_Sock_Connect::count_interfaces (ACE_HANDLE handle, size_t &how_many) +ACE::count_interfaces (ACE_HANDLE handle, size_t &how_many) { #if defined (sparc) && defined (SIOCGIFNUM) int tmp_how_many; // For 64 bit Solaris @@ -1200,7 +1210,7 @@ ACE_Sock_Connect::count_interfaces (ACE_HANDLE handle, size_t &how_many) (caddr_t) &tmp_how_many) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::count_interfaces:") + ACE_LIB_TEXT ("ACE::count_interfaces:") ACE_LIB_TEXT ("ioctl - SIOCGIFNUM failed")), -1); how_many = (size_t) tmp_how_many; @@ -1264,7 +1274,7 @@ ACE_Sock_Connect::count_interfaces (ACE_HANDLE handle, size_t &how_many) ACE_OS::free (ifcfg.ifc_req); ACE_ERROR_RETURN ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_Sock_Connect::count_interfaces:") + ACE_LIB_TEXT ("ACE::count_interfaces:") ACE_LIB_TEXT ("ioctl - SIOCGIFCONF failed")), -1); } @@ -1311,7 +1321,7 @@ ACE_Sock_Connect::count_interfaces (ACE_HANDLE handle, size_t &how_many) // Routine to return a handle from which ioctl() requests can be made. ACE_HANDLE -ACE_Sock_Connect::get_handle (void) +ACE::get_handle (void) { // Solaris 2.x ACE_HANDLE handle = ACE_INVALID_HANDLE; @@ -1328,33 +1338,33 @@ ACE_Sock_Connect::get_handle (void) int -ACE_Sock_Connect::ipv6_enabled (void) +ACE::ipv6_enabled (void) { #if defined (ACE_HAS_IPV6) - if (ACE_Sock_Connect::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_Sock_Connect::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_Sock_Connect::ipv6_enabled_ = 0; + ACE::ipv6_enabled_ = 0; } else { - ACE_Sock_Connect::ipv6_enabled_ = 1; + ACE::ipv6_enabled_ = 1; ACE_OS::closesocket (s); } } } - return ACE_Sock_Connect::ipv6_enabled_; + return ACE::ipv6_enabled_; #else return 0; #endif /* ACE_HAS_IPV6 */ diff --git a/ace/Sock_Connect.h b/ace/Sock_Connect.h index 1803636a2e2..532892d64fa 100644 --- a/ace/Sock_Connect.h +++ b/ace/Sock_Connect.h @@ -28,16 +28,14 @@ // Forward Declarations class ACE_INET_Addr; -class ACE_Export ACE_Sock_Connect +namespace ACE { - public: - // = Socket connection establishment calls. /// Bind a new unused port to @a handle. - static int bind_port (ACE_HANDLE handle, - ACE_UINT32 ip_addr = INADDR_ANY, - int address_family = AF_UNSPEC); + extern ACE_Export int bind_port (ACE_HANDLE handle, + ACE_UINT32 ip_addr = INADDR_ANY, + int address_family = AF_UNSPEC); /** * Get our broadcast address based on our @a host_addr. If @@ -47,30 +45,31 @@ class ACE_Export ACE_Sock_Connect * socket internally (and free it). Returns -1 on failure and 0 on * success. */ - static int get_bcast_addr (ACE_UINT32 &bcast_addr, - const ACE_TCHAR *hostname = 0, - ACE_UINT32 host_addr = 0, - ACE_HANDLE handle = ACE_INVALID_HANDLE); + extern ACE_Export int get_bcast_addr ( + ACE_UINT32 &bcast_addr, + const ACE_TCHAR *hostname = 0, + ACE_UINT32 host_addr = 0, + ACE_HANDLE handle = ACE_INVALID_HANDLE); /** * Return count and array of all configured IP interfaces on this * host, rc = 0 on success (count == number of interfaces else -1). * Caller is responsible for calling delete [] on @a addr_array. */ - static int get_ip_interfaces (size_t &count, - ACE_INET_Addr *&addr_array); + extern ACE_Export int get_ip_interfaces (size_t &count, + ACE_INET_Addr *&addr_array); /** * Helper routine for get_ip_interfaces, differs by UNIX platform so * put into own subroutine. perform some ioctls to retrieve ifconf * list of ifreq structs. */ - static int count_interfaces (ACE_HANDLE handle, + extern ACE_Export int count_interfaces (ACE_HANDLE handle, size_t &how_many); /// Routine to return a handle from which @c ioctl requests can be /// made. Caller must close the handle. - static ACE_HANDLE get_handle (void); + extern ACE_Export ACE_HANDLE get_handle (void); /** * Returns 1 if IPv6 is enabled on the current host; 0 if not. @@ -80,14 +79,8 @@ class ACE_Export ACE_Sock_Connect * returning 1 if it succeeds, and 0 if it fails. Caches the result * so it only gets checked once. */ - static int ipv6_enabled (void); - -#if defined (ACE_HAS_IPV6) -private: - /// Does this box have ipv6 turned on? - static int ipv6_enabled_; -#endif /* ACE_HAS_IPV6 */ -}; + extern ACE_Export int ipv6_enabled (void); +} #include /**/ "ace/post.h" diff --git a/ace/System_Time.cpp b/ace/System_Time.cpp index da8e6bbba07..6f588822b34 100644 --- a/ace/System_Time.cpp +++ b/ace/System_Time.cpp @@ -22,7 +22,7 @@ ACE_System_Time::ACE_System_Time (const ACE_TCHAR *poolname) ACE_OS::strcpy (this->poolname_, ACE_DEFAULT_BACKING_STORE); #else /* ACE_DEFAULT_BACKING_STORE */ - if (ACE_Lib_Find::get_temp_dir (this->poolname_, + if (ACE::get_temp_dir (this->poolname_, MAXPATHLEN - 17) == -1) // -17 for ace-malloc-XXXXXX { diff --git a/ace/UPIPE_Connector.cpp b/ace/UPIPE_Connector.cpp index 9702f1da622..138aeb3707c 100644 --- a/ace/UPIPE_Connector.cpp +++ b/ace/UPIPE_Connector.cpp @@ -40,7 +40,7 @@ ACE_UPIPE_Connector::connect (ACE_UPIPE_Stream &new_stream, ACE_TRACE ("ACE_UPIPE_Connector::connect"); ACE_ASSERT (new_stream.get_handle () == ACE_INVALID_HANDLE); - ACE_HANDLE handle = ACE_Handle_Ops::handle_timed_open (timeout, + ACE_HANDLE handle = ACE::handle_timed_open (timeout, addr.get_path_name (), flags, perms); diff --git a/ace/config-g++-common.h b/ace/config-g++-common.h index 0b49b272e19..9937e35c0e3 100644 --- a/ace/config-g++-common.h +++ b/ace/config-g++-common.h @@ -90,9 +90,9 @@ # define ACE_HAS_PENTIUM #endif /* i386 */ -// GNU g++ 3.4.x implements "#pragma once". +// // GNU g++ 3.4.x implements "#pragma once". // #if (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4)) && !defined (ACE_LACKS_PRAGMA_ONCE) -// // We define it with a -D with make depend. +// // We define it with a -D with make depend. // # define ACE_LACKS_PRAGMA_ONCE // #endif /* ! ACE_LACKS_PRAGMA_ONCE */ diff --git a/tests/Enum_Interfaces_Test.cpp b/tests/Enum_Interfaces_Test.cpp index 71f409dfae9..4afb92de031 100644 --- a/tests/Enum_Interfaces_Test.cpp +++ b/tests/Enum_Interfaces_Test.cpp @@ -10,11 +10,10 @@ // Enum_interfaces.cpp // // = DESCRIPTION -// This is a simple test of -// <ACE_Sock_Connection::get_ip_interfaces>. This call retrieves -// the IP addresses assigned to the host by interrogating the -// kernel. Network applications typically assume -// gethostbyname(uname()) will work, but this is just a +// This is a simple test of <ACE::get_ip_interfaces>. This call +// retrieves the IP addresses assigned to the host by +// interrogating the kernel. Network applications typically +// assume gethostbyname(uname()) will work, but this is just a // convention. It is also problematic if the resolver code // (DNS/NIS+...) is misconfigured. This happens more than // programmers realize. It is better to find out by asking the @@ -49,12 +48,12 @@ run_main (int, ACE_TCHAR *[]) ACE_INET_Addr *the_addr_array; size_t how_many = 0; - int rc = ACE_Sock_Connect::get_ip_interfaces (how_many, the_addr_array); + int rc = ACE::get_ip_interfaces (how_many, the_addr_array); if (rc != 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("%p\n"), - ACE_TEXT ("ACE_Sock_Connect::get_ip_interfaces failed"))); + ACE_TEXT ("ACE::get_ip_interfaces failed"))); else if (how_many == 0) ACE_ERROR ((LM_ERROR, ACE_TEXT ("No interfaces presently configured in the kernel\n"))); @@ -72,4 +71,3 @@ run_main (int, ACE_TCHAR *[]) ACE_END_TEST; return rc != 0; // return 1 if get_ip_interfaces() failed } - diff --git a/tests/FIFO_Test.cpp b/tests/FIFO_Test.cpp index f8f69e356d5..c1cdef66186 100644 --- a/tests/FIFO_Test.cpp +++ b/tests/FIFO_Test.cpp @@ -194,7 +194,7 @@ test_fifo_msg (void) // Reader side opens first - it may fail if fifo not supported on this // platform. ACE_TCHAR fifo_path[MAXPATHLEN]; - if (ACE_Lib_Find::get_temp_dir (fifo_path, MAXPATHLEN) == -1) + if (ACE::get_temp_dir (fifo_path, MAXPATHLEN) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%p\n"), ACE_TEXT ("get_temp_dir")), 1); ACE_OS::strcat (fifo_path, ACE_TEXT ("FIFO_Test")); diff --git a/tests/INET_Addr_Test.cpp b/tests/INET_Addr_Test.cpp index 4f026f19114..3f5924b74ab 100644 --- a/tests/INET_Addr_Test.cpp +++ b/tests/INET_Addr_Test.cpp @@ -189,7 +189,7 @@ int run_main (int argc, ACE_TCHAR *argv[]) } #if defined (ACE_HAS_IPV6) - if (ACE_Sock_Connect::ipv6_enabled ()) + if (ACE::ipv6_enabled ()) { const char *ipv6_addresses[] = { "1080::8:800:200c:417a", // unicast address diff --git a/tests/INET_Addr_Test_IPV6.cpp b/tests/INET_Addr_Test_IPV6.cpp index 12a9bb51459..96c4ed12cc8 100644 --- a/tests/INET_Addr_Test_IPV6.cpp +++ b/tests/INET_Addr_Test_IPV6.cpp @@ -64,7 +64,7 @@ int run_main (int argc, ACE_TCHAR *argv[]) int status = 0; // Innocent until proven guilty #if defined (ACE_HAS_IPV6) - if (ACE_Sock_Connect::ipv6_enabled ()) + if (ACE::ipv6_enabled ()) { ACE_INET_Addr addr ("::"); |