Public Member Functions

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.

{
  int result =
    this->active_object_map_->user_id_map_->find (user_id, entry);

  if (result == 0)
    {
      if (servant != 0)
        {
          entry->servant_ = servant;

          result =
            this->active_object_map_->servant_map_->bind (entry->servant_,
                                                          entry);

#if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
          if (result == 0)
            {
              this->active_object_map_->monitor_->receive (
                this->active_object_map_->servant_map_->current_size ());
            }
#endif /* TAO_HAS_MONITOR_POINTS==1 */
        }
    }
  else
    {
      ACE_NEW_RETURN (entry,
                      TAO_Active_Object_Map_Entry,
                      -1);
      entry->user_id_ = user_id;
      entry->servant_ = servant;
      entry->priority_ = priority;

      result = this->active_object_map_->id_hint_strategy_->bind (*entry);

      if (result == 0)
        {
          result =
            this->active_object_map_->user_id_map_->bind (entry->user_id_,
                                                          entry);
          if (result == 0)
            {
              if (servant != 0)
                {
                  result =
                    this->active_object_map_->servant_map_->bind (
                      entry->servant_,
                      entry);
                }

              if (result != 0)
                {
                  this->active_object_map_->user_id_map_->unbind (
                    entry->user_id_);
                  this->active_object_map_->id_hint_strategy_->unbind (
                    *entry);
                  delete entry;
                }
              else
                {
#if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
                  this->active_object_map_->monitor_->receive (
                    this->active_object_map_->servant_map_->current_size ());
#endif /* TAO_HAS_MONITOR_POINTS==1 */
                }
            }
          else
            {
              this->active_object_map_->id_hint_strategy_->unbind (*entry);
              delete entry;
            }
        }
      else
        {
          delete entry;
        }
    }

  return result;
}

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.

{
  TAO_Active_Object_Map_Entry *entry = 0;
  int result = this->active_object_map_->servant_map_->find (servant,
                                                             entry);
  if (result == 0)
    {
      if (entry->deactivated_)
        {
          result = -1;
        }
      else
        {
          result =
            this->active_object_map_->id_hint_strategy_->system_id (
              system_id,
              *entry);
          if (result == 0)
            {
              priority = entry->priority_;
            }
        }
    }

  return result;
}

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.

{
  TAO_Active_Object_Map_Entry *entry = 0;
  int result = this->active_object_map_->servant_map_->find (servant, entry);

  if (result == 0)
    {
      if (entry->deactivated_)
        {
          result = -1;
        }
      else
        {
          ACE_NEW_RETURN (user_id,
                          PortableServer::ObjectId (entry->user_id_),
                          -1);
        }
    }

  return result;
}

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.

{
  TAO_Active_Object_Map_Entry *entry = 0;
  int result = this->active_object_map_->servant_map_->find (servant,
                                                             entry);
  if (result == 0)
    {
      result = 1;

      if (entry->deactivated_)
        {
          deactivated = true;
        }
    }
  else
    {
      result = 0;
    }

  return result;
}

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.

{
  ACE_UNUSED_ARG (servant);

  // Since servant are always unique here, return false.
  return 0;
}

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.

{
  TAO_Active_Object_Map_Entry *entry = 0;
  int result = this->active_object_map_->user_id_map_->unbind (user_id,
                                                               entry);
  if (result == 0)
    {
      if (entry->servant_ != 0)
        {
          result =
            this->active_object_map_->servant_map_->unbind (entry->servant_);
        }

      if (result == 0)
        {
          result =
            this->active_object_map_->id_hint_strategy_->unbind (*entry);

#if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
          this->active_object_map_->monitor_->receive (
            this->active_object_map_->servant_map_->current_size ());
#endif /* TAO_HAS_MONITOR_POINTS==1 */
        }

      if (result == 0)
        {
          delete entry;
        }
    }

  return result;
}


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines