diff options
author | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-03-04 13:04:57 +0000 |
---|---|---|
committer | boris <boris@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-03-04 13:04:57 +0000 |
commit | e02e2f2b9e7de93c4565d02fdaa012679e62715b (patch) | |
tree | 24c5e7756abfea6eb7dd6dfa410d629020d12040 | |
parent | 375f6777caf4f2081f1ef332d10ebc1fe6685bf4 (diff) | |
download | ATCD-e02e2f2b9e7de93c4565d02fdaa012679e62715b.tar.gz |
ChangeLogTag: Fri Mar 4 15:18:50 2005 Boris Kolpackov <boris@kolpackov.net>
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/Receiver.cpp | 80 | ||||
-rw-r--r-- | examples/RMCast/Send_Msg/Sender.cpp | 11 |
3 files changed, 64 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog index 294943fd163..2948779f450 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Fri Mar 4 15:18:50 2005 Boris Kolpackov <boris@kolpackov.net> + + * examples/RMCast/Send_Msg/Receiver.cpp: + * examples/RMCast/Send_Msg/Sender.cpp: Replaced usage of + std::vector and std::cerr with ACE_Vector and ACE_ERROR/ACE_DEBUG + respectively. This should fix warnings in VC6 build. + Fri Mar 4 12:11:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl> * ace/Process_Manager.cpp: diff --git a/examples/RMCast/Send_Msg/Receiver.cpp b/examples/RMCast/Send_Msg/Receiver.cpp index a9fcf692e1e..f8416081956 100644 --- a/examples/RMCast/Send_Msg/Receiver.cpp +++ b/examples/RMCast/Send_Msg/Receiver.cpp @@ -2,20 +2,16 @@ // author : Boris Kolpackov <boris@kolpackov.net> // cvs-id : $Id$ -#include "ace/OS_NS_string.h" -#include "ace/RMCast/Socket.h" +#include <ace/Vector_T.h> +#include <ace/Log_Msg.h> +#include <ace/OS_NS_string.h> -#include "Protocol.h" - -#include <vector> -#include <iostream> +#include <ace/RMCast/Socket.h> -using std::cout; -using std::cerr; -using std::endl; +#include "Protocol.h" typedef -std::vector<unsigned char> +ACE_Vector<unsigned char, ACE_VECTOR_DEFAULT_SIZE> Status_List; class args {}; @@ -44,9 +40,21 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[]) } } - Status_List received (message_count, 0); - Status_List damaged (message_count, 0); - Status_List duplicate (message_count, 0); + Status_List received (message_count); + Status_List damaged (message_count); + Status_List duplicate (message_count); + + // VC6 does not know about new rules. + // + { + for (unsigned long i = 0; i < message_count; ++i) + { + received.push_back (0); + damaged.push_back (0); + duplicate.push_back (0); + } + } + Message msg; @@ -74,30 +82,46 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[]) unsigned long lost_count (0), damaged_count (0), duplicate_count (0); { - for (Status_List::iterator i (received.begin ()), end (received.end ()); - i != end; - ++i) if (*i == 0) ++lost_count; + for (Status_List::Iterator i (received); !i.done (); i.advance ()) + { + unsigned char* e; + i.next (e); + + if (*e == 0) ++lost_count; + } } { - for (Status_List::iterator i (damaged.begin ()), end (damaged.end ()); - i != end; - ++i) if (*i == 1) ++damaged_count; + for (Status_List::Iterator i (damaged); !i.done (); i.advance ()) + { + unsigned char* e; + i.next (e); + + if (*e == 1) ++damaged_count; + } } { - for (Status_List::iterator i (duplicate.begin ()), end (duplicate.end ()); - i != end; - ++i) if (*i == 1) ++duplicate_count; - } + for (Status_List::Iterator i (duplicate); !i.done (); i.advance ()) + { + unsigned char* e; + i.next (e); + if (*e == 1) ++duplicate_count; + } + } - cout << "lost : " << lost_count << endl - << "damaged : " << damaged_count << endl - << "duplicate : " << duplicate_count << endl << endl; + ACE_DEBUG ((LM_DEBUG, + "lost : %d\n" + "damaged : %d\n" + "duplicate : %d\n", + lost_count, + damaged_count, + duplicate_count)); + /* cout << "lost message dump:" << endl; unsigned long total = 0; @@ -123,12 +147,14 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[]) } if (total != lost_count) cerr << "trouble" << endl; + */ return 0; } catch (args const&) { - cerr << "usage: " << argv[0] << " <IPv4 Multicast Address>" << endl; + ACE_ERROR ((LM_ERROR, + "usage: %s <IPv4 multicast address>:<port>\n", argv[0])); } return 1; diff --git a/examples/RMCast/Send_Msg/Sender.cpp b/examples/RMCast/Send_Msg/Sender.cpp index 7492072a765..d681c733bc9 100644 --- a/examples/RMCast/Send_Msg/Sender.cpp +++ b/examples/RMCast/Send_Msg/Sender.cpp @@ -2,17 +2,13 @@ // author : Boris Kolpackov <boris@kolpackov.net> // cvs-id : $Id$ - #include <ace/OS.h> -#include <ace/RMCast/Socket.h> +#include <ace/Log_Msg.h> -#include <iostream> +#include <ace/RMCast/Socket.h> #include "Protocol.h" -using std::cerr; -using std::endl; - class args {}; int @@ -47,7 +43,8 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[]) } catch (args const&) { - cerr << "usage: " << argv[0] << " <IPv4 Multicast Address>" << endl; + ACE_ERROR ((LM_ERROR, + "usage: %s <IPv4 multicast address>:<port>\n", argv[0])); } return 1; |