00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Log_Msg_IPC.h 00006 * 00007 * $Id: Log_Msg_IPC.h 84536 2009-02-20 09:28:48Z johnnyw $ 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 #include "ace/Default_Constants.h" 00024 00025 // IPC conduit between sender and client daemon. This should be 00026 // included in the ACE_Log_Msg class, but due to "order of include" 00027 // problems it can't be... 00028 #if (ACE_HAS_STREAM_LOG_MSG_IPC == 1) 00029 # include "ace/SPIPE_Connector.h" 00030 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00031 typedef ACE_SPIPE_Stream ACE_LOG_MSG_IPC_STREAM; 00032 typedef ACE_SPIPE_Connector ACE_LOG_MSG_IPC_CONNECTOR; 00033 typedef ACE_SPIPE_Addr ACE_LOG_MSG_IPC_ADDR; 00034 ACE_END_VERSIONED_NAMESPACE_DECL 00035 #else 00036 # include "ace/SOCK_Connector.h" 00037 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00038 typedef ACE_SOCK_Stream ACE_LOG_MSG_IPC_STREAM; 00039 typedef ACE_SOCK_Connector ACE_LOG_MSG_IPC_CONNECTOR; 00040 typedef ACE_INET_Addr ACE_LOG_MSG_IPC_ADDR; 00041 ACE_END_VERSIONED_NAMESPACE_DECL 00042 #endif /* ACE_HAS_STREAM_PIPES */ 00043 00044 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00045 00046 /// Defines the interfaces for ACE_Log_Msg backend. 00047 /** 00048 * Implement an ACE_Log_Msg_Backend that logs to a remote logging 00049 * process. 00050 */ 00051 class ACE_Export ACE_Log_Msg_IPC : public ACE_Log_Msg_Backend 00052 { 00053 public: 00054 /// Constructor 00055 ACE_Log_Msg_IPC (void); 00056 00057 /// Destructor 00058 virtual ~ACE_Log_Msg_IPC (void); 00059 00060 /// Open a new connection 00061 virtual int open (const ACE_TCHAR *logger_key); 00062 00063 /** 00064 * Reset the backend. When changing the logging destination the 00065 * backend may need to properly disconnect from the remote logging 00066 * daemon and reclaim some local resources. But we try to reduce 00067 * the number of local allocations/deallocations. 00068 */ 00069 virtual int reset (void); 00070 00071 virtual int close (void); 00072 virtual ssize_t log (ACE_Log_Record &log_record); 00073 00074 private: 00075 ACE_LOG_MSG_IPC_STREAM message_queue_; 00076 }; 00077 00078 ACE_END_VERSIONED_NAMESPACE_DECL 00079 00080 #include /**/ "ace/post.h" 00081 #endif /* ACE_LOG_MSG_H */