ACE_MEM_Stream Class Reference

Defines the methods in the ACE_MEM_Stream abstraction. More...

#include <MEM_Stream.h>

Inheritance diagram for ACE_MEM_Stream:

Inheritance graph
[legend]
Collaboration diagram for ACE_MEM_Stream:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Addr PEER_ADDR

Public Member Functions

 ACE_MEM_Stream (void)
 Constructor.

 ACE_MEM_Stream (ACE_HANDLE h)
 Constructor (sets the underlying ACE_HANDLE with ).

 ~ACE_MEM_Stream (void)
 Destructor.

ssize_t send_n (const void *buf, size_t n)
ssize_t recv_n (void *buf, size_t n)
ssize_t send_n (const void *buf, size_t n, int flags)
ssize_t recv_n (void *buf, size_t n, int flags)
int close_reader (void)
 Close down the reader.

int close_writer (void)
 Close down the writer.

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Friends

class ACE_MEM_Acceptor
class ACE_MEM_Connector

Detailed Description

Defines the methods in the ACE_MEM_Stream abstraction.

This adds additional wrapper methods atop the ACE_MEM_IO class. Notice that ACE_MEM_Stream can only send messages no bigger than the underlying MMAP file size minus sizeof (ACE_MEM_SAP_Node). The size of the MMAP file is default to ACE_MEM_STREAM_MIN_BUFFER. (Define above in this file, to 4096 bytes.) If you need to increase the size of allowable message ACE_MEM_Stream can handle, you can set it to either ACE_MEM_Acceptor::malloc_options(). minimal_bytes_ ACE_MEM_Acceptor::init_buffer_size (size_t size); before establishing a connection.

Definition at line 53 of file MEM_Stream.h.


Member Typedef Documentation

typedef ACE_Addr ACE_MEM_Stream::PEER_ADDR
 

Definition at line 140 of file MEM_Stream.h.


Constructor & Destructor Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE ACE_MEM_Stream::ACE_MEM_Stream void   ) 
 

Constructor.

Definition at line 11 of file MEM_Stream.inl.

00012 {
00013   // ACE_TRACE ("ACE_MEM_Stream::ACE_MEM_Stream");
00014 }

ACE_INLINE ACE_MEM_Stream::ACE_MEM_Stream ACE_HANDLE  h  ) 
 

Constructor (sets the underlying ACE_HANDLE with ).

Definition at line 17 of file MEM_Stream.inl.

References ACE_IPC_SAP::set_handle().

00018 {
00019   // ACE_TRACE ("ACE_MEM_Stream::ACE_MEM_Stream");
00020   this->set_handle (h);
00021 }

ACE_INLINE ACE_MEM_Stream::~ACE_MEM_Stream void   ) 
 

Destructor.

Definition at line 24 of file MEM_Stream.inl.

00025 {
00026   // ACE_TRACE ("ACE_MEM_Stream::~ACE_MEM_Stream");
00027 }


Member Function Documentation

int ACE_MEM_Stream::close void   ) 
 

Close down the socket (we need this to make things work correctly on Win32, which requires use to do a before doing the close to avoid losing data).

Reimplemented from ACE_SOCK.

Definition at line 26 of file MEM_Stream.cpp.

References ACE_SOCK::close(), close_writer(), ACE_MEM_IO::fini(), and ACE_MEM_IO::send().

00027 {
00028   this->send ((char *)0, 0);
00029 
00030   this->fini ();
00031 
00032 #if defined (ACE_WIN32)
00033   // We need the following call to make things work correctly on
00034   // Win32, which requires use to do a <close_writer> before doing the
00035   // close in order to avoid losing data.  Note that we don't need to
00036   // do this on UNIX since it doesn't have this "feature".  Moreover,
00037   // this will cause subtle problems on UNIX due to the way that
00038   // fork() works.
00039   this->close_writer ();
00040 #endif /* ACE_WIN32 */
00041   // Close down the socket.
00042   return ACE_SOCK::close ();
00043 }

ACE_INLINE int ACE_MEM_Stream::close_reader void   ) 
 

Close down the reader.

Definition at line 30 of file MEM_Stream.inl.

References ACE_SHUTDOWN_READ, ACE_TRACE, ACE_IPC_SAP::get_handle(), and ACE_OS::shutdown().

00031 {
00032   ACE_TRACE ("ACE_MEM_Stream::close_reader");
00033   if (this->get_handle () != ACE_INVALID_HANDLE)
00034     return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_READ);
00035   else
00036     return 0;
00037 }

ACE_INLINE int ACE_MEM_Stream::close_writer void   ) 
 

Close down the writer.

Definition at line 42 of file MEM_Stream.inl.

References ACE_SHUTDOWN_WRITE, ACE_TRACE, ACE_IPC_SAP::get_handle(), and ACE_OS::shutdown().

Referenced by close().

00043 {
00044   ACE_TRACE ("ACE_MEM_Stream::close_writer");
00045   if (this->get_handle () != ACE_INVALID_HANDLE)
00046     return ACE_OS::shutdown (this->get_handle (), ACE_SHUTDOWN_WRITE);
00047   else
00048     return 0;
00049 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_MEM_Stream::dump void   )  const
 

Dump the state of an object.

Reimplemented from ACE_MEM_IO.

Definition at line 18 of file MEM_Stream.cpp.

References ACE_TRACE.

00019 {
00020 #if defined (ACE_HAS_DUMP)
00021   ACE_TRACE ("ACE_MEM_Stream::dump");
00022 #endif /* ACE_HAS_DUMP */
00023 }

ACE_INLINE ssize_t ACE_MEM_Stream::recv_n void *  buf,
size_t  n,
int  flags
 

Definition at line 71 of file MEM_Stream.inl.

References ACE_MEM_IO::recv().

00072 {
00073   return this->recv (buf, n, flags);
00074 }

ACE_INLINE ssize_t ACE_MEM_Stream::recv_n void *  buf,
size_t  n
 

Definition at line 59 of file MEM_Stream.inl.

References ACE_MEM_IO::recv().

00060 {
00061   return this->recv (buf, n);
00062 }

ACE_INLINE ssize_t ACE_MEM_Stream::send_n const void *  buf,
size_t  n,
int  flags
 

Send n bytes, keep trying until n are sent. Recv n bytes, keep trying until n are received.

Definition at line 65 of file MEM_Stream.inl.

References ACE_MEM_IO::send().

00066 {
00067   return this->send (buf, n, flags);
00068 }

ACE_INLINE ssize_t ACE_MEM_Stream::send_n const void *  buf,
size_t  n
 

Send n bytes, keep trying until n are sent. Recv n bytes, keep trying until n are received.

Definition at line 52 of file MEM_Stream.inl.

References ACE_MEM_IO::send().

00053 {
00054   return this->send (buf, n);
00055 }


Friends And Related Function Documentation

friend class ACE_MEM_Acceptor [friend]
 

Definition at line 57 of file MEM_Stream.h.

friend class ACE_MEM_Connector [friend]
 

Definition at line 58 of file MEM_Stream.h.


Member Data Documentation

ACE_MEM_Stream::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_MEM_IO.

Definition at line 146 of file MEM_Stream.h.


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