diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-04-10 17:44:16 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2002-04-10 17:44:16 +0000 |
commit | 229673fc49bb56c3f1207cb82c01f8914850c287 (patch) | |
tree | 1081fc9b38d9ab63244fa71ae0320de03e56a427 /ace | |
parent | 684aee545e53cd775175481dd38b306449c92fd7 (diff) | |
download | ATCD-229673fc49bb56c3f1207cb82c01f8914850c287.tar.gz |
ChangeLogTag:Wed Apr 10 10:40:36 2002 Ossama Othman <ossama@uci.edu>
Diffstat (limited to 'ace')
70 files changed, 1594 insertions, 1416 deletions
diff --git a/ace/Active_Map_Manager.h b/ace/Active_Map_Manager.h index 1911e6c7e2e..881e8d99382 100644 --- a/ace/Active_Map_Manager.h +++ b/ace/Active_Map_Manager.h @@ -15,7 +15,7 @@ #define ACE_ACTIVE_MAP_MANAGER_H #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/OS_String.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/ace/Active_Map_Manager.i b/ace/Active_Map_Manager.i index 486a595b2be..0e73f7e50ec 100644 --- a/ace/Active_Map_Manager.i +++ b/ace/Active_Map_Manager.i @@ -1,3 +1,5 @@ +// -*- C++ -*- +// // $Id$ ACE_INLINE @@ -72,16 +74,16 @@ ACE_INLINE void ACE_Active_Map_Manager_Key::decode (const void *data) { // Copy the information from the user buffer into the key. - ACE_OS::memcpy (&this->key_data_, - data, - sizeof this->key_data_); + ACE_OS_String::memcpy (&this->key_data_, + data, + sizeof this->key_data_); } ACE_INLINE void ACE_Active_Map_Manager_Key::encode (void *data) const { // Copy the key data to the user buffer. - ACE_OS::memcpy (data, - &this->key_data_, - sizeof this->key_data_); + ACE_OS_String::memcpy (data, + &this->key_data_, + sizeof this->key_data_); } diff --git a/ace/Addr.h b/ace/Addr.h index 5ea10111cc4..848209c9d39 100644 --- a/ace/Addr.h +++ b/ace/Addr.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,9 +12,10 @@ #ifndef ACE_ADDR_H #define ACE_ADDR_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -103,4 +104,5 @@ protected: #endif /* __ACE_INLINE__ */ #include "ace/post.h" + #endif /* ACE_ADDR_H */ diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp index 2fc8aca6a96..d1b0f7b91db 100644 --- a/ace/Arg_Shifter.cpp +++ b/ace/Arg_Shifter.cpp @@ -1,9 +1,11 @@ -// $Id$ - -// #include "ace/OS.h" #include "ace/Arg_Shifter.h" +#include "ace/OS_String.h" +#include "ace/OS_Errno.h" + +ACE_RCSID (ace, + Arg_Shifter, + "$Id$") -ACE_RCSID(ace, Arg_Shifter, "$Id$") ACE_Arg_Shifter::ACE_Arg_Shifter (int& argc, const ACE_TCHAR** argv, @@ -110,14 +112,14 @@ ACE_Arg_Shifter::cur_arg_strncasecmp (const ACE_TCHAR *flag) // Check for a current argument if (this->is_anything_left()) { - unsigned int flag_length = ACE_OS::strlen(flag); + unsigned int flag_length = ACE_OS_String::strlen (flag); // Check for presence of the flag - if (ACE_OS::strncasecmp(this->temp_[current_index_], - flag, - flag_length) == 0) + if (ACE_OS_String::strncasecmp(this->temp_[current_index_], + flag, + flag_length) == 0) { - if (ACE_OS::strlen(temp_[current_index_]) == + if (ACE_OS_String::strlen(temp_[current_index_]) == flag_length) { // match and lengths are equal @@ -126,7 +128,7 @@ ACE_Arg_Shifter::cur_arg_strncasecmp (const ACE_TCHAR *flag) else { // matches, with more info to boot! - return ACE_OS::strspn + return ACE_OS_String::strspn (this->temp_[current_index_] + flag_length, ACE_LIB_TEXT (" ")) + flag_length; } diff --git a/ace/Arg_Shifter.h b/ace/Arg_Shifter.h index 8a6ab8222fc..e87a916c594 100644 --- a/ace/Arg_Shifter.h +++ b/ace/Arg_Shifter.h @@ -12,9 +12,14 @@ #ifndef ACE_ARG_SHIFTER_H #define ACE_ARG_SHIFTER_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ /** * @class ACE_Arg_Shifter @@ -189,4 +194,5 @@ private: }; #include "ace/post.h" + #endif /* ACE_ARG_SHIFTER_H */ diff --git a/ace/Argv_Type_Converter.cpp b/ace/Argv_Type_Converter.cpp index 23c96ef44ec..3d9dcd7ef5d 100644 --- a/ace/Argv_Type_Converter.cpp +++ b/ace/Argv_Type_Converter.cpp @@ -1,45 +1,52 @@ -// $Id$ - #include "ace/Argv_Type_Converter.h" #if !defined (__ACE_INLINE__) #include "ace/Argv_Type_Converter.inl" -#endif // __ACE_INLINE__ +#endif /* __ACE_INLINE__ */ + +ACE_RCSID (ace, + Argv_Type_Converter, + "$Id$") +#include "ace/OS_String.h" #if defined (ACE_USES_WCHAR) ACE_Argv_Type_Converter::ACE_Argv_Type_Converter(int& argc, wchar_t** argv) -: saved_argc_(argc) -, char_argv_(0) -, wchar_argv_(argv) -, before_pass_argc_(argc) -, original_type_(true) -, wchar_passed_(false) -, char_passed_(false) + : saved_argc_ (argc) + , char_argv_ (0) + , wchar_argv_ (argv) + , before_pass_argc_ (argc) + , original_type_ (true) + , wchar_passed_ (false) + , char_passed_ (false) { - initialize(); + this->initialize (); - for (int i = 0; i < argc; ++i) { - char_argv_[i] = ACE_OS::strdup(ACE_TEXT_ALWAYS_CHAR(argv[i])); + for (int i = 0; i < argc; ++i) + { + this->char_argv_[i] = + ACE_OS_String::strdup (ACE_TEXT_ALWAYS_CHAR (argv[i])); } } #endif // ACE_USES_WCHAR ACE_Argv_Type_Converter::ACE_Argv_Type_Converter(int& argc, char** argv) -: saved_argc_(argc) -, char_argv_(argv) + : saved_argc_(argc) + , char_argv_(argv) #if defined (ACE_USES_WCHAR) -, wchar_argv_(0) -, before_pass_argc_(argc) -, original_type_(false) -, wchar_passed_(false) -, char_passed_(false) + , wchar_argv_(0) + , before_pass_argc_(argc) + , original_type_(false) + , wchar_passed_(false) + , char_passed_(false) { - initialize(); + this->initialize(); - for (int i = 0; i < argc; ++i) { - wchar_argv_[i] = ACE_OS::strdup(ACE_TEXT_ANTI_TO_TCHAR(argv[i])); + for (int i = 0; i < argc; ++i) + { + this->wchar_argv_[i] = + ACE_OS_String::strdup (ACE_TEXT_ANTI_TO_TCHAR (argv[i])); } } #else @@ -47,119 +54,144 @@ ACE_Argv_Type_Converter::ACE_Argv_Type_Converter(int& argc, char** argv) } #endif // ACE_USES_WCHAR - -ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter(void) +ACE_Argv_Type_Converter::~ACE_Argv_Type_Converter (void) { #if defined (ACE_USES_WCHAR) - // selectively delete the 'copy' of argv - if (original_type_) { - // if original type is wchar_t - if (char_passed_) { - align_wchar_with_char(); + // selectively delete the 'copy' of argv + if (this->original_type_) + { + // if original type is wchar_t + if (this->char_passed_) + { + this->align_wchar_with_char(); } - for (int i = 0; i < before_pass_argc_; ++i) { - delete [] char_argv_[i]; + for (int i = 0; i < this->before_pass_argc_; ++i) + { + delete [] this->char_argv_[i]; } - delete [] char_argv_; + delete [] this->char_argv_; } - else { - // if original type is char - if (wchar_passed_) { - align_char_with_wchar(); + else + { + // if original type is char + if (this->wchar_passed_) { + this->align_char_with_wchar (); + } + for (int i = 0; i < this->before_pass_argc_; ++i) + { + delete [] this->wchar_argv_[i]; } - for (int i = 0; i < before_pass_argc_; ++i) { - delete [] wchar_argv_[i]; - } - delete [] wchar_argv_; + delete [] this->wchar_argv_; } #endif // ACE_USES_WCHAR } - #if defined (ACE_USES_WCHAR) -void ACE_Argv_Type_Converter::initialize() +void +ACE_Argv_Type_Converter::initialize (void) { - if (original_type_) { // make a copy of argv in 'char' type - // Create one more argv entry than original argc for the NULL. - ACE_NEW(char_argv_, char*[saved_argc_ + 1]); - char_argv_[saved_argc_] = 0; // last entry of argv is always a NULL + if (this->original_type_) + { // make a copy of argv in 'char' type + // Create one more argv entry than original argc for the NULL. + ACE_NEW (char_argv_, char*[this->saved_argc_ + 1]); + this->char_argv_[saved_argc_] = 0; // last entry of argv is + // always a NULL } - else { // make a copy of argv in 'wchar_t' type - ACE_NEW(wchar_argv_, wchar_t*[saved_argc_ + 1]); - wchar_argv_[saved_argc_] = 0; + else + { // make a copy of argv in 'wchar_t' type + ACE_NEW (this->wchar_argv_, wchar_t*[this->saved_argc_ + 1]); + this->wchar_argv_[saved_argc_] = 0; } } -void ACE_Argv_Type_Converter::align_char_with_wchar() +void +ACE_Argv_Type_Converter::align_char_with_wchar (void) { - int wchar_argv_index = 0; - wchar_t* match_argv = wchar_argv_[0]; // pick the initial entry - - while (wchar_argv_index < saved_argc_) { - // if n'th entries of both argv lists are different - if (ACE_OS::strcmp(char_argv_[wchar_argv_index], ACE_TEXT_ALWAYS_CHAR(match_argv)) != 0) { - // loop through the wchar argv list entries that are after wchar_argv_index - for (int i = wchar_argv_index + 1; i < before_pass_argc_; ++i) { - if (ACE_OS::strcmp(char_argv_[i], ACE_TEXT_ALWAYS_CHAR(match_argv)) == 0) { - // swap the pointers in the char argv list - char* temp = char_argv_[wchar_argv_index]; - char_argv_[wchar_argv_index] = char_argv_[i]; - char_argv_[i] = temp; - break; + int wchar_argv_index = 0; + wchar_t* match_argv = this->wchar_argv_[0]; // pick the initial entry + + while (wchar_argv_index < this->saved_argc_) + { + // if n'th entries of both argv lists are different + if (ACE_OS::strcmp(this->char_argv_[wchar_argv_index], + ACE_TEXT_ALWAYS_CHAR (match_argv)) != 0) + { + // loop through the wchar argv list entries that are after + // wchar_argv_index + for (int i = wchar_argv_index + 1; i < before_pass_argc_; ++i) + { + if (ACE_OS_String::strcmp (this->char_argv_[i], + ACE_TEXT_ALWAYS_CHAR (match_argv)) + == 0) + { + // swap the pointers in the char argv list + char* temp = this->char_argv_[wchar_argv_index]; + this->char_argv_[wchar_argv_index] = this->char_argv_[i]; + this->char_argv_[i] = temp; + break; } } } // move to the next wchar argv list entry - match_argv = wchar_argv_[++wchar_argv_index]; + match_argv = this->wchar_argv_[++wchar_argv_index]; } - cleanup(); + this->cleanup (); } - -void ACE_Argv_Type_Converter::align_wchar_with_char() +void +ACE_Argv_Type_Converter::align_wchar_with_char (void) { - int char_argv_index = 0; - char* match_argv = char_argv_[0]; // pick the initial entry - - while (char_argv_index < saved_argc_) { - // if n'th entries of both argv lists are different - if (ACE_OS::strcmp(ACE_TEXT_ALWAYS_CHAR(wchar_argv_[char_argv_index]), match_argv) != 0) { - // loop through the wchar argv list entries that are after wchar_argv_index - for (int i = char_argv_index + 1; i < before_pass_argc_; ++i) { - if (ACE_OS::strcmp(ACE_TEXT_ALWAYS_CHAR(wchar_argv_[i]), match_argv) == 0) { - // swap the pointers in the char argv list - wchar_t* temp = wchar_argv_[char_argv_index]; - wchar_argv_[char_argv_index] = wchar_argv_[i]; - wchar_argv_[i] = temp; - break; - } + int char_argv_index = 0; + char* match_argv = this->char_argv_[0]; // pick the initial entry + + while (char_argv_index < saved_argc_) + { + // if n'th entries of both argv lists are different + if (ACE_OS_String::strcmp ( + ACE_TEXT_ALWAYS_CHAR (this->wchar_argv_[char_argv_index]), + match_argv) != 0) + { + // loop through the wchar argv list entries that are after + // wchar_argv_index + for (int i = char_argv_index + 1; i < this->before_pass_argc_; ++i) + { + if (ACE_OS_String::strcmp ( + ACE_TEXT_ALWAYS_CHAR(this->wchar_argv_[i]), + match_argv) == 0) { + // swap the pointers in the char argv list + wchar_t* temp = this->wchar_argv_[char_argv_index]; + this->wchar_argv_[char_argv_index] = this->wchar_argv_[i]; + this->wchar_argv_[i] = temp; + break; + } } } - // move to the next wchar argv list entry - match_argv = char_argv_[++char_argv_index]; + // move to the next wchar argv list entry + match_argv = this->char_argv_[++char_argv_index]; } - cleanup(); + this->cleanup(); } - -void ACE_Argv_Type_Converter::cleanup() +void +ACE_Argv_Type_Converter::cleanup (void) { - for (int i = saved_argc_; i < before_pass_argc_; ++i) { - delete [] char_argv_[i]; - delete [] wchar_argv_[i]; + for (int i = this->saved_argc_; i < this->before_pass_argc_; ++i) + { + delete [] this->char_argv_[i]; + delete [] this->wchar_argv_[i]; - char_argv_[i] = 0; - wchar_argv_[i] = 0; + this->char_argv_[i] = 0; + this->wchar_argv_[i] = 0; } - before_pass_argc_ = saved_argc_; + this->before_pass_argc_ = this->saved_argc_; - wchar_passed_ = false; - char_passed_ = false; + this->wchar_passed_ = false; + this->char_passed_ = false; } #endif // ACE_USES_WCHAR diff --git a/ace/Argv_Type_Converter.h b/ace/Argv_Type_Converter.h index 8559cb8acc6..ed368d585c8 100644 --- a/ace/Argv_Type_Converter.h +++ b/ace/Argv_Type_Converter.h @@ -1,4 +1,5 @@ // -*- C++ -*- + //============================================================================= /** * @file Argv_Type_Converter.h @@ -9,11 +10,16 @@ */ //============================================================================= -#ifndef ACE_Argv_Type_Converter_h -#define ACE_Argv_Type_Converter_h +#ifndef ACE_ARGV_TYPE_CONVERTER_H +#define ACE_ARGV_TYPE_CONVERTER_H #include "ace/pre.h" -#include "ace/OS.h" + +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ /** @@ -31,114 +37,79 @@ class ACE_Export ACE_Argv_Type_Converter { public: - /** - * Ctor accepts integer argc and 'char' type argv. - */ - ACE_Argv_Type_Converter(int& argc, char** argv); + + ACE_Argv_Type_Converter (int& argc, char** argv); #if defined (ACE_USES_WCHAR) - /** - * Ctor accepts integer argc and 'wchar_t' type argv. - */ - ACE_Argv_Type_Converter(int& argc, wchar_t** argv); + ACE_Argv_Type_Converter (int& argc, wchar_t** argv); #endif // ACE_USES_WCHAR - /** - * Dtor will delete all stored data. - */ - ~ACE_Argv_Type_Converter(void); + ~ACE_Argv_Type_Converter (void); - /** - * Returns the pointer of converted command line. - */ - ACE_TCHAR** get_TCHAR_argv(void); + /// Returns the pointer of converted command line. + ACE_TCHAR** get_TCHAR_argv (void); - /** - * Returns the pointer of ASCII (char) command line. - */ - char** get_ASCII_argv(void); + /// Returns the pointer of ASCII (char) command line. + char** get_ASCII_argv (void); - /** - * Returns the number of sub paramters (argc). - */ - int& get_argc(void); + /// Returns the number of sub paramters (argc). + int& get_argc (void); private: - /** - * Copy Ctor should not be used. - */ - ACE_Argv_Type_Converter(ACE_Argv_Type_Converter&); - /** - * '=' operator should not be used. - */ - ACE_Argv_Type_Converter operator = (ACE_Argv_Type_Converter&); + /// Copy Constructor should not be used. + ACE_Argv_Type_Converter (const ACE_Argv_Type_Converter&); + + /// Assignment '=' operator should not be used. + ACE_Argv_Type_Converter operator= (const ACE_Argv_Type_Converter&); #if defined (ACE_USES_WCHAR) - /** - * Perform common initialization for two Ctor's. - */ - void initialize(); - - /** - * Align all entries in the char type argv list with wchar_t type argv list. - */ - void align_char_with_wchar(); - - /** - * Align all entries in the wchar_t type argv list with char type argv list. - */ - void align_wchar_with_char(); - - /** - * Clean up removed (comsumed) argv entries and reset the pass flags. - */ - void cleanup(); + + /// Perform common initialization for two Ctor's. + void initialize (void); + + /// Align all entries in the char type argv list with wchar_t type + /// argv list. + void align_char_with_wchar (void); + + /// Align all entries in the wchar_t type argv list with char type + /// argv list. + void align_wchar_with_char (void); + + /// Clean up removed (comsumed) argv entries and reset the pass flags. + void cleanup (void); #endif // ACE_USES_WCHAR - /** - * Original number of input paramter, same as 'argc'. - */ - int& saved_argc_; +private: + /// Original number of input paramter, same as 'argc'. + int& saved_argc_; - /** - * Data member pointer that contains converted argv in ACE_ANTI_TCHAR. - */ - char** char_argv_; + /// Data member pointer that contains converted argv in ACE_ANTI_TCHAR. + char** char_argv_; #if defined (ACE_USES_WCHAR) - /** - * Data member pointer that contains converted argv in ACE_TCHAR. - */ - wchar_t** wchar_argv_; - - /** - * argc value before any argv has been passed. - */ - int before_pass_argc_; - - /** - * FALSE represents original argv passed in is char, and TRUE represents wchar_t. - * Boolean type could be used for this, but used integer for old compiler issue. - */ - const bool original_type_; - - /** - * TRUE indicates wchar_t type argv has been passed. - */ - bool wchar_passed_; - - /** - * TRUE indicates char type argv has been passed. - */ + /// Data member pointer that contains converted argv in ACE_TCHAR. + wchar_t** wchar_argv_; + + /// argc value before any argv has been passed. + int before_pass_argc_; + + /// FALSE represents original argv passed in is char, and TRUE + /// represents wchar_t. + const bool original_type_; + + /// TRUE indicates wchar_t type argv has been passed. + bool wchar_passed_; + + /// TRUE indicates char type argv has been passed. bool char_passed_; -#endif // ACE_USES_WCHAR +#endif /* ACE_USES_WCHAR */ }; #if defined (__ACE_INLINE__) #include "ace/Argv_Type_Converter.inl" -#endif // __ACE_INLINE__ +#endif /* __ACE_INLINE__ */ #include "ace/post.h" -#endif // ACE_Argv_Type_Converter_h +#endif /* ACE_ARGV_TYPE_CONVERTER_H */ diff --git a/ace/Argv_Type_Converter.inl b/ace/Argv_Type_Converter.inl index f29cd705e99..dbba9309f8e 100644 --- a/ace/Argv_Type_Converter.inl +++ b/ace/Argv_Type_Converter.inl @@ -1,39 +1,41 @@ +// -*- C++ -*- +// // $Id$ ACE_INLINE ACE_TCHAR** -ACE_Argv_Type_Converter::get_TCHAR_argv(void) +ACE_Argv_Type_Converter::get_TCHAR_argv (void) { #if defined (ACE_USES_WCHAR) - if (char_passed_) { - align_wchar_with_char(); + if (this->char_passed_) + { + this->align_wchar_with_char (); } - wchar_passed_ = true; - return wchar_argv_; + this->wchar_passed_ = true; + return this->wchar_argv_; #else - return char_argv_; + return this->char_argv_; #endif // ACE_USES_WCHAR } - ACE_INLINE char** -ACE_Argv_Type_Converter::get_ASCII_argv(void) +ACE_Argv_Type_Converter::get_ASCII_argv (void) { #if defined (ACE_USES_WCHAR) - if (wchar_passed_) { - align_char_with_wchar(); + if (this->wchar_passed_) + { + this->align_char_with_wchar (); } - char_passed_ = true; + this->char_passed_ = true; #endif // ACE_USES_WCHAR - return char_argv_; + return this->char_argv_; } - ACE_INLINE int& -ACE_Argv_Type_Converter::get_argc(void) +ACE_Argv_Type_Converter::get_argc (void) { - return saved_argc_; + return this->saved_argc_; } diff --git a/ace/Asynch_Acceptor.h b/ace/Asynch_Acceptor.h index 761cf230ec0..188e226f3f2 100644 --- a/ace/Asynch_Acceptor.h +++ b/ace/Asynch_Acceptor.h @@ -23,7 +23,7 @@ #if defined (ACE_WIN32) || defined (ACE_HAS_AIO_CALLS) // This only works on platforms that support async i/o. -#include "ace/OS.h" +#include "ace/Default_Constants.h" #include "ace/Asynch_IO.h" // Forward declarations diff --git a/ace/Auto_IncDec_T.h b/ace/Auto_IncDec_T.h index 39a5c43ad97..3b272137bc4 100644 --- a/ace/Auto_IncDec_T.h +++ b/ace/Auto_IncDec_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,9 +13,10 @@ #ifndef ACE_AUTO_INCDEC_T_H #define ACE_AUTO_INCDEC_T_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -36,7 +37,7 @@ template <class ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> class ACE_Auto_IncDec { public: - // = Initialization and termination methods. + /// Implicitly increment the counter. ACE_Auto_IncDec (ACE_SAFELY_INCREMENTABLE_DECREMENTABLE &counter); @@ -56,7 +57,7 @@ private: ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &)) ACE_UNIMPLEMENTED_FUNC (ACE_Auto_IncDec (const - ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &)) + ACE_Auto_IncDec<ACE_SAFELY_INCREMENTABLE_DECREMENTABLE> &)) }; #if defined (__ACE_INLINE__) @@ -81,4 +82,5 @@ private: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" + #endif /* ACE_AUTO_INCDEC_T_H */ diff --git a/ace/Auto_Ptr.h b/ace/Auto_Ptr.h index aa7e0eec35d..1889ace99be 100644 --- a/ace/Auto_Ptr.h +++ b/ace/Auto_Ptr.h @@ -17,12 +17,14 @@ #define ACE_AUTO_PTR_H #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Trace.h" + /** * @class ACE_Auto_Basic_Ptr * diff --git a/ace/Based_Pointer_Repository.h b/ace/Based_Pointer_Repository.h index 2b14c52fa9f..c568bc8c083 100644 --- a/ace/Based_Pointer_Repository.h +++ b/ace/Based_Pointer_Repository.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -14,9 +14,15 @@ #ifndef ACE_BASED_POINTER_REPOSITORY_H #define ACE_BASED_POINTER_REPOSITORY_H + #include "ace/pre.h" -#include "ace/OS.h" // Need ACE_Export +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + // Forward decl., using the "Cheshire Cat" technique. class ACE_Based_Pointer_Repository_Rep; @@ -55,9 +61,11 @@ public: int unbind (void *addr); private: + /// Use the "Cheshire-Cat" technique to hide the implementation in /// order to avoid circular #include dependencies. ACE_Based_Pointer_Repository_Rep *rep_; + }; #include "ace/Singleton.h" @@ -67,4 +75,5 @@ typedef ACE_Singleton<ACE_Based_Pointer_Repository, ACE_SYNCH_RW_MUTEX> ACE_BASED_POINTER_REPOSITORY; #include "ace/post.h" + #endif /* ACE_BASED_POINTER_REPOSITORY_H */ diff --git a/ace/Based_Pointer_T.h b/ace/Based_Pointer_T.h index c8a8dcf55be..02fb8731202 100644 --- a/ace/Based_Pointer_T.h +++ b/ace/Based_Pointer_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,9 +13,10 @@ #ifndef ACE_BASED_POINTER_T_H #define ACE_BASED_POINTER_T_H + #include "ace/pre.h" -#include "ace/OS.h" // Need ACE_Export +#include "ace/config-all.h" #if defined (_MSC_VER) // Suppress warning e.g. "return type for @@ -195,4 +196,5 @@ public: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" + #endif /* ACE_BASED_POINTER_T_H */ diff --git a/ace/Bound_Ptr.h b/ace/Bound_Ptr.h index 094bdb6b8d2..c1d3d63fc48 100644 --- a/ace/Bound_Ptr.h +++ b/ace/Bound_Ptr.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,21 +12,25 @@ #ifndef ACE_BOUND_PTR_H #define ACE_BOUND_PTR_H + #include "ace/pre.h" -#include "ace/OS.h" -#include "ace/Auto_Ptr.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Auto_Ptr.h" + /** * @class ACE_Bound_Ptr_Counter * - * @brief An ACE_Bound_Ptr_Counter<ACE_LOCK> object encapsulates an object - * reference count. Do not use this class directly, use ACE_Strong_Bound_Ptr - * or ACE_Weak_Bound_Ptr instead. + * @brief An ACE_Bound_Ptr_Counter<ACE_LOCK> object encapsulates an + * object reference count. + * + * Do not use this class directly, use ACE_Strong_Bound_Ptr or + * ACE_Weak_Bound_Ptr instead. */ template <class ACE_LOCK> class ACE_Bound_Ptr_Counter @@ -38,40 +42,45 @@ public: ACE_Bound_Ptr_Counter (int init_obj_ref_count = 0); ~ACE_Bound_Ptr_Counter (void); - /// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the reference - /// count to indicate ownership by a strong pointer. + /// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the + /// reference count to indicate ownership by a strong pointer. static ACE_Bound_Ptr_Counter<ACE_LOCK> *create_strong (void); - /// Increase both the object and counter reference counts and return the new - /// object reference count. A return value of -1 indicates that the object - /// has already been destroyed. + /// Increase both the object and counter reference counts and return + /// the new object reference count. A return value of -1 indicates + /// that the object has already been destroyed. static int attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter); - /// Decreases both the object and counter reference counts and deletes - /// whichever has no more references. Returns the new object reference count. + /// Decreases both the object and counter reference counts and + /// deletes whichever has no more references. Returns the new object + /// reference count. static int detach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter); - /// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the reference - /// count to indicate no ownership. + /// Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the + /// reference count to indicate no ownership. static ACE_Bound_Ptr_Counter<ACE_LOCK> *create_weak (void); /// Increase the counter reference count and return argument. static void attach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter); - /// Decreases the counter reference count and deletes the counter if it has - /// no more references. + /// Decreases the counter reference count and deletes the counter if + /// it has no more references. static void detach_weak (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter); /// Determine whether the object has been deleted. static int object_was_deleted (ACE_Bound_Ptr_Counter<ACE_LOCK> *counter); private: - /// Allocate a new ACE_Bound_Ptr_Counter<ACE_LOCK> instance, returning NULL - /// if it cannot be created. + + /// Allocate a new ACE_Bound_Ptr_Counter<ACE_LOCK> instance, + /// returning NULL if it cannot be created. static ACE_Bound_Ptr_Counter<ACE_LOCK> *internal_create (int init_obj_ref_count); - /// Reference count of underlying object. Is set to -1 once the object has - /// been destroyed to indicate to all weak pointers that it is no longer valid. +private: + + /// Reference count of underlying object. Is set to -1 once the + /// object has been destroyed to indicate to all weak pointers that + /// it is no longer valid. int obj_ref_count_; /// Reference count of this counter. @@ -87,7 +96,9 @@ template <class X, class ACE_LOCK> class ACE_Weak_Bound_Ptr; /** * @class ACE_Strong_Bound_Ptr * - * @brief This class implements support for a reference counted pointer. + * @brief This class implements support for a reference counted + * pointer. + * * Assigning or copying instances of an ACE_Strong_Bound_Ptr will * automatically increment the reference count of the underlying object. * When the last instance of an ACE_Strong_Bound_Ptr that references a @@ -121,19 +132,25 @@ public: /// Assignment operator that binds <this> and <r> to the same object. void operator = (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r); - /// Equality operator that returns 1 if both ACE_Strong_Bound_Ptr instances - /// point to the same underlying object. Attention: It also returns 1 if - /// both objects have just been instantiated and not used yet. + /// Equality operator that returns 1 if both ACE_Strong_Bound_Ptr + /// instances point to the same underlying object. + /** + * @note It also returns 1 if both objects have just been + * instantiated and not used yet. + */ int operator == (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const; /// Equality operator that returns 1 if the ACE_Strong_Bound_Ptr and /// ACE_Weak_Bound_Ptr objects point to the same underlying object. - /// Attention: It also returns 1 if both objects have just been - /// instantiated and not used yet. + /** + * + * @note It also returns 1 if both objects have just been + * instantiated and not used yet. + */ int operator == (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const; - /// Equality operator that returns 1 if the ACE_Strong_Bound_Ptr and the raw - /// pointer point to the same underlying object. + /// Equality operator that returns 1 if the ACE_Strong_Bound_Ptr and + /// the raw pointer point to the same underlying object. int operator == (X *p) const; /// Inequality operator, which is the opposite of equality. @@ -154,15 +171,17 @@ public: /// Get the pointer value. X *get (void); - /// Resets the ACE_Strong_Bound_Ptr to refer to a different underlying - /// object. + /// Resets the ACE_Strong_Bound_Ptr to refer to a different + /// underlying object. void reset (X *p = 0); - /// Resets the ACE_Strong_Bound_Ptr to refer to a different underlying - /// object, ownership of which is stolen from the auto_ptr. + /// Resets the ACE_Strong_Bound_Ptr to refer to a different + /// underlying object, ownership of which is stolen from the + /// auto_ptr. void reset (auto_ptr<X> p); - /// Allows us to check for NULL on all ACE_Strong_Bound_Ptr objects. + /// Allows us to check for NULL on all ACE_Strong_Bound_Ptr + /// objects. int null (void) const; /// Declare the dynamic allocation hooks. @@ -185,22 +204,24 @@ private: * @class ACE_Weak_Bound_Ptr * * @brief This class implements support for a weak pointer that complements - * ACE_Strong_Bound_Ptr. Unlike ACE_Strong_Bound_Ptr, assigning or copying - * instances of an ACE_Weak_Bound_Ptr will not automatically increment the - * reference count of the underlying object. What ACE_Weak_Bound_Ptr does is - * preserve the knowledge that the object is in fact reference counted, and - * thus provides an alternative to raw pointers where non-ownership - * associations must be maintained. When the last instance of an - * ACE_Strong_Bound_Ptr that references a particular object is destroyed or - * overwritten, the corresponding ACE_Weak_Bound_Ptr instances are set to - * null. + * ACE_Strong_Bound_Ptr. + * + * Unlike ACE_Strong_Bound_Ptr, assigning or copying instances of an + * ACE_Weak_Bound_Ptr will not automatically increment the reference + * count of the underlying object. What ACE_Weak_Bound_Ptr does is + * preserve the knowledge that the object is in fact reference + * counted, and thus provides an alternative to raw pointers where + * non-ownership associations must be maintained. When the last + * instance of an ACE_Strong_Bound_Ptr that references a particular + * object is destroyed or overwritten, the corresponding + * ACE_Weak_Bound_Ptr instances are set to NULL. */ template <class X, class ACE_LOCK> class ACE_Weak_Bound_Ptr { public: - /// Constructor that initializes an ACE_Weak_Bound_Ptr to point to the - /// object <p> immediately. + /// Constructor that initializes an ACE_Weak_Bound_Ptr to point to + /// the object <p> immediately. ACE_EXPLICIT ACE_Weak_Bound_Ptr (X *p = 0); /// Copy constructor binds <this> and <r> to the same object. @@ -218,19 +239,25 @@ public: /// Assignment operator that binds <this> and <r> to the same object. void operator = (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r); - /// Equality operator that returns 1 if both ACE_Weak_Bound_Ptr objects - /// point to the same underlying object. Attention: It also returns 1 if - /// both objects have just been instantiated and not used yet. + /// Equality operator that returns 1 if both ACE_Weak_Bound_Ptr + /// objects point to the same underlying object. + /** + * @note It also returns 1 if both objects have just been + * instantiated and not used yet. + */ int operator == (const ACE_Weak_Bound_Ptr<X, ACE_LOCK> &r) const; /// Equality operator that returns 1 if the ACE_Weak_Bound_Ptr and - /// ACE_Strong_Bound_Ptr objects point to the same underlying object. - /// Attention: It also returns 1 if both objects have just been instantiated - /// and not used yet. + /// ACE_Strong_Bound_Ptr objects point to the same underlying + /// object. + /** + * @note It also returns 1 if both objects have just been + * instantiated and not used yet. + */ int operator == (const ACE_Strong_Bound_Ptr<X, ACE_LOCK> &r) const; - /// Equality operator that returns 1 if the ACE_Weak_Bound_Ptr and the raw - /// pointer point to the same underlying object. + /// Equality operator that returns 1 if the ACE_Weak_Bound_Ptr and + /// the raw pointer point to the same underlying object. int operator == (X *p) const; /// Inequality operator, which is the opposite of equality. @@ -242,37 +269,47 @@ public: /// Inequality operator, which is the opposite of equality. int operator != (X *p) const; - /// Redirection operator. It returns a temporary strong pointer and makes - /// use of the chaining properties of operator-> to ensure that the - /// underlying object does not disappear while you are using it. If - /// you are certain of the lifetimes of the object, and do not want to incur - /// the locking overhead, then use the unsafe_get method instead. + /// Redirection operator. + /** + * It returns a temporary strong pointer and makes use of the + * chaining properties of operator-> to ensure that the underlying + * object does not disappear while you are using it. If you are + * certain of the lifetimes of the object, and do not want to incur + * the locking overhead, then use the unsafe_get method instead. + */ ACE_Strong_Bound_Ptr<X, ACE_LOCK> operator-> (void) const; - /// Obtain a strong pointer corresponding to this weak pointer. This function - /// is useful to create a temporary strong pointer for conversion to a - /// reference. + /// Obtain a strong pointer corresponding to this weak pointer. This + /// function is useful to create a temporary strong pointer for + /// conversion to a reference. ACE_Strong_Bound_Ptr<X, ACE_LOCK> strong (void) const; - /// Get the pointer value. Warning: this does not affect the reference count - /// of the underlying object, so it may disappear on you while you are using - /// it if you are not careful. + /// Get the pointer value. Warning: this does not affect the + /// reference count of the underlying object, so it may disappear on + /// you while you are using it if you are not careful. X *unsafe_get (void) const; - /// Resets the ACE_Weak_Bound_Ptr to refer to a different underlying object. + /// Resets the ACE_Weak_Bound_Ptr to refer to a different underlying + /// object. void reset (X *p = 0); - /// Increment the reference count on the underlying object. Returns the new - /// reference count on the object. This function may be used to integrate the - /// bound pointers into an external reference counting mechanism such as - /// those used by COM or CORBA servants. + /// Increment the reference count on the underlying object. + /** + * Returns the new reference count on the object. This function may + * be used to integrate the bound pointers into an external + * reference counting mechanism such as those used by COM or CORBA + * servants. + */ int add_ref (void); /// Decrement the reference count on the underlying object, which is deleted - /// if the count has reached zero. Returns the new reference count on the - /// object. This function may be used to integrate the bound pointers into an - /// external reference counting mechanism such as those used by COM or CORBA - /// servants. + /// if the count has reached zero. + /** + * Returns the new reference count on the object. This function may + * be used to integrate the bound pointers into an external + * reference counting mechanism such as those used by COM or CORBA + * servants. + */ int remove_ref (void); /// Allows us to check for NULL on all ACE_Weak_Bound_Ptr objects. @@ -297,4 +334,5 @@ private: #include "ace/Bound_Ptr.i" #include "ace/post.h" + #endif /* ACE_BOUND_PTR_H */ diff --git a/ace/CE_Screen_Output.h b/ace/CE_Screen_Output.h index 0b79c75c2f5..0571fe39b88 100644 --- a/ace/CE_Screen_Output.h +++ b/ace/CE_Screen_Output.h @@ -1,3 +1,6 @@ +// -*- C++ -*- + +//============================================================================= /** * @file CE_Screen_Output.h * @@ -7,8 +10,8 @@ */ //============================================================================= -#ifndef ACE_CE_Screen_Output_h -#define ACE_CE_Screen_Output_h +#ifndef ACE_CE_SCREEN_OUTPUT_H +#define ACE_CE_SCREEN_OUTPUT_H #include "ace/config-all.h" @@ -41,78 +44,60 @@ const ACE_TCHAR tab[] = ACE_LIB_TEXT("\t"); class ACE_Export ACE_CE_Screen_Output : public ACE_Log_Msg_Callback { public: - /** - * Ctor with HWND specified. - */ - ACE_CE_Screen_Output(HWND hEdit); - /** - * Default Ctor - */ - ACE_CE_Screen_Output(); + ACE_CE_Screen_Output (HWND hEdit); + + ACE_CE_Screen_Output (void); + + virtual ~ACE_CE_Screen_Output(); - /** - * Default Dtor - */ - virtual ~ACE_CE_Screen_Output(); + /// Implementation of pure virtual function from ACE_Log_Msg_Callback. + virtual void log (ACE_Log_Record &log_record); - /** - * Implementation of pure virtual function from ACE_Log_Msg_Callback. - */ - virtual void log (ACE_Log_Record &log_record); + /// Interface to specify active window handle. + void SetOutputWindow (HWND hWnd); - /** - * Interface to specify active window handle. - */ - void SetOutputWindow(HWND hWnd); + void clear (void); - /** - * Clears text screen. - */ - void clear(); + /// Stream insertion operator that performs actual print out. + /** + * @note This is the only one operator that performs output. All + * other perators convert the type and use this operator + * underneath. + */ + ACE_CE_Screen_Output& operator << (ACE_TCHAR*); + ACE_CE_Screen_Output& operator << (const ACE_TCHAR*); - /** - * << operator that performs actual print out. - * - * Note: This is the only one operator that performs - * output. All other perators convert the type and - * use this operator underneath. - */ - ACE_CE_Screen_Output& operator << (ACE_TCHAR*); - ACE_CE_Screen_Output& operator << (const ACE_TCHAR*); + ACE_CE_Screen_Output& operator << (ACE_ANTI_TCHAR* output); + ACE_CE_Screen_Output& operator << (const ACE_ANTI_TCHAR* output); - ACE_CE_Screen_Output& operator << (ACE_ANTI_TCHAR* output); - ACE_CE_Screen_Output& operator << (const ACE_ANTI_TCHAR* output); + ACE_CE_Screen_Output& operator << (char output); + ACE_CE_Screen_Output& operator << (unsigned char output); - ACE_CE_Screen_Output& operator << (char output); - ACE_CE_Screen_Output& operator << (unsigned char output); + ACE_CE_Screen_Output& operator << (unsigned short output); - ACE_CE_Screen_Output& operator << (unsigned short output); + ACE_CE_Screen_Output& operator << (int output); + ACE_CE_Screen_Output& operator << (unsigned int output); - ACE_CE_Screen_Output& operator << (int output); - ACE_CE_Screen_Output& operator << (unsigned int output); + ACE_CE_Screen_Output& operator << (float output); - ACE_CE_Screen_Output& operator << (float output); + ACE_CE_Screen_Output& operator << (long output); + ACE_CE_Screen_Output& operator << (unsigned long output); - ACE_CE_Screen_Output& operator << (long output); - ACE_CE_Screen_Output& operator << (unsigned long output); + ACE_CE_Screen_Output& operator << (FILE* pFile); - ACE_CE_Screen_Output& operator << (FILE* pFile); +private: + + ACE_CE_Screen_Output(ACE_CE_Screen_Output&); private: - /** - * Copy Ctor - */ - ACE_CE_Screen_Output(ACE_CE_Screen_Output&); - - HWND handler_; - - /** - * File pointer that used to save output to file. - * This class does not own the file handler pointer. - */ - FILE* pFile_; + + HWND handler_; + + /// FILE pointer that used to save output to file. This class does + /// not own the file handler pointer. + FILE* pFile_; }; #endif // ACE_HAS_WINCE -#endif // ACE_CE_Screen_Output_h +#endif // ACE_CE_SCREEN_OUTPUT_H diff --git a/ace/CORBA_macros.h b/ace/CORBA_macros.h index 8f00466a53b..6540e6f8909 100644 --- a/ace/CORBA_macros.h +++ b/ace/CORBA_macros.h @@ -1,18 +1,19 @@ -// $Id$ +// -*- C++ -*- // ============================================================================ /** * @file CORBA_macros.h * + * $Id$ + * * Writing code that is portable between platforms with or without * native C++ exceptions is hard. The following macros offer some * help on this task, mostly oriented to making the ORB code and the * IDL generated code portable. * * @author Nanbor Wang <nanbor@cs.wustl.edu> - * @author Based on the original <tao/try_macros.h> implementation by * @author Aniruddha Gokhale <gokhale@sahyadri.research.bell-labs.com> - * @author Carlos O'Ryan <coryan@cs.wustl.edu>, et al. + * @author Carlos O'Ryan <coryan@uci.edu>, et al. */ // ============================================================================ @@ -20,14 +21,15 @@ #ifndef ACE_CORBA_MACROS_H #define ACE_CORBA_MACROS_H + #include "ace/pre.h" +#include "ace/config-all.h" + # if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/OS.h" - // All these macros assume the CORBA::Environment variable used to pass // in/out the exception is call ACE_TRY_ENV. Below is the name we use // in TAO (The ACE ORB.) Most other ORB's have their own naming @@ -475,4 +477,5 @@ # endif /* ACE_PRINT_EXCEPTION */ #include "ace/post.h" + #endif /* ACE_CORBA_MACROS_H */ diff --git a/ace/Cache_Map_Manager_T.h b/ace/Cache_Map_Manager_T.h index cef4f7ab99f..85750043709 100644 --- a/ace/Cache_Map_Manager_T.h +++ b/ace/Cache_Map_Manager_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -11,14 +11,15 @@ //============================================================================= -#ifndef CACHE_MAP_MANAGER_T_H -#define CACHE_MAP_MANAGER_T_H +#ifndef ACE_CACHE_MAP_MANAGER_T_H +#define ACE_CACHE_MAP_MANAGER_T_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) -#define ACE_LACKS_PRAGMA_ONCE +# pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Pair_T.h" @@ -422,4 +423,5 @@ protected: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" -#endif /* CACHE_MAP_MANAGER_T_H */ + +#endif /* ACE_CACHE_MAP_MANAGER_T_H */ diff --git a/ace/Cached_Connect_Strategy_T.h b/ace/Cached_Connect_Strategy_T.h index 56ec72b1606..67a04d90fe8 100644 --- a/ace/Cached_Connect_Strategy_T.h +++ b/ace/Cached_Connect_Strategy_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,12 +12,13 @@ #ifndef CACHED_CONNECT_STRATEGY_T_H #define CACHED_CONNECT_STRATEGY_T_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) -#define ACE_LACKS_PRAGMA_ONCE +# pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Strategies_T.h" @@ -43,16 +44,18 @@ * tweaking the role of the cache as per the caching strategy. */ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> -class ACE_Cached_Connect_Strategy_Ex : public ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX> +class ACE_Cached_Connect_Strategy_Ex + : public ACE_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, MUTEX> { public: /// Constructor - ACE_Cached_Connect_Strategy_Ex (CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy<SVC_HANDLER> *cre_s = 0, - ACE_Concurrency_Strategy<SVC_HANDLER> *con_s = 0, - ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0, - MUTEX *lock = 0, - int delete_lock = 0); + ACE_Cached_Connect_Strategy_Ex ( + CACHING_STRATEGY &caching_s, + ACE_Creation_Strategy<SVC_HANDLER> *cre_s = 0, + ACE_Concurrency_Strategy<SVC_HANDLER> *con_s = 0, + ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0, + MUTEX *lock = 0, + int delete_lock = 0); /// Destructor virtual ~ACE_Cached_Connect_Strategy_Ex (void); @@ -75,20 +78,16 @@ public: typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> REFCOUNTED_HASH_RECYCLABLE_ADDRESS; typedef ACE_Hash_Cache_Map_Manager<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, - SVC_HANDLER *, - ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, - ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, - CACHING_STRATEGY, - ATTRIBUTES> + SVC_HANDLER *, + ACE_Hash<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, + ACE_Equal_To<REFCOUNTED_HASH_RECYCLABLE_ADDRESS>, + CACHING_STRATEGY, + ATTRIBUTES> CONNECTION_CACHE; - typedef ACE_TYPENAME CONNECTION_CACHE::CACHE_ENTRY - CONNECTION_CACHE_ENTRY; - typedef ACE_TYPENAME CONNECTION_CACHE::key_type - KEY; - typedef ACE_TYPENAME CONNECTION_CACHE::mapped_type - VALUE; - - // = Cleanup of the svc_handler. + typedef ACE_TYPENAME CONNECTION_CACHE::CACHE_ENTRY CONNECTION_CACHE_ENTRY; + typedef ACE_TYPENAME CONNECTION_CACHE::key_type KEY; + typedef ACE_TYPENAME CONNECTION_CACHE::mapped_type VALUE; + typedef ACE_Recyclable_Handler_Cleanup_Strategy<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, ACE_Pair<SVC_HANDLER *, ATTRIBUTES>, ACE_Hash_Map_Manager_Ex<REFCOUNTED_HASH_RECYCLABLE_ADDRESS, @@ -201,8 +200,8 @@ protected: template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, class CACHING_STRATEGY, class ATTRIBUTES, class MUTEX> - class ACE_Bounded_Cached_Connect_Strategy - : public ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX> +class ACE_Bounded_Cached_Connect_Strategy + : public ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX> { typedef ACE_Cached_Connect_Strategy_Ex<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX> @@ -212,16 +211,16 @@ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, typedef ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR> REFCOUNTED_HASH_RECYCLABLE_ADDRESS; - public: +public: - /// Constructor - ACE_Bounded_Cached_Connect_Strategy (size_t max_size, - CACHING_STRATEGY &caching_s, - ACE_Creation_Strategy<SVC_HANDLER> *cre_s = 0, - ACE_Concurrency_Strategy<SVC_HANDLER> *con_s = 0, - ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0, - MUTEX *lock = 0, - int delete_lock = 0); + /// Constructor + ACE_Bounded_Cached_Connect_Strategy (size_t max_size, + CACHING_STRATEGY &caching_s, + ACE_Creation_Strategy<SVC_HANDLER> *cre_s = 0, + ACE_Concurrency_Strategy<SVC_HANDLER> *con_s = 0, + ACE_Recycling_Strategy<SVC_HANDLER> *rec_s = 0, + MUTEX *lock = 0, + int delete_lock = 0); /// Destructor virtual ~ACE_Bounded_Cached_Connect_Strategy (void); @@ -229,21 +228,23 @@ template <class SVC_HANDLER, ACE_PEER_CONNECTOR_1, /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; - protected: - - virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, - const ACE_PEER_CONNECTOR_ADDR &remote_addr, - ACE_Time_Value *timeout, - const ACE_PEER_CONNECTOR_ADDR &local_addr, - int reuse_addr, - int flags, - int perms, - ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, - ACE_Pair<SVC_HANDLER *, ATTRIBUTES> > *&entry, - int &found); - - /// max items in the cache, used as a bound for the creation of svc_handlers. - size_t max_size_; +protected: + + virtual int find_or_create_svc_handler_i (SVC_HANDLER *&sh, + const ACE_PEER_CONNECTOR_ADDR &remote_addr, + ACE_Time_Value *timeout, + const ACE_PEER_CONNECTOR_ADDR &local_addr, + int reuse_addr, + int flags, + int perms, + ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>, + ACE_Pair<SVC_HANDLER *, ATTRIBUTES> > *&entry, + int &found); + +protected: + + /// max items in the cache, used as a bound for the creation of svc_handlers. + size_t max_size_; }; diff --git a/ace/Caching_Strategies_T.h b/ace/Caching_Strategies_T.h index 3c6dbef3a8e..6129f4d0e1d 100644 --- a/ace/Caching_Strategies_T.h +++ b/ace/Caching_Strategies_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -10,15 +10,16 @@ */ //============================================================================= -#ifndef CACHING_STRATEGIES_H -#define CACHING_STRATEGIES_H +#ifndef ACE_CACHING_STRATEGIES_H +#define ACE_CACHING_STRATEGIES_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #include "ace/Caching_Utility_T.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) -#define ACE_LACKS_PRAGMA_ONCE +# pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #if defined(_MSC_VER) @@ -33,8 +34,9 @@ * * @brief This class is an abstract base class for a caching strategy. * - * This class consists of all the interfaces a caching strategy should have and - * is used in association with the ACE_Caching_Strategy_Adaptor. + * This class consists of all the interfaces a caching strategy should + * have and is used in association with the + * ACE_Caching_Strategy_Adaptor. */ template <class ATTRIBUTES, class CACHING_UTILITY> class ACE_Caching_Strategy @@ -100,7 +102,8 @@ public: * part of the External Polymorphism pattern. */ template <class ATTRIBUTES, class CACHING_UTILITY, class IMPLEMENTATION> -class ACE_Caching_Strategy_Adapter : public ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY> +class ACE_Caching_Strategy_Adapter + : public ACE_Caching_Strategy<ATTRIBUTES, CACHING_UTILITY> { public: @@ -189,7 +192,6 @@ private: template <class ATTRIBUTES, class CACHING_UTILITY> class ACE_LRU_Caching_Strategy { - public: // Traits. @@ -534,4 +536,5 @@ private: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" -#endif /* CACHING_STRATEGIES_H */ + +#endif /* ACE_CACHING_STRATEGIES_H */ diff --git a/ace/Caching_Utility_T.h b/ace/Caching_Utility_T.h index 4a529627f20..8f22710fd28 100644 --- a/ace/Caching_Utility_T.h +++ b/ace/Caching_Utility_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -10,14 +10,15 @@ */ //============================================================================= -#ifndef CACHING_UTILITY_H -#define CACHING_UTILITY_H +#ifndef ACE_CACHING_UTILITY_H +#define ACE_CACHING_UTILITY_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) -#define ACE_LACKS_PRAGMA_ONCE +# pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Cleanup_Strategies_T.h" @@ -340,4 +341,5 @@ private: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" -#endif /* CACHING_UTILITY_H */ + +#endif /* ACE_CACHING_UTILITY_H */ diff --git a/ace/Capabilities.h b/ace/Capabilities.h index 03fc25242e6..ad470883788 100644 --- a/ace/Capabilities.h +++ b/ace/Capabilities.h @@ -15,16 +15,17 @@ #define ACE_CAPABILITIES_H #include "ace/pre.h" -#include "ace/OS.h" -#include "ace/Synch.h" -#include "ace/Hash_Map_Manager.h" -#include "ace/Containers.h" -#include "ace/SString.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Synch.h" +#include "ace/Hash_Map_Manager.h" +#include "ace/Containers.h" +#include "ace/SString.h" + /** * @class ACE_CapEntry * diff --git a/ace/Cleanup_Strategies_T.h b/ace/Cleanup_Strategies_T.h index 337e30bd9fe..935b0271753 100644 --- a/ace/Cleanup_Strategies_T.h +++ b/ace/Cleanup_Strategies_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -15,10 +15,10 @@ #define CLEANUP_STRATEGIES_H #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) -#define ACE_LACKS_PRAGMA_ONCE +# pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ // For linkers that cant grok long names. diff --git a/ace/Containers.cpp b/ace/Containers.cpp index 9fb16735ea4..2d6815e3c35 100644 --- a/ace/Containers.cpp +++ b/ace/Containers.cpp @@ -1,9 +1,10 @@ // $Id$ -#include "ace/OS.h" #include "ace/Containers.h" -ACE_RCSID(ace, Containers, "$Id$") +ACE_RCSID (ace, + Containers, + "$Id$") #if !defined (__ACE_INLINE__) #include "ace/Containers.i" diff --git a/ace/Containers.h b/ace/Containers.h index 5e28cc43c8e..512df2cc55d 100644 --- a/ace/Containers.h +++ b/ace/Containers.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,10 +12,10 @@ #ifndef ACE_CONTAINERS_H #define ACE_CONTAINERS_H + #include "ace/pre.h" -#include "ace/OS.h" -#include "ace/Malloc_Base.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -69,4 +69,5 @@ protected: #include "ace/Containers_T.h" #include "ace/post.h" + #endif /* ACE_CONTAINERS_H */ diff --git a/ace/Containers_T.h b/ace/Containers_T.h index 23aaeac2979..d0c954c14e0 100644 --- a/ace/Containers_T.h +++ b/ace/Containers_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,9 +12,10 @@ #ifndef ACE_CONTAINERS_T_H #define ACE_CONTAINERS_T_H + #include "ace/pre.h" -#include "ace/ACE.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -1821,4 +1822,5 @@ public: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" + #endif /* ACE_CONTAINERS_T_H */ diff --git a/ace/Copy_Disabled.h b/ace/Copy_Disabled.h index 5c315ba3ece..4fca4e2b3e4 100644 --- a/ace/Copy_Disabled.h +++ b/ace/Copy_Disabled.h @@ -1,4 +1,6 @@ -/* -*- C++ -*- */ +// -*- C++ -*- + +//=========================================================================== /** * @file Copy_Disabled.h * @@ -6,12 +8,14 @@ * * @author Carlos O'Ryan <coryan@uci.edu> */ +//=========================================================================== #ifndef ACE_COPY_DISABLED_H #define ACE_COPY_DISABLED_H + #include "ace/pre.h" -#include "ace/config-all.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -52,4 +56,5 @@ private: }; #include "ace/post.h" + #endif /* ACE_FUNCTOR_H */ diff --git a/ace/Dirent.h b/ace/Dirent.h index 0764011cd4d..fedf7a7e634 100644 --- a/ace/Dirent.h +++ b/ace/Dirent.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -16,12 +16,14 @@ #define ACE_DIRENT_H #include "ace/pre.h" -#include "ace/OS_Dirent.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/OS_Dirent.h" + /** * @class ACE_Dirent * diff --git a/ace/Dynamic_Service.h b/ace/Dynamic_Service.h index 054aa3dd1c8..55d45bdae78 100644 --- a/ace/Dynamic_Service.h +++ b/ace/Dynamic_Service.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,9 +13,15 @@ #ifndef ACE_DYNAMIC_SERVICE_H #define ACE_DYNAMIC_SERVICE_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + #include "ace/Dynamic_Service_Base.h" class ACE_Service_Object; @@ -54,4 +60,5 @@ public: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" + #endif /* ACE_DYNAMIC_SERVICE_H */ diff --git a/ace/Dynamic_Service_Base.h b/ace/Dynamic_Service_Base.h index 15379c32e5b..4a67ce2ea3a 100644 --- a/ace/Dynamic_Service_Base.h +++ b/ace/Dynamic_Service_Base.h @@ -13,9 +13,15 @@ #ifndef ACE_DYNAMIC_SERVICE_BASE_H #define ACE_DYNAMIC_SERVICE_BASE_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + /** * @class ACE_Dynamic_Service_Base diff --git a/ace/Env_Value_T.h b/ace/Env_Value_T.h index c38e5deac86..00d01aae531 100644 --- a/ace/Env_Value_T.h +++ b/ace/Env_Value_T.h @@ -1,4 +1,4 @@ -/* This may look like C, but it's really -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -17,9 +17,10 @@ #ifndef ACE_ENV_VALUE_T_H #define ACE_ENV_VALUE_T_H + #include "ace/pre.h" -#include "ace/OS.h" // Need to get ACE_static_cast definition +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -32,8 +33,6 @@ * * Reads a variable from the user enviroment, providing a default * value. - * = AUTHOR - * Chris Cleeland, Carlos O'Ryan */ template <class T> class ACE_Env_Value diff --git a/ace/Flag_Manip.h b/ace/Flag_Manip.h index 3d8596bddba..b9c5dc1cf91 100644 --- a/ace/Flag_Manip.h +++ b/ace/Flag_Manip.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + //============================================================================= /** * @file Flag_Manip.h @@ -6,20 +8,23 @@ * * This class includes the functions used for the Flag Manipulation. * - * @author Priyanka Gontla <pgontla@ece.uci.edu> + * @author Priyanka Gontla <pgontla@doc.ece.uci.edu> */ //============================================================================= #ifndef ACE_FLAG_MANIP_H #define ACE_FLAG_MANIP_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/OS.h" + class ACE_Export ACE_Flag_Manip { public: diff --git a/ace/Global_Macros.h b/ace/Global_Macros.h index 7715199b128..2ab013cddc2 100644 --- a/ace/Global_Macros.h +++ b/ace/Global_Macros.h @@ -15,11 +15,12 @@ #ifndef ACE_GLOBAL_MACROS_H #define ACE_GLOBAL_MACROS_H + #include "ace/pre.h" // Included just keep compilers that see #pragma dierctive first // happy. -#include "ace/config-all.h" +#include "ace/OS_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -111,5 +112,31 @@ friend class ace_dewarn_gplusplus # endif /* ACE_NTRACE */ +// Convenient macro for testing for deadlock, as well as for detecting +// when mutexes fail. +#define ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ACTION, REACTION) \ + ACE_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () != 0) { ACTION; } \ + else { REACTION; } +#define ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, REACTION) \ + ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ;, REACTION) +#define ACE_GUARD(MUTEX, OBJ, LOCK) \ + ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return) +#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN) \ + ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return RETURN) +# define ACE_WRITE_GUARD(MUTEX,OBJ,LOCK) \ + ACE_Write_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return; +# define ACE_WRITE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ + ACE_Write_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return RETURN; +# define ACE_READ_GUARD(MUTEX,OBJ,LOCK) \ + ACE_Read_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return; +# define ACE_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ + ACE_Read_Guard< MUTEX > OBJ (LOCK); \ + if (OBJ.locked () == 0) return RETURN; + #include "ace/post.h" + #endif /*ACE_GLOBAL_MACROS_H*/ diff --git a/ace/Handle_Ops.h b/ace/Handle_Ops.h index 06b4d13cb1b..7368e090a73 100644 --- a/ace/Handle_Ops.h +++ b/ace/Handle_Ops.h @@ -1,3 +1,5 @@ +// -*- C++ -*- + //============================================================================= /** * @file Handle_Ops.h @@ -11,13 +13,20 @@ */ //============================================================================= - #ifndef ACE_HANDLE_OPS_H #define ACE_HANDLE_OPS_H + #include "ace/pre.h" +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + #include "ace/OS.h" + class ACE_Export ACE_Handle_Ops { public: @@ -40,4 +49,5 @@ public: #endif /* ACE_LACKS_INLINE_FUNCTIONS */ #include "ace/post.h" + #endif /* ACE_HANDLE_OPS_H */ diff --git a/ace/Hash_Map_Manager.h b/ace/Hash_Map_Manager.h index dc2b7fce755..b2e91c8507f 100644 --- a/ace/Hash_Map_Manager.h +++ b/ace/Hash_Map_Manager.h @@ -12,10 +12,10 @@ #ifndef ACE_HASH_MAP_MANAGER_H #define ACE_HASH_MAP_MANAGER_H + #include "ace/pre.h" -#include "ace/OS.h" -#include "ace/Functor.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -25,4 +25,5 @@ #include "ace/Hash_Map_Manager_T.h" #include "ace/post.h" + #endif /* ACE_HASH_MAP_MANAGER_H */ diff --git a/ace/Hash_Map_Manager_T.h b/ace/Hash_Map_Manager_T.h index 71bf90c10d1..fa801bec7a3 100644 --- a/ace/Hash_Map_Manager_T.h +++ b/ace/Hash_Map_Manager_T.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -14,14 +14,16 @@ #define ACE_HASH_MAP_MANAGER_T_H #include "ace/pre.h" -#include "ace/OS.h" -#include "ace/Functor.h" -#include "ace/Log_Msg.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Default_Constants.h" +#include "ace/Functor.h" +#include "ace/Log_Msg.h" + /** * @class ACE_Hash_Map_Entry * diff --git a/ace/Hashable.h b/ace/Hashable.h index ff12aed4ec6..8e6fb2d00c1 100644 --- a/ace/Hashable.h +++ b/ace/Hashable.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -9,21 +9,19 @@ * @author Doug Schmidt */ //============================================================================= + #ifndef ACE_HASHABLE_H #define ACE_HASHABLE_H -#include "ace/pre.h" -// @@todo: Hate to do this. Looks like we have less luck here as -// compilers complain for type u_long unknowns -#include "ace/OS.h" +#include "ace/pre.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - /** * @class ACE_Recyclable * @@ -31,7 +29,6 @@ * * */ - class ACE_Export ACE_Hashable { public: @@ -41,7 +38,7 @@ public: /// Computes and returns hash value. This "caches" the hash value to /// improve performance. - virtual u_long hash (void) const; + virtual unsigned long hash (void) const; protected: /// Protected constructor. @@ -49,10 +46,13 @@ protected: /// This is the method that actually performs the non-cached hash /// computation. - virtual u_long hash_i (void) const = 0; + virtual unsigned long hash_i (void) const = 0; + +protected: /// Pre-computed hash-value. - u_long hash_value_; + unsigned long hash_value_; + }; @@ -61,4 +61,5 @@ protected: #endif /* __ACE_INLINE __ */ #include "ace/post.h" + #endif /*ACE_HASHABLE_H*/ diff --git a/ace/Hashable.inl b/ace/Hashable.inl index efe4f9a8d75..4938b231fab 100644 --- a/ace/Hashable.inl +++ b/ace/Hashable.inl @@ -1,5 +1,8 @@ -/* -*- C++ -*- */ +// -*- C++ -*- +// // $Id$ + + ACE_INLINE ACE_Hashable::ACE_Hashable (void) : hash_value_ (0) @@ -11,7 +14,7 @@ ACE_Hashable::~ACE_Hashable (void) { } -ACE_INLINE u_long +ACE_INLINE unsigned long ACE_Hashable::hash (void) const { // In doing the check below, we take chance of paying a performance diff --git a/ace/Init_ACE.cpp b/ace/Init_ACE.cpp index 344af5cf422..87fece39bde 100644 --- a/ace/Init_ACE.cpp +++ b/ace/Init_ACE.cpp @@ -1,5 +1,3 @@ -// $Id$ - #include "ace/Init_ACE.h" #include "ace/Object_Manager.h" @@ -8,10 +6,13 @@ #include "ace/Init_ACE.i" #endif /* ACE_LACKS_INLINE_FUNCTIONS */ -ACE_RCSID(ace, Init_ACE, "$Id$") +ACE_RCSID (ace, + Init_ACE, + "$Id$") + +// Static data members. +unsigned int ACE_Init_ACE::init_fini_count_ = 0; - // Static data members. - u_int ACE_Init_ACE::init_fini_count_ = 0; int ACE_Init_ACE::init (void) { diff --git a/ace/Init_ACE.h b/ace/Init_ACE.h index 4e2ed9285c5..a81d5d21343 100644 --- a/ace/Init_ACE.h +++ b/ace/Init_ACE.h @@ -1,3 +1,4 @@ +// -*- C++ -*- //============================================================================= /** @@ -7,7 +8,6 @@ * * This class consolidates the operations on the Handles. * - * * @author Priyanka Gontla <pgontla@ece.uci.edu> */ //============================================================================= @@ -15,9 +15,10 @@ #ifndef ACE_INIT_ACE_H #define ACE_INIT_ACE_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -54,7 +55,7 @@ private: * <fini> must decrement it. <fini> then does nothing until it * reaches 0. */ - static u_int init_fini_count_; + static unsigned int init_fini_count_; }; #if !defined (ACE_LACKS_INLINE_FUNCTIONS) @@ -62,4 +63,5 @@ private: #endif /* ACE_LACKS_INLINE_FUNCTIONS */ #include "ace/post.h" + #endif /* ACE_INIT_ACE_H */ diff --git a/ace/Log_Msg_Backend.h b/ace/Log_Msg_Backend.h index bc8e867018a..1276f98720e 100644 --- a/ace/Log_Msg_Backend.h +++ b/ace/Log_Msg_Backend.h @@ -15,7 +15,7 @@ #define ACE_LOG_MSG_BACKEND_H #include "ace/pre.h" -#include "ace/config-all.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/ace/Log_Msg_Callback.h b/ace/Log_Msg_Callback.h index b9c833745ad..3602d56459d 100644 --- a/ace/Log_Msg_Callback.h +++ b/ace/Log_Msg_Callback.h @@ -14,7 +14,7 @@ #define ACE_LOG_MSG_CALLBACK_H #include "ace/pre.h" -#include "ace/config-all.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/ace/Makefile b/ace/Makefile index c26d3dc1fb7..aea683543af 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -11,6 +11,7 @@ SHLIB = $(LIBACE).$(SOEXT) OS_FILES = \ Basic_Types \ + Time_Value \ OS \ OS_Dirent \ OS_Memory \ diff --git a/ace/Makefile.bor b/ace/Makefile.bor index 132017a407c..adbea9750ca 100644 --- a/ace/Makefile.bor +++ b/ace/Makefile.bor @@ -206,6 +206,7 @@ OBJFILES = \ $(OBJDIR)\Thread.obj \ $(OBJDIR)\Thread_Manager.obj \ $(OBJDIR)\Time_Request_Reply.obj \ + $(OBJDIR)\Time_Value.obj \ $(OBJDIR)\Timeprobe.obj \ $(OBJDIR)\Timer_Hash.obj \ $(OBJDIR)\Timer_Heap.obj \ diff --git a/ace/Managed_Object.h b/ace/Managed_Object.h index 6d3597316ce..412379b809b 100644 --- a/ace/Managed_Object.h +++ b/ace/Managed_Object.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,9 +13,10 @@ #ifndef ACE_MANAGED_OBJECT_H #define ACE_MANAGED_OBJECT_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -157,4 +158,5 @@ private: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" + #endif /* ACE_MANAGED_OBJECT_H */ diff --git a/ace/Map.h b/ace/Map.h index a8334f72cb6..111fb1aa476 100644 --- a/ace/Map.h +++ b/ace/Map.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,9 +13,10 @@ #ifndef ACE_MAP_H #define ACE_MAP_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -25,4 +26,5 @@ #include "ace/Map_T.h" #include "ace/post.h" + #endif /* ACE_MAP_H */ diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h index 4e38e192b91..be3ab6fc45c 100644 --- a/ace/Map_Manager.h +++ b/ace/Map_Manager.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,9 +12,10 @@ #ifndef ACE_MAP_MANAGER_H #define ACE_MAP_MANAGER_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -697,4 +698,5 @@ public: #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ #include "ace/post.h" + #endif /* ACE_MAP_MANAGER_H */ diff --git a/ace/Method_Request.cpp b/ace/Method_Request.cpp index 003d5acc4f7..3215e1042d2 100644 --- a/ace/Method_Request.cpp +++ b/ace/Method_Request.cpp @@ -1,11 +1,10 @@ -// Method_Request.cpp -// $Id$ - #include "ace/Method_Request.h" -ACE_RCSID(ace, Method_Request, "$Id$") +ACE_RCSID (ace, + Method_Request, + "$Id$") -ACE_Method_Request::ACE_Method_Request (u_long prio) +ACE_Method_Request::ACE_Method_Request (unsigned long prio) : priority_ (prio) { } @@ -14,14 +13,14 @@ ACE_Method_Request::~ACE_Method_Request (void) { } -u_long +unsigned long ACE_Method_Request::priority (void) const { return this->priority_; } void -ACE_Method_Request::priority (u_long prio) +ACE_Method_Request::priority (unsigned long prio) { this->priority_ = prio; } diff --git a/ace/Method_Request.h b/ace/Method_Request.h index b545648712a..fb9e4063d90 100644 --- a/ace/Method_Request.h +++ b/ace/Method_Request.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -14,14 +14,17 @@ #ifndef ACE_METHOD_REQUEST_H #define ACE_METHOD_REQUEST_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "Global_Macros.h" + /** * @class ACE_Method_Request * @@ -44,10 +47,10 @@ public: // = Accessors. /// Get priority. - u_long priority (void) const; + unsigned long priority (void) const; /// Set priority. - void priority (u_long); + void priority (unsigned long); // = Invocation method (must be overridden by subclasses). /// Invoked when the <Method_Request> is scheduled to run. @@ -55,12 +58,13 @@ public: protected: /// The priority of the request. - u_long priority_; + unsigned long priority_; private: ACE_UNIMPLEMENTED_FUNC (void operator= (const ACE_Method_Request &)) ACE_UNIMPLEMENTED_FUNC (ACE_Method_Request (const ACE_Method_Request &)) }; + #include "ace/post.h" #endif /* ACE_METHOD_REQUEST_H */ diff --git a/ace/OS.cpp b/ace/OS.cpp index 81c2cb1f11b..052eb1678d3 100644 --- a/ace/OS.cpp +++ b/ace/OS.cpp @@ -233,142 +233,6 @@ ACE_OS::netdb_release (void) ACE_EXIT_HOOK ACE_OS::exit_hook_ = 0; -// Static constant representing `zero-time'. -// Note: this object requires static construction. -const ACE_Time_Value ACE_Time_Value::zero; - -// Constant for maximum time representable. Note that this time -// is not intended for use with select () or other calls that may -// have *their own* implementation-specific maximum time representations. -// Its primary use is in time computations such as those used by the -// dynamic subpriority strategies in the ACE_Dynamic_Message_Queue class. -// Note: this object requires static construction. -const ACE_Time_Value ACE_Time_Value::max_time (LONG_MAX, - ACE_ONE_SECOND_IN_USECS - 1); - -ACE_ALLOC_HOOK_DEFINE(ACE_Time_Value) - -// Increment microseconds (the only reason this is here is to allow -// the use of ACE_Atomic_Op with ACE_Time_Value). - -ACE_Time_Value -ACE_Time_Value::operator ++ (int) -{ - ACE_OS_TRACE ("ACE_Time_Value::operator ++ (int)"); - usec (usec () + 1); - normalize (); - return *this; -} - -ACE_Time_Value & -ACE_Time_Value::operator ++ (void) -{ - ACE_OS_TRACE ("ACE_Time_Value::operator ++ (void)"); - usec (usec () + 1); - normalize (); - return *this; -} - -// Decrement microseconds (the only reason this is here is / to allow -// the use of ACE_Atomic_Op with ACE_Time_Value). - -ACE_Time_Value -ACE_Time_Value::operator -- (int) -{ - ACE_OS_TRACE ("ACE_Time_Value::operator -- (int)"); - usec (usec () - 1); - normalize (); - return *this; -} - -ACE_Time_Value & -ACE_Time_Value::operator -- (void) -{ - ACE_OS_TRACE ("ACE_Time_Value::operator -- (void)"); - usec (usec () - 1); - normalize (); - return *this; -} - -#if defined (ACE_WIN32) -// Static constant to remove time skew between FILETIME and POSIX -// time. POSIX and Win32 use different epochs (Jan. 1, 1970 v.s. -// Jan. 1, 1601). The following constant defines the difference -// in 100ns ticks. -// -// In the beginning (Jan. 1, 1601), there was no time and no computer. -// And Bill said: "Let there be time," and there was time.... -# if defined (ACE_LACKS_LONGLONG_T) -const ACE_U_LongLong ACE_Time_Value::FILETIME_to_timval_skew = -ACE_U_LongLong (0xd53e8000, 0x19db1de); -# else -const DWORDLONG ACE_Time_Value::FILETIME_to_timval_skew = -ACE_INT64_LITERAL (0x19db1ded53e8000); -# endif - -// Initializes the ACE_Time_Value object from a Win32 FILETIME - -ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time) -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (file_time); -} - -void ACE_Time_Value::set (const FILETIME &file_time) -{ - // Initializes the ACE_Time_Value object from a Win32 FILETIME -#if defined (ACE_LACKS_LONGLONG_T) - ACE_U_LongLong LL_100ns(file_time.dwLowDateTime, file_time.dwHighDateTime); - LL_100ns -= ACE_Time_Value::FILETIME_to_timval_skew; - // Convert 100ns units to seconds; - this->tv_.tv_sec = (long) (LL_100ns / ((double) (10000 * 1000))); - // Convert remainder to microseconds; - this->tv_.tv_usec = (long)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); -#else - // Don't use a struct initializer, gcc don't like it. - ULARGE_INTEGER _100ns; - _100ns.LowPart = file_time.dwLowDateTime; - _100ns.HighPart = file_time.dwHighDateTime; - - _100ns.QuadPart -= ACE_Time_Value::FILETIME_to_timval_skew; - - // Convert 100ns units to seconds; - this->tv_.tv_sec = (long) (_100ns.QuadPart / (10000 * 1000)); - // Convert remainder to microseconds; - this->tv_.tv_usec = (long) ((_100ns.QuadPart % (10000 * 1000)) / 10); -#endif // ACE_LACKS_LONGLONG_T -} - -// Returns the value of the object as a Win32 FILETIME. - -ACE_Time_Value::operator FILETIME () const -{ - FILETIME file_time; - ACE_OS_TRACE ("ACE_Time_Value::operator FILETIME"); - -#if defined (ACE_LACKS_LONGLONG_T) - ACE_U_LongLong LL_sec(this->tv_.tv_sec); - ACE_U_LongLong LL_usec(this->tv_.tv_usec); - ACE_U_LongLong LL_100ns = LL_sec * (ACE_UINT32)(10000 * 1000) + - LL_usec * (ACE_UINT32)10 + - ACE_Time_Value::FILETIME_to_timval_skew; - file_time.dwLowDateTime = LL_100ns.lo(); - file_time.dwHighDateTime = LL_100ns.hi(); -#else - ULARGE_INTEGER _100ns; - _100ns.QuadPart = (((DWORDLONG) this->tv_.tv_sec * (10000 * 1000) + - this->tv_.tv_usec * 10) + - ACE_Time_Value::FILETIME_to_timval_skew); - - file_time.dwLowDateTime = _100ns.LowPart; - file_time.dwHighDateTime = _100ns.HighPart; -#endif //ACE_LACKS_LONGLONG_T - - return file_time; -} - -#endif /* ACE_WIN32 */ - ACE_Cleanup_Info::ACE_Cleanup_Info (void) : object_ (0), cleanup_hook_ (0), @@ -517,55 +381,6 @@ ACE_OS_Exit_Info::call_hooks () } } -void -ACE_Time_Value::dump (void) const -{ - ACE_OS_TRACE ("ACE_Time_Value::dump"); -#if 0 - ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntv_sec_ = %d"), this->tv_.tv_sec)); - ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntv_usec_ = %d\n"), this->tv_.tv_usec)); - ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); -#endif /* 0 */ -} - -void -ACE_Time_Value::normalize (void) -{ - // ACE_OS_TRACE ("ACE_Time_Value::normalize"); - // New code from Hans Rohnert... - - if (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS) - { - do - { - this->tv_.tv_sec++; - this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; - } - while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); - } - else if (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS) - { - do - { - this->tv_.tv_sec--; - this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; - } - while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); - } - - if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0) - { - this->tv_.tv_sec--; - this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; - } - else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) - { - this->tv_.tv_sec++; - this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; - } -} - ACE_Countdown_Time::ACE_Countdown_Time (ACE_Time_Value *max_wait_time) : max_wait_time_ (max_wait_time), stopped_ (0) @@ -34,6 +34,8 @@ #include "ace/OS_TLI.h" #include "ace/OS_Errno.h" +#include "ace/Time_Value.h" + class ACE_Timeout_Manager; #if !defined (_SC_AIO_MAX) @@ -660,22 +662,6 @@ using std::timezone; using std::difftime; # endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */ -# if !defined (ACE_HAS_POSIX_TIME) && !defined (ACE_PSOS) -// Definition per POSIX. -typedef struct timespec -{ - time_t tv_sec; // Seconds - long tv_nsec; // Nanoseconds -} timespec_t; -# elif defined (ACE_HAS_BROKEN_POSIX_TIME) -// OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs -# include /**/ <sys/timers.h> -# endif /* !ACE_HAS_POSIX_TIME */ - -# if defined(ACE_LACKS_TIMESPEC_T) -typedef struct timespec timespec_t; -# endif /* ACE_LACKS_TIMESPEC_T */ - # if !defined (ACE_HAS_CLOCK_GETTIME) && !(defined (_CLOCKID_T_) || defined (_CLOCKID_T)) typedef int clockid_t; # if !defined (CLOCK_REALTIME) @@ -683,207 +669,6 @@ typedef int clockid_t; # endif /* CLOCK_REALTIME */ # endif /* ! ACE_HAS_CLOCK_GETTIME && ! _CLOCKID_T_ */ -// ------------------------------------------------------------------- -// These forward declarations are only used to circumvent a bug in -// MSVC 6.0 compiler. They shouldn't cause any problem for other -// compilers and they can be removed once MS release a SP that contains -// the fix. -class ACE_Time_Value; -ACE_OS_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - -ACE_OS_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - -// This forward declaration is needed by the set() and FILETIME() functions -#if defined (ACE_LACKS_LONGLONG_T) - class ACE_Export ACE_U_LongLong; -#endif //ghs -// ------------------------------------------------------------------- - -/** - * @class ACE_Time_Value - * - * @brief Operations on "timeval" structures, which express time in <secs> and <usecs>. - * - * This class centralizes all the time related processing in - * ACE. These timers are typically used in conjunction with OS - * mechanisms like <select>, <poll>, or <cond_timedwait>. - * <ACE_Time_Value> makes the use of these mechanisms portable - * across OS platforms, - */ -class ACE_OS_Export ACE_Time_Value -{ -public: - // = Useful constants. - - /// Constant "0". - static const ACE_Time_Value zero; - - /** - * Constant for maximum time representable. Note that this time is - * not intended for use with <select> or other calls that may have - * *their own* implementation-specific maximum time representations. - * Its primary use is in time computations such as those used by the - * dynamic subpriority strategies in the <ACE_Dynamic_Message_Queue> - * class. - */ - static const ACE_Time_Value max_time; - - // = Initialization methods. - - /// Default Constructor. - ACE_Time_Value (void); - - /// Constructor. - ACE_Time_Value (long sec, long usec = 0); - - // = Methods for converting to/from various time formats. - /// Construct the <ACE_Time_Value> from a <timeval>. - ACE_Time_Value (const struct timeval &t); - - /// Initializes the <ACE_Time_Value> object from a <timespec_t>. - ACE_Time_Value (const timespec_t &t); - - /// Copy constructor. - ACE_Time_Value (const ACE_Time_Value &tv); - -# if defined (ACE_WIN32) - /// Initializes the ACE_Time_Value object from a Win32 FILETIME - ACE_Time_Value (const FILETIME &ft); -# endif /* ACE_WIN32 */ - - /// Construct a <Time_Value> from two <long>s. - void set (long sec, long usec); - - /// Construct a <Time_Value> from a <double>, which is assumed to be - /// in second format, with any remainder treated as microseconds. - void set (double d); - - /// Construct a <Time_Value> from a <timeval>. - void set (const timeval &t); - - /// Initializes the <Time_Value> object from a <timespec_t>. - void set (const timespec_t &t); - -# if defined (ACE_WIN32) - /// Initializes the <Time_Value> object from a <timespec_t>. - void set (const FILETIME &ft); -# endif /* ACE_WIN32 */ - - /// Converts from <Time_Value> format into milli-seconds format. - long msec (void) const; - - /// Converts from milli-seconds format into <Time_Value> format. - void msec (long); - - /// Returns the value of the object as a <timespec_t>. - operator timespec_t () const; - - /// Returns the value of the object as a <timeval>. - operator timeval () const; - - /// Returns a pointer to the object as a <timeval>. - operator const timeval *() const; - -# if defined (ACE_WIN32) - /// Returns the value of the object as a Win32 FILETIME. - operator FILETIME () const; -# endif /* ACE_WIN32 */ - - // = The following are accessor/mutator methods. - - /// Get seconds. - long sec (void) const; - - /// Set seconds. - void sec (long sec); - - /// Get microseconds. - long usec (void) const; - - /// Set microseconds. - void usec (long usec); - - // = The following arithmetic methods operate on <Time_Value>s. - - /// Add <tv> to this. - ACE_Time_Value &operator += (const ACE_Time_Value &tv); - - /// Subtract <tv> to this. - ACE_Time_Value &operator -= (const ACE_Time_Value &tv); - - /// Multiply the time value by the <d> factor, which must be >= 0. - ACE_Time_Value &operator *= (double d); - - /// Increment microseconds (the only reason this is here is - /// to allow the use of ACE_Atomic_Op with ACE_Time_Value). - ACE_Time_Value operator++ (int); // Postfix advance - ACE_Time_Value &operator++ (void); // Prefix advance - - /// Decrement microseconds (the only reason this is here is - /// to allow the use of ACE_Atomic_Op with ACE_Time_Value). - ACE_Time_Value operator-- (int); // Postfix dec - ACE_Time_Value &operator-- (void); // Prefix dec - - /// Adds two ACE_Time_Value objects together, returns the sum. - friend ACE_OS_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// Subtracts two ACE_Time_Value objects, returns the difference. - friend ACE_OS_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if tv1 < tv2. - friend ACE_OS_Export int operator < (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if tv1 > tv2. - friend ACE_OS_Export int operator > (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if tv1 <= tv2. - friend ACE_OS_Export int operator <= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if tv1 >= tv2. - friend ACE_OS_Export int operator >= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if tv1 == tv2. - friend ACE_OS_Export int operator == (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// True if tv1 != tv2. - friend ACE_OS_Export int operator != (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2); - - /// Dump is a no-op. - /** - * The dump() method is a no-op. It's here for backwards compatibility - * only, but does not dump anything. Invoking logging methods here - * violates layering restrictions in ACE because this class is part - * of the OS layer and @c ACE_Log_Msg is at a higher level. - */ - void dump (void) const; - -# if defined (ACE_WIN32) - /// Const time difference between FILETIME and POSIX time. -# if defined (ACE_LACKS_LONGLONG_T) - static const ACE_U_LongLong FILETIME_to_timval_skew; -# else - static const DWORDLONG FILETIME_to_timval_skew; -# endif // ACE_LACKS_LONGLONG_T -# endif /* ACE_WIN32 */ - -private: - /// Put the timevalue into a canonical form. - void normalize (void); - - /// Store the values as a <timeval>. - timeval tv_; -}; - /** * @class ACE_Countdown_Time * @@ -1442,31 +1227,6 @@ typedef const struct rlimit ACE_SETRLIMIT_TYPE; # define ACE_DEFAULT_THREAD_PRIORITY (-0x7fffffffL - 1L) # endif /* ACE_DEFAULT_THREAD_PRIORITY */ -// Convenient macro for testing for deadlock, as well as for detecting -// when mutexes fail. -#define ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ACTION, REACTION) \ - ACE_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () != 0) { ACTION; } \ - else { REACTION; } -#define ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, REACTION) \ - ACE_GUARD_ACTION(MUTEX, OBJ, LOCK, ;, REACTION) -#define ACE_GUARD(MUTEX, OBJ, LOCK) \ - ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return) -#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN) \ - ACE_GUARD_REACTION(MUTEX, OBJ, LOCK, return RETURN) -# define ACE_WRITE_GUARD(MUTEX,OBJ,LOCK) \ - ACE_Write_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) return; -# define ACE_WRITE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ - ACE_Write_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) return RETURN; -# define ACE_READ_GUARD(MUTEX,OBJ,LOCK) \ - ACE_Read_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) return; -# define ACE_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ - ACE_Read_Guard< MUTEX > OBJ (LOCK); \ - if (OBJ.locked () == 0) return RETURN; - # if defined (ACE_HAS_PACE) && !defined (ACE_WIN32) # include /**/ "pace/semaphore.h" # if !defined (SEM_FAILED) @@ -2725,12 +2485,6 @@ typedef unsigned int size_t; # endif # endif /* ACE_HAS_LLSEEK || ACE_HAS_LSEEK64 */ -// Define some helpful constants. -// Not type-safe, and signed. For backward compatibility. -#define ACE_ONE_SECOND_IN_MSECS 1000L -#define ACE_ONE_SECOND_IN_USECS 1000000L -#define ACE_ONE_SECOND_IN_NSECS 1000000000L - // Type-safe, and unsigned. static const ACE_UINT32 ACE_U_ONE_SECOND_IN_MSECS = 1000U; static const ACE_UINT32 ACE_U_ONE_SECOND_IN_USECS = 1000000U; @@ -137,341 +137,6 @@ typedef const struct timespec * ACE_TIMESPEC_PTR; # include /**/ <malloc.h> #endif /* ACE_LACKS_MALLOC_H */ -// Returns the value of the object as a timeval. - -ACE_INLINE -ACE_Time_Value::operator timeval () const -{ - ACE_OS_TRACE ("ACE_Time_Value::operator timeval"); - return this->tv_; -} - -// Returns a pointer to the object as a timeval. - -ACE_INLINE -ACE_Time_Value::operator const timeval * () const -{ - ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *"); - return (const timeval *) &this->tv_; -} - -ACE_INLINE void -ACE_Time_Value::set (long sec, long usec) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); - this->tv_.tv_sec = sec; - this->tv_.tv_usec = usec; -} - -ACE_INLINE void -ACE_Time_Value::set (double d) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); - long l = (long) d; - this->tv_.tv_sec = l; - this->tv_.tv_usec = (long) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS); - this->normalize (); -} - -// Initializes a timespec_t. Note that this approach loses precision -// since it converts the nano-seconds into micro-seconds. But then -// again, do any real systems have nano-second timer precision?! - -ACE_INLINE void -ACE_Time_Value::set (const timespec_t &tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); -#if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) - this->tv_.tv_sec = tv.tv_sec; - // Convert nanoseconds into microseconds. - this->tv_.tv_usec = tv.tv_nsec / 1000; -#else - this->tv_.tv_sec = tv.ts_sec; - // Convert nanoseconds into microseconds. - this->tv_.tv_usec = tv.ts_nsec / 1000; -#endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ - - this->normalize (); -} - -ACE_INLINE void -ACE_Time_Value::set (const timeval &tv) -{ - // ACE_OS_TRACE ("ACE_Time_Value::set"); - this->tv_.tv_sec = tv.tv_sec; - this->tv_.tv_usec = tv.tv_usec; - - this->normalize (); -} - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (const timeval &tv) - // : tv_ () -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (tv); -} - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (void) - // : tv_ () -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (0, 0); - - // Don't need to normalize time value of (0, 0). -} - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (long sec, long usec) -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (sec, usec); - this->normalize (); -} - -// Returns number of seconds. - -ACE_INLINE long -ACE_Time_Value::sec (void) const -{ - ACE_OS_TRACE ("ACE_Time_Value::sec"); - return this->tv_.tv_sec; -} - -// Sets the number of seconds. - -ACE_INLINE void -ACE_Time_Value::sec (long sec) -{ - ACE_OS_TRACE ("ACE_Time_Value::sec"); - this->tv_.tv_sec = sec; -} - -// Converts from Time_Value format into milli-seconds format. - -ACE_INLINE long -ACE_Time_Value::msec (void) const -{ - ACE_OS_TRACE ("ACE_Time_Value::msec"); - return this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000; -} - -// Converts from milli-seconds format into Time_Value format. - -ACE_INLINE void -ACE_Time_Value::msec (long milliseconds) -{ - ACE_OS_TRACE ("ACE_Time_Value::msec"); - // Convert millisecond units to seconds; - this->tv_.tv_sec = milliseconds / 1000; - // Convert remainder to microseconds; - this->tv_.tv_usec = (milliseconds - (this->tv_.tv_sec * 1000)) * 1000; -} - -// Returns number of micro-seconds. - -ACE_INLINE long -ACE_Time_Value::usec (void) const -{ - ACE_OS_TRACE ("ACE_Time_Value::usec"); - return this->tv_.tv_usec; -} - -// Sets the number of micro-seconds. - -ACE_INLINE void -ACE_Time_Value::usec (long usec) -{ - ACE_OS_TRACE ("ACE_Time_Value::usec"); - this->tv_.tv_usec = usec; -} - -// Initializes the ACE_Time_Value object from another ACE_Time_Value - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (const ACE_Time_Value &tv) - : tv_ (tv.tv_) -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); -} - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator *= (double d) -{ - double time = ((double) this->sec ()) * ACE_ONE_SECOND_IN_USECS + this->usec (); - time *= d; - this->sec ((long)(time / ACE_ONE_SECOND_IN_USECS)); - this->usec (((long)time) % ACE_ONE_SECOND_IN_USECS); - - return *this; -} - -ACE_INLINE ACE_Time_Value -operator * (double d, const ACE_Time_Value &tv) -{ - return ACE_Time_Value (tv) *= d; -} - -ACE_INLINE ACE_Time_Value -operator * (const ACE_Time_Value &tv, double d) -{ - return ACE_Time_Value (tv) *= d; -} - -// True if tv1 > tv2. - -ACE_INLINE int -operator > (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - ACE_OS_TRACE ("operator >"); - if (tv1.sec () > tv2.sec ()) - return 1; - else if (tv1.sec () == tv2.sec () - && tv1.usec () > tv2.usec ()) - return 1; - else - return 0; -} - -// True if tv1 >= tv2. - -ACE_INLINE int -operator >= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - ACE_OS_TRACE ("operator >="); - if (tv1.sec () > tv2.sec ()) - return 1; - else if (tv1.sec () == tv2.sec () - && tv1.usec () >= tv2.usec ()) - return 1; - else - return 0; -} - -// Returns the value of the object as a timespec_t. - -ACE_INLINE -ACE_Time_Value::operator timespec_t () const -{ - ACE_OS_TRACE ("ACE_Time_Value::operator timespec_t"); - timespec_t tv; -#if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) - tv.tv_sec = this->sec (); - // Convert microseconds into nanoseconds. - tv.tv_nsec = this->tv_.tv_usec * 1000; -#else - tv.ts_sec = this->sec (); - // Convert microseconds into nanoseconds. - tv.ts_nsec = this->tv_.tv_usec * 1000; -#endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ - return tv; -} - -// Initializes the ACE_Time_Value object from a timespec_t. - -ACE_INLINE -ACE_Time_Value::ACE_Time_Value (const timespec_t &tv) - // : tv_ () -{ - // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); - this->set (tv); -} - -// True if tv1 < tv2. - -ACE_INLINE int -operator < (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - ACE_OS_TRACE ("operator <"); - return tv2 > tv1; -} - -// True if tv1 >= tv2. - -ACE_INLINE int -operator <= (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - ACE_OS_TRACE ("operator <="); - return tv2 >= tv1; -} - -// True if tv1 == tv2. - -ACE_INLINE int -operator == (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator =="); - return tv1.sec () == tv2.sec () - && tv1.usec () == tv2.usec (); -} - -// True if tv1 != tv2. - -ACE_INLINE int -operator != (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - // ACE_OS_TRACE ("operator !="); - return !(tv1 == tv2); -} - -// Add TV to this. - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator+= (const ACE_Time_Value &tv) -{ - ACE_OS_TRACE ("ACE_Time_Value::operator+="); - this->sec (this->sec () + tv.sec ()); - this->usec (this->usec () + tv.usec ()); - this->normalize (); - return *this; -} - -// Subtract TV to this. - -ACE_INLINE ACE_Time_Value & -ACE_Time_Value::operator-= (const ACE_Time_Value &tv) -{ - ACE_OS_TRACE ("ACE_Time_Value::operator-="); - this->sec (this->sec () - tv.sec ()); - this->usec (this->usec () - tv.usec ()); - this->normalize (); - return *this; -} - -// Adds two ACE_Time_Value objects together, returns the sum. - -ACE_INLINE ACE_Time_Value -operator + (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - ACE_OS_TRACE ("operator +"); - ACE_Time_Value sum (tv1.sec () + tv2.sec (), - tv1.usec () + tv2.usec ()); - - sum.normalize (); - return sum; -} - -// Subtracts two ACE_Time_Value objects, returns the difference. - -ACE_INLINE ACE_Time_Value -operator - (const ACE_Time_Value &tv1, - const ACE_Time_Value &tv2) -{ - ACE_OS_TRACE ("operator -"); - ACE_Time_Value delta (tv1.sec () - tv2.sec (), - tv1.usec () - tv2.usec ()); - delta.normalize (); - return delta; -} - ACE_INLINE int ACE_OS::fcntl (ACE_HANDLE handle, int cmd, long arg) { diff --git a/ace/OS_Dirent.h b/ace/OS_Dirent.h index bbac4ab4eff..2586fed0081 100644 --- a/ace/OS_Dirent.h +++ b/ace/OS_Dirent.h @@ -16,13 +16,14 @@ #define ACE_OS_DIRENT_H #include "ace/pre.h" -#include "ace/config-all.h" #include "ace/OS_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/OS_Errno.h" + #if !defined (ACE_WIN32) && !defined (ACE_PSOS) && !defined (ACE_HAS_WINCE) # include /**/ <sys/types.h> # if !defined (ACE_LACKS_UNISTD_H) diff --git a/ace/OS_Errno.h b/ace/OS_Errno.h index fefd9f14571..378e092a445 100644 --- a/ace/OS_Errno.h +++ b/ace/OS_Errno.h @@ -14,7 +14,6 @@ #define ACE_OS_ERRNO_H #include "ace/pre.h" -#include "ace/config.h" #include "ace/OS_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) diff --git a/ace/OS_Export.h b/ace/OS_Export.h index bc6841996c8..cec9673f645 100644 --- a/ace/OS_Export.h +++ b/ace/OS_Export.h @@ -4,7 +4,7 @@ // This file is generated automatically by // generate_export_file.pl // ------------------------------ -#if !defined (ACE_OS_EXPORT_H) +#ifndef ACE_OS_EXPORT_H #define ACE_OS_EXPORT_H #include "ace/config-all.h" diff --git a/ace/OS_Memory.h b/ace/OS_Memory.h index c4daffa93ac..0902eff34c5 100644 --- a/ace/OS_Memory.h +++ b/ace/OS_Memory.h @@ -16,13 +16,14 @@ #define ACE_OS_MEMORY_H #include "ace/pre.h" -#include "ace/config-all.h" +#include "ace/OS_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/OS_Export.h" +#include "ace/OS_Errno.h" + #if defined (ACE_HAS_PACE) # include /**/ "pace/stdlib.h" #endif /* ACE_HAS_PACE */ diff --git a/ace/OS_String.h b/ace/OS_String.h index 46f19a6e411..4a6e671c566 100644 --- a/ace/OS_String.h +++ b/ace/OS_String.h @@ -17,7 +17,7 @@ #define ACE_OS_STRING_H #include "ace/pre.h" -#include "ace/config-all.h" +#include "ace/OS_Export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once diff --git a/ace/OS_TLI.h b/ace/OS_TLI.h index 43f899cc90f..2e033e1aea6 100644 --- a/ace/OS_TLI.h +++ b/ace/OS_TLI.h @@ -22,6 +22,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/OS_Errno.h" + # if !defined (ACE_HAS_TLI) // Dummies to help compilation. struct t_call { }; diff --git a/ace/Pair.h b/ace/Pair.h index 4fb5693e948..f31723c8899 100644 --- a/ace/Pair.h +++ b/ace/Pair.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,9 +13,10 @@ #ifndef ACE_PAIR_H #define ACE_PAIR_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -25,4 +26,5 @@ #include "ace/Pair_T.h" #include "ace/post.h" + #endif /* ACE_PAIR_H */ diff --git a/ace/Proactor.h b/ace/Proactor.h index 36a3340717a..cb609a5afe6 100644 --- a/ace/Proactor.h +++ b/ace/Proactor.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -396,98 +396,113 @@ public: // Note that the user does not have to use or know about these // methods unless they want to "fake" results. - /// Create the correct implementation class for ACE_Asynch_Read_Stream::Result class. - virtual ACE_Asynch_Read_Stream_Result_Impl *create_asynch_read_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_read, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Create the correct implementation class for ACE_Asynch_Write_Stream::Result. - virtual ACE_Asynch_Write_Stream_Result_Impl *create_asynch_write_stream_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_write, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Create the correct implementation class for ACE_Asynch_Read_File::Result. - virtual ACE_Asynch_Read_File_Result_Impl *create_asynch_read_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_read, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Create the correct implementation class for ACE_Asynch_Write_File::Result. - virtual ACE_Asynch_Write_File_Result_Impl *create_asynch_write_file_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block &message_block, - u_long bytes_to_write, - const void* act, - u_long offset, - u_long offset_high, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Create the correct implementation class for ACE_Asynch_Read_Dgram::Result. - virtual ACE_Asynch_Read_Dgram_Result_Impl *create_asynch_read_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_read, - int flags, - int protocol_family, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); + /// Create the correct implementation class for + /// ACE_Asynch_Read_Stream::Result class. + virtual ACE_Asynch_Read_Stream_Result_Impl * + create_asynch_read_stream_result (ACE_Handler &handler, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_read, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Create the correct implementation class for + /// ACE_Asynch_Write_Stream::Result. + virtual ACE_Asynch_Write_Stream_Result_Impl * + create_asynch_write_stream_result (ACE_Handler &handler, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_write, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Create the correct implementation class for + /// ACE_Asynch_Read_File::Result. + virtual ACE_Asynch_Read_File_Result_Impl * + create_asynch_read_file_result (ACE_Handler &handler, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_read, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Create the correct implementation class for + /// ACE_Asynch_Write_File::Result. + virtual ACE_Asynch_Write_File_Result_Impl * + create_asynch_write_file_result (ACE_Handler &handler, + ACE_HANDLE handle, + ACE_Message_Block &message_block, + u_long bytes_to_write, + const void* act, + u_long offset, + u_long offset_high, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Create the correct implementation class for + /// ACE_Asynch_Read_Dgram::Result. + virtual ACE_Asynch_Read_Dgram_Result_Impl * + create_asynch_read_dgram_result (ACE_Handler &handler, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_read, + int flags, + int protocol_family, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); - /// Create the correct implementation class for ACE_Asynch_Write_Dgram::Result. - virtual ACE_Asynch_Write_Dgram_Result_Impl *create_asynch_write_dgram_result (ACE_Handler &handler, - ACE_HANDLE handle, - ACE_Message_Block *message_block, - size_t bytes_to_write, - int flags, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); + /// Create the correct implementation class for + /// ACE_Asynch_Write_Dgram::Result. + virtual ACE_Asynch_Write_Dgram_Result_Impl * + create_asynch_write_dgram_result (ACE_Handler &handler, + ACE_HANDLE handle, + ACE_Message_Block *message_block, + size_t bytes_to_write, + int flags, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); /// Create the correct implementation class for ACE_Asynch_Accept::Result. - virtual ACE_Asynch_Accept_Result_Impl *create_asynch_accept_result (ACE_Handler &handler, - ACE_HANDLE listen_handle, - ACE_HANDLE accept_handle, - ACE_Message_Block &message_block, - u_long bytes_to_read, - const void* act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); - - /// Create the correct implementation class for ACE_Asynch_Transmit_File::Result. - virtual ACE_Asynch_Transmit_File_Result_Impl *create_asynch_transmit_file_result (ACE_Handler &handler, - ACE_HANDLE socket, - ACE_HANDLE file, - ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, - u_long bytes_to_write, - u_long offset, - u_long offset_high, - u_long bytes_per_send, - u_long flags, - const void *act, - ACE_HANDLE event = ACE_INVALID_HANDLE, - int priority = 0, - int signal_number = ACE_SIGRTMIN); + virtual ACE_Asynch_Accept_Result_Impl * + create_asynch_accept_result (ACE_Handler &handler, + ACE_HANDLE listen_handle, + ACE_HANDLE accept_handle, + ACE_Message_Block &message_block, + u_long bytes_to_read, + const void* act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); + + /// Create the correct implementation class for + /// ACE_Asynch_Transmit_File::Result. + virtual ACE_Asynch_Transmit_File_Result_Impl * + create_asynch_transmit_file_result (ACE_Handler &handler, + ACE_HANDLE socket, + ACE_HANDLE file, + ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer, + u_long bytes_to_write, + u_long offset, + u_long offset_high, + u_long bytes_per_send, + u_long flags, + const void *act, + ACE_HANDLE event = ACE_INVALID_HANDLE, + int priority = 0, + int signal_number = ACE_SIGRTMIN); /** * Create a timer result object which can be used with the Timer @@ -496,7 +511,8 @@ public: * Timer object with a meaningful signal number, choosing the * largest signal number from the signal mask of the Proactor. */ - virtual ACE_Asynch_Result_Impl *create_asynch_timer (ACE_Handler &handler, + virtual ACE_Asynch_Result_Impl *create_asynch_timer ( + ACE_Handler &handler, const void *act, const ACE_Time_Value &tv, ACE_HANDLE event = ACE_INVALID_HANDLE, @@ -570,7 +586,7 @@ private: #else /* NOT WIN32 or POSIX with AIO features. */ -# include "ace/OS.h" // Need ACE_Time_Value +class ACE_Time_Value; class ACE_Export ACE_Proactor { diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h index 12e127f7a00..1c8c5553e63 100644 --- a/ace/RB_Tree.h +++ b/ace/RB_Tree.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -15,7 +15,7 @@ #define ACE_RB_TREE_H #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/Global_Macros.h" #include "ace/Functor.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) diff --git a/ace/Recyclable.h b/ace/Recyclable.h index bcf47ef937b..87270a4cfc8 100644 --- a/ace/Recyclable.h +++ b/ace/Recyclable.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,15 +12,14 @@ #ifndef ACE_RECYCLABLE_H #define ACE_RECYCLABLE_H #include "ace/pre.h" -#include "ace/config-all.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - /// States of a recyclable object. enum ACE_Recyclable_State { @@ -50,7 +49,6 @@ enum ACE_Recyclable_State * * */ - class ACE_Export ACE_Recyclable { public: diff --git a/ace/Refcountable.h b/ace/Refcountable.h index d194dd13a84..1e622876887 100644 --- a/ace/Refcountable.h +++ b/ace/Refcountable.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,7 +13,7 @@ #define ACE_REFCOUNTABLE_H #include "ace/pre.h" -#include "ace/config-all.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -27,7 +27,6 @@ * * */ - class ACE_Export ACE_Refcountable { public: diff --git a/ace/String_Base_Const.h b/ace/String_Base_Const.h index 3f37b92e11c..d6f796ae8c6 100644 --- a/ace/String_Base_Const.h +++ b/ace/String_Base_Const.h @@ -10,11 +10,17 @@ */ //============================================================================= -#if !defined ACE_STRING_BASE_CONST_H +#ifndef ACE_STRING_BASE_CONST_H #define ACE_STRING_BASE_CONST_H #include "ace/pre.h" -#include "ace/config-all.h" + +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + /** * @class ACE_String_Base_Const diff --git a/ace/Thread_Adapter.h b/ace/Thread_Adapter.h index d7e8bd54f0f..355ef4eac30 100644 --- a/ace/Thread_Adapter.h +++ b/ace/Thread_Adapter.h @@ -13,12 +13,14 @@ #define ACE_THREAD_ADAPTER_H #include "ace/pre.h" -#include "ace/Base_Thread_Adapter.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Base_Thread_Adapter.h" + // Forward decl. class ACE_Thread_Manager; class ACE_Thread_Descriptor; diff --git a/ace/Time_Value.cpp b/ace/Time_Value.cpp new file mode 100644 index 00000000000..cf78a3c3039 --- /dev/null +++ b/ace/Time_Value.cpp @@ -0,0 +1,198 @@ +#include "ace/Time_Value.h" +#include "ace/Basic_Types.h" + + +ACE_RCSID (ace, + Time_Value, + "$Id$") + + +#if !defined (__ACE_INLINE__) +#include "ace/Time_Value.inl" +#endif /* __ACE_INLINE__ */ + + +// Static constant representing `zero-time'. +// Note: this object requires static construction. +const ACE_Time_Value ACE_Time_Value::zero; + +// Constant for maximum time representable. Note that this time +// is not intended for use with select () or other calls that may +// have *their own* implementation-specific maximum time representations. +// Its primary use is in time computations such as those used by the +// dynamic subpriority strategies in the ACE_Dynamic_Message_Queue class. +// Note: this object requires static construction. +const ACE_Time_Value ACE_Time_Value::max_time (LONG_MAX, + ACE_ONE_SECOND_IN_USECS - 1); + +ACE_ALLOC_HOOK_DEFINE (ACE_Time_Value) + +// Increment microseconds (the only reason this is here is to allow +// the use of ACE_Atomic_Op with ACE_Time_Value). + +ACE_Time_Value +ACE_Time_Value::operator ++ (int) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (int)"); + usec (usec () + 1); + normalize (); + return *this; +} + +ACE_Time_Value & +ACE_Time_Value::operator ++ (void) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator ++ (void)"); + usec (usec () + 1); + normalize (); + return *this; +} + +// Decrement microseconds (the only reason this is here is / to allow +// the use of ACE_Atomic_Op with ACE_Time_Value). + +ACE_Time_Value +ACE_Time_Value::operator -- (int) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator -- (int)"); + usec (usec () - 1); + normalize (); + return *this; +} + +ACE_Time_Value & +ACE_Time_Value::operator -- (void) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator -- (void)"); + usec (usec () - 1); + normalize (); + return *this; +} + +#if defined (ACE_WIN32) +// Static constant to remove time skew between FILETIME and POSIX +// time. POSIX and Win32 use different epochs (Jan. 1, 1970 v.s. +// Jan. 1, 1601). The following constant defines the difference +// in 100ns ticks. +// +// In the beginning (Jan. 1, 1601), there was no time and no computer. +// And Bill said: "Let there be time," and there was time.... +# if defined (ACE_LACKS_LONGLONG_T) +const ACE_U_LongLong ACE_Time_Value::FILETIME_to_timval_skew = +ACE_U_LongLong (0xd53e8000, 0x19db1de); +# else +const DWORDLONG ACE_Time_Value::FILETIME_to_timval_skew = +ACE_INT64_LITERAL (0x19db1ded53e8000); +# endif + +// Initializes the ACE_Time_Value object from a Win32 FILETIME + +ACE_Time_Value::ACE_Time_Value (const FILETIME &file_time) +{ + // // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (file_time); +} + +void ACE_Time_Value::set (const FILETIME &file_time) +{ + // Initializes the ACE_Time_Value object from a Win32 FILETIME +#if defined (ACE_LACKS_LONGLONG_T) + ACE_U_LongLong LL_100ns(file_time.dwLowDateTime, file_time.dwHighDateTime); + LL_100ns -= ACE_Time_Value::FILETIME_to_timval_skew; + // Convert 100ns units to seconds; + this->tv_.tv_sec = (long) (LL_100ns / ((double) (10000 * 1000))); + // Convert remainder to microseconds; + this->tv_.tv_usec = (long)((LL_100ns % ((ACE_UINT32)(10000 * 1000))) / 10); +#else + // Don't use a struct initializer, gcc don't like it. + ULARGE_INTEGER _100ns; + _100ns.LowPart = file_time.dwLowDateTime; + _100ns.HighPart = file_time.dwHighDateTime; + + _100ns.QuadPart -= ACE_Time_Value::FILETIME_to_timval_skew; + + // Convert 100ns units to seconds; + this->tv_.tv_sec = (long) (_100ns.QuadPart / (10000 * 1000)); + // Convert remainder to microseconds; + this->tv_.tv_usec = (long) ((_100ns.QuadPart % (10000 * 1000)) / 10); +#endif // ACE_LACKS_LONGLONG_T +} + +// Returns the value of the object as a Win32 FILETIME. + +ACE_Time_Value::operator FILETIME () const +{ + FILETIME file_time; + // ACE_OS_TRACE ("ACE_Time_Value::operator FILETIME"); + +#if defined (ACE_LACKS_LONGLONG_T) + ACE_U_LongLong LL_sec(this->tv_.tv_sec); + ACE_U_LongLong LL_usec(this->tv_.tv_usec); + ACE_U_LongLong LL_100ns = LL_sec * (ACE_UINT32)(10000 * 1000) + + LL_usec * (ACE_UINT32)10 + + ACE_Time_Value::FILETIME_to_timval_skew; + file_time.dwLowDateTime = LL_100ns.lo(); + file_time.dwHighDateTime = LL_100ns.hi(); +#else + ULARGE_INTEGER _100ns; + _100ns.QuadPart = (((DWORDLONG) this->tv_.tv_sec * (10000 * 1000) + + this->tv_.tv_usec * 10) + + ACE_Time_Value::FILETIME_to_timval_skew); + + file_time.dwLowDateTime = _100ns.LowPart; + file_time.dwHighDateTime = _100ns.HighPart; +#endif //ACE_LACKS_LONGLONG_T + + return file_time; +} + +#endif /* ACE_WIN32 */ + +void +ACE_Time_Value::dump (void) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::dump"); +#if 0 + ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntv_sec_ = %d"), this->tv_.tv_sec)); + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("\ntv_usec_ = %d\n"), this->tv_.tv_usec)); + ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); +#endif /* 0 */ +} + +void +ACE_Time_Value::normalize (void) +{ + // // ACE_OS_TRACE ("ACE_Time_Value::normalize"); + // New code from Hans Rohnert... + + if (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS) + { + do + { + this->tv_.tv_sec++; + this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; + } + while (this->tv_.tv_usec >= ACE_ONE_SECOND_IN_USECS); + } + else if (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS) + { + do + { + this->tv_.tv_sec--; + this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; + } + while (this->tv_.tv_usec <= -ACE_ONE_SECOND_IN_USECS); + } + + if (this->tv_.tv_sec >= 1 && this->tv_.tv_usec < 0) + { + this->tv_.tv_sec--; + this->tv_.tv_usec += ACE_ONE_SECOND_IN_USECS; + } + else if (this->tv_.tv_sec < 0 && this->tv_.tv_usec > 0) + { + this->tv_.tv_sec++; + this->tv_.tv_usec -= ACE_ONE_SECOND_IN_USECS; + } +} diff --git a/ace/Time_Value.h b/ace/Time_Value.h index 913b180c2a0..5a54f6220aa 100644 --- a/ace/Time_Value.h +++ b/ace/Time_Value.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -13,16 +13,245 @@ #ifndef ACE_TIME_VALUE_H #define ACE_TIME_VALUE_H -#include "ace/pre.h" -// This file is no longer used and is only here due to backwards -// compatibility. All the functionality has been merged into OS.h. +#include "ace/pre.h" -#include "ace/OS.h" +#include "ace/OS_Export.h" +#include "ace/ACE_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ + +// Define some helpful constants. +// Not type-safe, and signed. For backward compatibility. +#define ACE_ONE_SECOND_IN_MSECS 1000L +#define ACE_ONE_SECOND_IN_USECS 1000000L +#define ACE_ONE_SECOND_IN_NSECS 1000000000L + + +// ------------------------------------------------------------------- +// These forward declarations are only used to circumvent a bug in +// MSVC 6.0 compiler. They shouldn't cause any problem for other +// compilers and they can be removed once MS release a SP that contains +// the fix. +class ACE_Time_Value; +ACE_OS_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + +ACE_OS_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + +// This forward declaration is needed by the set() and FILETIME() functions +#if defined (ACE_LACKS_LONGLONG_T) +class ACE_Export ACE_U_LongLong; +#endif /* ACE_LACKS_LONGLONG_T */ +// ------------------------------------------------------------------- + +# if !defined (ACE_HAS_POSIX_TIME) && !defined (ACE_PSOS) +// Definition per POSIX. +typedef struct timespec +{ + time_t tv_sec; // Seconds + long tv_nsec; // Nanoseconds +} timespec_t; +# elif defined (ACE_HAS_BROKEN_POSIX_TIME) +// OSF/1 defines struct timespec in <sys/timers.h> - Tom Marrs +# include /**/ <sys/timers.h> +# endif /* !ACE_HAS_POSIX_TIME */ + +# if defined(ACE_LACKS_TIMESPEC_T) +typedef struct timespec timespec_t; +# endif /* ACE_LACKS_TIMESPEC_T * + +// ------------------------------------------------------------------- + +/** + * @class ACE_Time_Value + * + * @brief Operations on "timeval" structures, which express time in + * seconds (secs) and microseconds (usecs). + * + * This class centralizes all the time related processing in + * ACE. These time values are typically used in conjunction with OS + * mechanisms like <select>, <poll>, or <cond_timedwait>. + */ +class ACE_OS_Export ACE_Time_Value +{ +public: + + /// Constant "0". + static const ACE_Time_Value zero; + + /** + * Constant for maximum time representable. Note that this time is + * not intended for use with <select> or other calls that may have + * *their own* implementation-specific maximum time representations. + * Its primary use is in time computations such as those used by the + * dynamic subpriority strategies in the <ACE_Dynamic_Message_Queue> + * class. + */ + static const ACE_Time_Value max_time; + + // = Initialization methods. + + /// Default Constructor. + ACE_Time_Value (void); + + /// Constructor. + ACE_Time_Value (long sec, long usec = 0); + + // = Methods for converting to/from various time formats. + /// Construct the <ACE_Time_Value> from a <timeval>. + ACE_Time_Value (const struct timeval &t); + + /// Initializes the <ACE_Time_Value> object from a <timespec_t>. + ACE_Time_Value (const timespec_t &t); + + /// Copy constructor. + ACE_Time_Value (const ACE_Time_Value &tv); + +# if defined (ACE_WIN32) + /// Initializes the ACE_Time_Value object from a Win32 FILETIME + ACE_Time_Value (const FILETIME &ft); +# endif /* ACE_WIN32 */ + + /// Construct a <Time_Value> from two <long>s. + void set (long sec, long usec); + + /// Construct a <Time_Value> from a <double>, which is assumed to be + /// in second format, with any remainder treated as microseconds. + void set (double d); + + /// Construct a <Time_Value> from a <timeval>. + void set (const timeval &t); + + /// Initializes the <Time_Value> object from a <timespec_t>. + void set (const timespec_t &t); + +# if defined (ACE_WIN32) + /// Initializes the <Time_Value> object from a <timespec_t>. + void set (const FILETIME &ft); +# endif /* ACE_WIN32 */ + + /// Converts from <Time_Value> format into milli-seconds format. + long msec (void) const; + + /// Converts from milli-seconds format into <Time_Value> format. + void msec (long); + + /// Returns the value of the object as a <timespec_t>. + operator timespec_t () const; + + /// Returns the value of the object as a <timeval>. + operator timeval () const; + + /// Returns a pointer to the object as a <timeval>. + operator const timeval *() const; + +# if defined (ACE_WIN32) + /// Returns the value of the object as a Win32 FILETIME. + operator FILETIME () const; +# endif /* ACE_WIN32 */ + + // = The following are accessor/mutator methods. + + /// Get seconds. + long sec (void) const; + + /// Set seconds. + void sec (long sec); + + /// Get microseconds. + long usec (void) const; + + /// Set microseconds. + void usec (long usec); + + // = The following arithmetic methods operate on <Time_Value>s. + + /// Add <tv> to this. + ACE_Time_Value &operator += (const ACE_Time_Value &tv); + + /// Subtract <tv> to this. + ACE_Time_Value &operator -= (const ACE_Time_Value &tv); + + /// Multiply the time value by the <d> factor, which must be >= 0. + ACE_Time_Value &operator *= (double d); + + /// Increment microseconds (the only reason this is here is + /// to allow the use of ACE_Atomic_Op with ACE_Time_Value). + ACE_Time_Value operator++ (int); // Postfix advance + ACE_Time_Value &operator++ (void); // Prefix advance + + /// Decrement microseconds (the only reason this is here is + /// to allow the use of ACE_Atomic_Op with ACE_Time_Value). + ACE_Time_Value operator-- (int); // Postfix dec + ACE_Time_Value &operator-- (void); // Prefix dec + + /// Adds two ACE_Time_Value objects together, returns the sum. + friend ACE_OS_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// Subtracts two ACE_Time_Value objects, returns the difference. + friend ACE_OS_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if tv1 < tv2. + friend ACE_OS_Export int operator < (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if tv1 > tv2. + friend ACE_OS_Export int operator > (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if tv1 <= tv2. + friend ACE_OS_Export int operator <= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if tv1 >= tv2. + friend ACE_OS_Export int operator >= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if tv1 == tv2. + friend ACE_OS_Export int operator == (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// True if tv1 != tv2. + friend ACE_OS_Export int operator != (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2); + + /// Dump is a no-op. + /** + * The dump() method is a no-op. It's here for backwards compatibility + * only, but does not dump anything. Invoking logging methods here + * violates layering restrictions in ACE because this class is part + * of the OS layer and @c ACE_Log_Msg is at a higher level. + */ + void dump (void) const; + +# if defined (ACE_WIN32) + /// Const time difference between FILETIME and POSIX time. +# if defined (ACE_LACKS_LONGLONG_T) + static const ACE_U_LongLong FILETIME_to_timval_skew; +# else + static const DWORDLONG FILETIME_to_timval_skew; +# endif // ACE_LACKS_LONGLONG_T +# endif /* ACE_WIN32 */ + +private: + /// Put the timevalue into a canonical form. + void normalize (void); + + /// Store the values as a <timeval>. + timeval tv_; +}; + +#if defined (__ACE_INLINE__) +#include "ace/Time_Value.inl" +#endif /* __ACE_INLINE__ */ + #include "ace/post.h" -#endif /* ACE_TIME_VALUE */ + +#endif /* ACE_TIME_VALUE_H */ diff --git a/ace/Time_Value.inl b/ace/Time_Value.inl new file mode 100644 index 00000000000..c70461c0a91 --- /dev/null +++ b/ace/Time_Value.inl @@ -0,0 +1,339 @@ +// -*- C++ -*- +// +// $Id$ + + +// Returns the value of the object as a timeval. + +ACE_INLINE +ACE_Time_Value::operator timeval () const +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator timeval"); + return this->tv_; +} + +// Returns a pointer to the object as a timeval. + +ACE_INLINE +ACE_Time_Value::operator const timeval * () const +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *"); + return (const timeval *) &this->tv_; +} + +ACE_INLINE void +ACE_Time_Value::set (long sec, long usec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); + this->tv_.tv_sec = sec; + this->tv_.tv_usec = usec; +} + +ACE_INLINE void +ACE_Time_Value::set (double d) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); + long l = (long) d; + this->tv_.tv_sec = l; + this->tv_.tv_usec = (long) ((d - (double) l) * ACE_ONE_SECOND_IN_USECS); + this->normalize (); +} + +// Initializes a timespec_t. Note that this approach loses precision +// since it converts the nano-seconds into micro-seconds. But then +// again, do any real systems have nano-second timer precision?! + +ACE_INLINE void +ACE_Time_Value::set (const timespec_t &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); +#if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) + this->tv_.tv_sec = tv.tv_sec; + // Convert nanoseconds into microseconds. + this->tv_.tv_usec = tv.tv_nsec / 1000; +#else + this->tv_.tv_sec = tv.ts_sec; + // Convert nanoseconds into microseconds. + this->tv_.tv_usec = tv.ts_nsec / 1000; +#endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ + + this->normalize (); +} + +ACE_INLINE void +ACE_Time_Value::set (const timeval &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::set"); + this->tv_.tv_sec = tv.tv_sec; + this->tv_.tv_usec = tv.tv_usec; + + this->normalize (); +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (const timeval &tv) + // : tv_ () +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (tv); +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (void) + // : tv_ () +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (0, 0); + + // Don't need to normalize time value of (0, 0). +} + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (long sec, long usec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (sec, usec); + this->normalize (); +} + +// Returns number of seconds. + +ACE_INLINE long +ACE_Time_Value::sec (void) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::sec"); + return this->tv_.tv_sec; +} + +// Sets the number of seconds. + +ACE_INLINE void +ACE_Time_Value::sec (long sec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::sec"); + this->tv_.tv_sec = sec; +} + +// Converts from Time_Value format into milli-seconds format. + +ACE_INLINE long +ACE_Time_Value::msec (void) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::msec"); + return this->tv_.tv_sec * 1000 + this->tv_.tv_usec / 1000; +} + +// Converts from milli-seconds format into Time_Value format. + +ACE_INLINE void +ACE_Time_Value::msec (long milliseconds) +{ + // ACE_OS_TRACE ("ACE_Time_Value::msec"); + // Convert millisecond units to seconds; + this->tv_.tv_sec = milliseconds / 1000; + // Convert remainder to microseconds; + this->tv_.tv_usec = (milliseconds - (this->tv_.tv_sec * 1000)) * 1000; +} + +// Returns number of micro-seconds. + +ACE_INLINE long +ACE_Time_Value::usec (void) const +{ + // ACE_OS_TRACE ("ACE_Time_Value::usec"); + return this->tv_.tv_usec; +} + +// Sets the number of micro-seconds. + +ACE_INLINE void +ACE_Time_Value::usec (long usec) +{ + // ACE_OS_TRACE ("ACE_Time_Value::usec"); + this->tv_.tv_usec = usec; +} + +// Initializes the ACE_Time_Value object from another ACE_Time_Value + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (const ACE_Time_Value &tv) + : tv_ (tv.tv_) +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); +} + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator *= (double d) +{ + double time = ((double) this->sec ()) * ACE_ONE_SECOND_IN_USECS + this->usec (); + time *= d; + this->sec ((long)(time / ACE_ONE_SECOND_IN_USECS)); + this->usec (((long)time) % ACE_ONE_SECOND_IN_USECS); + + return *this; +} + +ACE_INLINE ACE_Time_Value +operator * (double d, const ACE_Time_Value &tv) +{ + return ACE_Time_Value (tv) *= d; +} + +ACE_INLINE ACE_Time_Value +operator * (const ACE_Time_Value &tv, double d) +{ + return ACE_Time_Value (tv) *= d; +} + +// True if tv1 > tv2. + +ACE_INLINE int +operator > (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator >"); + if (tv1.sec () > tv2.sec ()) + return 1; + else if (tv1.sec () == tv2.sec () + && tv1.usec () > tv2.usec ()) + return 1; + else + return 0; +} + +// True if tv1 >= tv2. + +ACE_INLINE int +operator >= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator >="); + if (tv1.sec () > tv2.sec ()) + return 1; + else if (tv1.sec () == tv2.sec () + && tv1.usec () >= tv2.usec ()) + return 1; + else + return 0; +} + +// Returns the value of the object as a timespec_t. + +ACE_INLINE +ACE_Time_Value::operator timespec_t () const +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator timespec_t"); + timespec_t tv; +#if ! defined(ACE_HAS_BROKEN_TIMESPEC_MEMBERS) + tv.tv_sec = this->sec (); + // Convert microseconds into nanoseconds. + tv.tv_nsec = this->tv_.tv_usec * 1000; +#else + tv.ts_sec = this->sec (); + // Convert microseconds into nanoseconds. + tv.ts_nsec = this->tv_.tv_usec * 1000; +#endif /* ACE_HAS_BROKEN_TIMESPEC_MEMBERS */ + return tv; +} + +// Initializes the ACE_Time_Value object from a timespec_t. + +ACE_INLINE +ACE_Time_Value::ACE_Time_Value (const timespec_t &tv) + // : tv_ () +{ + // ACE_OS_TRACE ("ACE_Time_Value::ACE_Time_Value"); + this->set (tv); +} + +// True if tv1 < tv2. + +ACE_INLINE int +operator < (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator <"); + return tv2 > tv1; +} + +// True if tv1 >= tv2. + +ACE_INLINE int +operator <= (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator <="); + return tv2 >= tv1; +} + +// True if tv1 == tv2. + +ACE_INLINE int +operator == (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator =="); + return tv1.sec () == tv2.sec () + && tv1.usec () == tv2.usec (); +} + +// True if tv1 != tv2. + +ACE_INLINE int +operator != (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator !="); + return !(tv1 == tv2); +} + +// Add TV to this. + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator+= (const ACE_Time_Value &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator+="); + this->sec (this->sec () + tv.sec ()); + this->usec (this->usec () + tv.usec ()); + this->normalize (); + return *this; +} + +// Subtract TV to this. + +ACE_INLINE ACE_Time_Value & +ACE_Time_Value::operator-= (const ACE_Time_Value &tv) +{ + // ACE_OS_TRACE ("ACE_Time_Value::operator-="); + this->sec (this->sec () - tv.sec ()); + this->usec (this->usec () - tv.usec ()); + this->normalize (); + return *this; +} + +// Adds two ACE_Time_Value objects together, returns the sum. + +ACE_INLINE ACE_Time_Value +operator + (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator +"); + ACE_Time_Value sum (tv1.sec () + tv2.sec (), + tv1.usec () + tv2.usec ()); + + sum.normalize (); + return sum; +} + +// Subtracts two ACE_Time_Value objects, returns the difference. + +ACE_INLINE ACE_Time_Value +operator - (const ACE_Time_Value &tv1, + const ACE_Time_Value &tv2) +{ + // ACE_OS_TRACE ("operator -"); + ACE_Time_Value delta (tv1.sec () - tv2.sec (), + tv1.usec () - tv2.usec ()); + delta.normalize (); + return delta; +} diff --git a/ace/Trace.cpp b/ace/Trace.cpp index e85ecfc4a6f..b5031352b10 100644 --- a/ace/Trace.cpp +++ b/ace/Trace.cpp @@ -1,10 +1,11 @@ // $Id$ -// We need this to get the status of ACE_NTRACE... -#include "ace/config-all.h" +#include "ace/Trace.h" -ACE_RCSID(ace, Trace, "$Id$") +ACE_RCSID (ace, + Trace, + "$Id$") // Turn off tracing for the duration of this file. #if defined (ACE_NTRACE) @@ -12,7 +13,6 @@ ACE_RCSID(ace, Trace, "$Id$") #endif /* ACE_NTRACE */ #define ACE_NTRACE 1 -#include "ace/Trace.h" #include "ace/Log_Msg.h" // = Static initialization. diff --git a/ace/Trace.h b/ace/Trace.h index 6ad981d60d3..b6b5429cc8a 100644 --- a/ace/Trace.h +++ b/ace/Trace.h @@ -1,4 +1,4 @@ -/* -*- C++ -*- */ +// -*- C++ -*- //============================================================================= /** @@ -12,9 +12,16 @@ #ifndef ACE_TRACE_H #define ACE_TRACE_H + #include "ace/pre.h" -#include "ace/OS.h" +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Global_Macros.h" /** * @class ACE_Trace @@ -83,4 +90,5 @@ private: }; #include "ace/post.h" + #endif /* ACE_TRACE_H */ diff --git a/ace/config-all.h b/ace/config-all.h index 7ddff622133..810d3d588af 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -146,9 +146,6 @@ # define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) #endif /* ACE_HAS_CUSTOM_EXPORT_MACROS */ -#include "ace/ACE_export.h" -#include "ace/svc_export.h" - // This is a whim of mine -- that instead of annotating a class with // ACE_Export in its declaration, we make the declaration near the TOP // of the file with ACE_DECLARE_EXPORT. @@ -331,12 +328,6 @@ #endif /* __sgi || ghs || ..... */ // ============================================================================ -// errno stuff -// ============================================================================ - -#include "ace/OS_Errno.h" - -// ============================================================================ // ACE_NEW macros // // A useful abstraction for expressions involving operator new since |