Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Big_Oneways / Coordinator.cpp
blob70bc80cdf48ed86f55f6ab5c294ea8a592acb3bf
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 ();
54 (*i) = Test::Peer::_nil ();
56 catch (const CORBA::Exception& ex)
58 ex._tao_print_exception ("Coordinator::shutdown, ignored");
63 void
64 Coordinator::add_peer (Test::Peer_ptr peer)
66 if (this->peer_count_ >= this->peer_max_)
67 return;
69 this->peers_[this->peer_count_++] =
70 Test::Peer::_duplicate (peer);