Updated logging to include the class/method so that it is more obvious where these...
[ACE_TAO.git] / TAO / tao / PortableServer / Active_Object_Map.inl
blobfad3a561bd35fbb1b6f8b2cc47eb788aff1ddcb4
1 // -*- C++ -*-
2 #include "tao/PortableServer/Active_Object_Map_Entry.h"
4 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
6 ACE_INLINE int
7 TAO_Active_Object_Map::is_servant_in_map (PortableServer::Servant servant,
8                                           bool &deactivated)
10   return this->id_uniqueness_strategy_->is_servant_in_map (servant,
11                                                            deactivated);
14 ACE_INLINE int
15 TAO_Active_Object_Map::bind_using_system_id_returning_system_id (
16   PortableServer::Servant servant,
17   CORBA::Short priority,
18   PortableServer::ObjectId_out system_id)
20   if (servant == 0 && !this->using_active_maps_)
21     {
22       PortableServer::ObjectId id;
24       int result = this->user_id_map_->create_key (id);
26       if (result == 0)
27         {
28           ACE_NEW_RETURN (system_id,
29                           PortableServer::ObjectId (id),
30                           -1);
31         }
33       return result;
34     }
36   TAO_Active_Object_Map_Entry *entry = 0;
38   int result =
39     this->id_assignment_strategy_->bind_using_system_id (servant,
40                                                          priority,
41                                                          entry);
43   if (result == 0)
44     {
45       result = this->id_hint_strategy_->system_id (system_id,
46                                                    *entry);
47     }
49   return result;
52 ACE_INLINE int
53 TAO_Active_Object_Map::bind_using_system_id_returning_user_id (
54   PortableServer::Servant servant,
55   CORBA::Short priority,
56   PortableServer::ObjectId_out user_id)
58   TAO_Active_Object_Map_Entry *entry = 0;
60   int result =
61     this->id_assignment_strategy_->bind_using_system_id (servant,
62                                                          priority,
63                                                          entry);
64   if (result == 0)
65     ACE_NEW_RETURN (user_id,
66                     PortableServer::ObjectId (entry->user_id_),
67                     -1);
68   return result;
71 ACE_INLINE int
72 TAO_Active_Object_Map::bind_using_user_id (
73   PortableServer::Servant servant,
74   const PortableServer::ObjectId &user_id,
75   CORBA::Short priority)
77   TAO_Active_Object_Map_Entry *entry = 0;
78   return this->id_uniqueness_strategy_->bind_using_user_id (servant,
79                                                             user_id,
80                                                             priority,
81                                                             entry);
84 ACE_INLINE int
85 TAO_Active_Object_Map::find_system_id_using_user_id (
86   const PortableServer::ObjectId &user_id,
87   CORBA::Short priority,
88   PortableServer::ObjectId_out system_id)
90   if (!this->using_active_maps_)
91     {
92       ACE_NEW_RETURN (system_id,
93                       PortableServer::ObjectId (user_id),
94                       -1);
96       return 0;
97     }
99   TAO_Active_Object_Map_Entry *entry = 0;
100   int result =
101     this->id_uniqueness_strategy_->bind_using_user_id (0,
102                                                        user_id,
103                                                        priority,
104                                                        entry);
105   if (result == 0)
106     {
107       result =
108         this->id_hint_strategy_->system_id (system_id, *entry);
109     }
111   return result;
114 ACE_INLINE int
115 TAO_Active_Object_Map::rebind_using_user_id_and_system_id (
116   PortableServer::Servant servant,
117   const PortableServer::ObjectId &user_id,
118   const PortableServer::ObjectId &,
119   TAO_Active_Object_Map_Entry *&entry)
121   return this->id_uniqueness_strategy_->bind_using_user_id (servant,
122                                                             user_id,
123                                                             -1,
124                                                             entry);
127 ACE_INLINE int
128 TAO_Active_Object_Map::unbind_using_user_id (
129   const PortableServer::ObjectId &user_id)
131   return this->id_uniqueness_strategy_->unbind_using_user_id (user_id);
134 ACE_INLINE int
135 TAO_Active_Object_Map::find_user_id_using_servant (
136   PortableServer::Servant servant,
137   PortableServer::ObjectId_out user_id)
139   return
140     this->id_uniqueness_strategy_->find_user_id_using_servant (servant,
141                                                                user_id);
144 ACE_INLINE int
145 TAO_Active_Object_Map::find_system_id_using_servant (
146   PortableServer::Servant servant,
147   PortableServer::ObjectId_out system_id,
148   CORBA::Short &priority)
150   return
151     this->id_uniqueness_strategy_->find_system_id_using_servant (servant,
152                                                                  system_id,
153                                                                  priority);
156 ACE_INLINE int
157 TAO_Active_Object_Map::find_servant_using_user_id (
158   const PortableServer::ObjectId &user_id,
159   PortableServer::Servant &servant)
161   TAO_Active_Object_Map_Entry *entry = 0;
162   int result = this->user_id_map_->find (user_id, entry);
164   if (result == 0)
165     {
166       if (entry->deactivated_)
167         {
168           result = -1;
169         }
170       else if (entry->servant_ == 0)
171         {
172           result = -1;
173         }
174       else
175         {
176           servant = entry->servant_;
177         }
178     }
180   return result;
183 ACE_INLINE int
184 TAO_Active_Object_Map::find_servant_using_system_id_and_user_id (
185   const PortableServer::ObjectId &system_id,
186   const PortableServer::ObjectId &user_id,
187   PortableServer::Servant &servant,
188   TAO_Active_Object_Map_Entry *&entry)
190   return
191     this->lifespan_strategy_->find_servant_using_system_id_and_user_id (
192       system_id,
193       user_id,
194       servant,
195       entry);
198 ACE_INLINE int
199 TAO_Active_Object_Map::find_entry_using_user_id (
200   const PortableServer::ObjectId &user_id,
201   TAO_Active_Object_Map_Entry *&entry)
203   int result = this->user_id_map_->find (user_id, entry);
205   if (result == 0)
206     {
207       if (entry->deactivated_)
208         {
209           result = -1;
210         }
211     }
213   return result;
216 ACE_INLINE int
217 TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (
218   const PortableServer::ObjectId &user_id,
219   PortableServer::Servant &servant,
220   PortableServer::ObjectId_out system_id,
221   CORBA::Short &priority)
223   TAO_Active_Object_Map_Entry *entry = 0;
224   int result = this->find_entry_using_user_id (user_id, entry);
226   if (result == 0)
227     {
228       if (entry->servant_ == 0)
229         {
230           result = -1;
231         }
232       else
233         {
234           result = this->id_hint_strategy_->system_id (system_id,
235                                                        *entry);
236           if (result == 0)
237             {
238               servant = entry->servant_;
239               priority = entry->priority_;
240             }
241         }
242     }
244   return result;
247 ACE_INLINE int
248 TAO_Active_Object_Map::find_user_id_using_system_id (
249   const PortableServer::ObjectId &system_id,
250   PortableServer::ObjectId_out user_id)
252   PortableServer::ObjectId id;
253   if (this->id_hint_strategy_->recover_key (system_id, id) == 0)
254     {
255       ACE_NEW_RETURN (user_id,
256                       PortableServer::ObjectId (id),
257                       -1);
258     }
260   return 0;
263 ACE_INLINE int
264 TAO_Active_Object_Map::find_user_id_using_system_id (
265   const PortableServer::ObjectId &system_id,
266   PortableServer::ObjectId &user_id)
268   return this->id_hint_strategy_->recover_key (system_id, user_id);
271 ACE_INLINE CORBA::Boolean
272 TAO_Active_Object_Map::remaining_activations (PortableServer::Servant servant)
274   return this->id_uniqueness_strategy_->remaining_activations (servant);
277 ACE_INLINE size_t
278 TAO_Active_Object_Map::current_size (void)
280   return this->user_id_map_->current_size ();
283 /* static */
284 ACE_INLINE size_t
285 TAO_Active_Object_Map::system_id_size (void)
287   return TAO_Active_Object_Map::system_id_size_;
290 TAO_END_VERSIONED_NAMESPACE_DECL