Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | Static Private Attributes

ACE_IO_SAP Class Reference

Defines the methods for the base class of the ACE_IO_SAP abstraction, which includes ACE_FILE and ACE_DEV. 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

static pid_t pid_ = 0
 Cache the process ID.

Detailed Description

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

Definition at line 34 of file IO_SAP.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
INVALID_HANDLE 

Be consistent with Winsock.

Definition at line 37 of file IO_SAP.h.

  {
    /// Be consistent with Winsock
    INVALID_HANDLE = -1
  };


Constructor & Destructor Documentation

ACE_IO_SAP::~ACE_IO_SAP ( void   )  [inline]

Default dtor.

Definition at line 10 of file IO_SAP.inl.

{
  ACE_TRACE ("ACE_IO_SAP::~ACE_IO_SAP");
}

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.

  : handle_ (ACE_INVALID_HANDLE)
{
  ACE_TRACE ("ACE_IO_SAP::ACE_IO_SAP");
}


Member Function Documentation

int ACE_IO_SAP::control ( int  cmd,
void *  arg 
) const [inline]

Interface for ioctl.

Definition at line 36 of file IO_SAP.inl.

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

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 value.

Reimplemented in ACE_DEV, and ACE_FILE.

Definition at line 97 of file IO_SAP.cpp.

{
  ACE_TRACE ("ACE_IO_SAP::disable");

  switch (value)
    {
#if defined (SIGURG)
    case SIGURG:
    case ACE_SIGURG:
#if defined (F_SETOWN)
      if (ACE_OS::fcntl (this->handle_,
                         F_SETOWN, 0) == -1)
        return -1;
      break;
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN */
#endif /* SIGURG */
#if defined (SIGIO)
    case SIGIO:
    case ACE_SIGIO:
#if defined (F_SETOWN) && defined (FASYNC)
      if (ACE_OS::fcntl (this->handle_,
                         F_SETOWN,
                         0) == -1
          || ACE::clr_flags (this->handle_, FASYNC) == -1)
        return -1;
      break;
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN && FASYNC */
#else  // <==
      ACE_NOTSUP_RETURN (-1);
#endif /* SIGIO <== */
    case ACE_NONBLOCK:
      if (ACE::clr_flags (this->handle_,
                                     ACE_NONBLOCK) == -1)
        return -1;
      break;
    default:
      return -1;
    }
  return 0;
}

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.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_IO_SAP::dump");

  ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %d"), this->handle_));
  ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\npid_ = %d"), this->pid_));
  ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
#endif /* ACE_HAS_DUMP */
}

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 value.

Definition at line 47 of file IO_SAP.cpp.

{
  ACE_TRACE ("ACE_IO_SAP::enable");
  /* First-time in initialization. */
  if (ACE_IO_SAP::pid_ == 0)
    ACE_IO_SAP::pid_ = ACE_OS::getpid ();

  switch (value)
    {
#if defined (SIGURG)
    case SIGURG:
    case ACE_SIGURG:
#if defined (F_SETOWN)
      return ACE_OS::fcntl (this->handle_,
                            F_SETOWN,
                            ACE_IO_SAP::pid_);
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN */
#endif /* SIGURG */
#if defined (SIGIO)
    case SIGIO:
    case ACE_SIGIO:
#if defined (F_SETOWN) && defined (FASYNC)
      if (ACE_OS::fcntl (this->handle_,
                         F_SETOWN,
                         ACE_IO_SAP::pid_) == -1
          || ACE::set_flags (this->handle_,
                             FASYNC) == -1)
        return -1;
      break;
#else
      ACE_NOTSUP_RETURN (-1);
#endif /* F_SETOWN && FASYNC */
#else  // <==
      ACE_NOTSUP_RETURN (-1);
#endif /* SIGIO <== */
    case ACE_NONBLOCK:
      if (ACE::set_flags (this->handle_,
                          ACE_NONBLOCK) == -1)
        return -1;
      break;
    default:
      return -1;
    }

  return 0;
}

ACE_HANDLE ACE_IO_SAP::get_handle ( void   )  const [inline]

Get the underlying handle.

Definition at line 18 of file IO_SAP.inl.

{
  ACE_TRACE ("ACE_IO_SAP::get_handle");
  return this->handle_;
}

void ACE_IO_SAP::set_handle ( ACE_HANDLE  handle  )  [inline]

Set the underlying handle.

Definition at line 27 of file IO_SAP.inl.

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


Member Data Documentation

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 86 of file IO_SAP.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines