00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Log_Msg_IPC.h 00006 * 00007 * $Id: Log_Msg_IPC.h 80826 2008-03-04 14:51:23Z wotte $ 00008 * 00009 * @author Carlos O'Ryan <coryan@uci.edu> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef ACE_LOG_MSG_LOGGER_H 00014 #define ACE_LOG_MSG_LOGGER_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include "ace/Log_Msg_Backend.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 // IPC conduit between sender and client daemon. This should be 00024 // included in the ACE_Log_Msg class, but due to "order of include" 00025 // problems it can't be... 00026 #if defined (ACE_HAS_STREAM_PIPES) 00027 # include "ace/SPIPE_Connector.h" 00028 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00029 typedef ACE_SPIPE_Stream ACE_LOG_MSG_IPC_STREAM; 00030 typedef ACE_SPIPE_Connector ACE_LOG_MSG_IPC_CONNECTOR; 00031 typedef ACE_SPIPE_Addr ACE_LOG_MSG_IPC_ADDR; 00032 ACE_END_VERSIONED_NAMESPACE_DECL 00033 #else 00034 # include "ace/SOCK_Connector.h" 00035 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00036 typedef ACE_SOCK_Stream ACE_LOG_MSG_IPC_STREAM; 00037 typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR; 00038 typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR; 00039 ACE_END_VERSIONED_NAMESPACE_DECL 00040 #endif /* ACE_HAS_STREAM_PIPES */ 00041 00042 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00043 00044 /// Defines the interfaces for ACE_Log_Msg backend. 00045 /** 00046 * Implement an ACE_Log_Msg_Backend that logs to a remote logging 00047 * process. 00048 */ 00049 class ACE_Export ACE_Log_Msg_IPC : public ACE_Log_Msg_Backend 00050 { 00051 public: 00052 /// Constructor 00053 ACE_Log_Msg_IPC (void); 00054 00055 /// Destructor 00056 virtual ~ACE_Log_Msg_IPC (void); 00057 00058 /// Open a new connection 00059 virtual int open (const ACE_TCHAR *logger_key); 00060 00061 /** 00062 * Reset the backend. When changing the logging destination the 00063 * backend may need to properly disconnect from the remote logging 00064 * daemon and reclaim some local resources. But we try to reduce 00065 * the number of local allocations/deallocations. 00066 */ 00067 virtual int reset (void); 00068 00069 virtual int close (void); 00070 virtual ssize_t log (ACE_Log_Record &log_record); 00071 00072 private: 00073 ACE_LOG_MSG_IPC_STREAM message_queue_; 00074 }; 00075 00076 ACE_END_VERSIONED_NAMESPACE_DECL 00077 00078 #include /**/ "ace/post.h" 00079 #endif /* ACE_LOG_MSG_H */