diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-25 11:15:47 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2003-07-25 11:15:47 +0000 |
commit | f27d35c07a218e9421b2b945e5d3d323c02a7aa0 (patch) | |
tree | 515a0091d745f2e783992b23aadc4fed2cdeffb9 | |
parent | b4d95b1d67569c31b1a25ceb0c7b7d8b47360687 (diff) | |
download | ATCD-f27d35c07a218e9421b2b945e5d3d323c02a7aa0.tar.gz |
ChangeLogTag: Fri Jul 25 09:11:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | ace/Makefile.bor | 1 | ||||
-rw-r--r-- | ace/UUID.cpp | 2 | ||||
-rw-r--r-- | ace/UUID.h | 84 | ||||
-rw-r--r-- | ace/config-win32-common.h | 2 | ||||
-rw-r--r-- | tests/Tests.bor | 1 | ||||
-rw-r--r-- | tests/UUIDTest.cpp | 42 |
7 files changed, 85 insertions, 68 deletions
diff --git a/ChangeLog b/ChangeLog index 516165007a1..52496097c7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Fri Jul 25 11:10:21 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl> + + * ace/config-win32-common.h: + Only do a pragma comment with MSVC + + * ace/Makefile.bor: + Added UUID + + * ace/UUID.h: + Fixed compile error with Borland + + * ace/UUID.cpp: + Improved log line. + + * tests/UUIDTest.cpp: + Fix compile problem in unicode build and ACE_START_TEST to + get logfile. + + * tests/Tests.bor: + Added UUIDTest + Fri Jul 25 09:34:11 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl> * ace/config-win32-common.h: diff --git a/ace/Makefile.bor b/ace/Makefile.bor index 905242307e8..26666fa845e 100644 --- a/ace/Makefile.bor +++ b/ace/Makefile.bor @@ -243,6 +243,7 @@ OBJFILES = \ $(OBJDIR)\UPIPE_Acceptor.obj \ $(OBJDIR)\UPIPE_Connector.obj \ $(OBJDIR)\UPIPE_Stream.obj \ + $(OBJDIR)\UUID.obj \ $(OBJDIR)\WFMO_Reactor.obj \ $(OBJDIR)\WIN32_Asynch_IO.obj \ $(OBJDIR)\WIN32_Proactor.obj \ diff --git a/ace/UUID.cpp b/ace/UUID.cpp index e57d009287d..c3a4f5b5b20 100644 --- a/ace/UUID.cpp +++ b/ace/UUID.cpp @@ -81,7 +81,7 @@ ACE_UUID::ACE_UUID (const ACE_CString& uuid_string) { ACE_DEBUG ((LM_DEBUG, "%N ACE_UUID::ACE_UUID - " - "IllegalArgument(incorrect string length)")); + "IllegalArgument(incorrect string length)\n")); return; } diff --git a/ace/UUID.h b/ace/UUID.h index 9e05c74b2d9..4fb1850cc03 100644 --- a/ace/UUID.h +++ b/ace/UUID.h @@ -20,27 +20,27 @@ #include "ace/Synch.h" /// Class to hold a MAC address -class ACE_Export UUID_node +class ACE_Export UUID_node { public: /// Constructor UUID_node (void); - - typedef enum {NODE_ID_SIZE = 6}; + + enum {NODE_ID_SIZE = 6}; typedef u_char NodeID[NODE_ID_SIZE]; - + NodeID& nodeID (void); void nodeID (NodeID&); /// Assignment Operation UUID_node &operator=(const UUID_node &right); - /// Equality Operations + /// Equality Operations bool operator == (const UUID_node& right) const; bool operator != (const UUID_node& right) const; - /// Relational Operations + /// Relational Operations bool operator < (const UUID_node& right) const; private: @@ -62,63 +62,63 @@ class ACE_Export UUID_node * UUIDs have value semantics. In addition, they may be compared for * ordering and equality. * - * Additionally in this implementation provisions have been made to include - * process and thread ids to make the UUIDs more unique. The variant 0xc0 + * Additionally in this implementation provisions have been made to include + * process and thread ids to make the UUIDs more unique. The variant 0xc0 * has been added to facilitate this. */ -class ACE_Export ACE_UUID +class ACE_Export ACE_UUID { public: /// Constructor ACE_UUID(void); - + /// Copy constructor ACE_UUID(const ACE_UUID &right); - + /// Constructs a UUID from a string representation. ACE_UUID (const ACE_CString& uuidString); - + // Destructor ~ACE_UUID (void); ACE_UINT32 timeLow (void); void timeLow (ACE_UINT32); - ACE_UINT16 timeMid (void); - void timeMid (ACE_UINT16); + ACE_UINT16 timeMid (void); + void timeMid (ACE_UINT16); ACE_UINT16 timeHiAndVersion (void); void timeHiAndVersion (ACE_UINT16); - u_char clockSeqHiAndReserved (void); - void clockSeqHiAndReserved (u_char); + u_char clockSeqHiAndReserved (void); + void clockSeqHiAndReserved (u_char); u_char clockSeqLow (void); void clockSeqLow (u_char); - - UUID_node* node (void); - void node (UUID_node*); - - ACE_CString* thr_id (void); - void thr_id (char*); - - ACE_CString* pid (void); + + UUID_node* node (void); + void node (UUID_node*); + + ACE_CString* thr_id (void); + void thr_id (char*); + + ACE_CString* pid (void); void pid (char*); /// Returns a string representation of the UUID const ACE_CString* to_string (void); - + static ACE_UUID NIL_UUID; /// Assignment Operation ACE_UUID & operator=(const ACE_UUID &right); - /// Equality Operations + /// Equality Operations bool operator==(const ACE_UUID &right) const; bool operator!=(const ACE_UUID &right) const; - /// Relational Operations + /// Relational Operations bool operator< (const ACE_UUID &right) const; bool operator> (const ACE_UUID &right) const; bool operator<=(const ACE_UUID &right) const; @@ -128,23 +128,23 @@ class ACE_Export ACE_UUID /// Data Members for Class Attributes ACE_UINT32 timeLow_; - ACE_UINT16 timeMid_; - ACE_UINT16 timeHiAndVersion_; - u_char clockSeqHiAndReserved_; - u_char clockSeqLow_; - UUID_node* node_; + ACE_UINT16 timeMid_; + ACE_UINT16 timeHiAndVersion_; + u_char clockSeqHiAndReserved_; + u_char clockSeqLow_; + UUID_node* node_; int node_release_; - ACE_CString thr_id_; - ACE_CString pid_; - + ACE_CString thr_id_; + ACE_CString pid_; + /// The string representation of the UUID. This is created and /// updated only on demand. - ACE_CString *as_string_; + ACE_CString *as_string_; }; /** - * @class ACE_UUID_Generator + * @class ACE_UUID_Generator * * Singleton class that generates UUIDs. * @@ -160,11 +160,11 @@ class ACE_Export ACE_UUID_Generator void init (void); - /// Format timestamp, clockseq, and nodeID into an UUID of the + /// Format timestamp, clockseq, and nodeID into an UUID of the /// specified version and variant. For generating UUID's with /// thread and process ids use variant=0xc0 void generateUUID(ACE_UUID&, ACE_UINT16 version=0x0001, u_char variant=0x80); - + /// Format timestamp, clockseq, and nodeID into a VI UUID. For /// generating UUID's with thread and process ids use variant=0xc0 ACE_UUID* generateUUID (ACE_UINT16 version=0x0001, u_char variant=0x80); @@ -172,7 +172,7 @@ class ACE_Export ACE_UUID_Generator /// Type to represent UTC as a count of 100 nanosecond intervals /// since 00:00:00.00, 15 October 1582. typedef ACE_UINT64 UUID_time; - + /// The locking strategy prevents multiple generators from accessing /// the UUID_state at the same time. Get the locking strategy. ACE_SYNCH_MUTEX* lock (void); @@ -180,7 +180,7 @@ class ACE_Export ACE_UUID_Generator /// Set a new locking strategy and return the old one. ACE_SYNCH_MUTEX* lock (ACE_SYNCH_MUTEX*lock, int release_lock); - + private: @@ -204,7 +204,7 @@ class ACE_Export ACE_UUID_Generator /// since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to /// the Christian calendar). void get_systemtime( UUID_time& timeNow); - + /// The UUID generator persistent state. UUID_State uuid_state_; diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 9b2656b2931..bdd2f710c11 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -581,7 +581,7 @@ typedef unsigned long long ACE_UINT64; // check for ACE_HAS_WINCE. # if !defined (ACE_HAS_WINCE) # include <nb30.h> -# if !defined (__MINGW32__) +# if defined (_MSC_VER) # pragma comment(lib, "netapi32.lib") // needed for obtaing MACaddress # endif # endif /* !ACE_HAS_WINCE */ diff --git a/tests/Tests.bor b/tests/Tests.bor index 5ea476caecc..8ca9029c4f3 100644 --- a/tests/Tests.bor +++ b/tests/Tests.bor @@ -130,6 +130,7 @@ NAMES = \ UPIPE_SAP_Test \ Unbounded_Set_Test_Ex \ Upgradable_RW_Test \ + UUIDTest \ Vector_Test \ WFMO_Reactor_Test \ XtReactor_Test diff --git a/tests/UUIDTest.cpp b/tests/UUIDTest.cpp index 0469b081cbf..3a034e65579 100644 --- a/tests/UUIDTest.cpp +++ b/tests/UUIDTest.cpp @@ -13,7 +13,7 @@ public: }; -int +int Tester::init (void) { ///Initialise the UUID Generator @@ -21,7 +21,7 @@ Tester::init (void) return 0; } -int +int Tester::test (void) { // Generate UUID @@ -31,64 +31,58 @@ Tester::test (void) "Generated UUID\n %s\n", uuid_str.c_str ())); delete uuid; - + // Construct UUID from string ACE_UUID new_uuid (uuid_str); ACE_DEBUG ((LM_DEBUG, "UUID Constructed from above Generated UUID\n %s\n", new_uuid.to_string ()->c_str ())); - // Generate UUID with process and thread ids. + // Generate UUID with process and thread ids. ACE_UUID* uuid_with_tp_id = ACE_UUID_GENERATOR::instance ()->generateUUID (0x0001, 0xc0); ACE_DEBUG ((LM_DEBUG, "UUID with Thread and Process ID\n %s\n", uuid_with_tp_id->to_string ()->c_str ())); - + // Construct UUID from string ACE_UUID new_uuid_with_tp_id (uuid_with_tp_id->to_string ()->c_str ()); ACE_DEBUG ((LM_DEBUG, "UUID with Thread and Process ID reconstructed from above UUID \n %s\n", new_uuid_with_tp_id.to_string ()->c_str ())); delete uuid_with_tp_id; - + return 0; } -int run_main(int, char* []) +int run_main(int, ACE_TCHAR* []) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Starting %s test at %D\n"), - "UUIDTest")); + ACE_START_TEST (ACE_TEXT ("UUIDTest")); Tester tester; - if (tester.init () == -1) + if (tester.init () == -1) { - + ACE_DEBUG((LM_DEBUG, "UUIDTest: Tester::init failed\n")); return -1; } - + int testRetValue = tester.test(); - - if (testRetValue == 0) + + if (testRetValue == 0) { ACE_DEBUG((LM_DEBUG, "UUIDTest succeeded\n")); - } - else + } + else { ACE_DEBUG((LM_DEBUG, "UUIDTest failed\n")); } - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Ending %s test at %D\n"), - "UUIDTest")); - return testRetValue; -} - - + ACE_END_TEST; + return testRetValue; +} |