TAO_Unique_Id_Strategy Class Reference

Unique id strategy. More...

#include <Active_Object_Map.h>

Inheritance diagram for TAO_Unique_Id_Strategy:

Inheritance graph
[legend]
Collaboration diagram for TAO_Unique_Id_Strategy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual int is_servant_in_map (PortableServer::Servant servant, bool &deactivated)
 Must be used with UNIQUE_ID policy.
virtual int unbind_using_user_id (const PortableServer::ObjectId &user_id)
virtual int find_user_id_using_servant (PortableServer::Servant servant, PortableServer::ObjectId_out user_id)
virtual int find_system_id_using_servant (PortableServer::Servant servant, PortableServer::ObjectId_out system_id, CORBA::Short &priority)
virtual int bind_using_user_id (PortableServer::Servant servant, const PortableServer::ObjectId &user_id, CORBA::Short priority, TAO_Active_Object_Map_Entry *&entry)
virtual CORBA::Boolean remaining_activations (PortableServer::Servant servant)

Detailed Description

Unique id strategy.

Strategy for the UNIQUE_ID policy.

Definition at line 338 of file Active_Object_Map.h.


Member Function Documentation

int TAO_Unique_Id_Strategy::bind_using_user_id ( PortableServer::Servant  servant,
const PortableServer::ObjectId user_id,
CORBA::Short  priority,
TAO_Active_Object_Map_Entry *&  entry 
) [virtual]

Can be used with any policy. With the SYSTEM_ID policy, user_id is actually system_id.

Implements TAO_Id_Uniqueness_Strategy.

Definition at line 413 of file Active_Object_Map.cpp.

References ACE_NEW_RETURN, TAO_Id_Uniqueness_Strategy::active_object_map_, TAO_Active_Object_Map::id_hint_strategy_, TAO_Active_Object_Map_Entry::priority_, TAO_Active_Object_Map_Entry::servant_, TAO_Active_Object_Map::servant_map_, TAO_Active_Object_Map_Entry::user_id_, and TAO_Active_Object_Map::user_id_map_.

00418 {
00419   int result =
00420     this->active_object_map_->user_id_map_->find (user_id, entry);
00421 
00422   if (result == 0)
00423     {
00424       if (servant != 0)
00425         {
00426           entry->servant_ = servant;
00427 
00428           result =
00429             this->active_object_map_->servant_map_->bind (entry->servant_,
00430                                                           entry);
00431 
00432 #if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
00433           if (result == 0)
00434             {
00435               this->active_object_map_->monitor_->receive (
00436                 this->active_object_map_->servant_map_->current_size ());
00437             }
00438 #endif /* TAO_HAS_MONITOR_POINTS==1 */
00439         }
00440     }
00441   else
00442     {
00443       ACE_NEW_RETURN (entry,
00444                       TAO_Active_Object_Map_Entry,
00445                       -1);
00446       entry->user_id_ = user_id;
00447       entry->servant_ = servant;
00448       entry->priority_ = priority;
00449 
00450       result = this->active_object_map_->id_hint_strategy_->bind (*entry);
00451 
00452       if (result == 0)
00453         {
00454           result =
00455             this->active_object_map_->user_id_map_->bind (entry->user_id_,
00456                                                           entry);
00457           if (result == 0)
00458             {
00459               if (servant != 0)
00460                 {
00461                   result =
00462                     this->active_object_map_->servant_map_->bind (
00463                       entry->servant_,
00464                       entry);
00465                 }
00466 
00467               if (result != 0)
00468                 {
00469                   this->active_object_map_->user_id_map_->unbind (
00470                     entry->user_id_);
00471                   this->active_object_map_->id_hint_strategy_->unbind (
00472                     *entry);
00473                   delete entry;
00474                 }
00475               else
00476                 {
00477 #if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
00478                   this->active_object_map_->monitor_->receive (
00479                     this->active_object_map_->servant_map_->current_size ());
00480 #endif /* TAO_HAS_MONITOR_POINTS==1 */
00481                 }
00482             }
00483           else
00484             {
00485               this->active_object_map_->id_hint_strategy_->unbind (*entry);
00486               delete entry;
00487             }
00488         }
00489       else
00490         {
00491           delete entry;
00492         }
00493     }
00494 
00495   return result;
00496 }

int TAO_Unique_Id_Strategy::find_system_id_using_servant ( PortableServer::Servant  servant,
PortableServer::ObjectId_out  system_id,
CORBA::Short priority 
) [virtual]

Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy, <user_id> is actually system_id.

Implements TAO_Id_Uniqueness_Strategy.

Definition at line 559 of file Active_Object_Map.cpp.

References TAO_Id_Uniqueness_Strategy::active_object_map_, TAO_Active_Object_Map_Entry::deactivated_, TAO_Active_Object_Map::id_hint_strategy_, TAO_Active_Object_Map_Entry::priority_, and TAO_Active_Object_Map::servant_map_.

