diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-08-26 23:42:52 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-08-26 23:42:52 +0000 |
commit | 4b6694c5a2baef59a4845caef124ab550a876e43 (patch) | |
tree | 495797f7118c50c4adbd1feb035f7ed5a7d460fd | |
parent | ac5745535942fed5c6c518e7a39b304415001fee (diff) | |
download | ATCD-4b6694c5a2baef59a4845caef124ab550a876e43.tar.gz |
ChangeLogTag:Sat Aug 26 17:39:53 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 12 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 12 | ||||
-rw-r--r-- | ace/Logging_Strategy.cpp | 95 | ||||
-rw-r--r-- | ace/Logging_Strategy.h | 10 | ||||
-rw-r--r-- | ace/Reactor.h | 4 | ||||
-rw-r--r-- | ace/Reactor.i | 4 | ||||
-rw-r--r-- | ace/Reactor_Impl.h | 2 | ||||
-rw-r--r-- | ace/Select_Reactor_Base.h | 2 | ||||
-rw-r--r-- | ace/Select_Reactor_Base.i | 2 | ||||
-rw-r--r-- | ace/Select_Reactor_T.h | 2 | ||||
-rw-r--r-- | ace/Select_Reactor_T.i | 2 | ||||
-rw-r--r-- | ace/WFMO_Reactor.h | 2 | ||||
-rw-r--r-- | ace/WFMO_Reactor.i | 2 | ||||
-rw-r--r-- | ace/config-all.h | 2 |
15 files changed, 153 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index ef8550cb761..3e3977fd4e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Sat Aug 26 17:39:53 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace/config-all.h: Added new ACE_CONST_WHEN_MUTABLE macro. + Thanks to Edan Ayal <edan@bandwiz.com> for contributing this. + + * ace/Logging_Strategy: Added support for more fine-grained + control over logging strategies and priorities. Thanks to + Martin Krumpolec <krumpo@pobox.sk> for reporting this. + + * ace: Improved the "const correctness" of many Reactor methods. + Thanks to Edan Ayal <edan@bandwiz.com> for contributing this. + Sat Aug 26 15:23:54 2000 Carlos O'Ryan <coryan@uci.edu> * ace/OS.cpp: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index ef8550cb761..3e3977fd4e5 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,15 @@ +Sat Aug 26 17:39:53 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace/config-all.h: Added new ACE_CONST_WHEN_MUTABLE macro. + Thanks to Edan Ayal <edan@bandwiz.com> for contributing this. + + * ace/Logging_Strategy: Added support for more fine-grained + control over logging strategies and priorities. Thanks to + Martin Krumpolec <krumpo@pobox.sk> for reporting this. + + * ace: Improved the "const correctness" of many Reactor methods. + Thanks to Edan Ayal <edan@bandwiz.com> for contributing this. + Sat Aug 26 15:23:54 2000 Carlos O'Ryan <coryan@uci.edu> * ace/OS.cpp: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index ef8550cb761..3e3977fd4e5 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,15 @@ +Sat Aug 26 17:39:53 2000 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace/config-all.h: Added new ACE_CONST_WHEN_MUTABLE macro. + Thanks to Edan Ayal <edan@bandwiz.com> for contributing this. + + * ace/Logging_Strategy: Added support for more fine-grained + control over logging strategies and priorities. Thanks to + Martin Krumpolec <krumpo@pobox.sk> for reporting this. + + * ace: Improved the "const correctness" of many Reactor methods. + Thanks to Edan Ayal <edan@bandwiz.com> for contributing this. + Sat Aug 26 15:23:54 2000 Carlos O'Ryan <coryan@uci.edu> * ace/OS.cpp: diff --git a/ace/Logging_Strategy.cpp b/ace/Logging_Strategy.cpp index be72da3cce7..105b228d0bf 100644 --- a/ace/Logging_Strategy.cpp +++ b/ace/Logging_Strategy.cpp @@ -8,6 +8,73 @@ ACE_RCSID(lib, Logging_Strategy, "$Id$") +// Parse the string containing (thread) priorities and set them accordingly. + +void +ACE_Logging_Strategy::priorities (ACE_TCHAR *priority_string, + ACE_Log_Msg::MASK_TYPE mask) +{ + u_long priority_mask = 0; + + // Choose priority mask to change. + + if (mask == ACE_Log_Msg::PROCESS) + priority_mask = process_priority_mask_; + else + priority_mask = thread_priority_mask_; + + // Parse string and alternate priority mask. + + for (ACE_TCHAR *priority = ACE_OS::strtok (priority_string, "|"); + priority != 0; + priority = ACE_OS::strtok (0, "|")) + { + if (ACE_OS::strcmp (priority, "TRACE") == 0) + ACE_SET_BITS (priority_mask, LM_TRACE); + else if (ACE_OS::strcmp (priority, "~TRACE") == 0) + ACE_CLR_BITS (priority_mask, LM_TRACE); + else if (ACE_OS::strcmp (priority, "DEBUG") == 0) + ACE_SET_BITS (priority_mask, LM_DEBUG); + else if (ACE_OS::strcmp (priority, "~DEBUG") == 0) + ACE_CLR_BITS (priority_mask, LM_DEBUG); + else if (ACE_OS::strcmp (priority, "INFO") == 0) + ACE_SET_BITS (priority_mask, LM_INFO); + else if (ACE_OS::strcmp (priority, "~INFO") == 0) + ACE_CLR_BITS (priority_mask, LM_INFO); + else if (ACE_OS::strcmp (priority, "NOTICE") == 0) + ACE_SET_BITS (priority_mask, LM_NOTICE); + else if (ACE_OS::strcmp (priority, "~NOTICE") == 0) + ACE_CLR_BITS (priority_mask, LM_NOTICE); + else if (ACE_OS::strcmp (priority, "WARNING") == 0) + ACE_SET_BITS (priority_mask, LM_WARNING); + else if (ACE_OS::strcmp (priority, "~WARNING") == 0) + ACE_CLR_BITS (priority_mask, LM_WARNING); + else if (ACE_OS::strcmp (priority, "ERROR") == 0) + ACE_SET_BITS (priority_mask, LM_ERROR); + else if (ACE_OS::strcmp (priority, "~ERROR") == 0) + ACE_CLR_BITS (priority_mask, LM_ERROR); + else if (ACE_OS::strcmp (priority, "CRITICAL") == 0) + ACE_SET_BITS (priority_mask, LM_CRITICAL); + else if (ACE_OS::strcmp (priority, "~CRITICAL") == 0) + ACE_CLR_BITS (priority_mask, LM_CRITICAL); + else if (ACE_OS::strcmp (priority, "ALERT") == 0) + ACE_SET_BITS (priority_mask, LM_ALERT); + else if (ACE_OS::strcmp (priority, "~ALERT") == 0) + ACE_CLR_BITS (priority_mask, LM_ALERT); + else if (ACE_OS::strcmp (priority, "EMERGENCY") == 0) + ACE_SET_BITS (priority_mask, LM_EMERGENCY); + else if (ACE_OS::strcmp (priority, "~EMERGENCY") == 0) + ACE_CLR_BITS (priority_mask, LM_EMERGENCY); + } + + // Affect right priority mask. + + if (mask == ACE_Log_Msg::PROCESS) + process_priority_mask_ = priority_mask; + else + thread_priority_mask_ = priority_mask; +} + // Parse the string containing all the flags and set the flags // accordingly. @@ -44,7 +111,7 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[]) this->interval_ = 0; this->max_size_ = ACE_DEFAULT_MAX_LOGFILE_SIZE; - ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("f:i:m:s:w"), 0); + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("f:i:m:p:s:t:w"), 0); for (int c; (c = get_opt ()) != -1; ) { @@ -66,12 +133,22 @@ ACE_Logging_Strategy::parse_args (int argc, ACE_TCHAR *argv[]) this->max_size_ = ACE_DEFAULT_MAX_LOGFILE_SIZE; this->max_size_ <<= 10; // convert to KB break; + case 'p': + temp = get_opt.optarg; + // Now tokenize the string to setup process log priority + this->priorities (temp, ACE_Log_Msg::PROCESS); + break; case 's': // Ensure that the OSTREAM flag is set ACE_SET_BITS (this->flags_, ACE_Log_Msg::OSTREAM); delete [] this->filename_; this->filename_ = ACE::strnew (get_opt.optarg); break; + case 't': + temp = get_opt.optarg; + // Now tokenize the string to setup thread log priority + this->priorities (temp, ACE_Log_Msg::THREAD); + break; case 'w': // Cause the logfile to be wiped out, both on startup and on // reconfigure. @@ -119,9 +196,25 @@ ACE_Logging_Strategy::init (int argc, ACE_TCHAR *argv[]) { ACE_TRACE ("ACE_Logging_Strategy::init"); + // Store current priority masks for changes in <parse_args>. + + this->process_priority_mask_ = + ACE_Log_Msg::instance ()->priority_mask (ACE_Log_Msg::PROCESS); + + this->thread_priority_mask_ = + ACE_Log_Msg::instance ()->priority_mask (ACE_Log_Msg::THREAD); + // Use the options hook to parse the command line arguments. this->parse_args (argc, argv); + // Setup priorities (to original if not specified on command line) + + ACE_Log_Msg::instance ()->priority_mask (thread_priority_mask_, + ACE_Log_Msg::THREAD); + + ACE_Log_Msg::instance ()->priority_mask (process_priority_mask_, + ACE_Log_Msg::PROCESS); + // Check if any flags were specified. If none were specified, let // the default behavior take effect. if (this->flags_ != 0) diff --git a/ace/Logging_Strategy.h b/ace/Logging_Strategy.h index 158cfcbd394..57e757c97c0 100644 --- a/ace/Logging_Strategy.h +++ b/ace/Logging_Strategy.h @@ -68,6 +68,16 @@ private: void tokenize (ACE_TCHAR *flag_string); // Tokenize to set all the flags + void priorities (ACE_TCHAR *priority_string, + ACE_Log_Msg::MASK_TYPE mask); + // Tokenize to set priorities (either process or thread one). + + u_long thread_priority_mask_; + // Current thread's priority mask set by <priorities> + + u_long process_priority_mask_; + // Process-wide priority mask set by <priorities> + u_long flags_; // Flags we keep track of. diff --git a/ace/Reactor.h b/ace/Reactor.h index 06ff8fcb88d..1bde5178fc4 100644 --- a/ace/Reactor.h +++ b/ace/Reactor.h @@ -461,7 +461,7 @@ public: // Returns true if Reactor has been successfully initialized, else // false. - virtual size_t size (void); + virtual size_t size (void) const; // Returns the current size of the Reactor's internal descriptor // table. @@ -516,7 +516,7 @@ public: int ops); // GET/SET/ADD/CLR the ready "bit" bound with the <handle> and <mask>. - virtual ACE_Reactor_Impl *implementation (void); + virtual ACE_Reactor_Impl *implementation (void) const; // Get the implementation class virtual int current_info (ACE_HANDLE handle, diff --git a/ace/Reactor.i b/ace/Reactor.i index 25001e418fc..12a306711d0 100644 --- a/ace/Reactor.i +++ b/ace/Reactor.i @@ -5,7 +5,7 @@ #include "ace/Handle_Set.h" ACE_INLINE ACE_Reactor_Impl * -ACE_Reactor::implementation (void) +ACE_Reactor::implementation (void) const { return this->implementation_; } @@ -635,7 +635,7 @@ ACE_Reactor::ready_ops (ACE_HANDLE handle, } ACE_INLINE size_t -ACE_Reactor::size (void) +ACE_Reactor::size (void) const { return this->implementation ()->size (); } diff --git a/ace/Reactor_Impl.h b/ace/Reactor_Impl.h index 3aeb710064e..9a651a099c2 100644 --- a/ace/Reactor_Impl.h +++ b/ace/Reactor_Impl.h @@ -406,7 +406,7 @@ public: // Returns true if Reactor has been successfully initialized, else // false. - virtual size_t size (void) = 0; + virtual size_t size (void) const = 0; // Returns the current size of the Reactor's internal descriptor // table. diff --git a/ace/Select_Reactor_Base.h b/ace/Select_Reactor_Base.h index 4fecba588f0..f0e4b596ae6 100644 --- a/ace/Select_Reactor_Base.h +++ b/ace/Select_Reactor_Base.h @@ -255,7 +255,7 @@ public: int handle_in_range (ACE_HANDLE handle); // = Accessors. - size_t size (void); + size_t size (void) const; // Returns the current table size. size_t max_handlep1 (void); diff --git a/ace/Select_Reactor_Base.i b/ace/Select_Reactor_Base.i index 001a19fb753..9cc272afe1f 100644 --- a/ace/Select_Reactor_Base.i +++ b/ace/Select_Reactor_Base.i @@ -24,7 +24,7 @@ ACE_Select_Reactor_Handler_Repository_Iterator::~ACE_Select_Reactor_Handler_Repo } ACE_INLINE size_t -ACE_Select_Reactor_Handler_Repository::size (void) +ACE_Select_Reactor_Handler_Repository::size (void) const { return this->max_size_; } diff --git a/ace/Select_Reactor_T.h b/ace/Select_Reactor_T.h index 6cff9eefb5a..acb3457b224 100644 --- a/ace/Select_Reactor_T.h +++ b/ace/Select_Reactor_T.h @@ -498,7 +498,7 @@ public: virtual int initialized (void); // Returns true if we've been successfully initialized, else false. - virtual size_t size (void); + virtual size_t size (void) const; // Returns the current size of the Reactor's internal descriptor // table. diff --git a/ace/Select_Reactor_T.i b/ace/Select_Reactor_T.i index 9c447a5d50b..6adfe6aa8e2 100644 --- a/ace/Select_Reactor_T.i +++ b/ace/Select_Reactor_T.i @@ -233,7 +233,7 @@ ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop) } template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ size_t -ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::size (void) +ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::size (void) const { return this->handler_rep_.size (); } diff --git a/ace/WFMO_Reactor.h b/ace/WFMO_Reactor.h index 16d80122dc4..38024a19dec 100644 --- a/ace/WFMO_Reactor.h +++ b/ace/WFMO_Reactor.h @@ -933,7 +933,7 @@ public: // Returns true if WFMO_Reactor has been successfully initialized, else // false. - virtual size_t size (void); + virtual size_t size (void) const; // Returns the current size of the WFMO_Reactor's internal // descriptor table. diff --git a/ace/WFMO_Reactor.i b/ace/WFMO_Reactor.i index 2aa56f2c08d..a1f025844f7 100644 --- a/ace/WFMO_Reactor.i +++ b/ace/WFMO_Reactor.i @@ -1100,7 +1100,7 @@ ACE_WFMO_Reactor::lock (void) } ACE_INLINE size_t -ACE_WFMO_Reactor::size (void) +ACE_WFMO_Reactor::size (void) const { // Size of repository minus the 2 used for internal purposes return this->handler_rep_.max_size_ - 2; diff --git a/ace/config-all.h b/ace/config-all.h index 7c9263ba13b..f3ce51fdac6 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -127,8 +127,10 @@ # if defined (ACE_HAS_MUTABLE_KEYWORD) # define ACE_MUTABLE mutable +# define ACE_CONST_WHEN_MUTABLE const // Addition #1 # else /* ! ACE_HAS_MUTABLE_KEYWORD */ # define ACE_MUTABLE +# define ACE_CONST_WHEN_MUTABLE // Addition #2 # endif /* ! ACE_HAS_MUTABLE_KEYWORD */ // ============================================================================ |