summaryrefslogtreecommitdiff
path: root/tao/PortableServer/POA_Current_Impl.inl
blob: d8077bc29a8492adcbf8fa34abc16373dda6b8ea (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
// -*- C++ -*-
//
// $Id$

#include "tao/SystemException.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  namespace Portable_Server
  {
    ACE_INLINE void
    POA_Current_Impl::poa (::TAO_Root_POA *p)
    {
      this->poa_ = p;
    }

    ACE_INLINE ::TAO_Root_POA *
    POA_Current_Impl::poa (void) const
    {
      return this->poa_;
    }

    ACE_INLINE void
    POA_Current_Impl::object_id (const PortableServer::ObjectId &id)
    {
//      if (this->object_id_.release () ||
//          this->object_id_.get_buffer() == this->object_id_buf_)
      if (this->object_id_ == this->object_id_buf_)
        {
          // Resize the current object_id_.  If it is less than the
          // length of the current buffer, no allocation will take place.
          size_t id_size = id.size ();
          this->object_id_.resize (id_size);
          
          for (CORBA::ULong i = 0; i < id_size; ++i)
            {
              this->object_id_[i] = id[i];
            }

          // Get the buffer and copy the new object id in it's place.
//          ACE_OS::memcpy (this->object_id_.get_buffer (),
//                          id.get_buffer (), id_size);
        }
      else
        {
          this->object_id_ = id;
        }
    }

    ACE_INLINE const PortableServer::ObjectId &
    POA_Current_Impl::object_id (void) const
    {
      return this->object_id_;
    }

    ACE_INLINE void
    POA_Current_Impl::replace_object_id (
      const PortableServer::ObjectId &system_id)
    {
      this->object_id_.resize (system_id.size ());
      
      for (CORBA::ULong i = 0; i < system_id.size (); ++i)
        {
          this->object_id_[i] = system_id[i];
        }
    /*
      // This has the effect of replacing the underlying buffer
      // with that of another object id without copying.
      object_id_.replace (system_id.maximum (),
                          system_id.length (),
                          const_cast <CORBA::Octet *> (system_id.get_buffer ()),
                          0);
    */
    }

    ACE_INLINE void
    POA_Current_Impl::object_key (const TAO::ObjectKey &key)
    {
      this->object_key_ = key;
    }

    ACE_INLINE const TAO::ObjectKey &
    POA_Current_Impl::object_key (void) const
    {
      return this->object_key_;
    }

    ACE_INLINE void
    POA_Current_Impl::servant (PortableServer::Servant servant)
    {
      this->servant_ = servant;
    }

    ACE_INLINE PortableServer::Servant
    POA_Current_Impl::servant (void) const
    {
      return this->servant_;
    }

    ACE_INLINE void
    POA_Current_Impl::priority (CORBA::Short priority)
    {
      this->priority_ = priority;
    }

    ACE_INLINE CORBA::Short
    POA_Current_Impl::priority (void) const
    {
      return this->priority_;
    }

  }
}

TAO_END_VERSIONED_NAMESPACE_DECL