diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-06-17 05:07:19 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2001-06-17 05:07:19 +0000 |
commit | 200204cedec85b5976a9f442e5b50a178c422570 (patch) | |
tree | 4cfbdca429ad332dbe6198befb0304d492d6c8e1 | |
parent | 40acbd5a35437361de66c6d6f39a1e825f97e167 (diff) | |
download | ATCD-200204cedec85b5976a9f442e5b50a178c422570.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_Location_Equal_To.inl | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_Location_Hash.inl | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_ObjectGroupManager.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_PropertyManager.cpp | 138 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_PropertyManager.h | 58 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Equal_To.inl | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Hash.inl | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroupManager.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.cpp | 138 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.h | 58 |
10 files changed, 340 insertions, 66 deletions
diff --git a/TAO/orbsvcs/orbsvcs/LB_Location_Equal_To.inl b/TAO/orbsvcs/orbsvcs/LB_Location_Equal_To.inl index 94b22dfb46f..e001d512e7f 100644 --- a/TAO/orbsvcs/orbsvcs/LB_Location_Equal_To.inl +++ b/TAO/orbsvcs/orbsvcs/LB_Location_Equal_To.inl @@ -5,6 +5,8 @@ TAO_LB_Location_Equal_To::operator () ( const LoadBalancing::Location &lhs, const LoadBalancing::Location &rhs) { + // @todo Interim implementation until we figure out what to do when a + // location has multiple components. CORBA::ULong lhs_len = lhs.length (); CORBA::ULong rhs_len = rhs.length (); diff --git a/TAO/orbsvcs/orbsvcs/LB_Location_Hash.inl b/TAO/orbsvcs/orbsvcs/LB_Location_Hash.inl index c524a4f9598..1174194abae 100644 --- a/TAO/orbsvcs/orbsvcs/LB_Location_Hash.inl +++ b/TAO/orbsvcs/orbsvcs/LB_Location_Hash.inl @@ -6,6 +6,9 @@ ACE_INLINE CORBA::ULong TAO_LB_Location_Hash::operator() ( const LoadBalancing::Location &location) const { + // @todo Interim implementation until we figure out what to do when a + // location has multiple components. + CORBA::ULong len = location.length (); CORBA::ULong hash = 0; diff --git a/TAO/orbsvcs/orbsvcs/LB_ObjectGroupManager.h b/TAO/orbsvcs/orbsvcs/LB_ObjectGroupManager.h index 2716b14c22d..8fc9dc11e32 100644 --- a/TAO/orbsvcs/orbsvcs/LB_ObjectGroupManager.h +++ b/TAO/orbsvcs/orbsvcs/LB_ObjectGroupManager.h @@ -173,6 +173,8 @@ private: /// Pointer to the ObjectGroup map. TAO_LB_ObjectGroup_Map &object_group_map_; + /// Map that contains list of all replicas at a given location. + TAO_LB_Location_Map location_map_; }; #endif /* TAO_LB_OBJECT_GROUP_MANAGER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LB_PropertyManager.cpp b/TAO/orbsvcs/orbsvcs/LB_PropertyManager.cpp index 3893abbc868..835a4b5d450 100644 --- a/TAO/orbsvcs/orbsvcs/LB_PropertyManager.cpp +++ b/TAO/orbsvcs/orbsvcs/LB_PropertyManager.cpp @@ -6,9 +6,13 @@ ACE_RCSID (LoadBalancing, LB_PropertyManager, "$Id$") -// TAO_LB_PropertyManager::TAO_LB_PropertyManager (void) -// { -// } +TAO_LB_PropertyManager::TAO_LB_PropertyManager (void) + : default_properties_ (), + type_properties_ (), + creation_properties_ (), + dynamic_properties_ () +{ +} void TAO_LB_PropertyManager::set_default_properties ( @@ -18,6 +22,10 @@ TAO_LB_PropertyManager::set_default_properties ( LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (props, ACE_TRY_ENV); + ACE_CHECK; + + this->default_properties_ = props; } LoadBalancing::Properties * @@ -25,33 +33,51 @@ TAO_LB_PropertyManager::get_default_properties ( CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + LoadBalancing::Properties *props = 0; + ACE_NEW_THROW_EX (props, + LoadBalancing::Properties (this->default_properties_), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (0); + + return props; } void TAO_LB_PropertyManager::remove_default_properties ( - const LoadBalancing::Properties & props, + const LoadBalancing::Properties &props, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (props, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } void TAO_LB_PropertyManager::set_type_properties ( - const char * type_id, + const char * /* type_id */, const LoadBalancing::Properties & overrides, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (overrides, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } LoadBalancing::Properties * TAO_LB_PropertyManager::get_type_properties ( - const char * type_id, + const char * /* type_id */, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { @@ -60,13 +86,17 @@ TAO_LB_PropertyManager::get_type_properties ( void TAO_LB_PropertyManager::remove_type_properties ( - const char * type_id, + const char * /* type_id */, const LoadBalancing::Properties & props, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (props, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } void @@ -79,6 +109,10 @@ TAO_LB_PropertyManager::set_properties_dynamically ( LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (overrides, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } LoadBalancing::Properties * @@ -90,3 +124,91 @@ TAO_LB_PropertyManager::get_properties ( { ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); } + +void +TAO_LB_PropertyManager::validate_properties ( + const LoadBalancing::Properties & props, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((LoadBalancing::InvalidProperty, + LoadBalancing::UnsupportedProperty)) +{ + // @todo FIXME! Just a hack to get things going... + + CORBA::ULong len = props.length (); + for (CORBA::ULong i = 0; i < len; ++i) + { + if (ACE_OS::strcmp (props[i].nam.id[0], + "Factories") == 0) + return; + else if (ACE_OS::strcmp (props[i].nam.id[0], + "InitialNumberReplicas") == 0) + return; + else if (ACE_OS::strcmp (props[i].nam.id[0], + "MinimumNumberReplicas") == 0) + return; + else + ACE_THROW (LoadBalancing::UnsupportedProperty (props[i].nam)); + } +} + +// ----------------------------------------------------------- + +CORBA::Boolean +operator== (const LoadBalancing::Property &lhs, + const LoadBalancing::Property &rhs) +{ + // @todo Interim implementation until we figure out what to do when a + // property has multiple components. + CORBA::ULong lhs_len = lhs.length (); + CORBA::ULong rhs_len = rhs.length (); + + if (lhs_len != rhs_len) + return 0; + + for (CORBA::ULong i = 0; i < lhs_len; ++i) + if (ACE_OS::strcmp (lhs[i].id, rhs[i].id) != 0 + || ACE_OS::strcmp (lhs[i].kind, rhs[i].kind) != 0) + return 0; + + return 1; +} + +// ----------------------------------------------------------- + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +// Type-specific property hash map template instantiations +template class ACE_Hash_Map_Entry<const char *, LoadBalancing::Properties>; +template class ACE_Hash_Map_Manager_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Base_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; + +// ObjectGroup-specific property hash map template instantiations +template class ACE_Hash_Map_Entry<PortableServer::ObjectId, LoadBalancing::Properties>; +template class ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; + +template class ACE_Equal_To<PortableServer::ObjectId>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +// Type-specific property hash map template instantiations +#pragma instantiate ACE_Hash_Map_Entry<const char *, LoadBalancing::Properties> +#pragma instantiate ACE_Hash_Map_Manager_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> + +// ObjectGroup-specific property hash map template instantiations +#pragma instantiate ACE_Hash_Map_Entry<PortableServer::ObjectId, LoadBalancing::Properties> +#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> + +#pragma instantiate ACE_Equal_To<PortableServer::ObjectId> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/LB_PropertyManager.h b/TAO/orbsvcs/orbsvcs/LB_PropertyManager.h index 5a5c6e39561..493d42859e4 100644 --- a/TAO/orbsvcs/orbsvcs/LB_PropertyManager.h +++ b/TAO/orbsvcs/orbsvcs/LB_PropertyManager.h @@ -149,40 +149,48 @@ public: //@} -// /// Type-specific property hash map. -// typedef ACE_Hash_Map_Manager_Ex< -// const char *, -// LoadBalancing::Property, -// ACE_Hash<const ACE_TCHAR *>, -// TAO_LB_Property_Equal_To, -// ACE_SYNCH_MUTEX> Type_Prop_Table; - -// typedef ACE_Hash_Map_Manager_Ex< -// ACE_UINT32, // Use the FactoryCreationId as the hash. -// LoadBalancing::Property, -// ACE_Hash<ACE_UINT32>, -// TAO_LB_Property_Equal_To, -// ACE_SYNCH_MUTEX> Creation_Prop_Table; - -// typedef Creation_Prop_Table Dynamic_Prop_Table; + /// Type-specific property hash map. + typedef ACE_Hash_Map_Manager_Ex< + const ACE_TCHAR *, + LoadBalancing::Properties, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + TAO_SYNCH_MUTEX> Type_Prop_Table; + + /// Properties used when a given object group was created. + typedef ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + LoadBalancing::Properties, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + TAO_SYNCH_MUTEX> Creation_Prop_Table; + + /// Properties set at run time + typedef Creation_Prop_Table Dynamic_Prop_Table; private: - /// Table of global default object group properties. -// Default_Prop_Table default_properties_; + /// Default properties. + LoadBalancing::Properties default_properties_; -// /// Table of type-specific object group properties. -// Type_Prop_Table type_properties_; + /// Table of type-specific object group properties. + Type_Prop_Table type_properties_; -// /// Table of object group properties used when the object group was -// /// created. -// Creation_Prop_Table creation_properties_; + /// Table of object group properties used when the object group was + /// created. + Creation_Prop_Table creation_properties_; -// /// Table of object group properties used at run-time. -// Dynamic_Prop_Table dynamic_properties_; + /// Table of object group properties used at run-time. + Dynamic_Prop_Table dynamic_properties_; }; + +/// Property sequence equality operator. +CORBA::Boolean operator== (const LoadBalancing::Properties &lhs, + const LoadBalancing::Properties &rhs); + + #include "ace/post.h" #endif /* TAO_LB_PROPERTY_MANAGER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Equal_To.inl b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Equal_To.inl index 94b22dfb46f..e001d512e7f 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Equal_To.inl +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Equal_To.inl @@ -5,6 +5,8 @@ TAO_LB_Location_Equal_To::operator () ( const LoadBalancing::Location &lhs, const LoadBalancing::Location &rhs) { + // @todo Interim implementation until we figure out what to do when a + // location has multiple components. CORBA::ULong lhs_len = lhs.length (); CORBA::ULong rhs_len = rhs.length (); diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Hash.inl b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Hash.inl index c524a4f9598..1174194abae 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Hash.inl +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Location_Hash.inl @@ -6,6 +6,9 @@ ACE_INLINE CORBA::ULong TAO_LB_Location_Hash::operator() ( const LoadBalancing::Location &location) const { + // @todo Interim implementation until we figure out what to do when a + // location has multiple components. + CORBA::ULong len = location.length (); CORBA::ULong hash = 0; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroupManager.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroupManager.h index 2716b14c22d..8fc9dc11e32 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroupManager.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ObjectGroupManager.h @@ -173,6 +173,8 @@ private: /// Pointer to the ObjectGroup map. TAO_LB_ObjectGroup_Map &object_group_map_; + /// Map that contains list of all replicas at a given location. + TAO_LB_Location_Map location_map_; }; #endif /* TAO_LB_OBJECT_GROUP_MANAGER_H */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.cpp index 3893abbc868..835a4b5d450 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.cpp @@ -6,9 +6,13 @@ ACE_RCSID (LoadBalancing, LB_PropertyManager, "$Id$") -// TAO_LB_PropertyManager::TAO_LB_PropertyManager (void) -// { -// } +TAO_LB_PropertyManager::TAO_LB_PropertyManager (void) + : default_properties_ (), + type_properties_ (), + creation_properties_ (), + dynamic_properties_ () +{ +} void TAO_LB_PropertyManager::set_default_properties ( @@ -18,6 +22,10 @@ TAO_LB_PropertyManager::set_default_properties ( LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (props, ACE_TRY_ENV); + ACE_CHECK; + + this->default_properties_ = props; } LoadBalancing::Properties * @@ -25,33 +33,51 @@ TAO_LB_PropertyManager::get_default_properties ( CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); + LoadBalancing::Properties *props = 0; + ACE_NEW_THROW_EX (props, + LoadBalancing::Properties (this->default_properties_), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK_RETURN (0); + + return props; } void TAO_LB_PropertyManager::remove_default_properties ( - const LoadBalancing::Properties & props, + const LoadBalancing::Properties &props, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (props, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } void TAO_LB_PropertyManager::set_type_properties ( - const char * type_id, + const char * /* type_id */, const LoadBalancing::Properties & overrides, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (overrides, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } LoadBalancing::Properties * TAO_LB_PropertyManager::get_type_properties ( - const char * type_id, + const char * /* type_id */, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { @@ -60,13 +86,17 @@ TAO_LB_PropertyManager::get_type_properties ( void TAO_LB_PropertyManager::remove_type_properties ( - const char * type_id, + const char * /* type_id */, const LoadBalancing::Properties & props, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException, LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (props, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } void @@ -79,6 +109,10 @@ TAO_LB_PropertyManager::set_properties_dynamically ( LoadBalancing::InvalidProperty, LoadBalancing::UnsupportedProperty)) { + this->validate_properties (overrides, ACE_TRY_ENV); + ACE_CHECK; + + ACE_THROW (CORBA::NO_IMPLEMENT ()); } LoadBalancing::Properties * @@ -90,3 +124,91 @@ TAO_LB_PropertyManager::get_properties ( { ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); } + +void +TAO_LB_PropertyManager::validate_properties ( + const LoadBalancing::Properties & props, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((LoadBalancing::InvalidProperty, + LoadBalancing::UnsupportedProperty)) +{ + // @todo FIXME! Just a hack to get things going... + + CORBA::ULong len = props.length (); + for (CORBA::ULong i = 0; i < len; ++i) + { + if (ACE_OS::strcmp (props[i].nam.id[0], + "Factories") == 0) + return; + else if (ACE_OS::strcmp (props[i].nam.id[0], + "InitialNumberReplicas") == 0) + return; + else if (ACE_OS::strcmp (props[i].nam.id[0], + "MinimumNumberReplicas") == 0) + return; + else + ACE_THROW (LoadBalancing::UnsupportedProperty (props[i].nam)); + } +} + +// ----------------------------------------------------------- + +CORBA::Boolean +operator== (const LoadBalancing::Property &lhs, + const LoadBalancing::Property &rhs) +{ + // @todo Interim implementation until we figure out what to do when a + // property has multiple components. + CORBA::ULong lhs_len = lhs.length (); + CORBA::ULong rhs_len = rhs.length (); + + if (lhs_len != rhs_len) + return 0; + + for (CORBA::ULong i = 0; i < lhs_len; ++i) + if (ACE_OS::strcmp (lhs[i].id, rhs[i].id) != 0 + || ACE_OS::strcmp (lhs[i].kind, rhs[i].kind) != 0) + return 0; + + return 1; +} + +// ----------------------------------------------------------- + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +// Type-specific property hash map template instantiations +template class ACE_Hash_Map_Entry<const char *, LoadBalancing::Properties>; +template class ACE_Hash_Map_Manager_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Base_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX>; + +// ObjectGroup-specific property hash map template instantiations +template class ACE_Hash_Map_Entry<PortableServer::ObjectId, LoadBalancing::Properties>; +template class ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX>; + +template class ACE_Equal_To<PortableServer::ObjectId>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +// Type-specific property hash map template instantiations +#pragma instantiate ACE_Hash_Map_Entry<const char *, LoadBalancing::Properties> +#pragma instantiate ACE_Hash_Map_Manager_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<const char *, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> + +// ObjectGroup-specific property hash map template instantiations +#pragma instantiate ACE_Hash_Map_Entry<PortableServer::ObjectId, LoadBalancing::Properties> +#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectId, LoadBalancing::Properties, TAO_ObjectId_Hash, ACE_Equal_To<PortableServer::ObjectId>, TAO_SYNCH_MUTEX> + +#pragma instantiate ACE_Equal_To<PortableServer::ObjectId> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.h index 5a5c6e39561..493d42859e4 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_PropertyManager.h @@ -149,40 +149,48 @@ public: //@} -// /// Type-specific property hash map. -// typedef ACE_Hash_Map_Manager_Ex< -// const char *, -// LoadBalancing::Property, -// ACE_Hash<const ACE_TCHAR *>, -// TAO_LB_Property_Equal_To, -// ACE_SYNCH_MUTEX> Type_Prop_Table; - -// typedef ACE_Hash_Map_Manager_Ex< -// ACE_UINT32, // Use the FactoryCreationId as the hash. -// LoadBalancing::Property, -// ACE_Hash<ACE_UINT32>, -// TAO_LB_Property_Equal_To, -// ACE_SYNCH_MUTEX> Creation_Prop_Table; - -// typedef Creation_Prop_Table Dynamic_Prop_Table; + /// Type-specific property hash map. + typedef ACE_Hash_Map_Manager_Ex< + const ACE_TCHAR *, + LoadBalancing::Properties, + ACE_Hash<const ACE_TCHAR *>, + ACE_Equal_To<const ACE_TCHAR *>, + TAO_SYNCH_MUTEX> Type_Prop_Table; + + /// Properties used when a given object group was created. + typedef ACE_Hash_Map_Manager_Ex< + PortableServer::ObjectId, + LoadBalancing::Properties, + TAO_ObjectId_Hash, + ACE_Equal_To<PortableServer::ObjectId>, + TAO_SYNCH_MUTEX> Creation_Prop_Table; + + /// Properties set at run time + typedef Creation_Prop_Table Dynamic_Prop_Table; private: - /// Table of global default object group properties. -// Default_Prop_Table default_properties_; + /// Default properties. + LoadBalancing::Properties default_properties_; -// /// Table of type-specific object group properties. -// Type_Prop_Table type_properties_; + /// Table of type-specific object group properties. + Type_Prop_Table type_properties_; -// /// Table of object group properties used when the object group was -// /// created. -// Creation_Prop_Table creation_properties_; + /// Table of object group properties used when the object group was + /// created. + Creation_Prop_Table creation_properties_; -// /// Table of object group properties used at run-time. -// Dynamic_Prop_Table dynamic_properties_; + /// Table of object group properties used at run-time. + Dynamic_Prop_Table dynamic_properties_; }; + +/// Property sequence equality operator. +CORBA::Boolean operator== (const LoadBalancing::Properties &lhs, + const LoadBalancing::Properties &rhs); + + #include "ace/post.h" #endif /* TAO_LB_PROPERTY_MANAGER_H */ |