summaryrefslogtreecommitdiff
path: root/TAO/tao/PortableServer/POA_Current.cpp
blob: cdb6a81c23c5569f85234ce1aee42e0db764e2e6 (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
// -*- C++ -*-
// -- PortableServer Include --
#include "tao/PortableServer/POA_Current.h"
#include "tao/PortableServer/POA_Current_Impl.h"

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

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

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

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

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

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

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

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

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

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

    POA_Current_Impl *
    POA_Current::implementation ()
    {
      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