ACE_IO_SAP Class Reference

Defines the methods for the base class of the abstraction, which includes and . More...

#include <IO_SAP.h>

Inheritance diagram for ACE_IO_SAP:

Inheritance graph
[legend]
List of all members.

Public Types

enum  { INVALID_HANDLE = -1 }

Public Member Functions

 ~ACE_IO_SAP (void)
 Default dtor.

int control (int cmd, void *) const
 Interface for ioctl.

int enable (int value) const
int disable (int value) const
ACE_HANDLE get_handle (void) const
 Get the underlying handle.

void set_handle (ACE_HANDLE handle)
 Set the underlying handle.

void dump (void) const
 Dump the state of an object.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Protected Member Functions

 ACE_IO_SAP (void)
 Ensure that ACE_IO_SAP is an abstract base class.


Private Attributes

ACE_HANDLE handle_
 Underlying I/O handle.


Static Private Attributes

pid_t pid_ = 0
 Cache the process ID.


Detailed Description

Defines the methods for the base class of the abstraction, which includes and .

Definition at line 34 of file IO_SAP.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
INVALID_HANDLE  Be consistent with Winsock.

Definition at line 37 of file IO_SAP.h.

00038   {
00039     /// Be consistent with Winsock
00040     INVALID_HANDLE = -1
00041   };


Constructor & Destructor Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_IO_SAP::~ACE_IO_SAP void   ) 
 

Default dtor.

Definition at line 10 of file IO_SAP.inl.

References ACE_TRACE.

00011 {
00012   ACE_TRACE ("ACE_IO_SAP::~ACE_IO_SAP");
00013 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_IO_SAP::ACE_IO_SAP void   )  [protected]
 

Ensure that ACE_IO_SAP is an abstract base class.

Definition at line 24 of file IO_SAP.cpp.

References ACE_TRACE.

00025   : handle_ (ACE_INVALID_HANDLE)
00026 {
00027   ACE_TRACE ("ACE_IO_SAP::ACE_IO_SAP");
00028 }


Member Function Documentation

ACE_INLINE int ACE_IO_SAP::control int  cmd,
void * 
const
 

Interface for ioctl.

Definition at line 36 of file IO_SAP.inl.

References ACE_TRACE, and ACE_OS::ioctl().

Referenced by ACE_TTY_IO::control().

00037 {
00038   ACE_TRACE ("ACE_IO_SAP::control");
00039   return ACE_OS::ioctl (this->handle_, cmd, arg);
00040 }

int ACE_IO_SAP::disable int  value  )  const
 

Disable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), which is passed as the .

Reimplemented in ACE_DEV, and ACE_FILE.

Definition at line 97 of file IO_SAP.cpp.

References ACE_NONBLOCK, ACE_NOTSUP_RETURN, ACE_SIGIO, ACE_SIGURG, ACE_TRACE, ACE::clr_flags(), ACE_OS::fcntl(), and SIGIO.

Referenced by ACE_FILE::disable(), and ACE_DEV::disable().

00098 {
00099   ACE_TRACE ("ACE_IO_SAP::disable");
00100 
00101   switch (value)
00102     {
00103 #if defined (SIGURG)
00104     case SIGURG:
00105     case ACE_SIGURG:
00106 #if defined (F_SETOWN)
00107       if (ACE_OS::fcntl (this->handle_,
00108                          F_SETOWN, 0) == -1)
00109         return -1;
00110       break;
00111 #else
00112       ACE_NOTSUP_RETURN (-1);
00113 #endif /* F_SETOWN */
00114 #endif /* SIGURG */
00115 #if defined (SIGIO)
00116     case SIGIO:
00117     case ACE_SIGIO:
00118 #if defined (F_SETOWN) && defined (FASYNC)
00119       if (ACE_OS::fcntl (this->handle_,
00120                          F_SETOWN,
00121                          0) == -1
00122           || ACE::clr_flags (this->handle_, FASYNC) == -1)
00123         return -1;
00124       break;
00125 #else
00126       ACE_NOTSUP_RETURN (-1);
00127 #endif /* F_SETOWN && FASYNC */
00128 #else  // <==
00129       ACE_NOTSUP_RETURN (-1);
00130 #endif /* SIGIO <== */
00131     case ACE_NONBLOCK:
00132       if (ACE::clr_flags (this->handle_,
00133                                      ACE_NONBLOCK) == -1)
00134         return -1;
00135       break;
00136     default:
00137       return -1;
00138     }
00139   return 0;
00140 }