00563 {
00564   TAO_Active_Object_Map_Entry *entry = 0;
00565   int result = this->active_object_map_->servant_map_->find (servant,
00566                                                              entry);
00567   if (result == 0)
00568     {
00569       if (entry->deactivated_)
00570         {
00571           result = -1;
00572         }
00573       else
00574         {
00575           result =
00576             this->active_object_map_->id_hint_strategy_->system_id (
00577               system_id,
00578               *entry);
00579           if (result == 0)
00580             {
00581               priority = entry->priority_;
00582             }
00583         }
00584     }
00585 
00586   return result;
00587 }

int TAO_Unique_Id_Strategy::find_user_id_using_servant ( PortableServer::Servant  servant,
PortableServer::ObjectId_out  user_id 
) [virtual]

Must be used with UNIQUE_ID policy. With the SYSTEM_ID policy, user_id is actually system_id.

Implements TAO_Id_Uniqueness_Strategy.

Definition at line 534 of file Active_Object_Map.cpp.

References ACE_NEW_RETURN, TAO_Id_Uniqueness_Strategy::active_object_map_, TAO_Active_Object_Map_Entry::deactivated_, TAO_Active_Object_Map::servant_map_, and TAO_Active_Object_Map_Entry::user_id_.

00537 {
00538   TAO_Active_Object_Map_Entry *entry = 0;
00539   int result = this->active_object_map_->servant_map_->find (servant, entry);
00540 
00541   if (result == 0)
00542     {
00543       if (entry->deactivated_)
00544         {
00545           result = -1;
00546         }
00547       else
00548         {
00549           ACE_NEW_RETURN (user_id,
00550                           PortableServer::ObjectId (entry->user_id_),
00551                           -1);
00552         }
00553     }
00554 
00555   return result;
00556 }

int TAO_Unique_Id_Strategy::is_servant_in_map ( PortableServer::Servant  servant,
bool &  deactivated 
) [virtual]

Must be used with UNIQUE_ID policy.

Implements TAO_Id_Uniqueness_Strategy.

Definition at line 389 of file Active_Object_Map.cpp.

References TAO_Id_Uniqueness_Strategy::active_object_map_, TAO_Active_Object_Map_Entry::deactivated_, and TAO_Active_Object_Map::servant_map_.

00391 {
00392   TAO_Active_Object_Map_Entry *entry = 0;
00393   int result = this->active_object_map_->servant_map_->find (servant,
00394                                                              entry);
00395   if (result == 0)
00396     {
00397       result = 1;
00398 
00399       if (entry->deactivated_)
00400         {
00401           deactivated = true;
00402         }
00403     }
00404   else
00405     {
00406       result = 0;
00407     }
00408 
00409   return result;
00410 }

CORBA::Boolean TAO_Unique_Id_Strategy::remaining_activations ( PortableServer::Servant  servant  )  [virtual]

Are there any remaining activations of servant in the active object map? Can be used with any policy.

Implements TAO_Id_Uniqueness_Strategy.

Definition at line 590 of file Active_Object_Map.cpp.

00592 {
00593   ACE_UNUSED_ARG (servant);
00594 
00595   // Since servant are always unique here, return false.
00596   return 0;
00597 }

int TAO_Unique_Id_Strategy::unbind_using_user_id ( const PortableServer::ObjectId user_id  )  [virtual]

Can be used with any policy. With the SYSTEM_ID policy, user_id is actually system_id.

Implements TAO_Id_Uniqueness_Strategy.

Definition at line 499 of file Active_Object_Map.cpp.

References TAO_Id_Uniqueness_Strategy::active_object_map_, TAO_Active_Object_Map::id_hint_strategy_, TAO_Active_Object_Map_Entry::servant_, TAO_Active_Object_Map::servant_map_, and TAO_Active_Object_Map::user_id_map_.

00501 {
00502   TAO_Active_Object_Map_Entry *entry = 0;
00503   int result = this->active_object_map_->user_id_map_->unbind (user_id,
00504                                                                entry);
00505   if (result == 0)
00506     {
00507       if (entry->servant_ != 0)
00508         {
00509           result =
00510             this->active_object_map_->servant_map_->unbind (entry->servant_);
00511         }
00512 
00513       if (result == 0)
00514         {
00515           result =
00516             this->active_object_map_->id_hint_strategy_->unbind (*entry);
00517 
00518 #if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
00519           this->active_object_map_->monitor_->receive (
00520             this->active_object_map_->servant_map_->current_size ());
00521 #endif /* TAO_HAS_MONITOR_POINTS==1 */
00522         }
00523 
00524       if (result == 0)
00525         {
00526           delete entry;
00527         }
00528     }
00529 
00530   return result;
00531 }


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:41:34 2010 for TAO_PortableServer by  doxygen 1.4.7