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 | 5d6aed4351ed1a6483ad1893937b564cfdda537a (patch) | |
tree | bd0d1a3d7e80466e5e8e99720d5dd1495ea99040 /ace/ACE.h | |
parent | 7f61a53818e64251b4804bad80f06873b0524e08 (diff) | |
download | ATCD-5d6aed4351ed1a6483ad1893937b564cfdda537a.tar.gz |
ChangeLogTag:Fri Aug 13 23:26:56 2004 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'ace/ACE.h')
-rw-r--r-- | ace/ACE.h | 851 |
1 files changed, 439 insertions, 412 deletions
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" |