summaryrefslogtreecommitdiff
path: root/performance-tests/Throughput/Receiver_Factory.cpp
blob: ed04a345a9900c3d09db7d66ad75134acdd9516c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// $Id$
//
#include "Receiver_Factory.h"
#include "Receiver.h"

Receiver_Factory::Receiver_Factory (CORBA::ORB_ptr orb)
  : orb_ (CORBA::ORB::_duplicate (orb))
{
}

Test::Receiver_ptr
Receiver_Factory::create_receiver (void)
{
  Receiver *receiver_impl = 0;
  ACE_NEW_THROW_EX (receiver_impl,
                    Receiver,
                    CORBA::NO_MEMORY ());
  PortableServer::ServantBase_var transfer_ownership(receiver_impl);

  CORBA::Object_var poa_object =
    this->orb_->resolve_initial_references("RootPOA");

  PortableServer::POA_var root_poa =
    PortableServer::POA::_narrow (poa_object.in ());

  PortableServer::ObjectId_var id =
    root_poa->activate_object (receiver_impl);

  CORBA::Object_var object = root_poa->id_to_reference (id.in ());

  return Test::Receiver::_narrow (object.in ());
}

void
Receiver_Factory::shutdown (void)
{
  this->orb_->shutdown (0);
}