=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tests / Collocated_Forwarding / test_i.cpp
blob4ccb5c4e7d06636228f5bd2323bdedda01dac8a7
1 // -*- C++ -*-
3 #include "test_i.h"
4 #include "tao/PortableServer/ForwardRequestC.h"
6 test_i::test_i (CORBA::Short id,
7 CORBA::ORB_ptr orb)
8 : id_ (id)
9 , orb_ (CORBA::ORB::_duplicate (orb))
10 , to_ (CORBA::Object::_nil ())
11 , request_pass_count_ (0)
12 , request_count_ (0)
16 void
17 test_i::forward (CORBA::Object_ptr to,
18 CORBA::ULong request_pass_count)
20 this->to_ = CORBA::Object::_duplicate (to);
21 this->request_pass_count_ = request_pass_count;
24 CORBA::Short
25 test_i::collocated_call ()
27 this->request_count_++;
29 ACE_DEBUG ((LM_DEBUG,
30 "Collocated call is executed in object with id %d.\n",
31 this->id_));
33 if (!CORBA::is_nil (this->to_.in ()))
35 if (this->request_count_ == this->request_pass_count_)
37 ACE_DEBUG ((LM_DEBUG,
38 "SERVER: Request %d will be forwarded "
39 "to object 'to'\nSERVER: via collocated_call().\n",
40 this->request_count_));
42 // Throw forward exception
43 throw PortableServer::ForwardRequest (this->to_.in ());
47 return this->id_;