diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2013-02-25 17:40:02 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2013-02-25 17:40:02 +0000 |
commit | f48c86ccb384982513c88811c974c82327cb6f24 (patch) | |
tree | 56f392a3a31b9ad7e94d72a6b19d25b0dbe9dfe7 /TAO/orbsvcs/orbsvcs | |
parent | a18a931c129b12763fe4a29d6f0e9f9d99598003 (diff) | |
download | ATCD-f48c86ccb384982513c88811c974c82327cb6f24.tar.gz |
Mon Feb 25 17:32:02 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
Diffstat (limited to 'TAO/orbsvcs/orbsvcs')
15 files changed, 65 insertions, 94 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp index ba5b5f8aa20..d2aaabc01b2 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp @@ -672,17 +672,11 @@ TAO_FT_Naming_Manager::create_object ( //////////////////////////////// // find the properties for this // type of object group - ACE_Auto_Ptr<TAO::PG_Property_Set> typeid_properties + TAO::PG_Property_Set_var typeid_properties = (this->properties_support_.find_typeid_properties (type_id)); TAO::PG_Object_Group * group = this->group_factory_.create_group - ( type_id, - the_criteria, - typeid_properties.get (), - true); - - // The group now owns the properties. - typeid_properties.release (); + ( type_id, the_criteria, typeid_properties); group->set_name (object_name); diff --git a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.cpp b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.cpp index 93b03929f61..5890db3344d 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.cpp @@ -95,8 +95,7 @@ TAO::FT_PG_Group_Factory::create_persistent_group ( const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory) { TAO::PG_Object_Group_Storable * objectGroup = 0; @@ -111,7 +110,6 @@ TAO::FT_PG_Group_Factory::create_persistent_group ( type_id, the_criteria, type_properties, - give_properties, storable_factory ), CORBA::NO_MEMORY()); diff --git a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.h b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.h index b84f79f560b..4c411ed4e4d 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Group_Factory.h @@ -62,8 +62,7 @@ namespace TAO const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory); virtual PG_Object_Group_Storable * restore_persistent_group ( diff --git a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.cpp b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.cpp index 8328eeccd61..546e1a7e54d 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.cpp @@ -16,8 +16,7 @@ TAO::FT_PG_Object_Group_Storable::FT_PG_Object_Group_Storable ( const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory) : PG_Object_Group_Storable(orb, factory_registry, @@ -27,7 +26,6 @@ TAO::FT_PG_Object_Group_Storable::FT_PG_Object_Group_Storable ( type_id, the_criteria, type_properties, - give_properties, storable_factory) , stale_ (false) , file_created_ (false) diff --git a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.h b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.h index 463299b70df..e5e146441ce 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.h +++ b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_PG_Object_Group_Storable.h @@ -58,8 +58,7 @@ namespace TAO const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory); /** diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.cpp index a076a89352f..50c7f85edcc 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.cpp @@ -102,8 +102,7 @@ void TAO::PG_Group_Factory::init ( 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, - bool give_properties) + const TAO::PG_Property_Set_var & typeid_properties) { /////////////////////////////////// // Create an empty group reference @@ -151,7 +150,6 @@ TAO::PG_Object_Group * TAO::PG_Group_Factory::create_group ( type_id, the_criteria, typeid_properties, - give_properties, *storable_factory_); this->list_store_->add(group_id); @@ -168,9 +166,7 @@ TAO::PG_Object_Group * TAO::PG_Group_Factory::create_group ( tagged_component, type_id, the_criteria, - typeid_properties, - give_properties - ), + typeid_properties), CORBA::NO_MEMORY()); } @@ -452,8 +448,7 @@ TAO::PG_Group_Factory::create_persistent_group ( const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory) { TAO::PG_Object_Group_Storable * objectGroup = 0; @@ -468,7 +463,6 @@ TAO::PG_Group_Factory::create_persistent_group ( type_id, the_criteria, type_properties, - give_properties, storable_factory ), CORBA::NO_MEMORY()); diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.h index 0c857a1c46d..faefba948b0 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Group_Factory.h @@ -23,6 +23,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "orbsvcs/PortableGroup/PG_Object_Group_Manipulator.h" +#include "orbsvcs/PortableGroup/PG_Property_Set.h" #include "orbsvcs/PortableGroupC.h" #include "tao/PortableServer/PortableServer.h" @@ -37,7 +38,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Forward references namespace TAO { - class PG_Property_Set; class PG_Group_List_Store; class PG_Object_Group_Storable; class Storable_Factory; @@ -91,8 +91,7 @@ namespace TAO TAO::PG_Object_Group * create_group ( const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * typeid_properties, - bool give_props); + const TAO::PG_Property_Set_var & typeid_properties); void delete_group (PortableGroup::ObjectGroup_ptr object_group); @@ -183,8 +182,7 @@ namespace TAO const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory); /** diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp index 0af413fc6b1..22e1f86fcc8 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.cpp @@ -59,8 +59,7 @@ TAO::PG_Object_Group::PG_Object_Group ( const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties) + const TAO::PG_Property_Set_var & type_properties) : internals_() , orb_ (CORBA::ORB::_duplicate (orb)) , factory_registry_ (PortableGroup::FactoryRegistry::_duplicate (factory_registry)) @@ -74,7 +73,7 @@ TAO::PG_Object_Group::PG_Object_Group ( , group_name_ (0) , members_ () , primary_location_(0) - , properties_ (the_criteria, type_properties, give_properties) + , properties_ (the_criteria, type_properties) , initial_number_members_ (0) , minimum_number_members_ (0) , group_specific_factories_ () diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h index 921577917f8..47cb2d1e0cb 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group.h @@ -126,9 +126,7 @@ namespace TAO const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_proprerties); - + const TAO::PG_Property_Set_var & type_properties); /** * This constructor is to be used for initialization when * reading the object group from a stream. diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp index 02c641822bc..ea14855054b 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.cpp @@ -150,8 +150,7 @@ TAO::PG_Object_Group_Storable::PG_Object_Group_Storable ( const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory) : PG_Object_Group(orb, factory_registry, @@ -160,8 +159,7 @@ TAO::PG_Object_Group_Storable::PG_Object_Group_Storable ( tagged_component, type_id, the_criteria, - type_properties, - give_properties) + type_properties) , group_previously_stored_(false) , group_id_previously_stored_(0) , storable_factory_ (storable_factory) diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.h index 5002315a946..ad44d4a98d8 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Object_Group_Storable.h @@ -65,8 +65,7 @@ namespace TAO const PortableGroup::TagGroupTaggedComponent & tagged_component, const char * type_id, const PortableGroup::Criteria & the_criteria, - TAO::PG_Property_Set * type_properties, - bool give_properties, + const TAO::PG_Property_Set_var & type_properties, TAO::Storable_Factory & storable_factory); /** diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp index 34854b00079..625182a319d 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp @@ -18,22 +18,27 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::PG_Properties_Support::PG_Properties_Support () { + TAO::PG_Property_Set *props; + ACE_NEW_THROW_EX (props, + TAO::PG_Property_Set (), + CORBA::NO_MEMORY()); + this->default_properties_.reset (props); } TAO::PG_Properties_Support::~PG_Properties_Support () { - + this->properties_map_.unbind_all (); } void TAO::PG_Properties_Support::set_default_property (const char * name, const PortableGroup::Value & value) { - this->default_properties_.set_property(name, value); + this->default_properties_->set_property(name, value); } void TAO::PG_Properties_Support::set_default_properties (const PortableGroup::Properties & props) { - this->default_properties_.decode (props); + this->default_properties_->decode (props); } PortableGroup::Properties * @@ -41,14 +46,14 @@ TAO::PG_Properties_Support::get_default_properties () { PortableGroup::Properties_var result; ACE_NEW_THROW_EX ( result, PortableGroup::Properties(), CORBA::NO_MEMORY()); - this->default_properties_.export_properties (*result); + this->default_properties_->export_properties (*result); return result._retn (); } void TAO::PG_Properties_Support::remove_default_properties ( const PortableGroup::Properties & props) { - this->default_properties_.remove (props); + this->default_properties_->remove (props); } void @@ -58,13 +63,15 @@ TAO::PG_Properties_Support::set_type_properties ( { ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); - TAO::PG_Property_Set * typeid_properties = 0; + TAO::PG_Property_Set_var typeid_properties; if ( 0 != this->properties_map_.find (type_id, typeid_properties)) { - ACE_NEW_THROW_EX ( - typeid_properties, - TAO::PG_Property_Set (overrides, & this->default_properties_, false), - CORBA::NO_MEMORY()); + TAO::PG_Property_Set *props; + ACE_NEW_THROW_EX (props, + TAO::PG_Property_Set (overrides, + this->default_properties_), + CORBA::NO_MEMORY()); + typeid_properties.reset (props); this->properties_map_.bind (type_id, typeid_properties); } typeid_properties->clear (); @@ -80,7 +87,7 @@ TAO::PG_Properties_Support::get_type_properties ( ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0); - TAO::PG_Property_Set * typeid_properties = 0; + TAO::PG_Property_Set_var typeid_properties; if ( 0 != this->properties_map_.find (type_id, typeid_properties)) { typeid_properties->export_properties (*result); @@ -100,7 +107,7 @@ TAO::PG_Properties_Support::remove_type_properties ( ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); - TAO::PG_Property_Set * typeid_properties = 0; + TAO::PG_Property_Set_var typeid_properties; if ( 0 != this->properties_map_.find (type_id, typeid_properties)) { typeid_properties->remove (props); @@ -108,22 +115,22 @@ TAO::PG_Properties_Support::remove_type_properties ( } -TAO::PG_Property_Set * -TAO::PG_Properties_Support::find_typeid_properties ( - const char *type_id) +TAO::PG_Property_Set_var +TAO::PG_Properties_Support::find_typeid_properties (const char *type_id) { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, 0); + TAO::PG_Property_Set_var result; + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->internals_, result); - TAO::PG_Property_Set * typeid_properties = 0; - if ( 0 != this->properties_map_.find (type_id, typeid_properties)) + if ( 0 != this->properties_map_.find (type_id, result)) { - ACE_NEW_THROW_EX ( - typeid_properties, - TAO::PG_Property_Set (& this->default_properties_, false), - CORBA::NO_MEMORY()); - this->properties_map_.bind (type_id, typeid_properties); + TAO::PG_Property_Set * props; + ACE_NEW_THROW_EX (props, + TAO::PG_Property_Set (this->default_properties_), + CORBA::NO_MEMORY()); + result.reset (props); + this->properties_map_.bind (type_id, result); } - return typeid_properties; + return result; } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h index 7af594f10f0..a59d33b7b89 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h @@ -54,11 +54,11 @@ namespace TAO { typedef ACE_Hash_Map_Manager< ACE_CString, - ::TAO::PG_Property_Set *, + ::TAO::PG_Property_Set_var, TAO_SYNCH_MUTEX> Properties_Map; typedef ACE_Hash_Map_Iterator< ACE_CString, - ::TAO::PG_Property_Set *, + ::TAO::PG_Property_Set_var, TAO_SYNCH_MUTEX> Properties_Map_Iterator; public: @@ -157,7 +157,7 @@ namespace TAO * @param type_id identifies the set of properties to be found. * @returns a pointer to a Property_Set owned by this Properties_Support object. */ - TAO::PG_Property_Set * find_typeid_properties ( + TAO::PG_Property_Set_var find_typeid_properties ( const char *type_id); /** @@ -182,7 +182,7 @@ namespace TAO TAO_SYNCH_MUTEX internals_; /// The default property set. - TAO::PG_Property_Set default_properties_; + TAO::PG_Property_Set_var default_properties_; /// A collection of property sets indexed by type_id. Properties_Map properties_map_; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp index d49b666346c..5acf71e1773 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp @@ -33,27 +33,21 @@ TAO::PG_Property_Set::PG_Property_Set (const PortableGroup::Properties & ps) } TAO::PG_Property_Set::PG_Property_Set (const PortableGroup::Properties & ps, - PG_Property_Set * defaults, - bool own_defaults) - : defaults_ (defaults), - own_defaults_ (own_defaults) + const PG_Property_Set_var & defaults) + : defaults_ (defaults) { this->decode (ps); } -TAO::PG_Property_Set::PG_Property_Set (PG_Property_Set * defaults, - bool own_defaults) - : defaults_ (defaults), - own_defaults_ (own_defaults) +TAO::PG_Property_Set::PG_Property_Set (const PG_Property_Set_var & defaults) + : defaults_ (defaults) { } TAO::PG_Property_Set::~PG_Property_Set () { this->clear (); - if (this->own_defaults_) - delete this->defaults_; } void diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h index 2ebac7767ad..bc712a1b5ca 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h @@ -27,12 +27,16 @@ #include "ace/Hash_Map_Manager.h" #include "ace/SString.h" #include "ace/Null_Mutex.h" +#include "ace/Refcounted_Auto_Ptr.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { + class PG_Property_Set; + typedef ACE_Refcounted_Auto_Ptr<PG_Property_Set, TAO_SYNCH_MUTEX> PG_Property_Set_var; + /** * The PG_Property_Set captures the set of properties from a * PortableGroup::Properties structure in a more usable format (a @@ -78,17 +82,14 @@ namespace TAO * @param defaults a propert set decoder that supplies default values. */ PG_Property_Set (const PortableGroup::Properties & property_set, - PG_Property_Set * defaults, - bool own_defaults); + const PG_Property_Set_var & defaults); /** * constructor with defaults, but no properties (yet) * (note this is not a copy constructor) * @param defaults a propert set decoder that supplies default values. */ - PG_Property_Set (PG_Property_Set * defaults, - bool own_defaults); - + PG_Property_Set (const PG_Property_Set_var & defaults); ~PG_Property_Set (); @@ -102,7 +103,7 @@ namespace TAO * @param pValue an out parameter to receive a pointer to the Any containing the value * @returns boolean true if found */ - int find (const ACE_CString & key, const PortableGroup::Value *& pValue)const; + int find (const ACE_CString & key, const PortableGroup::Value *& pValue) const; /** @@ -166,13 +167,8 @@ namespace TAO /** * a parent to another property decoder that provides default values * these can be chained indefinitely. - * @todo reference counted pointers would be a good idea here. - */ - PG_Property_Set * defaults_; - /** - * flag denoting ownership of the defaults. */ - bool own_defaults_; + PG_Property_Set_var defaults_; }; |