summaryrefslogtreecommitdiff
path: root/TAO/tests/ORT/ObjectReferenceFactory.cpp
blob: 7bc1831378c96d0e5520e6767aa742d3154fffa9 (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
40
41
42
#include "ObjectReferenceFactory.h"
#include "tao/debug.h"

ObjectReferenceFactory::ObjectReferenceFactory (
  PortableInterceptor::ObjectReferenceFactory * old_orf)
  : old_orf_ (old_orf)
{
  // Claim ownership of the old ObjectReferenceFactory.
  CORBA::add_ref (old_orf);
}

::CORBA::ValueBase *
ObjectReferenceFactory::_copy_value (void)
{
  ::CORBA::ValueBase *ret_val= 0;
  ACE_NEW_THROW_EX (
    ret_val,
    ObjectReferenceFactory (old_orf_.inout ()),
    ::CORBA::NO_MEMORY ()
  );
  return ret_val;
}

ObjectReferenceFactory::~ObjectReferenceFactory (void)
{
  // No need to call CORBA::remove_ref() on this->old_orf_.  It is a
  // "_var" object, meaning that will be done automatically.
}

CORBA::Object_ptr
ObjectReferenceFactory::make_object (
    const char *repository_id,
    const PortableInterceptor::ObjectId & id)
{
  ACE_ASSERT (repository_id != 0);

  ACE_DEBUG ((LM_INFO,
              "Invoked custom ObjectReferenceFactory::make_object()\n"));

  return this->old_orf_->make_object (repository_id,
                                      id);
}