void ACE_IO_SAP::dump void   )  const
 

Dump the state of an object.

Reimplemented in ACE_DEV, ACE_DEV_IO, ACE_FILE, and ACE_FILE_IO.

Definition at line 31 of file IO_SAP.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, and LM_DEBUG.

Referenced by ACE_FILE::dump().

00032 {
00033 #if defined (ACE_HAS_DUMP)
00034   ACE_TRACE ("ACE_IO_SAP::dump");
00035 
00036   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00037   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("handle_ = %d"), this->handle_));
00038   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\npid_ = %d"), this->pid_));
00039   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00040 #endif /* ACE_HAS_DUMP */
00041 }

int ACE_IO_SAP::enable int  value  )  const
 

Enable asynchronous I/O (ACE_SIGIO), urgent data (ACE_SIGURG), non-blocking I/O (ACE_NONBLOCK), or close-on-exec (ACE_CLOEXEC), which is passed as the .

Definition at line 47 of file IO_SAP.cpp.

References ACE_NONBLOCK, ACE_NOTSUP_RETURN, ACE_SIGIO, ACE_SIGURG, ACE_TRACE, ACE_OS::fcntl(), ACE_OS::getpid(), pid_, ACE::set_flags(), and SIGIO.

00048 {
00049   ACE_TRACE ("ACE_IO_SAP::enable");
00050   /* First-time in initialization. */
00051   if (ACE_IO_SAP::pid_ == 0)
00052     ACE_IO_SAP::pid_ = ACE_OS::getpid ();
00053 
00054   switch (value)
00055     {
00056 #if defined (SIGURG)
00057     case SIGURG:
00058     case ACE_SIGURG:
00059 #if defined (F_SETOWN)
00060       return ACE_OS::fcntl (this->handle_,
00061                             F_SETOWN,
00062                             ACE_IO_SAP::pid_);
00063 #else
00064       ACE_NOTSUP_RETURN (-1);
00065 #endif /* F_SETOWN */
00066 #endif /* SIGURG */
00067 #if defined (SIGIO)
00068     case SIGIO:
00069     case ACE_SIGIO:
00070 #if defined (F_SETOWN) && defined (FASYNC)
00071       if (ACE_OS::fcntl (this->handle_,
00072                          F_SETOWN,
00073                          ACE_IO_SAP::pid_) == -1
00074           || ACE::set_flags (this->handle_,
00075                              FASYNC) == -1)
00076         return -1;
00077       break;
00078 #else
00079       ACE_NOTSUP_RETURN (-1);
00080 #endif /* F_SETOWN && FASYNC */
00081 #else  // <==
00082       ACE_NOTSUP_RETURN (-1);
00083 #endif /* SIGIO <== */
00084     case ACE_NONBLOCK:
00085       if (ACE::set_flags (this->handle_,
00086                           ACE_NONBLOCK) == -1)
00087         return -1;
00088       break;
00089     default:
00090       return -1;
00091     }
00092 
00093   return 0;
00094 }

ACE_INLINE ACE_HANDLE ACE_IO_SAP::get_handle void   )  const
 

Get the underlying handle.

Definition at line 18 of file IO_SAP.inl.

References ACE_TRACE.

Referenced by ACE_FILE::close(), ACE_FILE_Connector::connect(), and ACE_TTY_IO::control().

00019 {
00020   ACE_TRACE ("ACE_IO_SAP::get_handle");
00021   return this->handle_;
00022 }

ACE_INLINE void ACE_IO_SAP::set_handle ACE_HANDLE  handle  ) 
 

Set the underlying handle.

Definition at line 27 of file IO_SAP.inl.

References ACE_TRACE.

Referenced by ACE_FILE::close(), ACE_DEV::close(), ACE_FILE_Connector::connect(), and ACE_DEV_Connector::connect().

00028 {
00029   ACE_TRACE ("ACE_IO_SAP::set_handle");
00030   this->handle_ = handle;
00031 }


Member Data Documentation

ACE_IO_SAP::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented in ACE_DEV, ACE_DEV_IO, ACE_FILE, and ACE_FILE_IO.

Definition at line 75 of file IO_SAP.h.

ACE_HANDLE ACE_IO_SAP::handle_ [private]
 

Underlying I/O handle.

Definition at line 83 of file IO_SAP.h.

pid_t ACE_IO_SAP::pid_ = 0 [static, private]
 

Cache the process ID.

Definition at line 44 of file IO_SAP.cpp.

Referenced by enable().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:23:36 2006 for ACE by doxygen 1.3.6