#include <PG_Group_Factory.h>
Collaboration diagram for TAO::PG_Group_Factory:
Public Member Functions | |
PG_Group_Factory () | |
Constructor. | |
~PG_Group_Factory () | |
Destructor. | |
void | init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, PortableGroup::FactoryRegistry_ptr factory_registry) |
TAO::PG_Object_Group * | create_group (const char *type_id, const PortableGroup::Criteria &the_criteria, TAO::PG_Property_Set *typeid_properties) |
void | delete_group (PortableGroup::ObjectGroup_ptr object_group) |
void | delete_group (PortableGroup::ObjectGroupId group_id) |
PortableGroup::ObjectGroups * | groups_at_location (const PortableGroup::Location &the_location) |
int | insert_group (::TAO::PG_Object_Group *group) |
int | insert_group (PortableGroup::ObjectGroupId group_id,::TAO::PG_Object_Group *group) |
int | find_group (PortableGroup::ObjectGroupId group_id,::TAO::PG_Object_Group *&group) const |
int | find_group (PortableGroup::ObjectGroup_ptr object_group,::TAO::PG_Object_Group *&group) const |
int | destroy_group (PortableGroup::ObjectGroupId object_group_id) |
int | destroy_group (PortableGroup::ObjectGroup_ptr object_group) |
Private Types | |
typedef ACE_Hash_Map_Manager_Ex< PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group *, ACE_Hash< ACE_UINT64 >, ACE_Equal_To< ACE_UINT64 >, TAO_SYNCH_MUTEX > | Group_Map |
typedef ACE_Hash_Map_Entry< PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group * > | Group_Map_Entry |
typedef ACE_Hash_Map_Iterator_Ex< PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group *, ACE_Hash< ACE_UINT64 >, ACE_Equal_To< ACE_UINT64 >, TAO_SYNCH_MUTEX > | Group_Map_Iterator |
Private Attributes | |
CORBA::ORB_var | orb_ |
PortableServer::POA_var | poa_ |
Reference to the POA used to create object group references. | |
PortableGroup::FactoryRegistry_var | factory_registry_ |
The factory registry for replica factories. | |
::TAO::PG_Object_Group_Manipulator | manipulator_ |
const char * | domain_id_ |
Group_Map | group_map_ |
Definition at line 52 of file PG_Group_Factory.h.
typedef ACE_Hash_Map_Manager_Ex< PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, TAO_SYNCH_MUTEX> TAO::PG_Group_Factory::Group_Map [private] |
Definition at line 61 of file PG_Group_Factory.h.
typedef ACE_Hash_Map_Entry<PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group *> TAO::PG_Group_Factory::Group_Map_Entry [private] |
Definition at line 63 of file PG_Group_Factory.h.
typedef ACE_Hash_Map_Iterator_Ex< PortableGroup::ObjectGroupId, ::TAO::PG_Object_Group *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, TAO_SYNCH_MUTEX> TAO::PG_Group_Factory::Group_Map_Iterator [private] |
Definition at line 70 of file PG_Group_Factory.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::PG_Group_Factory::PG_Group_Factory | ( | ) |
Constructor.
Definition at line 27 of file PG_Group_Factory.cpp.
00028 : orb_ (CORBA::ORB::_nil()) 00029 , poa_ (PortableServer::POA::_nil()) 00030 , manipulator_ () 00031 , domain_id_ ("default-domain") 00032 00033 { 00034 }
TAO::PG_Group_Factory::~PG_Group_Factory | ( | ) |
Destructor.
Definition at line 36 of file PG_Group_Factory.cpp.
References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), group_map_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind_all(), and ~PG_Group_Factory().
Referenced by ~PG_Group_Factory().
00037 { 00038 for (Group_Map_Iterator it = this->group_map_.begin (); 00039 it != this->group_map_.end (); 00040 ++it) 00041 { 00042 TAO::PG_Object_Group * group = (*it).int_id_; 00043 delete group; 00044 } 00045 this->group_map_.unbind_all (); 00046 }
TAO::PG_Object_Group * TAO::PG_Group_Factory::create_group | ( | const char * | type_id, | |
const PortableGroup::Criteria & | the_criteria, | |||
TAO::PG_Property_Set * | typeid_properties | |||
) |
Definition at line 71 of file PG_Group_Factory.cpp.
References ACE_NEW_THROW_EX, create_group(), factory_registry_, and manipulator_.
Referenced by create_group().
00075 { 00076 /////////////////////////////////// 00077 // Create an empty group reference 00078 00079 PortableGroup::ObjectGroupId group_id = 0; 00080 PortableGroup::ObjectGroup_var empty_group = 00081 this->manipulator_.create_object_group ( 00082 type_id, 00083 this->domain_id_, 00084 group_id); 00085 00086 // pick up the object group information as assigned by 00087 // ObjectGroupManager 00088 00089 PortableGroup::TagGroupTaggedComponent tagged_component; 00090 if (! TAO::PG_Utils::get_tagged_component (empty_group, tagged_component)) 00091 { 00092 throw PortableGroup::ObjectNotCreated(); 00093 } 00094 00095 TAO::PG_Object_Group * objectGroup = 0; 00096 00097 ACE_NEW_THROW_EX ( 00098 objectGroup, 00099 TAO::PG_Object_Group ( 00100 this->orb_.in (), 00101 this->factory_registry_.in (), 00102 this->manipulator_, 00103 empty_group.in (), 00104 tagged_component, 00105 type_id, 00106 the_criteria, 00107 typeid_properties 00108 ), 00109 CORBA::NO_MEMORY()); 00110 00111 if (this->group_map_.bind (group_id, objectGroup) != 0) 00112 { 00113 delete objectGroup; 00114 throw PortableGroup::ObjectNotCreated(); 00115 } 00116 return objectGroup; 00117 }
void TAO::PG_Group_Factory::delete_group | ( | PortableGroup::ObjectGroupId | group_id | ) |
Definition at line 128 of file PG_Group_Factory.cpp.
References delete_group(), and destroy_group().
00129 { 00130 if (! destroy_group (group_id)) 00131 { 00132 throw PortableGroup::ObjectNotFound (); 00133 } 00134 }
void TAO::PG_Group_Factory::delete_group | ( | PortableGroup::ObjectGroup_ptr | object_group | ) |
Definition at line 119 of file PG_Group_Factory.cpp.
References delete_group(), and destroy_group().
Referenced by delete_group().
00120 { 00121 if (! destroy_group (object_group)) 00122 { 00123 throw PortableGroup::ObjectNotFound (); 00124 } 00125 }
int TAO::PG_Group_Factory::destroy_group | ( | PortableGroup::ObjectGroup_ptr | object_group | ) |
remove group from map and delete it. note: uses group id extracted from object_group
Definition at line 174 of file PG_Group_Factory.cpp.
References destroy_group().
00175 { 00176 PortableGroup::TagGroupTaggedComponent tc; 00177 TAO::PG_Utils::get_tagged_component (object_group, tc); 00178 return destroy_group (tc.object_group_id); 00179 }
int TAO::PG_Group_Factory::destroy_group | ( | PortableGroup::ObjectGroupId | object_group_id | ) |
remove group from map and delete it.
Definition at line 163 of file PG_Group_Factory.cpp.
References destroy_group(), group_map_, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind().
Referenced by delete_group(), and destroy_group().
00164 { 00165 ::TAO::PG_Object_Group * group = 0; 00166 int result = (this->group_map_.unbind (group_id, group) == 0); 00167 if (result) 00168 { 00169 delete group; 00170 } 00171 return result; 00172 }
int TAO::PG_Group_Factory::find_group | ( | PortableGroup::ObjectGroup_ptr | object_group, | |
::TAO::PG_Object_Group *& | group | |||
) | const |
find group note: uses group id extracted from object_group
Definition at line 152 of file PG_Group_Factory.cpp.
References find_group().
00153 { 00154 int result = 0; 00155 PortableGroup::TagGroupTaggedComponent tc; 00156 if (TAO::PG_Utils::get_tagged_component (object_group, tc)) 00157 { 00158 result = find_group (tc.object_group_id, group); 00159 } 00160 return result; 00161 }
int TAO::PG_Group_Factory::find_group | ( | PortableGroup::ObjectGroupId | group_id, | |
::TAO::PG_Object_Group *& | group | |||
) | const |
find group
Definition at line 147 of file PG_Group_Factory.cpp.
References find_group().
Referenced by find_group().
PortableGroup::ObjectGroups * TAO::PG_Group_Factory::groups_at_location | ( | const PortableGroup::Location & | the_location | ) |
Definition at line 184 of file PG_Group_Factory.cpp.
References ACE_NEW_THROW_EX, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::current_size(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), group_map_, and groups_at_location().
Referenced by groups_at_location().
00186 { 00187 size_t upper_limit = this->group_map_.current_size (); 00188 PortableGroup::ObjectGroups * result = 0; 00189 ACE_NEW_THROW_EX ( 00190 result, 00191 PortableGroup::ObjectGroups (upper_limit), 00192 CORBA::NO_MEMORY()); 00193 00194 result->length(upper_limit); 00195 00196 size_t group_count = 0; 00197 for (Group_Map_Iterator it = this->group_map_.begin (); 00198 it != this->group_map_.end (); 00199 ++it) 00200 { 00201 TAO::PG_Object_Group * group = (*it).int_id_; 00202 if (group->has_member_at (the_location)) 00203 { 00204 (*result)[group_count] = group->reference (); 00205 ++group_count; 00206 } 00207 } 00208 result->length (group_count); 00209 return result; 00210 }
void TAO::PG_Group_Factory::init | ( | CORBA::ORB_ptr | orb, | |
PortableServer::POA_ptr | poa, | |||
PortableGroup::FactoryRegistry_ptr | factory_registry | |||
) |
Definition at line 49 of file PG_Group_Factory.cpp.
References CORBA::ORB::_duplicate(), ACE_ASSERT, factory_registry_, CORBA::is_nil(), manipulator_, orb_, and poa_.
00053 { 00054 ACE_ASSERT (CORBA::is_nil (this->orb_.in ())); 00055 ACE_ASSERT (CORBA::is_nil (this->poa_.in ())); 00056 ACE_ASSERT (CORBA::is_nil (this->factory_registry_.in ())); 00057 00058 this->orb_ = CORBA::ORB::_duplicate(orb); 00059 this->poa_ = PortableServer::POA::_duplicate (poa); 00060 this->factory_registry_ = PortableGroup::FactoryRegistry::_duplicate (factory_registry); 00061 00062 00063 ACE_ASSERT (!CORBA::is_nil (this->orb_.in ())); 00064 ACE_ASSERT (!CORBA::is_nil (this->poa_.in ())); 00065 ACE_ASSERT (!CORBA::is_nil (this->factory_registry_.in ())); 00066 00067 this->manipulator_.init (orb, poa); 00068 }
int TAO::PG_Group_Factory::insert_group | ( | PortableGroup::ObjectGroupId | group_id, | |
::TAO::PG_Object_Group * | group | |||
) |
insert group. Take ownership
Definition at line 142 of file PG_Group_Factory.cpp.
References insert_group().
int TAO::PG_Group_Factory::insert_group | ( | ::TAO::PG_Object_Group * | group | ) |
insert existing group. Take ownership note: uses group id extracted from group object
Definition at line 137 of file PG_Group_Factory.cpp.
References TAO::PG_Object_Group::get_object_group_id(), and insert_group().
Referenced by insert_group().
00138 { 00139 return insert_group (group->get_object_group_id(), group); 00140 }
const char* TAO::PG_Group_Factory::domain_id_ [private] |
Definition at line 156 of file PG_Group_Factory.h.
PortableGroup::FactoryRegistry_var TAO::PG_Group_Factory::factory_registry_ [private] |
The factory registry for replica factories.
Definition at line 152 of file PG_Group_Factory.h.
Referenced by create_group(), and init().
Group_Map TAO::PG_Group_Factory::group_map_ [private] |
Definition at line 158 of file PG_Group_Factory.h.
Referenced by destroy_group(), groups_at_location(), and ~PG_Group_Factory().
::TAO::PG_Object_Group_Manipulator TAO::PG_Group_Factory::manipulator_ [private] |
CORBA::ORB_var TAO::PG_Group_Factory::orb_ [private] |
PortableServer::POA_var TAO::PG_Group_Factory::poa_ [private] |
Reference to the POA used to create object group references.
Definition at line 149 of file PG_Group_Factory.h.
Referenced by init().