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

ACE_Log_Msg_IPC Class Reference

Defines the interfaces for ACE_Log_Msg backend. More...

#include <Log_Msg_IPC.h>

Inheritance diagram for ACE_Log_Msg_IPC:

Inheritance graph
[legend]
Collaboration diagram for ACE_Log_Msg_IPC:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_Log_Msg_IPC (void)
 Constructor. More...

virtual ~ACE_Log_Msg_IPC (void)
 Destructor. More...

virtual int open (const ACE_TCHAR *logger_key)
 Open a new connection. More...

virtual int reset (void)
virtual int close (void)
 Close the backend completely. More...

virtual int log (ACE_Log_Record &log_record)
 Backend routine. This is called when we want to log a message. Since this routine is pure virtual, it must be overwritten by the subclass. More...


Private Attributes

ACE_LOG_MSG_IPC_STREAM message_queue_

Detailed Description

Defines the interfaces for ACE_Log_Msg backend.

Implement an ACE_Log_Msg_Backend that logs to a remote logging process.

Definition at line 43 of file Log_Msg_IPC.h.


Constructor & Destructor Documentation

ACE_Log_Msg_IPC::ACE_Log_Msg_IPC void   
 

Constructor.

Definition at line 9 of file Log_Msg_IPC.cpp.

00010 {
00011 }

ACE_Log_Msg_IPC::~ACE_Log_Msg_IPC void    [virtual]
 

Destructor.

Definition at line 13 of file Log_Msg_IPC.cpp.

References close.

00014 {
00015   (void) this->close ();
00016 }


Member Function Documentation

int ACE_Log_Msg_IPC::close void    [virtual]
 

Close the backend completely.

Implements ACE_Log_Msg_Backend.

Definition at line 44 of file Log_Msg_IPC.cpp.

References ACE_SOCK_Stream::close, and message_queue_.

Referenced by reset, and ~ACE_Log_Msg_IPC.

00045 {
00046   return this->message_queue_.close ();
00047 }

int ACE_Log_Msg_IPC::log ACE_Log_Record   log_record [virtual]
 

Backend routine. This is called when we want to log a message. Since this routine is pure virtual, it must be overwritten by the subclass.

Implements ACE_Log_Msg_Backend.

Definition at line 50 of file Log_Msg_IPC.cpp.

References ACE_Log_Record::length, message_queue_, ACE_Log_Record::priority, ACE_SOCK_IO::send, and ACE_SOCK_Stream::send_n.

00051 {
00052 #if defined (ACE_HAS_STREAM_PIPES)
00053   ACE_Str_Buf log_msg (ACE_static_cast (void *,
00054                                         &log_record),
00055                        ACE_static_cast (int,
00056                                         log_record.length ()));
00057 
00058   // Try to use the <putpmsg> API if possible in order to
00059   // ensure correct message queueing according to priority.
00060   return
00061     this->message_queue_.send
00062       (ACE_static_cast (const ACE_Str_Buf *, 0),
00063        &log_msg,
00064        ACE_static_cast (int, log_record.priority ()),
00065        MSG_BAND);
00066 #else
00067   // We're running over sockets, so we'll need to indicate the
00068   // number of bytes to send.
00069   return
00070     this->message_queue_.send_n ((void *) &log_record,
00071                                   log_record.length ());
00072 #endif /* ACE_HAS_STREAM_PIPES */
00073 }

int ACE_Log_Msg_IPC::open const ACE_TCHAR   logger_key [virtual]
 

Open a new connection.

Implements ACE_Log_Msg_Backend.

Definition at line 19 of file Log_Msg_IPC.cpp.

References ACE_TCHAR, and ACE_SOCK_Connector::connect.

00020 {
00021   ACE_LOG_MSG_IPC_CONNECTOR con;
00022   return con.connect (this->message_queue_,
00023                       ACE_LOG_MSG_IPC_ADDR (logger_key));
00024 }

int ACE_Log_Msg_IPC::reset void    [virtual]
 

Implements ACE_Log_Msg_Backend.

Definition at line 27 of file Log_Msg_IPC.cpp.

References close, ACE_IPC_SAP::get_handle, message_queue_, and ACE_SOCK_Stream::send_n.

00028 {
00029   if (this->message_queue_.get_handle () != ACE_INVALID_HANDLE)
00030     {
00031       // If we don't do this, handles aren't reused on Win32 and the
00032       // server eventually crashes!
00033 #if defined (ACE_WIN32)
00034       ACE_INT32 dummy = ~0;
00035       this->message_queue_.send_n ((const void *) &dummy,
00036                                     sizeof (ACE_INT32));
00037 #endif /* ACE_WIN32 */
00038       return this->close ();
00039     }
00040   return 0;
00041 }


Member Data Documentation

ACE_LOG_MSG_IPC_STREAM ACE_Log_Msg_IPC::message_queue_ [private]
 

Definition at line 59 of file Log_Msg_IPC.h.

Referenced by close, log, and reset.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:49:33 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002