summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/Transport_Current/Current_ORBInitializer_Base.cpp
blob: 874f77f72309e58339e25abec11e60dc9f33175b (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// $Id$

#include "tao/PI/ORBInitInfo.h"

#include "orbsvcs/Transport_Current/Current_ORBInitializer_Base.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace Transport
  {

    Current_ORBInitializer_Base::Current_ORBInitializer_Base(const ACE_TCHAR* id)
      : id_ (id)
    {
    }

    Current_ORBInitializer_Base::~Current_ORBInitializer_Base(void)
    {
    }



    void
    Current_ORBInitializer_Base::pre_init (PortableInterceptor::ORBInitInfo_ptr info
                                           ACE_ENV_ARG_DECL_NOT_USED )
      ACE_THROW_SPEC( (CORBA::SystemException) )
    {
      // Narrow to a TAO_ORBInitInfo object to get access to the
      // allocate_tss_slot_id() TAO extension.
      TAO_ORBInitInfo_var tao_info =
        TAO_ORBInitInfo::_narrow (info
                                  ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;

      if (CORBA::is_nil (tao_info.in ()))
        {
          if (TAO_debug_level > 0)
            ACE_ERROR ((LM_ERROR,
                        "TAO (%P|%t) TAO::Transport::ORBInitializer::pre_init - "
                        "Panic: unable to narrow the ORBInitInfo_ptr\n"));

          ACE_THROW (CORBA::INTERNAL ());
        }

      // Reserve a TSS slot in the ORB core internal TSS resources for the
      // thread-specific portion of the Current object.
      size_t tss_slot = tao_info->allocate_tss_slot_id (0
                                                        ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;

      // Create the Current
      Current_var current (this->make_current_instance (tao_info->orb_core (),
                                                        tss_slot
                                                        ACE_ENV_ARG_PARAMETER));

      info->register_initial_reference (ACE_TEXT_ALWAYS_CHAR (this->id_.fast_rep ()),
                                        current.in ());

    }

    void
    Current_ORBInitializer_Base::post_init (PortableInterceptor::ORBInitInfo_ptr
                                            ACE_ENV_ARG_DECL_NOT_USED )
      ACE_THROW_SPEC( (CORBA::SystemException) )
    {
    }

  }

}

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"
// $Id$

#include "tao/PI/ORBInitInfo.h"

#include "orbsvcs/Transport_Current/Current_ORBInitializer_Base.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace Transport
  {

    Current_ORBInitializer_Base::Current_ORBInitializer_Base(const ACE_TCHAR* id)
      : id_ (id)
    {
    }

    Current_ORBInitializer_Base::~Current_ORBInitializer_Base(void)
    {
    }



    void
    Current_ORBInitializer_Base::pre_init (PortableInterceptor::ORBInitInfo_ptr info
                                           ACE_ENV_ARG_DECL_NOT_USED )
      ACE_THROW_SPEC( (CORBA::SystemException) )
    {
      // Narrow to a TAO_ORBInitInfo object to get access to the
      // allocate_tss_slot_id() TAO extension.
      TAO_ORBInitInfo_var tao_info =
        TAO_ORBInitInfo::_narrow (info
                                  ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;

      if (CORBA::is_nil (tao_info.in ()))
        {
          if (TAO_debug_level > 0)
            ACE_ERROR ((LM_ERROR,
                        "TAO (%P|%t) TAO::Transport::ORBInitializer::pre_init - "
                        "Panic: unable to narrow the ORBInitInfo_ptr\n"));

          ACE_THROW (CORBA::INTERNAL ());
        }

      // Reserve a TSS slot in the ORB core internal TSS resources for the
      // thread-specific portion of the Current object.
      size_t tss_slot = tao_info->allocate_tss_slot_id (0
                                                        ACE_ENV_ARG_PARAMETER);
      ACE_CHECK;

      // Create the Current
      Current_var current (this->make_current_instance (tao_info->orb_core (),
                                                        tss_slot
                                                        ACE_ENV_ARG_PARAMETER));

      info->register_initial_reference (ACE_TEXT_ALWAYS_CHAR (this->id_.fast_rep ()),
                                        current.in ());

    }

    void
    Current_ORBInitializer_Base::post_init (PortableInterceptor::ORBInitInfo_ptr
                                            ACE_ENV_ARG_DECL_NOT_USED )
      ACE_THROW_SPEC( (CORBA::SystemException) )
    {
    }

  }

}

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"