Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

FILE_Connector.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    FILE_Connector.h
00006  *
00007  *  $Id: FILE_Connector.h,v 1.1.1.4 2003/02/21 18:36:32 chad Exp $
00008  *
00009  *  @author Doug Schmidt <schmidt@cs.wustl.edu>
00010  */
00011 //=============================================================================
00012 
00013 #ifndef ACE_FILE_CONNECTOR_H
00014 #define ACE_FILE_CONNECTOR_H
00015 #include "ace/pre.h"
00016 
00017 #include "ace/FILE_IO.h"
00018 #include "ace/Log_Msg.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 /**
00025  * @class ACE_FILE_Connector
00026  *
00027  * @brief Defines an active connection factory for the ACE_FILE wrappers.
00028  *
00029  * Note that the O_APPEND flag is only partly supported on Win32. If
00030  * you specify O_APPEND, then the file pointer will be positioned at
00031  * the end of the file initially during open, but it is not
00032  * re-positioned at the end prior to each write, as specified by
00033  * POSIX.  This is generally good enough for typical situations, but
00034  * it is ``not quite right'' in its semantics.  
00035  */
00036 class ACE_Export ACE_FILE_Connector
00037 {
00038 public:
00039   // = Initialization methods.
00040   /// Default constructor.
00041   ACE_FILE_Connector (void);
00042 
00043   /**
00044    * Actively ``connect'' and produce a <new_io> <ACE_FILE_IO> object
00045    * if things go well.  The <remote_sap> is the file that we are
00046    * trying to create/open.  If it's the default value of
00047    * <ACE_Addr::sap_any> then the user is letting the OS create the
00048    * filename (via <ACE_OS::mktemp>).  The <timeout> is the amount of
00049    * time to wait to create/open the file.  If it's 0 then we block
00050    * indefinitely.  If *timeout == {0, 0} then the file is created
00051    * using non-blocking mode.  In this case, if the create/open can't
00052    * be done immediately the value of -1 is returned with <errno ==
00053    * EWOULDBLOCK>.  If *timeout > {0, 0} then this is the maximum amount of
00054    * time to wait before timing out.  If the time expires before the
00055    * connection is made <errno == ETIME>.  The <local_sap> and
00056    * <reuse_addr> parameters are ignored.  The <flags> and <perms>
00057    * arguments are passed down to the <ACE_OS::open> method.
00058    */
00059   ACE_FILE_Connector (ACE_FILE_IO &new_io,
00060                       const ACE_FILE_Addr &remote_sap,
00061                       ACE_Time_Value *timeout = 0,
00062                       const ACE_Addr &local_sap = ACE_Addr::sap_any,
00063                       int reuse_addr = 0,
00064                       int flags = O_RDWR | O_CREAT,
00065                       int perms = ACE_DEFAULT_FILE_PERMS);
00066 
00067   /**
00068    * Actively ``connect'' and produce a <new_io> <ACE_FILE_IO> object
00069    * if things go well.  The <remote_sap> is the file that we are
00070    * trying to create/open.  If it's the default value of
00071    * <ACE_Addr::sap_any> then the user is letting the OS create the
00072    * filename (via <ACE_OS::mktemp>).  The <timeout> is the amount of
00073    * time to wait to create/open the file.  If it's 0 then we block
00074    * indefinitely.  If *timeout == {0, 0} then the file is created
00075    * using non-blocking mode.  In this case, if the create/open can't
00076    * be done immediately the value of -1 is returned with <errno ==
00077    * EWOULDBLOCK>.  If *timeout > {0, 0} then this is the maximum amount of
00078    * time to wait before timing out.  If the time expires before the
00079    * connection is made <errno == ETIME>.  The <local_sap> and
00080    * <reuse_addr> parameters are ignored.  The <flags> and <perms>
00081    * arguments are passed down to the <ACE_OS::open> method.
00082    */
00083   int connect (ACE_FILE_IO &new_io,
00084                const ACE_FILE_Addr &remote_sap,
00085                ACE_Time_Value *timeout = 0,
00086                const ACE_Addr &local_sap = ACE_Addr::sap_any,
00087                int reuse_addr = 0,
00088                int flags = O_RDWR | O_CREAT,
00089                int perms = ACE_DEFAULT_FILE_PERMS);
00090 
00091   /// Resets any event associations on this handle
00092   int reset_new_handle (ACE_HANDLE handle);
00093 
00094   /// Dump the state of an object.
00095   void dump (void) const;
00096 
00097   /// Declare the dynamic allocation hooks.
00098   ACE_ALLOC_HOOK_DECLARE;
00099 
00100   // = Meta-type "trait" information.
00101   typedef ACE_FILE_Addr PEER_ADDR;
00102   typedef ACE_FILE_IO PEER_STREAM;
00103 };
00104 
00105 #if !defined (ACE_LACKS_INLINE_FUNCTIONS)
00106 #include "ace/FILE_Connector.i"
00107 #endif
00108 
00109 #include "ace/post.h"
00110 #endif /* ACE_FILE_CONNECTOR_H */

Generated on Mon Jun 16 11:19:41 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002