Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Big_Twoways / Coordinator.cpp
blob36507c31cb2728ac17b789d349dac6d5b9c6bf22
1 #include "Coordinator.h"
3 Coordinator::Coordinator (CORBA::ULong peer_count)
4 : peers_ (0)
5 , peer_count_ (0)
6 , peer_max_ (peer_count)
8 ACE_NEW (this->peers_, Test::Peer_var[this->peer_max_]);
11 Coordinator::~Coordinator ()
13 delete[] this->peers_;
16 int
17 Coordinator::has_all_peers () const
19 return this->peer_count_ == this->peer_max_;
22 void
23 Coordinator::create_session_list (Test::Session_Control_ptr session_control,
24 CORBA::ULong payload_size,
25 CORBA::ULong thread_count,
26 CORBA::ULong message_count,
27 Test::Session_List &session_list)
29 session_list.length (this->peer_count_);
30 CORBA::ULong count = 0;
31 for (Test::Peer_var *i = this->peers_;
32 i != this->peers_ + this->peer_count_;
33 ++i)
35 session_list[count++] =
36 (*i)->create_session (session_control,
37 payload_size,
38 thread_count,
39 message_count,
40 this->peer_count_);
44 void
45 Coordinator::shutdown_all_peers ()
47 for (Test::Peer_var *i = this->peers_;
48 i != this->peers_ + this->peer_count_;
49 ++i)
51 try
53 (*i)->shutdown ();
55 catch (const CORBA::Exception& ex)
57 ex._tao_print_exception ("Coordinator::shutdown, ignored");
62 void
63 Coordinator::add_peer (Test::Peer_ptr peer)
65 if (this->peer_count_ >= this->peer_max_)
66 return;
68 this->peers_[this->peer_count_++] =
69 Test::Peer::_duplicate (peer);