summaryrefslogtreecommitdiff
path: root/TAO/tao/Cache_Entries.inl
blob: 475f8865a0d2acdfed5987dfb1d023d481d4019b (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
// -*- C++ -*-
//
// $Id$

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  ACE_INLINE
  Cache_IntId::Cache_IntId (void)
    : transport_ (0),
      recycle_state_ (ENTRY_UNKNOWN)
  {
  }

  ACE_INLINE
  Cache_IntId::Cache_IntId (const Cache_IntId &rhs)
    : transport_ (0),
      recycle_state_ (ENTRY_UNKNOWN)
  {
    *this = rhs;
  }

  ACE_INLINE bool
  Cache_IntId::operator== (const Cache_IntId &rhs) const
  {
    return (this->transport_ == rhs.transport_);
  }

  ACE_INLINE bool
  Cache_IntId::operator!= (const Cache_IntId &rhs) const
  {
    return (this->transport_ != rhs.transport_);
  }

  ACE_INLINE TAO_Transport *
  Cache_IntId::transport (void)
  {
    return this->transport_;
  }

  ACE_INLINE const TAO_Transport *
  Cache_IntId::transport (void) const
  {
    return this->transport_;
  }

  ACE_INLINE void
  Cache_IntId::recycle_state (Cache_Entries_State st)
  {
    this->recycle_state_ = st;
  }

  ACE_INLINE Cache_Entries_State
  Cache_IntId::recycle_state (void)
  {
    return this->recycle_state_;
  }

  ACE_INLINE TAO_Transport *
  Cache_IntId::relinquish_transport (void)
  {
    // Yield ownership of the TAO_Transport object.
    TAO_Transport *val = this->transport_;
    this->transport_ = 0;
    return val;
  }

  /*******************************************************/
  ACE_INLINE
  Cache_ExtId::Cache_ExtId (void)
    : transport_property_ (0),
      is_delete_ (0),
      index_ (0)
  {
  }

  ACE_INLINE
  Cache_ExtId::Cache_ExtId (TAO_Transport_Descriptor_Interface *prop)
    : transport_property_ (prop),
      is_delete_ (0),
      index_ (0)
  {

  }

  ACE_INLINE
  Cache_ExtId::~Cache_ExtId (void)
  {
    if (this->is_delete_)
      delete this->transport_property_;
  }

  ACE_INLINE Cache_ExtId &
  Cache_ExtId::operator= (const Cache_ExtId &rhs)
  {
    if (this != &rhs)
      {
        // Do a deep copy
        this->transport_property_ =
          rhs.transport_property_->duplicate ();

        if (this->transport_property_ == 0)
          {
            this->is_delete_ = 0;
            this->index_ = 0;
          }
        else
          {
            this->is_delete_ = 1;
            this->index_ = rhs.index_;
          }
      }
    return *this;
  }

  ACE_INLINE
  Cache_ExtId::Cache_ExtId (const Cache_ExtId &rhs)
    : transport_property_ (0),
      is_delete_ (0),
      index_ (0)
  {
    *this = rhs;
  }

  ACE_INLINE bool
  Cache_ExtId::operator== (const Cache_ExtId &rhs) const
  {
    return (this->transport_property_->is_equivalent (rhs.transport_property_) &&
            this->index_ == rhs.index_);
  }

  ACE_INLINE bool
  Cache_ExtId::operator!= (const Cache_ExtId &rhs) const
  {
    if (this->transport_property_->is_equivalent (rhs.transport_property_) &&
        this->index_ == rhs.index_)
      return false;

    return true;
  }

  ACE_INLINE u_long
  Cache_ExtId::hash (void) const
  {
    return (this->transport_property_->hash () + this->index_);
  }

  ACE_INLINE void
  Cache_ExtId::duplicate (void)
  {
    TAO_Transport_Descriptor_Interface *prop = 0;

    // Make a deep copy
    prop = this->transport_property_->duplicate ();

    if (prop == 0)
      return;

    // Release memory if there was some allocated in the first place
    if (this->is_delete_)
      delete this->transport_property_;

    this->is_delete_ = 1;
    this->transport_property_ = prop;
  }


  ACE_INLINE CORBA::ULong
  Cache_ExtId::index (void) const
  {
    return this->index_;
  }


  ACE_INLINE void
  Cache_ExtId::index (CORBA::ULong index)
  {
    this->index_ = index;
  }

  ACE_INLINE void
  Cache_ExtId::incr_index (void)
  {
    ++this->index_;
  }

  ACE_INLINE TAO_Transport_Descriptor_Interface *
  Cache_ExtId::property (void) const
  {
    return this->transport_property_;
  }
}

TAO_END_VERSIONED_NAMESPACE_DECL