Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / FILE_Connector.h
blob22dd23f48dd629803d3ed97ccdffe71bcaddb09e
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file FILE_Connector.h
7 * @author Doug Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef ACE_FILE_CONNECTOR_H
12 #define ACE_FILE_CONNECTOR_H
13 #include /**/ "ace/pre.h"
15 #include "ace/FILE_IO.h"
16 #include "ace/Log_Category.h"
17 #include "ace/os_include/os_fcntl.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 /**
26 * @class ACE_FILE_Connector
28 * @brief Defines an active connection factory for the ACE_FILE wrappers.
30 * Note that the O_APPEND flag is only partly supported on Win32. If
31 * you specify O_APPEND, then the file pointer will be positioned at
32 * the end of the file initially during open, but it is not
33 * re-positioned at the end prior to each write, as specified by
34 * POSIX. This is generally good enough for typical situations, but
35 * it is ``not quite right'' in its semantics.
37 class ACE_Export ACE_FILE_Connector
39 public:
40 /// Default constructor.
41 ACE_FILE_Connector ();
43 /**
44 * Actively ``connect'' and produce a @a new_io ACE_FILE_IO object
45 * if things go well. The @a remote_sap is the file that we are
46 * trying to create/open. If it's the default value of
47 * ACE_Addr::sap_any then the user is letting the OS create the
48 * filename (via <ACE_OS::mkstemp>). The @a timeout is the amount of
49 * time to wait to create/open the file. If it's 0 then we block
50 * indefinitely. If *timeout == {0, 0} then the file is created
51 * using non-blocking mode. If *timeout > {0, 0} then this is the
52 * maximum amount of time to wait before timing out. The
53 * @a local_sap and @a reuse_addr parameters are ignored. The @a flags
54 * and @a perms arguments are passed down to the <ACE_OS::open>
55 * method.
57 ACE_FILE_Connector (ACE_FILE_IO &new_io,
58 const ACE_FILE_Addr &remote_sap,
59 ACE_Time_Value *timeout = 0,
60 const ACE_Addr &local_sap = ACE_Addr::sap_any,
61 int reuse_addr = 0,
62 int flags = O_RDWR | O_CREAT,
63 int perms = ACE_DEFAULT_FILE_PERMS);
65 /**
66 * Actively ``connect'' and produce a @a new_io <ACE_FILE_IO> object
67 * if things go well. The @a remote_sap is the file that we are
68 * trying to create/open. If it's the default value of
69 * ACE_Addr::sap_any then the user is letting the OS create the
70 * filename (via <ACE_OS::mkstemp>). The @a timeout is the amount of
71 * time to wait to create/open the file. If it's 0 then we block
72 * indefinitely. If *timeout == {0, 0} then the file is created
73 * using non-blocking mode. In this case, if the create/open can't
74 * be done immediately the value of -1 is returned with <errno ==
75 * EWOULDBLOCK>. If *timeout > {0, 0} then this is the maximum amount of
76 * time to wait before timing out. If the time expires before the
77 * connection is made @c errno == ETIME. The @a local_sap and
78 * @a reuse_addr parameters are ignored. The @a flags and @a perms
79 * arguments are passed down to the <ACE_OS::open> method.
81 int connect (ACE_FILE_IO &new_io,
82 const ACE_FILE_Addr &remote_sap,
83 ACE_Time_Value *timeout = 0,
84 const ACE_Addr &local_sap = ACE_Addr::sap_any,
85 int reuse_addr = 0,
86 int flags = O_RDWR | O_CREAT,
87 int perms = ACE_DEFAULT_FILE_PERMS);
89 /// Resets any event associations on this handle
90 bool reset_new_handle (ACE_HANDLE handle);
92 /// Dump the state of an object.
93 void dump () const;
95 /// Declare the dynamic allocation hooks.
96 ACE_ALLOC_HOOK_DECLARE;
98 // = Meta-type "trait" information.
99 typedef ACE_FILE_Addr PEER_ADDR;
100 typedef ACE_FILE_IO PEER_STREAM;
103 ACE_END_VERSIONED_NAMESPACE_DECL
105 #if defined (__ACE_INLINE__)
106 #include "ace/FILE_Connector.inl"
107 #endif /* __ACE_INLINE__ */
109 #include /**/ "ace/post.h"
110 #endif /* ACE_FILE_CONNECTOR_H */