Public Member Functions | Private Member Functions | Private Attributes

TAO::PG_Object_Group_Manipulator Class Reference

PortableGroup::ObjectGroupManager implementation. More...

#include <PG_Object_Group_Manipulator.h>

Collaboration diagram for TAO::PG_Object_Group_Manipulator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PG_Object_Group_Manipulator ()
 Constructor.
 ~PG_Object_Group_Manipulator ()
 Destructor.
void init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa)
PortableGroup::ObjectGroup_ptr create_object_group (const char *type_id, const char *domain_id, PortableGroup::ObjectGroupId &group_id)
PortableGroup::ObjectGroup_ptr remove_profiles (PortableGroup::ObjectGroup_ptr group, PortableGroup::ObjectGroup_ptr profile) const
PortableGroup::ObjectGroup_ptr merge_iors (TAO_IOP::TAO_IOR_Manipulation::IORList &iors) const
int set_primary (TAO_IOP::TAO_IOR_Property *prop, PortableGroup::ObjectGroup_ptr reference, CORBA::Object_ptr new_primary) const
void dump_membership (const char *label, PortableGroup::ObjectGroup_ptr member) const

Private Member Functions

void allocate_ogid (PortableGroup::ObjectGroupId &ogid)
PortableServer::ObjectIdconvert_ogid_to_oid (PortableGroup::ObjectGroupId ogid) const

Private Attributes

CORBA::ORB_var orb_
 The orb.
PortableServer::POA_var poa_
 Reference to the POA that created the object group references.
TAO_IOP::TAO_IOR_Manipulation_var iorm_
 The ORBs IORManipulation object.
TAO_SYNCH_MUTEX lock_ogid_
 Lock used to synchronize access to next_ogid_.
PortableGroup::ObjectGroupId next_ogid_
 Next ogid to be allocated.

Detailed Description

PortableGroup::ObjectGroupManager implementation.

The ObjectGroupManager provides the interface necessary to facilitate application-controlled object group membership.

Definition at line 42 of file PG_Object_Group_Manipulator.h.


Constructor & Destructor Documentation

TAO::PG_Object_Group_Manipulator::PG_Object_Group_Manipulator (  ) 

Constructor.

Definition at line 26 of file PG_Object_Group_Manipulator.cpp.

  : orb_ (CORBA::ORB::_nil ())
  , poa_ (PortableServer::POA::_nil ())
  , iorm_ ()
  , lock_ogid_ ()
  , next_ogid_ (1)   // don't use ogid 0
{
}

TAO::PG_Object_Group_Manipulator::~PG_Object_Group_Manipulator (  ) 

Destructor.

Definition at line 35 of file PG_Object_Group_Manipulator.cpp.

{
}


Member Function Documentation

void TAO::PG_Object_Group_Manipulator::allocate_ogid ( PortableGroup::ObjectGroupId &  ogid  )  [private]

Allocate an ogid for a new object group

Definition at line 39 of file PG_Object_Group_Manipulator.cpp.

{
  ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_ogid_);

  // The numerical value used for the ObjectId increases
  // monotonically.

  ogid = this->next_ogid_;
  this->next_ogid_ += 1;
}

PortableServer::ObjectId * TAO::PG_Object_Group_Manipulator::convert_ogid_to_oid ( PortableGroup::ObjectGroupId  ogid  )  const [private]

convert numeric OGID to Sequence<Octet> oid

Definition at line 50 of file PG_Object_Group_Manipulator.cpp.

{
  // 4294967295 -- Largest 32 bit unsigned integer
  char oid_str[11];
  ACE_OS::snprintf (oid_str, sizeof(oid_str),
                   "%lu",
                   static_cast<ACE_UINT32> (ogid));
  oid_str[sizeof(oid_str) - 1] = '\0';

  return PortableServer::string_to_ObjectId (oid_str);
}

PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group_Manipulator::create_object_group ( const char *  type_id,
const char *  domain_id,
PortableGroup::ObjectGroupId &  group_id 
)

Create an empty object group.

Definition at line 63 of file PG_Object_Group_Manipulator.cpp.

