summaryrefslogtreecommitdiff
path: root/TAO/tao/Active_Object_Map.i
blob: 4dcfd2777a673a715b3064605658fbb0c668024f (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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
// $Id$

ACE_INLINE int
TAO_Active_Object_Map::is_servant_in_map (PortableServer::Servant servant)
{
  return this->id_uniqueness_strategy_->is_servant_in_map (servant);
}

ACE_INLINE int
TAO_Active_Object_Map::is_user_id_in_map (const PortableServer::ObjectId &user_id)
{
  Map_Entry *entry = 0;
  int result = this->user_id_map_->find (user_id,
                                         entry);
  if (result == 0)
    {
      if (entry->servant_ == 0)
        result = 0;
      else
        result = 1;
    }
  else
    result = 0;

  return result;
}

ACE_INLINE int
TAO_Active_Object_Map::bind_using_system_id_returning_system_id (PortableServer::Servant servant,
                                                                 PortableServer::ObjectId_out system_id)
{
  Map_Entry *entry = 0;

  int result = this->id_assignment_strategy_->bind_using_system_id (servant,
                                                                    entry);

  if (result == 0)
    result = this->id_hint_strategy_->system_id (system_id,
                                                 *entry);
  return result;
}

ACE_INLINE int
TAO_Active_Object_Map::bind_using_system_id_returning_user_id (PortableServer::Servant servant,
                                                               PortableServer::ObjectId_out user_id)
{
  Map_Entry *entry = 0;

  int result = this->id_assignment_strategy_->bind_using_system_id (servant,
                                                                    entry);
  if (result == 0)
    ACE_NEW_RETURN (user_id,
                    PortableServer::ObjectId (entry->user_id_),
                    -1);
  return result;
}

ACE_INLINE int
TAO_Active_Object_Map::bind_using_user_id (PortableServer::Servant servant,
                                           const PortableServer::ObjectId &user_id)
{
  Map_Entry *entry = 0;
  return this->id_uniqueness_strategy_->bind_using_user_id (servant,
                                                            user_id,
                                                            entry);
}

ACE_INLINE int
TAO_Active_Object_Map::find_system_id_using_user_id (const PortableServer::ObjectId &user_id,
                                                     PortableServer::ObjectId_out system_id)
{
  Map_Entry *entry = 0;
  int result = this->id_uniqueness_strategy_->bind_using_user_id (0,
                                                                  user_id,
                                                                  entry);
  if (result == 0)
    result = this->id_hint_strategy_->system_id (system_id,
                                                 *entry);
  return result;
}

ACE_INLINE int
TAO_Active_Object_Map::rebind_using_user_id_and_system_id (PortableServer::Servant servant,
                                                           const PortableServer::ObjectId &user_id,
                                                           const PortableServer::ObjectId &system_id,
                                                           TAO_Active_Object_Map::Map_Entry *&entry)
{
  ACE_UNUSED_ARG (system_id);

  return this->id_uniqueness_strategy_->bind_using_user_id (servant,
                                                            user_id,
                                                            entry);
}

ACE_INLINE int
TAO_Active_Object_Map::unbind_using_user_id (const PortableServer::ObjectId &user_id)
{
  return this->id_uniqueness_strategy_->unbind_using_user_id (user_id);
}

ACE_INLINE int
TAO_Active_Object_Map::find_user_id_using_servant (PortableServer::Servant servant,
                                                   PortableServer::ObjectId_out user_id)
{
  return this->id_uniqueness_strategy_->find_user_id_using_servant (servant,
                                                                    user_id);
}

ACE_INLINE int
TAO_Active_Object_Map::find_system_id_using_servant (PortableServer::Servant servant,
                                                     PortableServer::ObjectId_out system_id)
{
  return this->id_uniqueness_strategy_->find_system_id_using_servant (servant,
                                                                      system_id);
}

ACE_INLINE int
TAO_Active_Object_Map::find_servant_using_user_id (const PortableServer::ObjectId &user_id,
                                                   PortableServer::Servant &servant)
{
  Map_Entry *entry = 0;
  int result = this->user_id_map_->find (user_id,
                                         entry);
  if (result == 0)
    {
      if (entry->deactivated_)
        result = -1;
      else if (entry->servant_ == 0)
        result = -1;
      else
        servant = entry->servant_;
    }

  return result;
}

ACE_INLINE int
TAO_Active_Object_Map::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id,
                                                                 const PortableServer::ObjectId &user_id,
                                                                 PortableServer::Servant &servant,
                                                                 TAO_Active_Object_Map::Map_Entry *&entry)
{
  return this->lifespan_strategy_->find_servant_using_system_id_and_user_id (system_id,
                                                                             user_id,
                                                                             servant,
                                                                             entry);
}

ACE_INLINE int
TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (const PortableServer::ObjectId &user_id,
                                                                 PortableServer::Servant &servant,
                                                                 PortableServer::ObjectId_out system_id)
{
  Map_Entry *entry = 0;
  int result = this->user_id_map_->find (user_id,
                                         entry);

  if (result == 0)
    {
      if (entry->deactivated_)
        result = -1;
      else if (entry->servant_ == 0)
        result = -1;
      else
        {
          servant = entry->servant_;
          result = this->id_hint_strategy_->system_id (system_id,
                                                       *entry);
        }
    }

  return result;
}

ACE_INLINE int
TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (const PortableServer::ObjectId &user_id,
                                                                 TAO_Active_Object_Map::Map_Entry *&entry)
{
  return this->user_id_map_->find (user_id,
                                   entry);
}

ACE_INLINE int
TAO_Active_Object_Map::find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
                                                     PortableServer::ObjectId_out user_id)
{
  PortableServer::ObjectId id;
  int result = this->id_hint_strategy_->recover_key (system_id,
                                                     id);
  if (result == 0)
    ACE_NEW_RETURN (user_id,
                    PortableServer::ObjectId (id),
                    -1);
  return 0;
}

ACE_INLINE int
TAO_Active_Object_Map::find_user_id_using_system_id (const PortableServer::ObjectId &system_id,
                                                     PortableServer::ObjectId &user_id)
{
  return this->id_hint_strategy_->recover_key (system_id,
                                               user_id);
}

ACE_INLINE CORBA::Boolean
TAO_Active_Object_Map::remaining_activations (PortableServer::Servant servant)
{
  return this->id_uniqueness_strategy_->remaining_activations (servant);
}

ACE_INLINE size_t
TAO_Active_Object_Map::current_size (void)
{
  return this->user_id_map_->current_size ();
}

/* static */
ACE_INLINE size_t
TAO_Active_Object_Map::system_id_size (void)
{
  return TAO_Active_Object_Map::system_id_size_;
}