Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_2925_Regression / Hello_Impl.cpp
blobbd9e2c54acc0f464090e7223db66b9322a89b885
2 #include "Hello_Impl.h"
4 Hello_Impl::Hello_Impl (CORBA::ORB_ptr orb, MessageLog* logger)
5 : orb_ (CORBA::ORB::_duplicate (orb))
6 , logger_ (logger)
10 void
11 Hello_Impl::say_hello (CORBA::Short count)
13 this->logger_->register_message_recv (count);
15 ACE_DEBUG ((LM_DEBUG,
16 "%02d<<; ",
17 count));
20 void
21 Hello_Impl::shutdown ()
23 try
25 this->orb_->shutdown (0);
27 catch (const CORBA::Exception& ex)
29 //FUZZ: disable check_for_lack_ACE_OS
30 ex._tao_print_exception ("Exception caught in shutdown ():");
31 //FUZZ: enable check_for_lack_ACE_OS
35 MessageLog::MessageLog (int num)
36 : expected_ (num)
38 this->rcvd_ = new int[this->expected_];
40 int i;
41 for (i = 0; i < this->expected_; i++)
43 this->rcvd_[i] = 0;
47 MessageLog::~MessageLog ()
49 delete [] this->rcvd_;
52 void
53 MessageLog::register_message_recv (int message_num)
55 if (0 <= message_num && message_num < this->expected_)
57 this->rcvd_[message_num]++;
61 int
62 MessageLog::report_statistics ()
64 int i, count = 0;
65 for (i = 0; i < this->expected_; i++)
67 count += this->rcvd_[i];
69 if (this->rcvd_[i] == 0)
71 ACE_DEBUG ((LM_DEBUG,
72 "\nLOST message <<< %d >>>",
73 i));
77 return count;