Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / ACE.inl
blob5c7b15e4072b1e7049564f39962d7400e8e46e64
1 // -*- C++ -*-
2 #include "ace/OS_NS_unistd.h"
3 #include "ace/OS_NS_Thread.h"
4 #include "ace/OS_NS_ctype.h"
5 #include "ace/OS_NS_sys_socket.h"
7 // Open versioned namespace, if enabled by the user.
8 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
10 // Wrappers for methods that have been moved to ACE_OS.
12 ACE_INLINE ssize_t
13 ACE::read_n (ACE_HANDLE handle,
14              void *buf,
15              size_t len,
16              size_t *bytes_transferred)
18   return ACE_OS::read_n (handle,
19                          buf,
20                          len,
21                          bytes_transferred);
24 ACE_INLINE ssize_t
25 ACE::write_n (ACE_HANDLE handle,
26               const void *buf,
27               size_t len,
28               size_t *bytes_transferred)
30   return ACE_OS::write_n (handle,
31                           buf,
32                           len,
33                           bytes_transferred);
36 ACE_INLINE ssize_t
37 ACE::recv_n (ACE_HANDLE handle,
38              void *buf,
39              size_t len,
40              int flags,
41              const ACE_Time_Value *timeout,
42              size_t *bytes_transferred)
44   if (timeout == 0)
45     return ACE::recv_n_i (handle,
46                           buf,
47                           len,
48                           flags,
49                           bytes_transferred);
50   else
51     return ACE::recv_n_i (handle,
52                           buf,
53                           len,
54                           flags,
55                           timeout,
56                           bytes_transferred);
59 #if defined (ACE_HAS_TLI)
61 ACE_INLINE ssize_t
62 ACE::t_rcv_n (ACE_HANDLE handle,
63               void *buf,
64               size_t len,
65               int *flags,
66               const ACE_Time_Value *timeout,
67               size_t *bytes_transferred)
69   if (timeout == 0)
70     return ACE::t_rcv_n_i (handle,
71                            buf,
72                            len,
73                            flags,
74                            bytes_transferred);
75   else
76     return ACE::t_rcv_n_i (handle,
77                            buf,
78                            len,
79                            flags,
80                            timeout,
81                            bytes_transferred);
84 #endif /* ACE_HAS_TLI */
86 ACE_INLINE ssize_t
87 ACE::recv_n (ACE_HANDLE handle,
88              void *buf,
89              size_t len,
90              const ACE_Time_Value *timeout,
91              size_t *bytes_transferred)
93   if (timeout == 0)
94     return ACE::recv_n_i (handle,
95                           buf,
96                           len,
97                           bytes_transferred);
98   else
99     return ACE::recv_n_i (handle,
100                           buf,
101                           len,
102                           timeout,
103                           bytes_transferred);
106 ACE_INLINE ssize_t
107 ACE::recvv_n (ACE_HANDLE handle,
108               iovec *iov,
109               int iovcnt,
110               const ACE_Time_Value *timeout,
111               size_t *bytes_transferred)
113   if (timeout == 0)
114     return ACE::recvv_n_i (handle,
115                            iov,
116                            iovcnt,
117                            bytes_transferred);
118   else
119     return ACE::recvv_n_i (handle,
120                            iov,
121                            iovcnt,
122                            timeout,
123                            bytes_transferred);
126 ACE_INLINE ssize_t
127 ACE::send_n (ACE_HANDLE handle,
128              const void *buf,
129              size_t len,
130              int flags,
131              const ACE_Time_Value *timeout,
132              size_t *bytes_transferred)
134   if (timeout == 0)
135     return ACE::send_n_i (handle,
136                           buf,
137                           len,
138                           flags,
139                           bytes_transferred);
140   else
141     return ACE::send_n_i (handle,
142                           buf,
143                           len,
144                           flags,
145                           timeout,
146                           bytes_transferred);
149 #if defined (ACE_HAS_TLI)
151 ACE_INLINE ssize_t
152 ACE::t_snd_n (ACE_HANDLE handle,
153               const void *buf,
154               size_t len,
155               int flags,
156               const ACE_Time_Value *timeout,
157               size_t *bytes_transferred)
159   if (timeout == 0)
160     return ACE::t_snd_n_i (handle,
161                            buf,
162                            len,
163                            flags,
164                            bytes_transferred);
165   else
166     return ACE::t_snd_n_i (handle,
167                            buf,
168                            len,
169                            flags,
170                            timeout,
171                            bytes_transferred);
174 #endif /* ACE_HAS_TLI */
176 ACE_INLINE ssize_t
177 ACE::send_n (ACE_HANDLE handle,
178              const void *buf,
179              size_t len,
180              const ACE_Time_Value *timeout,
181              size_t *bytes_transferred)
183   if (timeout == 0)
184     return ACE::send_n_i (handle,
185                           buf,
186                           len,
187                           bytes_transferred);
188   else
189     return ACE::send_n_i (handle,
190                           buf,
191                           len,
192                           timeout,
193                           bytes_transferred);
196 ACE_INLINE ssize_t
197 ACE::sendv_n (ACE_HANDLE handle,
198               const iovec *iov,
199               int iovcnt,
200               const ACE_Time_Value *timeout,
201               size_t *bytes_transferred)
203   if (timeout == 0)
204     return ACE::sendv_n_i (handle,
205                            iov,
206                            iovcnt,
207                            bytes_transferred);
208   else
209     return ACE::sendv_n_i (handle,
210                            iov,
211                            iovcnt,
212                            timeout,
213                            bytes_transferred);
216 ACE_INLINE ssize_t
217 ACE::send_i (ACE_HANDLE handle, const void *buf, size_t len)
219 #if defined (ACE_WIN32) || defined (ACE_MQX)
220   return ACE_OS::send (handle, (const char *) buf, len);
221 #else
222   return ACE_OS::write (handle, (const char *) buf, len);
223 #endif /* ACE_WIN32 */
226 ACE_INLINE ssize_t
227 ACE::recv_i (ACE_HANDLE handle, void *buf, size_t len)
229 #if defined (ACE_WIN32) || defined (ACE_MQX)
230   return ACE_OS::recv (handle, (char *) buf, len);
231 #else
232   return ACE_OS::read (handle, (char *) buf, len);
233 #endif /* ACE_WIN32 */
236 ACE_INLINE int
237 ACE::handle_read_ready (ACE_HANDLE handle, const ACE_Time_Value *timeout)
239   return ACE::handle_ready (handle, timeout, true, false, false);
242 ACE_INLINE int
243 ACE::handle_write_ready (ACE_HANDLE handle, const ACE_Time_Value *timeout)
245   return ACE::handle_ready (handle, timeout, false, true, false);
248 ACE_INLINE int
249 ACE::handle_exception_ready (ACE_HANDLE handle, const ACE_Time_Value *timeout)
251   return ACE::handle_ready (handle, timeout, false, false, true);
254 ACE_INLINE void
255 ACE::strdelete (char *s)
257 #if defined (ACE_HAS_ALLOC_HOOKS)
258   ACE_Allocator::instance()->free(s);
259 #else
260   delete [] s;
261 #endif /* ACE_HAS_ALLOC_HOOKS */
264 #if defined (ACE_HAS_WCHAR)
265 ACE_INLINE void
266 ACE::strdelete (wchar_t *s)
268   delete [] s;
270 #endif /* ACE_HAS_WCHAR */
272 ACE_INLINE bool
273 ACE::isdotdir (const char *s)
275   return (s[0] == '.' &&
276           ((s[1] == 0) || (s[1] == '.' && s[2] == 0)));
279 #if defined (ACE_HAS_WCHAR)
280 ACE_INLINE bool
281 ACE::isdotdir (const wchar_t *s)
283   return (s[0] == ACE_TEXT ('.') &&
284           ((s[1] == 0) || (s[1] == ACE_TEXT ('.') && s[2] == 0)));
286 #endif /* ACE_HAS_WCHAR */
288 ACE_INLINE void
289 ACE::unique_name (const void *object,
290                   ACE_TCHAR *name,
291                   size_t length)
293   ACE_OS::unique_name (object, name, length);
296 ACE_INLINE u_long
297 ACE::log2 (u_long num)
299   u_long log = 0;
301   for (; num > 1; ++log)
302     num >>= 1;
304   return log;
307 ACE_INLINE int
308 ACE::map_errno (int error)
310 #if defined (ACE_WIN32)
311   switch (error)
312     {
313     case WSAEWOULDBLOCK:
314       return EAGAIN; // Same as UNIX errno EWOULDBLOCK.
315     }
316 #endif /* ACE_WIN32 */
318   return error;
321 ACE_INLINE u_char
322 ACE::hex2byte (ACE_TCHAR c)
324   if (ACE_OS::ace_isdigit (c))
325     return (u_char) (c - ACE_TEXT ('0'));
326   else if (ACE_OS::ace_islower (c))
327     return (u_char) (10 + c - ACE_TEXT ('a'));
328   else
329     return (u_char) (10 + c - ACE_TEXT ('A'));
332 // Close versioned namespace, if enabled by the user.
333 ACE_END_VERSIONED_NAMESPACE_DECL