summaryrefslogtreecommitdiff
path: root/TAO/tao/RT_ORB_Loader.cpp
blob: 9ac8dbaae2cdba01fd2a5a2c9a47a8e5bdfd2ab5 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// $Id$

#include "RT_ORB_Loader.h"
#include "RT_ORB.h"
#include "RT_Current.h"

#include "ORB_Core.h"

ACE_RCSID (TAO, RT_ORB_Loader, "$Id$")

TAO_RT_ORB_Loader::TAO_RT_ORB_Loader (void)
{
}

CORBA::Object_ptr
TAO_RT_ORB_Loader::create_object (CORBA::ORB_ptr orb,
                                  int,
                                  char *[],
                                  CORBA::Environment &ACE_TRY_ENV)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  /// Return RT_ORB
  CORBA::Object_ptr rt_orb;
  ACE_NEW_THROW_EX (rt_orb,
                    TAO_RT_ORB,
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO_DEFAULT_MINOR_CODE,
                        ENOMEM),
                      CORBA::COMPLETED_NO));
  ACE_CHECK_RETURN (CORBA::Object::_nil ());

  CORBA::Object_var safe_rt_orb = rt_orb;

  /// Sets the RT_Current object in the ORB.
  this->set_objects (orb->orb_core (), ACE_TRY_ENV);
  ACE_CHECK_RETURN (CORBA::Object::_nil ());

  return safe_rt_orb._retn ();
}

void
TAO_RT_ORB_Loader::set_objects (TAO_ORB_Core *orb_core,
                                CORBA::Environment &ACE_TRY_ENV)
{
  // Setup the RT_Current object in the ORB

  CORBA::Object_ptr current;
  ACE_NEW_THROW_EX (current,
                    TAO_RT_Current (orb_core),
                    CORBA::NO_MEMORY (
                      CORBA::SystemException::_tao_minor_code (
                        TAO_DEFAULT_MINOR_CODE,
                        ENOMEM),
                      CORBA::COMPLETED_NO));
  ACE_CHECK;

  CORBA::Object_var safe_current = current;
  orb_core->rt_current (safe_current.in ());
}

ACE_FACTORY_DEFINE (TAO, TAO_RT_ORB_Loader)
ACE_STATIC_SVC_DEFINE (TAO_RT_ORB_Loader,
                       ACE_TEXT ("RT_ORB_Loader"),
                       ACE_SVC_OBJ_T,
                       &ACE_SVC_NAME (TAO_RT_ORB_Loader),
                       ACE_Service_Type::DELETE_THIS
                       | ACE_Service_Type::DELETE_OBJ,
                       0)