diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-09-20 07:28:13 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-09-20 07:28:13 +0000 |
commit | dac8c4cdd6fc0f7c3822d518b1e0d35a8847ca09 (patch) | |
tree | 8e251ff34dc7a40c63781cf0281ff502fdf269b3 /ACE/ace | |
parent | 4737d360f196880a4806a993a7ff056bf550b7ab (diff) | |
download | ATCD-dac8c4cdd6fc0f7c3822d518b1e0d35a8847ca09.tar.gz |
Thu Sep 20 07:24:15 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ACE/ace')
-rw-r--r-- | ACE/ace/Log_Msg.cpp | 200 | ||||
-rw-r--r-- | ACE/ace/Log_Msg.h | 19 | ||||
-rw-r--r-- | ACE/ace/Log_Msg.inl | 235 | ||||
-rw-r--r-- | ACE/ace/Makefile.am | 1 |
4 files changed, 252 insertions, 203 deletions
diff --git a/ACE/ace/Log_Msg.cpp b/ACE/ace/Log_Msg.cpp index 0524364c134..34bb2d88477 100644 --- a/ACE/ace/Log_Msg.cpp +++ b/ACE/ace/Log_Msg.cpp @@ -13,12 +13,10 @@ #include "ace/Thread_Manager.h" #include "ace/Guard_T.h" #include "ace/OS_NS_stdio.h" -#include "ace/OS_NS_string.h" #include "ace/OS_NS_errno.h" #include "ace/OS_NS_sys_time.h" #include "ace/OS_NS_wchar.h" #include "ace/OS_NS_signal.h" -#include "ace/OS_NS_unistd.h" #if !defined (ACE_MT_SAFE) || (ACE_MT_SAFE != 0) # include "ace/Object_Manager_Base.h" @@ -41,6 +39,10 @@ #include "ace/Log_Record.h" #include "ace/Recursive_Thread_Mutex.h" +#if !defined (__ACE_INLINE__) +#include "ace/Log_Msg.inl" +#endif /* __ACE_INLINE__ */ + ACE_RCSID(ace, Log_Msg, "$Id$") ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -632,22 +634,6 @@ ACE_Log_Msg::priority_mask (u_long n_mask, MASK_TYPE mask_type) return o_mask; } -u_long -ACE_Log_Msg::priority_mask (MASK_TYPE mask_type) -{ - return mask_type == THREAD - ? this->priority_mask_ - : ACE_Log_Msg::process_priority_mask_; -} - -int -ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority) -{ - return ACE_BIT_ENABLED (this->priority_mask_ | - ACE_Log_Msg::process_priority_mask_, - log_priority); -} - int ACE_Log_Msg::release (void) { @@ -2343,96 +2329,6 @@ ACE_Log_Msg::dump (void) const } void -ACE_Log_Msg::op_status (int status) -{ - this->status_ = status; -} - -int -ACE_Log_Msg::op_status (void) -{ - return this->status_; -} - -void -ACE_Log_Msg::restart (int r) -{ - this->restart_ = r; -} - -int -ACE_Log_Msg::restart (void) -{ - return this->restart_; -} - -int -ACE_Log_Msg::errnum (void) -{ - return this->errnum_; -} - -void -ACE_Log_Msg::errnum (int e) -{ - this->errnum_ = e; -} - -int -ACE_Log_Msg::linenum (void) -{ - return this->linenum_; -} - -void -ACE_Log_Msg::linenum (int l) -{ - this->linenum_ = l; -} - -int -ACE_Log_Msg::inc (void) -{ - return this->trace_depth_++; -} - -int -ACE_Log_Msg::dec (void) -{ - return this->trace_depth_ == 0 ? 0 : --this->trace_depth_; -} - -int -ACE_Log_Msg::trace_depth (void) -{ - return this->trace_depth_; -} - -void -ACE_Log_Msg::trace_depth (int depth) -{ - this->trace_depth_ = depth; -} - -int -ACE_Log_Msg::trace_active (void) -{ - return this->trace_active_; -} - -void -ACE_Log_Msg::trace_active (int value) -{ - this->trace_active_ = value; -} - -ACE_Thread_Descriptor * -ACE_Log_Msg::thr_desc (void) const -{ - return this->thr_desc_; -} - -void ACE_Log_Msg::thr_desc (ACE_Thread_Descriptor *td) { this->thr_desc_ = td; @@ -2467,67 +2363,6 @@ ACE_Log_Msg::seh_except_handler (ACE_SEH_EXCEPT_HANDLER n) } #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS && ACE_LEGACY_MODE */ -// Enable the tracing facility on a per-thread basis. - -void -ACE_Log_Msg::start_tracing (void) -{ - this->tracing_enabled_ = 1; -} - -// Disable the tracing facility on a per-thread basis. - -void -ACE_Log_Msg::stop_tracing (void) -{ - this->tracing_enabled_ = 0; -} - -int -ACE_Log_Msg::tracing_enabled (void) -{ - return this->tracing_enabled_; -} - -const char * -ACE_Log_Msg::file (void) -{ - return this->file_; -} - -void -ACE_Log_Msg::file (const char *s) -{ - ACE_OS::strsncpy (this->file_, s, sizeof this->file_); -} - -const ACE_TCHAR * -ACE_Log_Msg::msg (void) -{ - return this->msg_ + ACE_Log_Msg::msg_off_; -} - -void -ACE_Log_Msg::msg (const ACE_TCHAR *m) -{ - ACE_OS::strsncpy (this->msg_, m, - ((ACE_MAXLOGMSGLEN+1) / sizeof (ACE_TCHAR))); -} - -ACE_Log_Msg_Callback * -ACE_Log_Msg::msg_callback (void) const -{ - return this->msg_callback_; -} - -ACE_Log_Msg_Callback * -ACE_Log_Msg::msg_callback (ACE_Log_Msg_Callback *c) -{ - ACE_Log_Msg_Callback *old = this->msg_callback_; - this->msg_callback_ = c; - return old; -} - ACE_Log_Msg_Backend * ACE_Log_Msg::msg_backend (ACE_Log_Msg_Backend *b) { @@ -2550,12 +2385,6 @@ ACE_Log_Msg::msg_backend (void) return ACE_Log_Msg_Manager::custom_backend_; } -ACE_OSTREAM_TYPE * -ACE_Log_Msg::msg_ostream (void) const -{ - return this->ostream_; -} - void ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m, int delete_ostream) { @@ -2576,12 +2405,6 @@ ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m, int delete_ostream) } void -ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m) -{ - this->ostream_ = m; -} - -void ACE_Log_Msg::local_host (const ACE_TCHAR *s) { if (s) @@ -2595,21 +2418,6 @@ ACE_Log_Msg::local_host (const ACE_TCHAR *s) } } -const ACE_TCHAR * -ACE_Log_Msg::local_host (void) const -{ - return ACE_Log_Msg::local_host_; -} - -pid_t -ACE_Log_Msg::getpid (void) const -{ - if (ACE_Log_Msg::pid_ == -1) - ACE_Log_Msg::pid_ = ACE_OS::getpid (); - - return ACE_Log_Msg::pid_; -} - int ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority, const char *, diff --git a/ACE/ace/Log_Msg.h b/ACE/ace/Log_Msg.h index f54d6fe7f5f..49a0bd19553 100644 --- a/ACE/ace/Log_Msg.h +++ b/ACE/ace/Log_Msg.h @@ -187,6 +187,7 @@ public: /// Returns the current program name used for logging. static const ACE_TCHAR * program_name (void); + /// Clears the flag from the default priority mask used to /// initialize ACE_Log_Msg instances. static void disable_debug_messages (ACE_Log_Priority priority = LM_DEBUG); @@ -270,7 +271,7 @@ public: /// Get the result of the operation status (by convention, -1 means /// error). - int op_status (void); + int op_status (void) const; /// Set the value of the errnum (by convention this corresponds to /// errno). @@ -278,13 +279,13 @@ public: /// Get the value of the errnum (by convention this corresponds to /// errno). - int errnum (void); + int errnum (void) const; /// Set the line number where an error occurred. void linenum (int); /// Get the line number where an error occurred. - int linenum (void); + int linenum (void) const; /// Set the file name where an error occurred. void file (const char *); @@ -304,7 +305,7 @@ public: /// Get the field that indicates whether interrupted calls should be /// restarted. - int restart (void); + int restart (void) const; // = Notice that the following two function is equivalent to // "void msg_ostream (HANDLE)" and "HANDLE msg_ostream (void)" @@ -352,13 +353,13 @@ public: int dec (void); /// Get trace depth. - int trace_depth (void); + int trace_depth (void) const; /// Set trace depth. void trace_depth (int); /// Set trace active status. - int trace_active (void); + int trace_active (void) const; /// Get trace active status. void trace_active (int value); @@ -401,7 +402,7 @@ public: void start_tracing (void); /// Query tracing status on a per-thread basis... - int tracing_enabled (void); + int tracing_enabled (void) const; typedef enum { @@ -723,5 +724,9 @@ ACE_TSS_CLEANUP_NAME (void *ptr); #include "ace/Log_Msg_Callback.h" #endif /* ACE_LEGACY_MODE */ +#if defined (__ACE_INLINE__) +#include "ace/Log_Msg.inl" +#endif /* __ACE_INLINE__ */ + #include /**/ "ace/post.h" #endif /* ACE_LOG_MSG_H */ diff --git a/ACE/ace/Log_Msg.inl b/ACE/ace/Log_Msg.inl new file mode 100644 index 00000000000..1b77f586b64 --- /dev/null +++ b/ACE/ace/Log_Msg.inl @@ -0,0 +1,235 @@ +// -*- C++ -*- +// +// $Id$ + +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_unistd.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +ACE_INLINE +u_long +ACE_Log_Msg::priority_mask (MASK_TYPE mask_type) +{ + return mask_type == THREAD + ? this->priority_mask_ + : ACE_Log_Msg::process_priority_mask_; +} + +ACE_INLINE +int +ACE_Log_Msg::log_priority_enabled (ACE_Log_Priority log_priority) +{ + return ACE_BIT_ENABLED (this->priority_mask_ | + ACE_Log_Msg::process_priority_mask_, + log_priority); +} + +ACE_INLINE +void +ACE_Log_Msg::op_status (int status) +{ + this->status_ = status; +} + +ACE_INLINE +int +ACE_Log_Msg::op_status (void) const +{ + return this->status_; +} + +ACE_INLINE +void +ACE_Log_Msg::restart (int r) +{ + this->restart_ = r; +} + +ACE_INLINE +int +ACE_Log_Msg::restart (void) const +{ + return this->restart_; +} + +ACE_INLINE +int +ACE_Log_Msg::errnum (void) const +{ + return this->errnum_; +} + +ACE_INLINE +void +ACE_Log_Msg::errnum (int e) +{ + this->errnum_ = e; +} + +ACE_INLINE +int +ACE_Log_Msg::linenum (void) const +{ + return this->linenum_; +} + +ACE_INLINE +void +ACE_Log_Msg::linenum (int l) +{ + this->linenum_ = l; +} + +ACE_INLINE +int +ACE_Log_Msg::inc (void) +{ + return this->trace_depth_++; +} + +ACE_INLINE +int +ACE_Log_Msg::dec (void) +{ + return this->trace_depth_ == 0 ? 0 : --this->trace_depth_; +} + +ACE_INLINE +int +ACE_Log_Msg::trace_depth (void) const +{ + return this->trace_depth_; +} + +ACE_INLINE +void +ACE_Log_Msg::trace_depth (int depth) +{ + this->trace_depth_ = depth; +} + +ACE_INLINE +int +ACE_Log_Msg::trace_active (void) const +{ + return this->trace_active_; +} + +ACE_INLINE +void +ACE_Log_Msg::trace_active (int value) +{ + this->trace_active_ = value; +} + +ACE_INLINE +ACE_Thread_Descriptor * +ACE_Log_Msg::thr_desc (void) const +{ + return this->thr_desc_; +} + +/// Enable the tracing facility on a per-thread basis. +ACE_INLINE +void +ACE_Log_Msg::start_tracing (void) +{ + this->tracing_enabled_ = 1; +} + +/// Disable the tracing facility on a per-thread basis. +ACE_INLINE +void +ACE_Log_Msg::stop_tracing (void) +{ + this->tracing_enabled_ = 0; +} + +ACE_INLINE +int +ACE_Log_Msg::tracing_enabled (void) const +{ + return this->tracing_enabled_; +} + +ACE_INLINE +const char * +ACE_Log_Msg::file (void) +{ + return this->file_; +} + +ACE_INLINE +void +ACE_Log_Msg::file (const char *s) +{ + ACE_OS::strsncpy (this->file_, s, sizeof this->file_); +} + +ACE_INLINE +const ACE_TCHAR * +ACE_Log_Msg::msg (void) +{ + return this->msg_ + ACE_Log_Msg::msg_off_; +} + +ACE_INLINE +void +ACE_Log_Msg::msg (const ACE_TCHAR *m) +{ + ACE_OS::strsncpy (this->msg_, m, + ((ACE_MAXLOGMSGLEN+1) / sizeof (ACE_TCHAR))); +} + +ACE_INLINE +ACE_Log_Msg_Callback * +ACE_Log_Msg::msg_callback (void) const +{ + return this->msg_callback_; +} + +ACE_INLINE +ACE_Log_Msg_Callback * +ACE_Log_Msg::msg_callback (ACE_Log_Msg_Callback *c) +{ + ACE_Log_Msg_Callback *old = this->msg_callback_; + this->msg_callback_ = c; + return old; +} + +ACE_INLINE +ACE_OSTREAM_TYPE * +ACE_Log_Msg::msg_ostream (void) const +{ + return this->ostream_; +} + +ACE_INLINE +void +ACE_Log_Msg::msg_ostream (ACE_OSTREAM_TYPE *m) +{ + this->ostream_ = m; +} + +ACE_INLINE +const ACE_TCHAR * +ACE_Log_Msg::local_host (void) const +{ + return ACE_Log_Msg::local_host_; +} + +ACE_INLINE +pid_t +ACE_Log_Msg::getpid (void) const +{ + if (ACE_Log_Msg::pid_ == -1) + ACE_Log_Msg::pid_ = ACE_OS::getpid (); + + return ACE_Log_Msg::pid_; +} + + + +ACE_END_VERSIONED_NAMESPACE_DECL + diff --git a/ACE/ace/Makefile.am b/ACE/ace/Makefile.am index 3f440a5ed7e..66079dc333f 100644 --- a/ACE/ace/Makefile.am +++ b/ACE/ace/Makefile.am @@ -620,6 +620,7 @@ nobase_include_HEADERS += \ Lock_Adapter_T.h \ Lock_Adapter_T.inl \ Log_Msg.h \ + Log_Msg.inl \ Log_Msg_Backend.h \ Log_Msg_Callback.h \ Log_Msg_IPC.h \ |