summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/performance-tests/RTEvent/lib/RIR_Narrow.cpp
blob: 357e58b3856d7ca825490db69e34071d76ced447 (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
43
44
/**
 * @file RIR_Narrow.cpp
 *
 * $Id$
 *
 * @author Jody Hagins <jody@atdesk.com>
 * @author Carlos O'Ryan <coryan@uci.edu>
 */
#ifndef TAO_PERF_RTEC_RIR_NARROW_CPP
#define TAO_PERF_RTEC_RIR_NARROW_CPP

#include "RIR_Narrow.h"

#include "tao/Environment.h"

#include "ace/Log_Msg.h"

template<class Interface> typename RIR_Narrow<Interface>::Interface_ptr
RIR_Narrow<Interface>::resolve (CORBA::ORB_ptr orb,
                                const char *object_id)
{
  Interface_var intface;

  try
    {
      CORBA::Object_var object =
        orb->resolve_initial_references (object_id);

      intface = Interface::_narrow (object.in ());

      if (CORBA::is_nil (intface.in ()))
        {
          ACE_ERROR ((LM_ERROR,
                      "Panic - error while narrowing <%s>\n",
                      object_id));
          ACE_OS::exit (1);
        }
    } catch (const CORBA::Exception& ex) {
      ex._tao_print_exception ("Caught an exception\n");
    }
  return intface._retn ();
}

#endif /* TAO_PERF_RTEC_RIR_NARROW_CPP */