00001 #include "ace_pch.h"
00002
00003
00004 #include "ace/Log_Msg_IPC.h"
00005 #include "ace/Log_Record.h"
00006
00007 ACE_RCSID(ace, Log_Msg_IPC, "$Id: Log_Msg_IPC.cpp,v 1.1.1.1.40.1 2003/03/13 19:44:21 chad Exp $")
00008
00009 ACE_Log_Msg_IPC::ACE_Log_Msg_IPC (void)
00010 {
00011 }
00012
00013 ACE_Log_Msg_IPC::~ACE_Log_Msg_IPC (void)
00014 {
00015 (void) this->close ();
00016 }
00017
00018 int
00019 ACE_Log_Msg_IPC::open (const ACE_TCHAR *logger_key)
00020 {
00021 ACE_LOG_MSG_IPC_CONNECTOR con;
00022 return con.connect (this->message_queue_,
00023 ACE_LOG_MSG_IPC_ADDR (logger_key));
00024 }
00025
00026 int
00027 ACE_Log_Msg_IPC::reset (void)
00028 {
00029 if (this->message_queue_.get_handle () != ACE_INVALID_HANDLE)
00030 {
00031
00032
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
00038 return this->close ();
00039 }
00040 return 0;
00041 }
00042
00043 int
00044 ACE_Log_Msg_IPC::close (void)
00045 {
00046 return this->message_queue_.close ();
00047 }
00048
00049 int
00050 ACE_Log_Msg_IPC::log (ACE_Log_Record &log_record)
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
00059
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
00068
00069 return
00070 this->message_queue_.send_n ((void *) &log_record,
00071 log_record.length ());
00072 #endif
00073 }