{
   allocate_ogid(group_id);
   PortableServer::ObjectId_var oid = convert_ogid_to_oid (group_id);

  // Create a reference for the ObjectGroup
  CORBA::Object_var object_group =
    this->poa_->create_reference_with_id (oid.in(),
                                          type_id);

  PortableGroup::TagGroupTaggedComponent tag_component;

  tag_component.component_version.major = (CORBA::Octet) 1;
  tag_component.component_version.minor = (CORBA::Octet) 0;
  tag_component.group_domain_id = domain_id;
  tag_component.object_group_id = group_id;
  tag_component.object_group_ref_version = 0;

  // Set the property
  TAO::PG_Utils::set_tagged_component (object_group,
                                       tag_component);

  return object_group._retn ();
}

void TAO::PG_Object_Group_Manipulator::dump_membership ( const char *  label,
PortableGroup::ObjectGroup_ptr  member 
) const
void TAO::PG_Object_Group_Manipulator::init ( CORBA::ORB_ptr  orb,
PortableServer::POA_ptr  poa 
)

Initializes the group creator.

Definition at line 92 of file PG_Object_Group_Manipulator.cpp.

{
  ACE_ASSERT (CORBA::is_nil (this->orb_.in ()) && !CORBA::is_nil (orb));
  this->orb_ = CORBA::ORB::_duplicate (orb);

  ACE_ASSERT (CORBA::is_nil (this->poa_.in ()) && !CORBA::is_nil (poa));
  this->poa_ = PortableServer::POA::_duplicate (poa);

  // Get an object reference for the ORBs IORManipulation object!
  CORBA::Object_var IORM = this->orb_->resolve_initial_references (
    TAO_OBJID_IORMANIPULATION, 0);

  this->iorm_ = TAO_IOP::TAO_IOR_Manipulation::_narrow (
    IORM.in ());
}

PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group_Manipulator::merge_iors ( TAO_IOP::TAO_IOR_Manipulation::IORList &  iors  )  const

Definition at line 123 of file PG_Object_Group_Manipulator.cpp.

{
  return this->iorm_->merge_iors (list);
}

PortableGroup::ObjectGroup_ptr TAO::PG_Object_Group_Manipulator::remove_profiles ( PortableGroup::ObjectGroup_ptr  group,
PortableGroup::ObjectGroup_ptr  profile 
) const

Definition at line 129 of file PG_Object_Group_Manipulator.cpp.

{
  return this->iorm_->remove_profiles(group, profile);
}

int TAO::PG_Object_Group_Manipulator::set_primary ( TAO_IOP::TAO_IOR_Property *  prop,
PortableGroup::ObjectGroup_ptr  reference,
CORBA::Object_ptr  new_primary 
) const

Definition at line 109 of file PG_Object_Group_Manipulator.cpp.

{
  int sts = this->iorm_->is_primary_set (prop, group);
  if (sts)
  {
    (void)this->iorm_->remove_primary_tag (prop, group);
  }
  /////note: iorm takes it's parameters in the "wrong" order for this call
  return this->iorm_->set_primary (prop, new_primary, group);
}


Member Data Documentation

TAO_IOP::TAO_IOR_Manipulation_var TAO::PG_Object_Group_Manipulator::iorm_ [private]

The ORBs IORManipulation object.

Definition at line 103 of file PG_Object_Group_Manipulator.h.

TAO_SYNCH_MUTEX TAO::PG_Object_Group_Manipulator::lock_ogid_ [private]

Lock used to synchronize access to next_ogid_.

Definition at line 106 of file PG_Object_Group_Manipulator.h.

PortableGroup::ObjectGroupId TAO::PG_Object_Group_Manipulator::next_ogid_ [private]

Next ogid to be allocated.

Definition at line 109 of file PG_Object_Group_Manipulator.h.

CORBA::ORB_var TAO::PG_Object_Group_Manipulator::orb_ [private]

The orb.

Definition at line 97 of file PG_Object_Group_Manipulator.h.

PortableServer::POA_var TAO::PG_Object_Group_Manipulator::poa_ [private]

Reference to the POA that created the object group references.

Definition at line 100 of file PG_Object_Group_Manipulator.h.


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