diff options
author | bala <balanatarajan@users.noreply.github.com> | 2003-09-27 00:33:03 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2003-09-27 00:33:03 +0000 |
commit | ebb060513f20c21db4bcc4f437d90b6f3d6162fa (patch) | |
tree | c4a887d3f19ec0829892303d28b60dabb6097c1b | |
parent | e2c96ffc42a809fe175682e13dfeb239296dc78f (diff) | |
download | ATCD-ebb060513f20c21db4bcc4f437d90b6f3d6162fa.tar.gz |
ChangeLogTag:Fri Sep 26 19:31:11 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp | 54 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp | 20 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp | 169 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.h | 53 |
8 files changed, 285 insertions, 57 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index ea259fc6385..4a5e80e4572 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,18 @@ +Fri Sep 26 19:31:11 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + * orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp (TAO): + * orbsvcs/orbsvcs/PortableGroup/PG_Utils.h: Moved group reference + manipulation functions to a new file which will be used within + the PortableGroup. + + * orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h: + * orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp: Fixed + warnings and errors with g++ builds. + + Thu Sep 25 16:08:35 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp: diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp index bd5501e6f0d..992cd3778cd 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_GenericFactory.cpp @@ -124,7 +124,7 @@ TAO_PG_GenericFactory::create_object ( } { - int _todo_get_the_domain_id_from_somewhere_; + // int _todo_get_the_domain_id_from_somewhere_; } const char * domain_id = "dummy-domain-id"; @@ -239,7 +239,7 @@ TAO_PG_GenericFactory::delete_object ( //TODO - fix this code. Factory-ids and group-ids are now different { - int _todo_fix_temporarily_disabled_code_; + // int _todo_fix_temporarily_disabled_code_; } #if 0 PortableServer::ObjectId_var oid; @@ -250,7 +250,7 @@ TAO_PG_GenericFactory::delete_object ( oid.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK; -#endif 0 +#endif } } else @@ -312,16 +312,16 @@ TAO_PG_GenericFactory::delete_object_i (TAO_PG_Factory_Set & factory_set, void TAO_PG_GenericFactory::delete_member ( - PortableGroup::ObjectGroupId group_id, - const PortableGroup::Location & location - ACE_ENV_ARG_DECL) + PortableGroup::ObjectGroupId , + const PortableGroup::Location & + ACE_ENV_ARG_DECL_NOT_USED) { //TODO - Fix this code. The original implementation for the load balancer assumed // that the factory-creation-id was the same as the object-group-id. This // is not longer true. The find below is supposed to be a factory-creation-id. { - int _todo_fix_temporarily_disabled_code_; + // int _todo_fix_temporarily_disabled_code_; } return; @@ -600,17 +600,17 @@ TAO_PG_GenericFactory::process_criteria ( void TAO_PG_GenericFactory::check_minimum_number_members ( - PortableGroup::ObjectGroup_ptr object_group, - PortableGroup::ObjectGroupId group_id, - const char * type_id - ACE_ENV_ARG_DECL) + PortableGroup::ObjectGroup_ptr , + PortableGroup::ObjectGroupId , + const char * + ACE_ENV_ARG_DECL_NOT_USED) { //TODO - Fix this code. The original implementation for the load balancer assumed // that the factory-creation-id was the same as the object-group-id. This // is not longer true. The find below is supposed to be a factory-creation-id. { - int _todo_fix_temporarily_disabled_code_; + // int _todo_fix_temporarily_disabled_code_; } return; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp index bb6aa2658c9..c780d6716b0 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.cpp @@ -2,7 +2,7 @@ #include "PG_GenericFactory.h" #include "PG_conf.h" #include "PG_Operators.h" -#include "orbsvcs/FaultTolerance/FT_Service_Activate.h" +#include "PG_Utils.h" #include "tao/debug.h" @@ -487,11 +487,9 @@ TAO_PG_ObjectGroupManager::create_object_group ( type_id ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - { int _TODO_replace_this_with_commemted_out_version_; } - FT::TagFTGroupTaggedComponent tag_component; - // PortableGroup::TagGroupTaggedComponent tag_component; - TAO_FT_IOGR_Property prop (tag_component); + + // { int _TODO_replace_this_with_commemted_out_version_; } + PortableGroup::TagGroupTaggedComponent tag_component; tag_component.component_version.major = (CORBA::Octet) 1; tag_component.component_version.minor = (CORBA::Octet) 0; @@ -500,10 +498,9 @@ TAO_PG_ObjectGroupManager::create_object_group ( tag_component.object_group_ref_version = 0; // Set the property - iorm_->set_property (&prop, - object_group.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + TAO::PG_Utils::set_tagged_component (object_group.in (), + tag_component); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); TAO_PG_ObjectGroup_Map_Entry * group_entry = 0; ACE_NEW_THROW_EX (group_entry, @@ -527,17 +524,18 @@ TAO_PG_ObjectGroupManager::create_object_group ( CORBA::ULong len = the_criteria.length (); group_entry->properties.length (len); + for (CORBA::ULong i = 0; i < len; ++i) group_entry->properties[i] = the_criteria[i]; - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->lock_, - 0); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->lock_, + 0); - if (this->object_group_map_.bind (group_id, group_entry) != 0) - ACE_THROW_RETURN (PortableGroup::ObjectNotCreated (), - PortableGroup::ObjectGroup::_nil ()); + if (this->object_group_map_.bind (group_id, group_entry) != 0) + ACE_THROW_RETURN (PortableGroup::ObjectNotCreated (), + PortableGroup::ObjectGroup::_nil ()); (void) safe_group_entry.release (); @@ -585,17 +583,16 @@ TAO_PG_ObjectGroupManager::object_group (const PortableServer::ObjectId & oid) PortableGroup::ObjectGroup::_nil ()); { -//TODO -- need to fix this code. The LoadBalancer uses this. -// Need to implement some sort of objectId-to-ObjectGroup nmap. - int _todo_fix_temporarily_disabled_code_; -} + //TODO -- need to fix this code. The LoadBalancer uses this. + // Need to implement some sort of objectId-to-ObjectGroup nmap. + // int _todo_fix_temporarily_disabled_code_; #if 0 TAO_PG_ObjectGroup_Map_Entry * group_entry = 0; if (this->object_group_map_.find (group_id, group_entry) == 0) return PortableGroup::ObjectGroup::_duplicate (group_entry->object_group.in ()); else -#endif 0 +#endif return PortableGroup::ObjectGroup::_nil (); } @@ -712,16 +709,11 @@ TAO_PG_ObjectGroupManager::get_group_entry ( if (CORBA::is_nil (this->poa_.in ())) ACE_THROW_RETURN (CORBA::INTERNAL (), 0); - { int _TODO_replace_this_with_commemted_out_version_; } - FT::TagFTGroupTaggedComponent tc; + // { int _TODO_replace_this_with_commemted_out_version_; } // extract the group_id from the object group reference - //PortableGroup::TagGroupTaggedComponent tc; - TAO_FT_IOGR_Property tmp_prop; - - tmp_prop.get_tagged_component (object_group, - tc - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + PortableGroup::TagGroupTaggedComponent tc; + TAO::PG_Utils::get_tagged_component (object_group, + tc); PortableGroup::ObjectGroupId group_id = tc.object_group_id; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h index 027c0e74720..c5da41a23f1 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroupManager.h @@ -25,11 +25,10 @@ #include "PG_ObjectGroup_Map.h" #include "PG_Location_Map.h" + #include "tao/PortableServer/Key_Adapters.h" #include "tao/PortableServer/PortableServerC.h" -#include "orbsvcs/FT_CORBA_ORBC.h" -#include "orbsvcs/FaultTolerance/FT_IOGR_Property.h" - +#include "tao/IORManipulation/IORManip_Loader.h" /// Forward declarations class TAO_PG_GenericFactory; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp index 7621b403ed7..3cf6b42ede6 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_ObjectGroup_Map.cpp @@ -8,18 +8,18 @@ ACE_RCSID (PortableGroup, #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Hash_Map_Entry<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *>; -template class ACE_Hash_Map_Manager_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Entry<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *>; +template class ACE_Hash_Map_Manager_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Hash_Map_Entry<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *> -#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableServer::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +#pragma instantiate ACE_Hash_Map_Entry<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *> +#pragma instantiate ACE_Hash_Map_Manager_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +#pragma instantiate ACE_Hash_Map_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<PortableGroup::ObjectGroupId, TAO_PG_ObjectGroup_Map_Entry *, ACE_Hash<ACE_UINT64>, ACE_Equal_To<ACE_UINT64>, ACE_Null_Mutex>; #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp index 355e36144dc..8b17a4425f6 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Utils.cpp @@ -34,7 +34,7 @@ TAO_PG::override_properties ( return; const CORBA::ULong old_length = properties.length (); - const CORBA::ULong new_length = old_length; + // const CORBA::ULong new_length = old_length; // @@ Slow O(n^2) operation. Note that it may be slower than O(n^2) // if the length of the property sequence must be increased diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp new file mode 100644 index 00000000000..a232f64dcf3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp @@ -0,0 +1,169 @@ +#include "PG_Utils.h" +#include "tao/MProfile.h" +#include "tao/Profile.h" +#include "tao/Stub.h" +#include "tao/Tagged_Components.h" + +ACE_RCSID (PortableGroup, + PG_Utils, + "$Id$") +namespace TAO +{ + /*static*/ CORBA::Boolean + PG_Utils::set_tagged_component ( + PortableGroup::ObjectGroup *&ior, + PortableGroup::TagGroupTaggedComponent &tg) + { + if (ior->_stubobj () == 0) + return 0; + + // We need to apply the property for every profile in the IOR + TAO_MProfile &tmp_pfiles = + ior->_stubobj ()->base_profiles (); + + // Create the output CDR stream + TAO_OutputCDR cdr; + + IOP::TaggedComponent tagged_components; + tagged_components.tag = IOP::TAG_FT_GROUP; + + // Encode the property in to the tagged_components + CORBA::Boolean retval = + PG_Utils::encode_properties (cdr, + tg); + + if (retval == 0) + return retval; + + // Get the length of the CDR stream + CORBA::ULong length = ACE_static_cast (CORBA::ULong, + cdr.total_length ()); + + // Set the length + tagged_components.component_data.length (length); + + // Get the pointer to the underlying buffer + CORBA::Octet *buf = + tagged_components.component_data.get_buffer (); + + for (const ACE_Message_Block *i = cdr.begin (); + i != 0; + i = i->cont ()) + { + + ACE_OS::memcpy (buf, i->rd_ptr (), i->length ()); + buf += i->length (); + } + const IOP::TaggedComponent &tmp_tc = tagged_components; + + // Get the profile count. + CORBA::ULong count = + ior->_stubobj ()->base_profiles ().profile_count (); + + // Go through every profile and set the TaggedComponent field + for (CORBA::ULong i = 0; i < count ; i++) + { + // Get the tagged components in the profile + TAO_Tagged_Components &tag_comp = + tmp_pfiles.get_profile (i)->tagged_components (); + + // Finally set the <tagged_component> in the + // <TAO_Tagged_Component> + tag_comp.set_component (tmp_tc); + } + + // Success + return 1; + } + + /*static*/ CORBA::Boolean + PG_Utils::get_tagged_component ( + PortableGroup::ObjectGroup *&ior, + PortableGroup::TagGroupTaggedComponent &tg) + { + if (ior->_stubobj () == 0) + return 0; + + TAO_MProfile &mprofile = + ior->_stubobj ()->base_profiles (); + + // Looking for a tagged component with a TAG_FT_GROUP flag. + IOP::TaggedComponent tc; + tc.tag = IOP::TAG_FT_GROUP; + + CORBA::ULong count = + mprofile.profile_count (); + + for (CORBA::ULong i = 0; + i < count; + i++) + { + + // Get the Tagged Components + const TAO_Tagged_Components &pfile_tagged = + mprofile.get_profile (i)->tagged_components (); + + // Look for the primary + if (pfile_tagged.get_component (tc) == 1) + { + TAO_InputCDR cdr (ACE_reinterpret_cast ( + const char*, + tc.component_data.get_buffer ()), + tc.component_data.length ()); + + CORBA::Boolean byte_order; + + cdr >> ACE_InputCDR::to_boolean (byte_order); + + if (!cdr.good_bit ()) + return 0; + + cdr.reset_byte_order (ACE_static_cast (int,byte_order)); + + cdr >> tg; + + if (cdr.good_bit ()) + return 1; + } + } + + return 0; + } + + CORBA::Boolean + PG_Utils::encode_properties ( + TAO_OutputCDR &cdr, + PortableGroup::TagGroupTaggedComponent &tg) + { + cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); + + if (!cdr.good_bit ()) + return 0; + + // the version info + cdr << tg.component_version; + + if (!cdr.good_bit ()) + return 0; + + // the domain id + cdr << tg.group_domain_id.in (); + + if (!cdr.good_bit ()) + return 0; + + // Object group id + cdr << tg.object_group_id; + + if (!cdr.good_bit ()) + return 0; + + // Object group reference version + cdr << tg.object_group_ref_version; + + if (!cdr.good_bit ()) + return 0; + + return cdr.good_bit (); + } +} diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.h new file mode 100644 index 00000000000..27c548d94c5 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Utils.h @@ -0,0 +1,53 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file PG_Utils.h + * + * $Id$ + * + * Utility methods + * + * @author Balachandran Natarajan <bala@dre.vanderbilt.edu> + */ +//============================================================================= +#ifndef TAO_PORTABLEGROUP_UTILS_H +#define TAO_PORTABLEGROUP_UTILS_H +#include /**/ "ace/pre.h" +#include "orbsvcs/PortableGroupC.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace TAO +{ + /** + * @class PG_Utils + * + * @brief Simple utility class + */ + class TAO_PortableGroup_Export PG_Utils + { + public: + + /// Set tagged component for the object group + static CORBA::Boolean set_tagged_component ( + PortableGroup::ObjectGroup *&ior, + PortableGroup::TagGroupTaggedComponent &t); + + /// Get tagged component for the object group + static CORBA::Boolean get_tagged_component ( + PortableGroup::ObjectGroup *&ior, + PortableGroup::TagGroupTaggedComponent &t); + + private: + static CORBA::Boolean encode_properties ( + TAO_OutputCDR &cdr, + PortableGroup::TagGroupTaggedComponent &tg); + }; +} + + + +#include /**/ "ace/post.h" +#endif /*TAO_PORTABLEGROUP_UTILS_H*/ |