summaryrefslogtreecommitdiff
path: root/tao/PortableServer/POA_Current.cpp
blob: 3ba22eb2f892efa5e2f1ea8d95ca15b9ef9603eb (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
// $Id$

// -- PortableServer Include --
#include "tao/PortableServer/POA_Current.h"
#include "tao/PortableServer/POA_Current_Impl.h"

// -- TAO Include --
#include "tao/TSS_Resources.h"

ACE_RCSID (PortableServer,
           POA_Current,
           "$Id$")

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace Portable_Server
  {
    PortableServer::POA_ptr
    POA_Current::get_POA (void)
    {
      POA_Current_Impl *impl = this->implementation ();

      if (impl == 0)
        throw PortableServer::Current::NoContext ();
      return impl->get_POA ();
    }

    PortableServer::ObjectId
    POA_Current::get_object_id (void)
    {
      POA_Current_Impl *impl = this->implementation ();

      if (impl == 0)
        throw PortableServer::Current::NoContext ();
      return impl->get_object_id ();
    }

    PortableServer::Servant
    POA_Current::get_servant (void)
    {
      POA_Current_Impl *impl = this->implementation ();

      if (impl == 0)
        throw PortableServer::Current::NoContext ();
      return impl->get_servant ();
    }

    CORBA::Object_ptr
    POA_Current::get_reference (void)
    {
      POA_Current_Impl *impl = this->implementation ();

      if (impl == 0)
        throw PortableServer::Current::NoContext ();
      return impl->get_reference ();
    }

    POA_Current_Impl *
    POA_Current::implementation (void)
    {
      return static_cast <POA_Current_Impl *>
                        (TAO_TSS_Resources::instance ()->poa_current_impl_);
    }

    POA_Current_Impl *
    POA_Current::implementation (POA_Current_Impl *new_current)
    {
      TAO_TSS_Resources *tss = TAO_TSS_Resources::instance ();

      POA_Current_Impl *old =
        static_cast <POA_Current_Impl *>
                     (tss->poa_current_impl_);
      tss->poa_current_impl_ = new_current;
      return old;
    }
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL