PortableGroup::ObjectGroups * TAO::PG_Group_Factory::groups_at_location ( const PortableGroup::Location & the_location) { Group_Map & group_map = this->get_group_map (); size_t upper_limit = group_map.current_size (); PortableGroup::ObjectGroups * result = 0; ACE_NEW_THROW_EX ( result, PortableGroup::ObjectGroups (upper_limit), CORBA::NO_MEMORY()); result->length(upper_limit); size_t group_count = 0; for (Group_Map_Iterator it = group_map.begin (); it != group_map.end (); ++it) { TAO::PG_Object_Group * group = (*it).int_id_; if (group->has_member_at (the_location)) { (*result)[group_count] = group->reference (); ++group_count; } } result->length (group_count); return result; }
PortableGroup::ObjectGroups * TAO::PG_Group_Factory::all_groups (void) { Group_Map & group_map = this->get_group_map (); size_t upper_limit = group_map.current_size (); PortableGroup::ObjectGroups * result = 0; ACE_NEW_THROW_EX ( result, PortableGroup::ObjectGroups (upper_limit), CORBA::NO_MEMORY()); result->length(upper_limit); size_t group_count = 0; for (Group_Map_Iterator it = group_map.begin (); it != group_map.end (); ++it) { TAO::PG_Object_Group * group = (*it).int_id_; (*result)[group_count] = CORBA::Object::_duplicate(group->reference ()); ++group_count; } result->length (group_count); return result; }
PortableGroup::ObjectGroups * TAO_PG_ObjectGroupManager::groups_at_location ( const PortableGroup::Location & the_location) { PortableGroup::ObjectGroups * ogs; ACE_NEW_THROW_EX (ogs, PortableGroup::ObjectGroups, CORBA::NO_MEMORY ()); PortableGroup::ObjectGroups_var object_groups = ogs; ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->lock_, 0); TAO_PG_ObjectGroup_Array * groups = 0; if (this->location_map_.find (the_location, groups) == 0) { CORBA::ULong len = static_cast<CORBA::ULong> (groups->size ()); ogs->length (len); for (CORBA::ULong i = 0; i < len; ++i) { object_groups[i] = PortableGroup::ObjectGroup::_duplicate ( (*groups)[i]->object_group.in ()); } } return object_groups._retn (); }