diff options
author | sbw1 <sbw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-03-14 08:03:06 +0000 |
---|---|---|
committer | sbw1 <sbw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-03-14 08:03:06 +0000 |
commit | 817ead6178656f5632a788c2c7ebb37226192411 (patch) | |
tree | 35005a1cae7ba9125c38c4b5d6cc0843e1dc43b3 /TAO | |
parent | 1b929b8c458a3fc9416ff0fb4120d0349b9c2f07 (diff) | |
download | ATCD-817ead6178656f5632a788c2c7ebb37226192411.tar.gz |
Fixed innumerable little bugs in the port
Diffstat (limited to 'TAO')
58 files changed, 2157 insertions, 2115 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Admin.cpp b/TAO/orbsvcs/orbsvcs/Trader/Admin.cpp index 6f98bcc5a2a..2b6fee7e5e7 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Admin.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Admin.cpp @@ -25,7 +25,11 @@ const char* TAO_Admin<TRADER>::NAME = "Trader: Admin"; template <class TRADER> TAO_Admin<TRADER>::TAO_Admin (TRADER &trader) - : trader_ (trader) + : trader_ (trader), + TAO_Trader_Components <POA_CosTrading::Admin> (trader.trading_components ()), + TAO_Import_Attributes <POA_CosTrading::Admin> (trader.import_attributes ()), + TAO_Support_Attributes <POA_CosTrading::Admin> (trader.support_attributes ()), + TAO_Link_Attributes <POA_CosTrading::Admin> (trader.link_attributes ()) { } @@ -36,15 +40,15 @@ TAO_Admin<TRADER>::~TAO_Admin (void) template <class TRADER> CosTrading::Admin::OctetSeq * TAO_Admin<TRADER>::request_id_stem (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { - TAO_THROW (CORBA::SystemException ()); + return 0; } template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_def_search_card (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().def_search_card (); @@ -56,7 +60,7 @@ TAO_Admin<TRADER>::set_def_search_card (CORBA::ULong value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_max_search_card (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().max_search_card (); @@ -68,7 +72,7 @@ TAO_Admin<TRADER>::set_max_search_card (CORBA::ULong value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_def_match_card (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().def_match_card (); @@ -80,7 +84,7 @@ TAO_Admin<TRADER>::set_def_match_card (CORBA::ULong value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_max_match_card (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().max_match_card (); @@ -92,7 +96,7 @@ TAO_Admin<TRADER>::set_max_match_card (CORBA::ULong value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_def_return_card (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().def_return_card (); @@ -104,7 +108,7 @@ TAO_Admin<TRADER>::set_def_return_card (CORBA::ULong value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_max_return_card (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().max_return_card (); @@ -116,7 +120,7 @@ TAO_Admin<TRADER>::set_max_return_card (CORBA::ULong value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_max_list (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().max_list (); @@ -129,7 +133,7 @@ template <class TRADER> CORBA::Boolean TAO_Admin<TRADER>:: set_supports_modifiable_properties (CORBA::Boolean value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::Boolean return_value = this->trader_.support_attributes ().supports_modifiable_properties (); @@ -142,7 +146,7 @@ template <class TRADER> CORBA::Boolean TAO_Admin<TRADER>:: set_supports_dynamic_properties (CORBA::Boolean value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::Boolean return_value = this->trader_.support_attributes ().supports_dynamic_properties (); @@ -154,7 +158,7 @@ set_supports_dynamic_properties (CORBA::Boolean value, template <class TRADER> CORBA::Boolean TAO_Admin<TRADER>::set_supports_proxy_offers (CORBA::Boolean value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::Boolean return_value = this->trader_.support_attributes ().supports_proxy_offers (); @@ -166,7 +170,7 @@ TAO_Admin<TRADER>::set_supports_proxy_offers (CORBA::Boolean value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_def_hop_count (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().def_hop_count (); @@ -178,7 +182,7 @@ TAO_Admin<TRADER>::set_def_hop_count (CORBA::ULong value, template <class TRADER> CORBA::ULong TAO_Admin<TRADER>::set_max_hop_count (CORBA::ULong value, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong return_value = this->trader_.import_attributes ().max_hop_count (); @@ -190,7 +194,7 @@ TAO_Admin<TRADER>::set_max_hop_count (CORBA::ULong value, template <class TRADER> CosTrading::FollowOption TAO_Admin<TRADER>::set_def_follow_policy (CosTrading::FollowOption policy, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CosTrading::FollowOption return_value = this->trader_.import_attributes ().def_follow_policy (); @@ -202,7 +206,7 @@ TAO_Admin<TRADER>::set_def_follow_policy (CosTrading::FollowOption policy, template <class TRADER> CosTrading::FollowOption TAO_Admin<TRADER>::set_max_follow_policy (CosTrading::FollowOption policy, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CosTrading::FollowOption return_value = this->trader_.import_attributes ().max_follow_policy (); @@ -215,7 +219,7 @@ template <class TRADER> CosTrading::FollowOption TAO_Admin<TRADER>:: set_max_link_follow_policy (CosTrading::FollowOption policy, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { CosTrading::FollowOption return_value = this->trader_.link_attributes ().max_link_follow_policy (); @@ -225,9 +229,10 @@ set_max_link_follow_policy (CosTrading::FollowOption policy, } template <class TRADER> CosTrading::TypeRepository_ptr -TAO_Admin<TRADER>::set_type_repos (CosTrading::TypeRepository_ptr repository, - CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) +TAO_Admin<TRADER>:: +set_type_repos (CosTrading::TypeRepository_ptr repository, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) { CosTrading::TypeRepository_ptr return_value = this->trader_.support_attributes ().type_repos (); @@ -239,9 +244,9 @@ TAO_Admin<TRADER>::set_type_repos (CosTrading::TypeRepository_ptr repository, template <class TRADER> CosTrading::Admin::OctetSeq* TAO_Admin<TRADER>::set_request_id_stem (const CosTrading::Admin::OctetSeq& stem, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { - TAO_THROW (CORBA::SystemException ()); + return 0; } template <class TRADER> void @@ -249,7 +254,7 @@ TAO_Admin<TRADER>::list_offers (CORBA::ULong how_many, CosTrading::OfferIdSeq_out ids, CosTrading::OfferIdIterator_out id_itr, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException,) CosTrading::NotImplemented) { // This method only applies when the register interface is implemented @@ -258,28 +263,22 @@ TAO_Admin<TRADER>::list_offers (CORBA::ULong how_many, TRADER::SERVICE_TYPE_MAP& type_map = this->trader_.service_type_map(); - CosTrading::OfferIdIterator_ptr oi = type_map.retrieve_all_offer_ids (); - + CosTrading::OfferIdIterator_ptr oi = + type_map.retrieve_all_offer_ids ()->_this (_env); + TAO_CHECK_ENV_RETURN (_env,); + id_itr = CosTrading::OfferIdIterator::_nil (); if (how_many > 0) { - if (oi->next_n(how_many, ids) == (CORBA::Boolean)0) + if (oi->next_n (how_many, ids, _env) == (CORBA::Boolean)0) { // No more items left in the iterator. - oi->destroy(); - oi = CosTrading::OfferIdIterator::_nil(); + oi->destroy (_env); + oi = CosTrading::OfferIdIterator::_nil (); } } else ids = new CosTrading::OfferIdSeq(0); - - // Register the iterator with the orb. - if (! CORBA::is_nil (oi)) - { - CORBA::BOA_var boa = _boa(); - id_itr = oi->_duplicate (oi); - boa->obj_is_ready (id_itr); - } } template <class TRADER> void @@ -287,178 +286,10 @@ TAO_Admin<TRADER>::list_proxies (CORBA::ULong how_many, CosTrading::OfferIdSeq_out ids, CosTrading::OfferIdIterator_out id_itr, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::NotImplemented) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::NotImplemented)) { TAO_THROW (CosTrading::NotImplemented ()); } -template <class TRADER> -CosTrading::Lookup_ptr -TAO_Admin<TRADER>::lookup_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Lookup::_duplicate (this->trader_.trading_components ().lookup_if ()); -} - -template <class TRADER> -CosTrading::Register_ptr -TAO_Admin<TRADER>::register_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Register::_duplicate (this->trader_.trading_components ().register_if ()); -} - -template <class TRADER> -CosTrading::Link_ptr -TAO_Admin<TRADER>::link_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Link::_duplicate (this->trader_.trading_components ().link_if ()); -} - -template <class TRADER> -CosTrading::Proxy_ptr -TAO_Admin<TRADER>::proxy_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Proxy::_duplicate (this->trader_.trading_components ().proxy_if ()); -} - -template <class TRADER> -CosTrading::Admin_ptr -TAO_Admin<TRADER>::admin_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Admin::_duplicate (this->trader_.trading_components ().admin_if ()); -} - -template <class TRADER> -CORBA::Boolean -TAO_Admin<TRADER>::supports_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_modifiable_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Admin<TRADER>::supports_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_dynamic_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Admin<TRADER>::supports_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_proxy_offers (); -} - -template <class TRADER> -CosTrading::TypeRepository_ptr -TAO_Admin<TRADER>::type_repos (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::TypeRepository::_duplicate - (this->trader_.support_attributes ().type_repos ()); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::def_search_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_search_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::max_search_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_search_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::def_match_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_match_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::max_match_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_match_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::def_return_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_return_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::max_return_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_return_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::max_list (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_list (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::def_hop_count (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_hop_count (); -} - -template <class TRADER> -CORBA::ULong -TAO_Admin<TRADER>::max_hop_count (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_hop_count (); -} - -template <class TRADER> -CosTrading::FollowOption -TAO_Admin<TRADER>::def_follow_policy (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_follow_policy (); -} - -template <class TRADER> -CosTrading::FollowOption -TAO_Admin<TRADER>::max_follow_policy (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_follow_policy (); -} - -template <class TRADER> -CosTrading::FollowOption -TAO_Admin<TRADER>::max_link_follow_policy (CORBA::Environment &env) -{ - return this->trader_.link_attributes ().max_link_follow_policy (); -} - #endif /* TAO_ADMIN_C */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Admin.h b/TAO/orbsvcs/orbsvcs/Trader/Admin.h index bcb46a7c6d2..5e6fd6c9ffc 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Admin.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Admin.h @@ -19,11 +19,14 @@ #ifndef TAO_ADMIN_H #define TAO_ADMIN_H -#include "CosTradingS.h" -#include "Offer_Id_Iterator.h" +#include "Attributes.h" template <class TRADER> -class TAO_Admin : public POA_CosTrading::Admin +class TAO_Admin : + public TAO_Trader_Components <POA_CosTrading::Admin>, + public TAO_Support_Attributes <POA_CosTrading::Admin>, + public TAO_Import_Attributes <POA_CosTrading::Admin>, + public TAO_Link_Attributes <POA_CosTrading::Admin> // // = TITLE // This class implements CosTrading::Admin IDL interface. @@ -55,47 +58,47 @@ public: virtual CORBA::ULong set_def_search_card (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::ULong set_max_search_card (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // search card is the cardinality of the offers searched for // constraint compliance. - virtual CORBA::ULong set_def_search_card (CORBA::ULong value, + virtual CORBA::ULong set_def_match_card (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); - virtual CORBA::ULong set_max_search_card (CORBA::ULong value, + TAO_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::ULong set_max_match_card (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // match card is the cardinality of offers found compliant with the // constraints. virtual CORBA::ULong set_def_return_card (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::ULong set_max_return_card (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // return card is the cardinality of the offers returned from // Lookup. virtual CORBA::ULong set_max_list (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::Boolean set_supports_modifiable_properties (CORBA::Boolean value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::Boolean set_supports_dynamic_properties (CORBA::Boolean value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::Boolean set_supports_proxy_offers (CORBA::Boolean value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // Types of offers available for consideration. Ween out those // offers with modifiable properties @@ -103,44 +106,46 @@ public: virtual CORBA::ULong set_def_hop_count (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::ULong set_max_hop_count (CORBA::ULong value, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CosTrading::FollowOption set_def_follow_policy (CosTrading::FollowOption policy, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CosTrading::FollowOption set_max_follow_policy (CosTrading::FollowOption policy, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CosTrading::FollowOption set_max_link_follow_policy (CosTrading::FollowOption policy, CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // = Set Type Repository virtual CosTrading::TypeRepository_ptr - set_type_repos(CosTrading::TypeRepository_ptr repository); + set_type_repos (CosTrading::TypeRepository_ptr repository, + CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CosTrading::Admin::OctetSeq* request_id_stem (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual CosTrading::Admin::OctetSeq* set_request_id_stem (const CosTrading::Admin::OctetSeq& stem, CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); virtual void list_offers (CORBA::ULong how_many, CosTrading::OfferIdSeq_out ids, CosTrading::OfferIdIterator_out id_itr, CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::NotImplemented); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::NotImplemented)); // BEGIN SPEC @@ -162,89 +167,12 @@ public: // END SPEC virtual void list_proxies (CORBA::ULong how_many, - CosTrading::OfferIdSeq*& ids, - CosTrading::OfferIdIterator_ptr& id_itr, + CosTrading::OfferIdSeq_out ids, + CosTrading::OfferIdIterator_out id_itr, CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::NotImplemented); - - virtual CosTrading::Lookup_ptr lookup_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns an object reference to the Lookup interface of the trader. - // Returns nil if the trader does not support Lookup interface. - - virtual CosTrading::Register_ptr register_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Register interface of the trader. - // Returns nil if the trader does not support Register interface. - - virtual CosTrading::Link_ptr link_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Link interface of the trader. - // Returns nil if the trader does not support Link interface. - - virtual CosTrading::Proxy_ptr proxy_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference to the Proxy interface of the trader. - // Returns nil if the trader does not support Proxy interface. - - virtual CosTrading::Admin_ptr admin_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Admin interface of the trader. - // Returns nil if the trader does not support Admin interface. - - // = CosTrading::ImportAttributes methods. - - virtual CORBA::ULong def_search_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_search_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong def_match_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_match_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong def_return_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_return_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_list (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong def_hop_count (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_hop_count (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::FollowOption def_follow_policy (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::FollowOption max_follow_policy (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // = CosTrading::SupportAttributes methods. - - virtual CORBA::Boolean supports_modifiable_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_dynamic_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_proxy_offers (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::TypeRepository_ptr type_repos (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::NotImplemented)); - // = CosTrading::LinkAttributes methods - virtual CosTrading::FollowOption max_link_follow_policy (CORBA::Environment &env) - TAO_THROW_SPEC (CORBA::SystemException); static const char* NAME; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Attributes.cpp b/TAO/orbsvcs/orbsvcs/Trader/Attributes.cpp index ac2396f328a..72df6df41c6 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Attributes.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Attributes.cpp @@ -1,13 +1,17 @@ -#define ACE_BUILD_DLL +// Attributes.h +// $Id$ + +#if !defined (TAO_ATTRIBUTES_C) +#define TAO_ATTRIBUTES_C #include "Attributes.h" #include "Trader_Base.h" - + TAO_Support_Attributes_Impl::TAO_Support_Attributes_Impl (TAO_Trader_Base &trader) : trader_ (trader), - supports_modifiable_properties_ (1), - supports_dynamic_properties_ (1), - supports_proxy_offers_ (0), + supports_modifiable_properties_ (CORBA::B_TRUE), + supports_dynamic_properties_ (CORBA::B_TRUE), + supports_proxy_offers_ (CORBA::B_FALSE), type_repos_ (CosTrading::TypeRepository::_nil ()) { } @@ -19,56 +23,62 @@ TAO_Support_Attributes_Impl::~TAO_Support_Attributes_Impl (void) CORBA::Boolean TAO_Support_Attributes_Impl::supports_modifiable_properties (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CORBA::B_FALSE); return this->supports_modifiable_properties_; } void TAO_Support_Attributes_Impl::supports_modifiable_properties (CORBA::Boolean new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->supports_modifiable_properties_ = new_value; } CORBA::Boolean TAO_Support_Attributes_Impl::supports_dynamic_properties (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CORBA::B_FALSE); + return this->supports_dynamic_properties_; } void TAO_Support_Attributes_Impl::supports_dynamic_properties (CORBA::Boolean new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->supports_dynamic_properties_ = new_value; } CORBA::Boolean TAO_Support_Attributes_Impl::supports_proxy_offers (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CORBA::B_FALSE); + return this->supports_proxy_offers_; } void TAO_Support_Attributes_Impl::supports_proxy_offers (CORBA::Boolean new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->supports_proxy_offers_ = new_value; } CosTrading::TypeRepository_ptr TAO_Support_Attributes_Impl::type_repos (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CosTrading::TypeRepository::_nil ()); return this->type_repos_->_duplicate (type_repos_); } void TAO_Support_Attributes_Impl::type_repos (CosTrading::TypeRepository_ptr new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->type_repos_ = new_value; } @@ -97,159 +107,158 @@ TAO_Import_Attributes_Impl::~TAO_Import_Attributes_Impl (void) CORBA::ULong TAO_Import_Attributes_Impl::def_search_card (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 10); return this->def_search_card_; } void TAO_Import_Attributes_Impl::def_search_card (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->def_search_card_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::max_search_card (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 10); return this->max_search_card_; } void TAO_Import_Attributes_Impl::max_search_card (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->max_search_card_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::def_match_card (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 10); return this->def_match_card_; } void TAO_Import_Attributes_Impl::def_match_card (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->def_match_card_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::max_match_card (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 10); return this->max_match_card_; } void TAO_Import_Attributes_Impl::max_match_card (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->max_match_card_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::def_return_card (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 10); return this->def_return_card_; } void TAO_Import_Attributes_Impl::def_return_card (CORBA::ULong new_value) -{ - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); +{ + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->def_return_card_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::max_return_card (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 10); return this->max_return_card_; } void TAO_Import_Attributes_Impl::max_return_card (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->max_return_card_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::max_list (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 0); return this->max_list_; } void TAO_Import_Attributes_Impl::max_list (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->max_list_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::def_hop_count (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 0); return this->def_hop_count_; } void TAO_Import_Attributes_Impl::def_hop_count (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->def_hop_count_ = new_value; } CORBA::ULong TAO_Import_Attributes_Impl::max_hop_count (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), 0); return this->max_hop_count_; } void TAO_Import_Attributes_Impl::max_hop_count (CORBA::ULong new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->max_hop_count_ = new_value; } -FollowOption +CosTrading::FollowOption TAO_Import_Attributes_Impl::def_follow_policy (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), CosTrading::local_only); return this->def_follow_policy_; } void TAO_Import_Attributes_Impl::def_follow_policy (FollowOption new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->def_follow_policy_ = new_value; } FollowOption TAO_Import_Attributes_Impl::max_follow_policy (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), CosTrading::local_only); return this->max_follow_policy_; } void TAO_Import_Attributes_Impl::max_follow_policy (FollowOption new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->max_follow_policy_ = new_value; } - TAO_Trading_Components_Impl::TAO_Trading_Components_Impl (TAO_Trader_Base &trader) : trader_ (trader), lookup_ (CosTrading::Lookup::_nil ()), @@ -267,77 +276,82 @@ TAO_Trading_Components_Impl::~TAO_Trading_Components_Impl (void) CosTrading::Lookup_ptr TAO_Trading_Components_Impl::lookup_if (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CosTrading::Lookup::_nil ()); return this->lookup_; } void TAO_Trading_Components_Impl::lookup_if (CosTrading::Lookup_ptr new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->lookup_ = new_value; } CosTrading::Register_ptr TAO_Trading_Components_Impl::register_if (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CosTrading::Register::_nil ()); return this->register_; } void TAO_Trading_Components_Impl::register_if (CosTrading::Register_ptr new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->register_ = new_value; } CosTrading::Link_ptr TAO_Trading_Components_Impl::link_if (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CosTrading::Link::_nil ()); return this->link_; } void TAO_Trading_Components_Impl::link_if (CosTrading::Link_ptr new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->link_ = new_value; } CosTrading::Proxy_ptr TAO_Trading_Components_Impl::proxy_if (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CosTrading::Proxy::_nil ()); return this->proxy_; } void TAO_Trading_Components_Impl::proxy_if (CosTrading::Proxy_ptr new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->proxy_ = new_value; } CosTrading::Admin_ptr TAO_Trading_Components_Impl::admin_if (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CosTrading::Admin::_nil ()); return this->admin_; } void TAO_Trading_Components_Impl::admin_if (CosTrading::Admin_ptr new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->admin_ = new_value; } TAO_Link_Attributes_Impl::TAO_Link_Attributes_Impl (TAO_Trader_Base &trader) :trader_ (trader), - max_link_follow_policy_ (0) + max_link_follow_policy_ (CosTrading::local_only) { } @@ -348,16 +362,190 @@ TAO_Link_Attributes_Impl::~TAO_Link_Attributes_Impl (void) CosTrading::FollowOption TAO_Link_Attributes_Impl::max_link_follow_policy (void) const { - ACE_READ_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_READ_GUARD_RETURN (ACE_Lock, ace_mon, this->trader_.lock (), + CosTrading::local_only); return this->max_link_follow_policy_; } void TAO_Link_Attributes_Impl::max_link_follow_policy (CosTrading::FollowOption new_value) { - ACE_WRITE_GUARD (TAO_Lock, ace_mon, this->trader_.lock ()); + ACE_WRITE_GUARD (ACE_Lock, ace_mon, this->trader_.lock ()); this->max_link_follow_policy_ = new_value; } +template <class IF> +TAO_Trader_Components<IF>:: +TAO_Trader_Components (const TAO_Trading_Components_Impl& comps) + : comps_ (comps) +{ +} + +template <class IF> CosTrading::Lookup_ptr +TAO_Trader_Components<IF>::lookup_if (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return CosTrading::Lookup::_duplicate (this->comps_.lookup_if ()); +} + +template <class IF> CosTrading::Register_ptr +TAO_Trader_Components<IF>::register_if (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return CosTrading::Register::_duplicate (this->comps_.register_if ()); +} + +template <class IF> CosTrading::Admin_ptr +TAO_Trader_Components<IF>::admin_if (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return CosTrading::Admin::_duplicate (this->comps_.admin_if ()); +} + +template <class IF> CosTrading::Proxy_ptr +TAO_Trader_Components<IF>::proxy_if (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return CosTrading::Proxy::_duplicate (this->comps_.proxy_if ()); +} + +template <class IF> CosTrading::Link_ptr +TAO_Trader_Components<IF>::link_if (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return CosTrading::Link::_duplicate (this->comps_.link_if ()); +} +template <class IF> +TAO_Support_Attributes<IF>:: +TAO_Support_Attributes (const TAO_Support_Attributes_Impl& attrs) + : attrs_ (attrs) +{ +} + +template <class IF> CORBA::Boolean +TAO_Support_Attributes<IF>::supports_modifiable_properties (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.supports_modifiable_properties (); +} + +template <class IF> CORBA::Boolean +TAO_Support_Attributes<IF>::supports_dynamic_properties (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.supports_dynamic_properties (); +} + +template <class IF> CORBA::Boolean +TAO_Support_Attributes<IF>::supports_proxy_offers (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.supports_proxy_offers (); +} + +template <class IF> CosTrading::TypeRepository_ptr +TAO_Support_Attributes<IF>::type_repos (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return CosTrading::TypeRepository::_duplicate (this->attrs_.type_repos ()); +} + +template <class IF> +TAO_Import_Attributes<IF>:: +TAO_Import_Attributes (const TAO_Import_Attributes_Impl& attrs) + : attrs_ (attrs) +{ +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::def_search_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.def_search_card (); +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::max_search_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.max_search_card (); +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::def_match_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.def_match_card (); +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::max_match_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.max_match_card (); +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::def_return_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.def_return_card (); +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::max_return_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.max_return_card (); +} +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::max_list (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.max_list (); +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::def_hop_count (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.def_hop_count (); +} + +template <class IF> CORBA::ULong +TAO_Import_Attributes<IF>::max_hop_count (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.max_hop_count (); +} + +template <class IF> CosTrading::FollowOption +TAO_Import_Attributes<IF>::def_follow_policy (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.def_follow_policy (); +} + +template <class IF> CosTrading::FollowOption +TAO_Import_Attributes<IF>::max_follow_policy (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.max_follow_policy (); +} + +template <class IF> +TAO_Link_Attributes<IF>:: +TAO_Link_Attributes (const TAO_Link_Attributes_Impl& attrs) + : attrs_ (attrs) +{ +} + +template <class IF> CosTrading::FollowOption +TAO_Link_Attributes<IF>::max_link_follow_policy (CORBA::Environment &env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + return this->attrs_.max_link_follow_policy (); +} +#endif /* TAO_ATTRIBUTES_C */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Attributes.h b/TAO/orbsvcs/orbsvcs/Trader/Attributes.h index c7b5094ea36..2c7dc376b16 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Attributes.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Attributes.h @@ -1,6 +1,6 @@ /* -*- C++ -*- */ -// ============================================================================ +// ======================================================================== // $Id$ // // = LIBRARY @@ -14,12 +14,20 @@ // Seth Widoff <sbw1@cs.wustl.edu> // Irfan Pyarali <irfan@cs.wustl.edu> // -// ============================================================================ +// ======================================================================== #ifndef TAO_ATTRIBUTES_H #define TAO_ATTRIBUTES_H -#include "CosTradingS.h" +#if defined (OS_NO_NAMESPACE) +#define queue foobar +#endif /* OS_NO_NAMESPACE */ + +#include "orbsvcs/CosTradingS.h" + +#if defined (OS_NO_NAMESPACE) +#undef queue +#endif /* OS_NO_NAMESPACE */ class TAO_Trader_Base; @@ -250,11 +258,154 @@ private: TAO_Trader_Base &trader_; - CosTrading::Lookup_ptr lookup_; - CosTrading::Register_ptr register_; - CosTrading::Link_ptr link_; - CosTrading::Proxy_ptr proxy_; - CosTrading::Admin_ptr admin_; + CosTrading::Lookup_var lookup_; + CosTrading::Register_var register_; + CosTrading::Link_var link_; + CosTrading::Proxy_var proxy_; + CosTrading::Admin_var admin_; +}; + + +template <class IF> +class TAO_Trader_Components : public virtual IF +{ +public: + + TAO_Trader_Components (const TAO_Trading_Components_Impl& comps); + + // = CosTrading::TraderComponents methods. + virtual CosTrading::Lookup_ptr lookup_if (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + // Returns an object reference to the Lookup interface of the trader. + // Returns nil if the trader does not support Lookup interface. + + virtual CosTrading::Register_ptr register_if (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + // Returns object reference for the Register interface of the trader. + // Returns nil if the trader does not support Register interface. + + virtual CosTrading::Link_ptr link_if (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + // Returns object reference for the Link interface of the trader. + // Returns nil if the trader does not support Link interface. + + virtual CosTrading::Proxy_ptr proxy_if (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + // Returns object reference to the Proxy interface of the trader. + // Returns nil if the trader does not support Proxy interface. + + virtual CosTrading::Admin_ptr admin_if (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + // Returns object reference for the Admin interface of the trader. + // Returns nil if the trader does not support Admin interface. + +private: + + const TAO_Trading_Components_Impl& comps_; +}; + +template <class IF> +class TAO_Support_Attributes : public virtual IF +{ +public: + + TAO_Support_Attributes (const TAO_Support_Attributes_Impl& attrs); + + // = CosTrading::SupportAttributes methods. + + virtual CORBA::Boolean supports_modifiable_properties (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean supports_dynamic_properties (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::Boolean supports_proxy_offers (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CosTrading::TypeRepository_ptr type_repos (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + +private: + + const TAO_Support_Attributes_Impl& attrs_; }; +template <class IF> +class TAO_Import_Attributes : public virtual IF +{ +public: + + TAO_Import_Attributes (const TAO_Import_Attributes_Impl& attrs); + + // = CosTrading::ImportAttributes methods. + + virtual CORBA::ULong def_search_card (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::ULong max_search_card (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + // Search cardinality determines the maximum number of offers searched + // before not considering other offers. + + virtual CORBA::ULong def_match_card (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::ULong max_match_card (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + // Match cardinality determines the maximum number of offers + // matched to the constraints before not considering other offers.. + + virtual CORBA::ULong def_return_card (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::ULong max_return_card (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + // Return cardinality determines the maximum number of offers marked + // to return before not considering other offers. + + + virtual CORBA::ULong max_list (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::ULong def_hop_count (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CORBA::ULong max_hop_count (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CosTrading::FollowOption def_follow_policy (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + virtual CosTrading::FollowOption max_follow_policy (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)); + + +private: + + const TAO_Import_Attributes_Impl& attrs_; +}; + +template <class IF> +class TAO_Link_Attributes : public virtual IF +{ +public: + + TAO_Link_Attributes (const TAO_Link_Attributes_Impl& attrs); + + // = CosTrading::LinkAttributes methods + virtual CosTrading::FollowOption max_link_follow_policy (CORBA::Environment &env) + TAO_THROW_SPEC ((CORBA::SystemException)); + +private: + + const TAO_Link_Attributes_Impl& attrs_; +}; + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Attributes.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + #endif /* TAO_ATTRIBUTES_H */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint.h index 4d9d193aa58..ec0008d195b 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint.h @@ -19,9 +19,6 @@ #include "Constraint_Nodes.h" -const int TRUE_CON = 1; -const int FALSE_CON = 0; - // Functions we need for parsing. extern int yyparse(void); extern void yyrestart(FILE*); diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.cpp index 2af74707c85..f791413e8b1 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.cpp @@ -267,21 +267,21 @@ TAO_Constraint_Evaluator::do_the_op (int operation) // the stack. TAO_Literal_Constraint& result = - (operation <= NE) + (operation <= TAO_NE) ? TAO_Literal_Constraint ((CORBA::Boolean) - ((operation == GT) ? l_op > r_op : - (operation == GE) ? l_op >= r_op : - (operation == LT) ? l_op < r_op : - (operation == LE) ? l_op <= r_op : - (operation == NE) ? l_op != r_op : - (operation == EQ) ? l_op == r_op : 0)) + ((operation == TAO_GT) ? l_op > r_op : + (operation == TAO_GE) ? l_op >= r_op : + (operation == TAO_LT) ? l_op < r_op : + (operation == TAO_LE) ? l_op <= r_op : + (operation == TAO_NE) ? l_op != r_op : + (operation == TAO_EQ) ? l_op == r_op : 0)) : - ((operation == PLUS) ? l_op + r_op : - (operation == MINUS) ? l_op - r_op : - (operation == MULT) ? l_op * r_op : - (operation == DIV) ? l_op / r_op : + ((operation == TAO_PLUS) ? l_op + r_op : + (operation == TAO_MINUS) ? l_op - r_op : + (operation == TAO_MULT) ? l_op * r_op : + (operation == TAO_DIV) ? l_op / r_op : TAO_Literal_Constraint ()); this->queue_.pop_back (); @@ -317,28 +317,28 @@ int TAO_Constraint_Evaluator:: visit_add(TAO_Binary_Constraint* boolean_add) { - return this->visit_bin_op (boolean_add, PLUS); + return this->visit_bin_op (boolean_add, TAO_PLUS); } int TAO_Constraint_Evaluator:: visit_sub(TAO_Binary_Constraint* boolean_sub) { - return this->visit_bin_op (boolean_sub, MINUS); + return this->visit_bin_op (boolean_sub, TAO_MINUS); } int TAO_Constraint_Evaluator:: visit_mult(TAO_Binary_Constraint* boolean_mult) { - return this->visit_bin_op (boolean_mult, MULT); + return this->visit_bin_op (boolean_mult, TAO_MULT); } int TAO_Constraint_Evaluator:: visit_div(TAO_Binary_Constraint* boolean_div) { - return this->visit_bin_op (boolean_div, DIV); + return this->visit_bin_op (boolean_div, TAO_DIV); } int @@ -413,42 +413,42 @@ int TAO_Constraint_Evaluator:: visit_less_than(TAO_Binary_Constraint* boolean_lt) { - return this->visit_bin_op (boolean_lt, LT); + return this->visit_bin_op (boolean_lt, TAO_LT); } int TAO_Constraint_Evaluator:: visit_less_than_equal(TAO_Binary_Constraint* boolean_lte) { - return this->visit_bin_op (boolean_lte, LE); + return this->visit_bin_op (boolean_lte, TAO_LE); } int TAO_Constraint_Evaluator:: visit_greater_than(TAO_Binary_Constraint* boolean_gt) { - return this->visit_bin_op (boolean_gt, GT); + return this->visit_bin_op (boolean_gt, TAO_GT); } int TAO_Constraint_Evaluator:: visit_greater_than_equal(TAO_Binary_Constraint* boolean_gte) { - return this->visit_bin_op (boolean_gte, GE); + return this->visit_bin_op (boolean_gte, TAO_GE); } int TAO_Constraint_Evaluator:: visit_equal(TAO_Binary_Constraint* boolean_eq) { - return this->visit_bin_op (boolean_eq, EQ); + return this->visit_bin_op (boolean_eq, TAO_EQ); } int TAO_Constraint_Evaluator:: visit_not_equal(TAO_Binary_Constraint* boolean_neq) { - return this->visit_bin_op (boolean_neq, NE); + return this->visit_bin_op (boolean_neq, TAO_NE); } int @@ -470,7 +470,7 @@ visit_property(TAO_Property_Constraint* literal) if (prop_iter != this->props_.end()) { - CORBA::Enviroment& env; + CORBA::Environment env; // Retrieve the value of the property from the Property_Evaluator int prop_index = (*prop_iter).second; @@ -538,16 +538,25 @@ sequence_does_contain(CORBA::Any* sequence, // any into a sequence type locally compiled from idl. The sequence // wrapper uses the [] operator to locate the target element in the // sequence. - - CORBA::Boolean return_value = (CORBA::Boolean) 0; + + CORBA::Environment env; + CORBA::Boolean return_value = CORBA::B_FALSE; CORBA::TypeCode_ptr type = sequence->type (); - CORBA::TypeCode_ptr content = type->content_type (); - CORBA::TCKind sequence_type = content->kind (); + CORBA::TypeCode_ptr content = type->content_type (env); + TAO_CHECK_ENV_RETURN (env, return_value); + CORBA::TCKind sequence_type = content->kind (env); + TAO_CHECK_ENV_RETURN (env, return_value); // What's up with this? if (sequence_type == CORBA::tk_sequence) - sequence_type = content ->content_type ()->kind (); - + { + CORBA::TypeCode_ptr tmp = content->content_type (env); + TAO_CHECK_ENV_RETURN (env, return_value); + sequence_type = tmp->kind (env); + TAO_CHECK_ENV_RETURN (env, return_value); + } + + /* switch(sequence_type) { case CORBA::tk_short: @@ -608,11 +617,11 @@ sequence_does_contain(CORBA::Any* sequence, return_value = ::TAO_find (string_seq, (const char *)element); #else return_value = ::TAO_find_string (string_seq, (const char*) element); -#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION */ +#endif // ACE_HAS_TEMPLATE_SPECIALIZATION } break; } - } - - return return_value; + } + */ +return return_value; } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.h index 16faee8715b..9ace91cfbc5 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Evaluator.h @@ -17,15 +17,24 @@ #ifndef TAO_CONSTRAINT_EVALUATOR_H #define TAO_CONSTRAINT_EVALUATOR_H +#include <map> +#include <deque> +#include <string> + #include "Property_Evaluator.h" #include "Constraint_Visitor.h" #include "Constraint_Nodes.h" -#include "CosTradingC.h" -#include "SequencesC.h" -#include <map> -#include <deque> -#include <string> +#if defined (OS_NO_NAMESPACE) +#define queue foobar +#endif /* OS_NO_NAMESPACE */ + +#include "orbsvcs/SequencesC.h" + +#if defined (OS_NO_NAMESPACE) +#undef queue +#endif /* OS_NO_NAMESPACE */ + class TAO_Constraint_Evaluator : public TAO_Constraint_Visitor // diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp index 6002f28f701..7e9fada6235 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp @@ -27,10 +27,10 @@ TAO_Noop_Constraint::accept(TAO_Constraint_Visitor* visitor) int return_value = -1; switch(this->type_) { - case FIRST: + case TAO_FIRST: return_value = visitor->visit_first(this); break; - case RANDOM: + case TAO_RANDOM: return_value = visitor->visit_random(this); } @@ -80,7 +80,7 @@ static int (*dispatch_table[]) (TAO_Constraint_Visitor*, int TAO_Binary_Constraint::accept(TAO_Constraint_Visitor* visitor) { - int offset = this->op_ - GT, + int offset = this->op_ - TAO_GT, return_value = -1; if (dispatch_table[offset] != 0) @@ -236,25 +236,25 @@ TAO_Unary_Constraint::accept(TAO_Constraint_Visitor* visitor) int return_value = -1; switch (this->op_) { - case CONSTRAINT: + case TAO_CONSTRAINT: return_value = visitor->visit_constraint(this); break; - case WITH: + case TAO_WITH: return_value = visitor->visit_with(this); break; - case MIN: + case TAO_MIN: return_value = visitor->visit_min(this); break; - case MAX: + case TAO_MAX: return_value = visitor->visit_max(this); break; - case NOT: + case TAO_NOT: return_value = visitor->visit_not(this); break; - case UMINUS: + case TAO_UMINUS: return_value = visitor->visit_unary_minus(this); break; - case EXIST: + case TAO_EXIST: return_value = visitor->visit_exist(this); break; } @@ -302,12 +302,14 @@ TAO_Literal_Constraint:: TAO_Literal_Constraint(CORBA::Any* any) : type_ (TAO_Literal_Constraint::comparable_type (any->type ())) { + CORBA::Environment env; CORBA::Any& any_ref = *any; - CORBA::TCKind corba_type = any_ref.type()->kind(); + CORBA::TCKind corba_type = any_ref.type()->kind(env); + TAO_CHECK_ENV_RETURN (env,); switch(this->type_) { - case SIGNED_INTEGER: + case TAO_SIGNED: this->op_.integer_ = 0; if (corba_type == CORBA::tk_short) { @@ -318,7 +320,7 @@ TAO_Literal_Constraint(CORBA::Any* any) else any_ref >>= this->op_.integer_; break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: this->op_.uinteger_ = 0; if (corba_type == CORBA::tk_ushort) { @@ -329,7 +331,7 @@ TAO_Literal_Constraint(CORBA::Any* any) else any_ref >>= this->op_.uinteger_; break; - case DOUBLE: + case TAO_DOUBLE: if (corba_type == CORBA::tk_float) { CORBA::Float fl; @@ -339,60 +341,58 @@ TAO_Literal_Constraint(CORBA::Any* any) else (*any) >>= this->op_.double_; break; - case BOOLEAN: + case TAO_BOOLEAN: { CORBA_Any::to_boolean tmp(this->op_.bool_); (*any) >>= tmp; } break; - case STRING: + case TAO_STRING: { char * s; any_ref >>= s; this->op_.str_ = ACE_OS::strdup(s); } break; - case SEQUENCE: + case TAO_SEQUENCE: this->op_.any_ = any; } } TAO_Literal_Constraint::TAO_Literal_Constraint(CORBA::ULong uinteger) - : type_ (UNSIGNED_INTEGER) + : type_ (TAO_UNSIGNED) { this->op_.uinteger_ = uinteger; } TAO_Literal_Constraint::TAO_Literal_Constraint(CORBA::Long integer) - : type_ (SIGNED_INTEGER) + : type_ (TAO_SIGNED) { this->op_.integer_ = integer; } TAO_Literal_Constraint::TAO_Literal_Constraint(CORBA::Boolean boolean) - : type_ (BOOLEAN) + : type_ (TAO_BOOLEAN) { this->op_.bool_ = boolean; } TAO_Literal_Constraint::TAO_Literal_Constraint(CORBA::Double doub) - : type_ (DOUBLE) + : type_ (TAO_DOUBLE) { this->op_.double_ = doub; } TAO_Literal_Constraint::TAO_Literal_Constraint(const char* str) - : type_ (STRING) + : type_ (TAO_STRING) { this->op_.str_ = ACE_OS::strdup(str); } TAO_Literal_Constraint::~TAO_Literal_Constraint(void) { - if (this->type_ == STRING) + if (this->type_ == TAO_STRING) free (this->op_.str_); - else if (this->type_ == SEQUENCE) - CORBA::Any::_release (this->op_.any_); } int @@ -409,19 +409,19 @@ TAO_Literal_Constraint::operator= (const TAO_Literal_Constraint& co) TAO_Literal_Constraint::operator CORBA::Boolean(void) const { - return (this->type_ == BOOLEAN) ? this->op_.bool_ : (CORBA::Boolean)0; + return (this->type_ == TAO_BOOLEAN) ? this->op_.bool_ : CORBA::B_FALSE; } TAO_Literal_Constraint::operator CORBA::ULong(void) const { CORBA::ULong return_value = (CORBA::ULong)0; - if (this->type_ == UNSIGNED_INTEGER) + if (this->type_ == TAO_UNSIGNED) return_value = this->op_.uinteger_; - else if (this->type_ == SIGNED_INTEGER) + else if (this->type_ == TAO_SIGNED) return_value = (this->op_.integer_ > 0) ? (CORBA::ULong)this->op_.integer_ : 0; - else if (this->type_ == DOUBLE) + else if (this->type_ == TAO_DOUBLE) return_value = (this->op_.double_ > 0) ? ((this->op_.double_ > MAX_UNSIGNED_INTEGER) ? @@ -436,13 +436,13 @@ TAO_Literal_Constraint::operator CORBA::Long(void) const { CORBA::Long return_value = (CORBA::Long)0; - if (this->type_ == SIGNED_INTEGER) + if (this->type_ == TAO_SIGNED) return_value = this->op_.integer_; - else if (this->type_ == UNSIGNED_INTEGER) + else if (this->type_ == TAO_UNSIGNED) return_value = (this->op_.uinteger_ > MAX_SIGNED_INTEGER) ? MAX_SIGNED_INTEGER : this->op_.uinteger_; - else if (this->type_ == DOUBLE) + else if (this->type_ == TAO_DOUBLE) return_value = (this->op_.double_ > 0) ? ((this->op_.double_ > MAX_SIGNED_INTEGER) ? @@ -459,11 +459,11 @@ TAO_Literal_Constraint::operator CORBA::Double(void) const { CORBA::Double return_value = (CORBA::Double)0.0; - if (this->type_ == DOUBLE) + if (this->type_ == TAO_DOUBLE) return_value = this->op_.double_; - else if (this->type_ == SIGNED_INTEGER) + else if (this->type_ == TAO_SIGNED) return_value = (CORBA::Double)this->op_.integer_; - else if (this->type_ == UNSIGNED_INTEGER) + else if (this->type_ == TAO_UNSIGNED) return_value = (CORBA::Double)this->op_.uinteger_; return return_value; @@ -471,52 +471,59 @@ TAO_Literal_Constraint::operator CORBA::Double(void) const TAO_Literal_Constraint::operator const char* (void) const { - return (this->type_ == STRING) ? this->op_.str_ : 0; + return (this->type_ == TAO_STRING) ? this->op_.str_ : 0; } TAO_Literal_Constraint::operator const CORBA::Any* (void) const { - return (this->type_ == SEQUENCE) ? this->op_.any_ : 0; + return (this->type_ == TAO_SEQUENCE) ? this->op_.any_ : 0; } TAO_Expression_Type TAO_Literal_Constraint::comparable_type (CORBA::TypeCode_ptr type) { // Convert a CORBA::TCKind into a TAO_Literal_Type - CORBA::TCKind kind = type->kind(); - TAO_Expression_Type return_value = UNKNOWN; + CORBA::Environment env; + TAO_Expression_Type return_value = TAO_UNKNOWN; + CORBA::TCKind kind = type->kind(env); + TAO_CHECK_ENV_RETURN (env, return_value); switch (kind) { case CORBA::tk_ushort: case CORBA::tk_ulong: - return_value = UNSIGNED_INTEGER; + return_value = TAO_UNSIGNED; break; case CORBA::tk_long: case CORBA::tk_short: - return_value = SIGNED_INTEGER; + return_value = TAO_SIGNED; break; case CORBA::tk_boolean: - return_value = BOOLEAN; + return_value = TAO_BOOLEAN; break; case CORBA::tk_float: case CORBA::tk_double: - return_value = DOUBLE; + return_value = TAO_DOUBLE; break; case CORBA::tk_string: - return_value = STRING; + return_value = TAO_STRING; break; case CORBA::tk_sequence: - return_value = SEQUENCE; + return_value = TAO_SEQUENCE; break; case CORBA::tk_alias: { - if (type->content_type ()->kind () == CORBA::tk_sequence) - return_value = SEQUENCE; + CORBA::TypeCode_ptr typecode = type->content_type (env); + TAO_CHECK_ENV_RETURN (env, return_value); + CORBA::TCKind kind = typecode->kind (env); + TAO_CHECK_ENV_RETURN (env, return_value); + + if (kind == CORBA::tk_sequence) + return_value = TAO_SEQUENCE; } break; default: - return_value = UNKNOWN; + return_value = TAO_UNKNOWN; } return return_value; @@ -532,19 +539,19 @@ operator== (const TAO_Literal_Constraint& left, switch (widest_type) { - case STRING: + case TAO_STRING: return_value = (ACE_OS::strcmp((const char*)left, (const char*)right) == 0); break; - case DOUBLE: + case TAO_DOUBLE: return_value = (CORBA::Double)left == (CORBA::Double)right; break; - case SIGNED_INTEGER: + case TAO_SIGNED: return_value = (CORBA::Long)left == (CORBA::Long)right; break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: return_value = (CORBA::ULong)left == (CORBA::ULong)right; break; - case BOOLEAN: + case TAO_BOOLEAN: return_value = (CORBA::Boolean)left == (CORBA::Boolean)right; break; } @@ -563,19 +570,19 @@ operator!= (const TAO_Literal_Constraint& left, switch (widest_type) { - case STRING: + case TAO_STRING: return_value = (ACE_OS::strcmp((const char*)left, (const char*)right) != 0); break; - case DOUBLE: + case TAO_DOUBLE: return_value = (CORBA::Double)left != (CORBA::Double)right; break; - case SIGNED_INTEGER: + case TAO_SIGNED: return_value = (CORBA::Long)left != (CORBA::Long)right; break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: return_value = (CORBA::ULong)left != (CORBA::ULong)right; break; - case BOOLEAN: + case TAO_BOOLEAN: return_value = (CORBA::Boolean)left != (CORBA::Boolean)right; break; } @@ -593,19 +600,19 @@ operator< (const TAO_Literal_Constraint& left, switch (widest_type) { - case STRING: + case TAO_STRING: return_value = (ACE_OS::strcmp((const char*)left, (const char*)right) < 0); break; - case DOUBLE: + case TAO_DOUBLE: return_value = (CORBA::Double)left < (CORBA::Double)right; break; - case SIGNED_INTEGER: + case TAO_SIGNED: return_value = (CORBA::Long)left < (CORBA::Long)right; break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: return_value = (CORBA::ULong)left < (CORBA::ULong)right; break; - case BOOLEAN: + case TAO_BOOLEAN: return_value = (CORBA::Boolean) left < (CORBA::Boolean) right; break; } @@ -623,16 +630,16 @@ operator<= (const TAO_Literal_Constraint& left, switch (widest_type) { - case STRING: + case TAO_STRING: return_value = (ACE_OS::strcmp((const char*)left, (const char*)right) <= 0); break; - case DOUBLE: + case TAO_DOUBLE: return_value = (CORBA::Double)left <= (CORBA::Double)right; break; - case SIGNED_INTEGER: + case TAO_SIGNED: return_value = (CORBA::Long)left <= (CORBA::Long)right; break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: return_value = (CORBA::ULong)left <= (CORBA::ULong)right; break; } @@ -650,16 +657,16 @@ operator> (const TAO_Literal_Constraint& left, switch (widest_type) { - case STRING: + case TAO_STRING: return_value = (ACE_OS::strcmp((const char*)left, (const char*)right) > 0); break; - case DOUBLE: + case TAO_DOUBLE: return_value = (CORBA::Double)left > (CORBA::Double)right; break; - case SIGNED_INTEGER: + case TAO_SIGNED: return_value = (CORBA::Long)left > (CORBA::Long)right; break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: return_value = (CORBA::ULong)left > (CORBA::ULong)right; break; } @@ -677,16 +684,16 @@ operator>= (const TAO_Literal_Constraint& left, switch (widest_type) { - case STRING: + case TAO_STRING: return_value = (ACE_OS::strcmp((const char*)left, (const char*)right) >= 0); break; - case DOUBLE: + case TAO_DOUBLE: return_value = (CORBA::Double)left >= (CORBA::Double)right; break; - case SIGNED_INTEGER: + case TAO_SIGNED: return_value = (CORBA::Long)left >= (CORBA::Long)right; break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: return_value = (CORBA::ULong)left >= (CORBA::ULong)right; break; } @@ -702,7 +709,7 @@ operator== (CORBA::Double left, const TAO_Literal_Constraint& right) } int -operator== (const StringSeq::Sequence_string& left, +operator== (const StringSeq::Manager& left, const TAO_Literal_Constraint& right) { int result = 0; @@ -723,19 +730,19 @@ operator+ (const TAO_Literal_Constraint& left, switch (widest_type) { - case DOUBLE: + case TAO_DOUBLE: { CORBA::Double result = (CORBA::Double)left + (CORBA::Double)right; return TAO_Literal_Constraint((CORBA::Double)result); } break; - case SIGNED_INTEGER: + case TAO_SIGNED: { CORBA::Long result = (CORBA::Long)left + (CORBA::Long)right; return TAO_Literal_Constraint((CORBA::Long)result); } break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: { CORBA::ULong result = (CORBA::ULong)left + (CORBA::ULong)right; return TAO_Literal_Constraint((CORBA::ULong)result); @@ -755,19 +762,19 @@ operator- (const TAO_Literal_Constraint& left, switch (widest_type) { - case DOUBLE: + case TAO_DOUBLE: { CORBA::Double result = (CORBA::Double)left - (CORBA::Double)right; return TAO_Literal_Constraint((CORBA::Double)result); } break; - case SIGNED_INTEGER: + case TAO_SIGNED: { CORBA::Long result = (CORBA::Long)left - (CORBA::Long)right; return TAO_Literal_Constraint((CORBA::Long)result); } break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: { CORBA::ULong result = (CORBA::ULong)left - (CORBA::ULong)right; return TAO_Literal_Constraint((CORBA::ULong)result); @@ -787,19 +794,19 @@ operator* (const TAO_Literal_Constraint& left, switch (widest_type) { - case DOUBLE: + case TAO_DOUBLE: { CORBA::Double result = (CORBA::Double)left * (CORBA::Double)right; return TAO_Literal_Constraint((CORBA::Double)result); } break; - case SIGNED_INTEGER: + case TAO_SIGNED: { CORBA::Long result = (CORBA::Long)left * (CORBA::Long)right; return TAO_Literal_Constraint((CORBA::Long)result); } break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: { CORBA::ULong result = (CORBA::ULong)left * (CORBA::ULong)right; return TAO_Literal_Constraint((CORBA::ULong)result); @@ -819,19 +826,19 @@ operator/ (const TAO_Literal_Constraint& left, switch (widest_type) { - case DOUBLE: + case TAO_DOUBLE: { CORBA::Double result = (CORBA::Double)left / (CORBA::Double)right; return TAO_Literal_Constraint((CORBA::Double)result); } break; - case SIGNED_INTEGER: + case TAO_SIGNED: { CORBA::Long result = (CORBA::Long)left / (CORBA::Long)right; return TAO_Literal_Constraint((CORBA::Long)result); } break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: { CORBA::ULong result = (CORBA::ULong)left / (CORBA::ULong)right; return TAO_Literal_Constraint((CORBA::ULong)result); @@ -847,19 +854,19 @@ operator- (const TAO_Literal_Constraint& operand) { switch (operand.expr_type()) { - case DOUBLE: + case TAO_DOUBLE: { CORBA::Double result = - (CORBA::Double)operand; return TAO_Literal_Constraint((CORBA::Double)result); } break; - case SIGNED_INTEGER: + case TAO_SIGNED: { CORBA::Long result = - (CORBA::Long)operand; return TAO_Literal_Constraint((CORBA::Long)result); } break; - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: { CORBA::Long result = - (CORBA::ULong)operand; return TAO_Literal_Constraint((CORBA::ULong)result); @@ -871,8 +878,8 @@ operator- (const TAO_Literal_Constraint& operand) } TAO_Expression_Type -TAO_Literal_Constraint::widest_type(TAO_Literal_Constraint& left, - TAO_Literal_Constraint& right) +TAO_Literal_Constraint::widest_type(const TAO_Literal_Constraint& left, + const TAO_Literal_Constraint& right) { TAO_Expression_Type left_type = left.expr_type(), right_type = right.expr_type(), @@ -893,18 +900,18 @@ void TAO_Literal_Constraint::copy (const TAO_Literal_Constraint& lit) { this->type_ = lit.type_; - if (this->type_ == STRING) + if (this->type_ == TAO_STRING) this->op_.str_ = ACE_OS::strdup(lit.op_.str_); - else if (this->type_ == DOUBLE) + else if (this->type_ == TAO_DOUBLE) this->op_.double_ = lit.op_.double_; - else if (this->type_ == UNSIGNED_INTEGER) + else if (this->type_ == TAO_UNSIGNED) this->op_.uinteger_ = lit.op_.uinteger_; - else if (this->type_ == SIGNED_INTEGER) + else if (this->type_ == TAO_SIGNED) this->op_.integer_ = lit.op_.integer_; - else if (this->type_ == BOOLEAN) + else if (this->type_ == TAO_BOOLEAN) this->op_.bool_ = lit.op_.bool_; - else if (this->type_ == SEQUENCE) - this->op_.any_ = CORBA::Any::_duplicate (lit.op_.any_); + else if (this->type_ == TAO_SEQUENCE) + this->op_.any_ = lit.op_.any_; else - type_ = UNKNOWN; + type_ = TAO_UNKNOWN; } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h index cb8b6dd4aae..6234b5c805f 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h @@ -1,11 +1,10 @@ /* -*- C++ -*- */ -// $Id$ - // ===================================================================== -// +// $Id$ +// // = LIBRARY -// Lookup +// orbsvcs // // = FILENAME // Constraint_Nodes.h @@ -18,19 +17,18 @@ #ifndef TAO_CONSTRAINT_NODES_H #define TAO_CONSTRAINT_NODES_H -#include "CosTradingC.h" -#include "SequencesC.h" #include "Constraint_Visitor.h" #include "Constraint_Tokens.h" #if defined (OS_NO_NAMESPACE) -#define map foobar +#define queue foobar #endif /* OS_NO_NAMESPACE */ -#include "ace/OS.h" +#include "orbsvcs/CosTradingC.h" +#include "orbsvcs/SequencesC.h" #if defined (OS_NO_NAMESPACE) -#undef map +#undef queue #endif /* OS_NO_NAMESPACE */ typedef unsigned short TAO_Expression_Type; @@ -176,14 +174,14 @@ public: virtual int accept(TAO_Constraint_Visitor* visitor); virtual TAO_Expression_Type expr_type(void) const - { return IDENT; } + { return TAO_IDENT; } const char* name(void) const; // Returns the name of the property. private: - const char* name_; + char* name_; // The name of the property. }; @@ -196,9 +194,9 @@ class TAO_Literal_Constraint : public TAO_Constraint public: TAO_Literal_Constraint(void) - : type_ (UNKNOWN) {} + : type_ (TAO_UNKNOWN) {} - // = Constructors for each of the various types of constructors. + // = Constructors for each of the various types of literals. TAO_Literal_Constraint(CORBA::Any* any); @@ -264,7 +262,7 @@ class TAO_Literal_Constraint : public TAO_Constraint const TAO_Literal_Constraint& right); friend int - operator== (const StringSeq::Sequence_string& left, + operator== (const StringSeq::Manager& left, const TAO_Literal_Constraint& right); // = Arithmetic operators. @@ -288,11 +286,13 @@ class TAO_Literal_Constraint : public TAO_Constraint friend TAO_Literal_Constraint operator- (const TAO_Literal_Constraint& operand); - static TAO_Expression_Type widest_type(TAO_Literal_Constraint& left, - TAO_Literal_Constraint& right); + static TAO_Expression_Type + widest_type (const TAO_Literal_Constraint& left, + const TAO_Literal_Constraint& right); // Ensure both operands are of the same simple numeric type. - static TAO_Expression_Type comparable_type(CORBA::TypeCode_ptr type); + static TAO_Expression_Type + comparable_type (CORBA::TypeCode_ptr type); // Determine the comparable Expression Type from the CORBA type private: @@ -302,7 +302,7 @@ class TAO_Literal_Constraint : public TAO_Constraint union { char* str_; - CORBA::Any* any_; + CORBA::Any_ptr any_; CORBA::ULong uinteger_; CORBA::Long integer_; CORBA::Boolean bool_; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Tokens.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Tokens.h index 8fbd5914704..4636d909dc5 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Tokens.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Tokens.h @@ -1,34 +1,34 @@ -# define GT 257 -# define GE 258 -# define LT 259 -# define LE 260 -# define EQ 261 -# define NE 262 -# define EXIST 263 -# define AND 264 -# define OR 265 -# define NOT 266 -# define IN 267 -# define TWIDDLE 268 -# define BOOLEAN 269 -# define PLUS 270 -# define MINUS 271 -# define MULT 272 -# define DIV 273 -# define UMINUS 274 -# define NUMBER 275 -# define RPAREN 276 -# define LPAREN 277 -# define IDENT 278 -# define STRING 279 -# define UNSIGNED_INTEGER 280 -# define SIGNED_INTEGER 281 -# define DOUBLE 282 -# define CONSTRAINT 283 -# define SEQUENCE 284 -# define UNKNOWN 285 -# define WITH 286 -# define MAX 287 -# define MIN 288 -# define FIRST 289 -# define RANDOM 290 +# define TAO_GT 257 +# define TAO_GE 258 +# define TAO_LT 259 +# define TAO_LE 260 +# define TAO_EQ 261 +# define TAO_NE 262 +# define TAO_EXIST 263 +# define TAO_AND 264 +# define TAO_OR 265 +# define TAO_NOT 266 +# define TAO_IN 267 +# define TAO_TWIDDLE 268 +# define TAO_BOOLEAN 269 +# define TAO_PLUS 270 +# define TAO_MINUS 271 +# define TAO_MULT 272 +# define TAO_DIV 273 +# define TAO_UMINUS 274 +# define TAO_NUMBER 275 +# define TAO_RPAREN 276 +# define TAO_LPAREN 277 +# define TAO_IDENT 278 +# define TAO_STRING 279 +# define TAO_UNKNOWN 280 +# define TAO_UNSIGNED 281 +# define TAO_SIGNED 282 +# define TAO_DOUBLE 283 +# define TAO_CONSTRAINT 284 +# define TAO_SEQUENCE 285 +# define TAO_WITH 286 +# define TAO_MAX 287 +# define TAO_MIN 288 +# define TAO_FIRST 289 +# define TAO_RANDOM 290 diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp index adfb372bf61..88936181e0e 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp @@ -138,7 +138,7 @@ visit_exist(TAO_Unary_Constraint* unary_exist) TAO_Constraint* operand = unary_exist->operand(); TAO_Expression_Type type = operand->expr_type(); - if (type == IDENT) + if (type == TAO_IDENT) return_value = operand->accept(this); return return_value; @@ -221,13 +221,13 @@ visit_div(TAO_Binary_Constraint* boolean_div) int right_isnt_zero = 1; switch(right->expr_type()) { - case UNSIGNED_INTEGER: + case TAO_UNSIGNED: right_isnt_zero = (CORBA::ULong)(*((TAO_Literal_Constraint*)right)); break; - case SIGNED_INTEGER: + case TAO_SIGNED: right_isnt_zero = (CORBA::Long)(*((TAO_Literal_Constraint*)right)); break; - case DOUBLE: + case TAO_DOUBLE: right_isnt_zero = (CORBA::Double)(*((TAO_Literal_Constraint*)right)); break; } @@ -280,23 +280,24 @@ visit_in (TAO_Binary_Constraint* binary_in) CORBA::TypeCode* prop_type = this->extract_type(right, right_type); this->extract_type(left, left_type); - if (right_type == SEQUENCE) + if (right_type == TAO_SEQUENCE) { int types_match = 0; + CORBA::Environment env; if (this->expr_returns_number (left_type)) { - types_match = prop_type->equal (_tc_ShortSeq) || - prop_type->equal (_tc_UShortSeq) || - prop_type->equal (_tc_LongSeq) || - prop_type->equal (_tc_ULongSeq) || - prop_type->equal (_tc_DoubleSeq) || - prop_type->equal (_tc_FloatSeq); + types_match = prop_type->equal (_tc_ShortSeq, env) || + prop_type->equal (_tc_UShortSeq, env) || + prop_type->equal (_tc_LongSeq, env) || + prop_type->equal (_tc_ULongSeq, env) || + prop_type->equal (_tc_DoubleSeq, env) || + prop_type->equal (_tc_FloatSeq, env); } else if (this->expr_returns_boolean (left_type)) - types_match = prop_type->equal (_tc_BooleanSeq); + types_match = prop_type->equal (_tc_BooleanSeq, env); else if (this->expr_returns_string (left_type)) - types_match = prop_type->equal (_tc_StringSeq); + types_match = prop_type->equal (_tc_StringSeq, env); if (types_match) return_value = left->accept(this); @@ -407,7 +408,7 @@ TAO_Constraint_Validator::extract_type (TAO_Constraint* expr, { CORBA::TypeCode* return_value = 0; type = expr->expr_type(); - if (type == IDENT) + if (type == TAO_IDENT) { TAO_Property_Constraint* prop = (TAO_Property_Constraint*) expr; string prop_name(prop->name()); @@ -431,7 +432,7 @@ TAO_Constraint_Validator::expr_returns_boolean(TAO_Expression_Type expr_type) // a boolean property, return 1. int return_value = 0; - if (expr_type <= BOOLEAN) + if (expr_type <= TAO_BOOLEAN) return_value = 1; return return_value; @@ -445,8 +446,8 @@ TAO_Constraint_Validator::expr_returns_number(TAO_Expression_Type expr_type) // numeric property, return 1. int return_value = 0; - if ((expr_type >= PLUS && expr_type <= NUMBER) || - (expr_type >= UNSIGNED_INTEGER && expr_type <= DOUBLE)) + if ((expr_type >= TAO_PLUS && expr_type <= TAO_NUMBER) || + (expr_type >= TAO_UNSIGNED && expr_type <= TAO_DOUBLE)) return_value = 1; return return_value; @@ -459,7 +460,7 @@ TAO_Constraint_Validator::expr_returns_string(TAO_Expression_Type expr_type) // string literal, or a property whose type is string, return 1. int return_value = 0; - if (expr_type == STRING) + if (expr_type == TAO_STRING) return_value = 1; return return_value; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.h index 6581d6a6493..9ba7a6baa00 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.h @@ -20,8 +20,6 @@ #include <map> #include <string> -#include "CosTradingC.h" -#include "Constraint_Visitor.h" #include "Constraint_Nodes.h" class TAO_Constraint_Validator : public TAO_Constraint_Visitor diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_l.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_l.cpp index 5cec54a98c1..7f191d8cb14 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_l.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_l.cpp @@ -414,14 +414,14 @@ static char *yy_last_accepting_cpos; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "constraint.l" +#line 1 "Trader/constraint.l" #define INITIAL 0 -#line 2 "constraint.l" +#line 2 "Trader/constraint.l" // $Id$ // ======================================================================== // // = LIBRARY -// Trading +// orbsvcs // // = FILENAME // constraint.l @@ -435,13 +435,13 @@ char *yytext; #include "Constraint_Nodes.h" #include "Constraint_Tokens.h" -static ACE_Literal_Constraint* extract_string(const char*); +static TAO_Literal_Constraint* extract_string(const char*); -#define ACE_YY_LEX_DEBUG +#define TAO_YY_LEX_DEBUG -#ifdef ACE_CONSTRAINT_DEBUG -#define ACE_YY_LEX_DEBUG ACE_OS::fprintf(stderr, "%s\n", yytext) -#endif /* ACE_CONSTRAINT_DEBUG */ +#ifdef TAO_CONSTRAINT_DEBUG +#define TAO_YY_LEX_DEBUG TAO_OS::fprintf(stderr, "%s\n", yytext) +#endif /* TAO_CONSTRAINT_DEBUG */ #line 448 "lex.yy.c" @@ -595,7 +595,7 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 42 "constraint.l" +#line 42 "Trader/constraint.l" #line 602 "lex.yy.c" @@ -683,182 +683,182 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 44 "constraint.l" -{ ACE_YY_LEX_DEBUG; return MIN; } +#line 44 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_MIN; } YY_BREAK case 2: YY_RULE_SETUP -#line 45 "constraint.l" -{ ACE_YY_LEX_DEBUG; return MAX; } +#line 45 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_MAX; } YY_BREAK case 3: YY_RULE_SETUP -#line 46 "constraint.l" -{ ACE_YY_LEX_DEBUG; return FIRST; } +#line 46 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_FIRST; } YY_BREAK case 4: YY_RULE_SETUP -#line 47 "constraint.l" -{ ACE_YY_LEX_DEBUG; return RANDOM; } +#line 47 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_RANDOM; } YY_BREAK case 5: YY_RULE_SETUP -#line 48 "constraint.l" -{ ACE_YY_LEX_DEBUG; return WITH; } +#line 48 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_WITH; } YY_BREAK case 6: YY_RULE_SETUP -#line 49 "constraint.l" -{ ACE_YY_LEX_DEBUG; return EXIST; } +#line 49 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_EXIST; } YY_BREAK case 7: YY_RULE_SETUP -#line 50 "constraint.l" -{ ACE_YY_LEX_DEBUG; return NOT; } +#line 50 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_NOT; } YY_BREAK case 8: YY_RULE_SETUP -#line 51 "constraint.l" -{ ACE_YY_LEX_DEBUG; return AND; } +#line 51 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_AND; } YY_BREAK case 9: YY_RULE_SETUP -#line 52 "constraint.l" -{ ACE_YY_LEX_DEBUG; return OR; } +#line 52 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_OR; } YY_BREAK case 10: YY_RULE_SETUP -#line 53 "constraint.l" -{ ACE_YY_LEX_DEBUG; return IN; } +#line 53 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_IN; } YY_BREAK case 11: YY_RULE_SETUP -#line 54 "constraint.l" -{ ACE_YY_LEX_DEBUG; return TWIDDLE; } +#line 54 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_TWIDDLE; } YY_BREAK case 12: YY_RULE_SETUP -#line 55 "constraint.l" -{ ACE_YY_LEX_DEBUG; return PLUS; } +#line 55 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_PLUS; } YY_BREAK case 13: YY_RULE_SETUP -#line 56 "constraint.l" -{ ACE_YY_LEX_DEBUG; return MINUS; } +#line 56 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_MINUS; } YY_BREAK case 14: YY_RULE_SETUP -#line 57 "constraint.l" -{ ACE_YY_LEX_DEBUG; return MULT; } +#line 57 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_MULT; } YY_BREAK case 15: YY_RULE_SETUP -#line 58 "constraint.l" -{ ACE_YY_LEX_DEBUG; return DIV; } +#line 58 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_DIV; } YY_BREAK case 16: YY_RULE_SETUP -#line 59 "constraint.l" -{ ACE_YY_LEX_DEBUG; return LT; } +#line 59 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_LT; } YY_BREAK case 17: YY_RULE_SETUP -#line 60 "constraint.l" -{ ACE_YY_LEX_DEBUG; return LE; } +#line 60 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_LE; } YY_BREAK case 18: YY_RULE_SETUP -#line 61 "constraint.l" -{ ACE_YY_LEX_DEBUG; return GT; } +#line 61 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_GT; } YY_BREAK case 19: YY_RULE_SETUP -#line 62 "constraint.l" -{ ACE_YY_LEX_DEBUG; return GE; } +#line 62 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_GE; } YY_BREAK case 20: YY_RULE_SETUP -#line 63 "constraint.l" -{ ACE_YY_LEX_DEBUG; return EQ; } +#line 63 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_EQ; } YY_BREAK case 21: YY_RULE_SETUP -#line 64 "constraint.l" -{ ACE_YY_LEX_DEBUG; return NE; } +#line 64 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_NE; } YY_BREAK case 22: YY_RULE_SETUP -#line 65 "constraint.l" -{ ACE_YY_LEX_DEBUG; return LPAREN; } +#line 65 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_LPAREN; } YY_BREAK case 23: YY_RULE_SETUP -#line 66 "constraint.l" -{ ACE_YY_LEX_DEBUG; return RPAREN; } +#line 66 "Trader/constraint.l" +{ TAO_YY_LEX_DEBUG; return TAO_RPAREN; } YY_BREAK case 24: YY_RULE_SETUP -#line 67 "constraint.l" +#line 67 "Trader/constraint.l" { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Boolean)TRUE_CON); - ACE_YY_LEX_DEBUG; return BOOLEAN; + new TAO_Literal_Constraint(CORBA::B_TRUE); + TAO_YY_LEX_DEBUG; return TAO_BOOLEAN; } YY_BREAK case 25: YY_RULE_SETUP -#line 72 "constraint.l" +#line 72 "Trader/constraint.l" { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Boolean)FALSE_CON); - ACE_YY_LEX_DEBUG; return BOOLEAN; + new TAO_Literal_Constraint(CORBA::B_FALSE); + TAO_YY_LEX_DEBUG; return TAO_BOOLEAN; } YY_BREAK case 26: YY_RULE_SETUP -#line 77 "constraint.l" +#line 77 "Trader/constraint.l" { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Long)atoi(yytext)); - ACE_YY_LEX_DEBUG; return NUMBER; + new TAO_Literal_Constraint((CORBA::Long)atoi(yytext)); + TAO_YY_LEX_DEBUG; return TAO_NUMBER; } YY_BREAK case 27: YY_RULE_SETUP -#line 82 "constraint.l" +#line 82 "Trader/constraint.l" { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Double)atof(yytext)); - ACE_YY_LEX_DEBUG; return NUMBER; + new TAO_Literal_Constraint((CORBA::Double)atof(yytext)); + TAO_YY_LEX_DEBUG; return TAO_NUMBER; } YY_BREAK case 28: YY_RULE_SETUP -#line 87 "constraint.l" +#line 87 "Trader/constraint.l" { yylval.constraint_ = extract_string(yytext); - ACE_YY_LEX_DEBUG; return STRING; + TAO_YY_LEX_DEBUG; return TAO_STRING; } YY_BREAK case 29: YY_RULE_SETUP -#line 91 "constraint.l" +#line 91 "Trader/constraint.l" { yylval.constraint_ = - new ACE_Property_Constraint(yytext); - ACE_YY_LEX_DEBUG; return IDENT; + new TAO_Property_Constraint(yytext); + TAO_YY_LEX_DEBUG; return TAO_IDENT; } YY_BREAK case 30: YY_RULE_SETUP -#line 96 "constraint.l" +#line 96 "Trader/constraint.l" { - ACE_YY_LEX_DEBUG; return UNKNOWN; + TAO_YY_LEX_DEBUG; return TAO_UNKNOWN; } YY_BREAK case 31: YY_RULE_SETUP -#line 99 "constraint.l" +#line 99 "Trader/constraint.l" ECHO; YY_BREAK #line 865 "lex.yy.c" @@ -1747,16 +1747,16 @@ int main() return 0; } #endif -#line 99 "constraint.l" +#line 99 "Trader/constraint.l" -ACE_Literal_Constraint* +TAO_Literal_Constraint* extract_string(const char* total) { int prev_slash = 0, ctr = 0; char str[BUFSIZ], - *tmp = total + 1; + *tmp = (char*) total + 1; while (*tmp != '\0') { @@ -1778,5 +1778,5 @@ extract_string(const char* total) } str[ctr - 1] = '\0'; - return new ACE_Literal_Constraint(str); + return new TAO_Literal_Constraint(str); }
\ No newline at end of file diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp index 597ee3d6a56..0c84915206c 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_y.cpp @@ -1,10 +1,10 @@ -# line 2 "constraint.y" +# line 2 "Trader/constraint.y" // $Id$ // ======================================================================== // // = LIBRARY -// Trading +// orbsvcs // // = FILENAME // constraint.y @@ -18,40 +18,40 @@ #include "Constraint_Nodes.h" //#define YYDEBUG 1 -# define GT 257 -# define GE 258 -# define LT 259 -# define LE 260 -# define EQ 261 -# define NE 262 -# define EXIST 263 -# define AND 264 -# define OR 265 -# define NOT 266 -# define IN 267 -# define TWIDDLE 268 -# define BOOLEAN 269 -# define PLUS 270 -# define MINUS 271 -# define MULT 272 -# define DIV 273 -# define UMINUS 274 -# define NUMBER 275 -# define RPAREN 276 -# define LPAREN 277 -# define IDENT 278 -# define STRING 279 -# define UNSIGNED_INTEGER 280 -# define SIGNED_INTEGER 281 -# define DOUBLE 282 -# define CONSTRAINT 283 -# define SEQUENCE 284 -# define UNKNOWN 285 -# define WITH 286 -# define MAX 287 -# define MIN 288 -# define FIRST 289 -# define RANDOM 290 +# define TAO_GT 257 +# define TAO_GE 258 +# define TAO_LT 259 +# define TAO_LE 260 +# define TAO_EQ 261 +# define TAO_NE 262 +# define TAO_EXIST 263 +# define TAO_AND 264 +# define TAO_OR 265 +# define TAO_NOT 266 +# define TAO_IN 267 +# define TAO_TWIDDLE 268 +# define TAO_BOOLEAN 269 +# define TAO_PLUS 270 +# define TAO_MINUS 271 +# define TAO_MULT 272 +# define TAO_DIV 273 +# define TAO_UMINUS 274 +# define TAO_NUMBER 275 +# define TAO_RPAREN 276 +# define TAO_LPAREN 277 +# define TAO_IDENT 278 +# define TAO_STRING 279 +# define TAO_UNKNOWN 280 +# define TAO_UNSIGNED 281 +# define TAO_SIGNED 282 +# define TAO_DOUBLE 283 +# define TAO_CONSTRAINT 284 +# define TAO_SEQUENCE 285 +# define TAO_WITH 286 +# define TAO_MAX 287 +# define TAO_MIN 288 +# define TAO_FIRST 289 +# define TAO_RANDOM 290 #ifdef __STDC__ #include <stdlib.h> @@ -99,7 +99,7 @@ YYSTYPE *yyv; static int yymaxdepth = YYMAXDEPTH; # define YYERRCODE 256 -# line 133 "constraint.y" +# line 133 "Trader/constraint.y" //extern int yydebug = 1; @@ -178,40 +178,40 @@ typedef struct yytoktype yytoks[] = { - "GT", 257, - "GE", 258, - "LT", 259, - "LE", 260, - "EQ", 261, - "NE", 262, - "EXIST", 263, - "AND", 264, - "OR", 265, - "NOT", 266, - "IN", 267, - "TWIDDLE", 268, - "BOOLEAN", 269, - "PLUS", 270, - "MINUS", 271, - "MULT", 272, - "DIV", 273, - "UMINUS", 274, - "NUMBER", 275, - "RPAREN", 276, - "LPAREN", 277, - "IDENT", 278, - "STRING", 279, - "UNSIGNED_INTEGER", 280, - "SIGNED_INTEGER", 281, - "DOUBLE", 282, - "CONSTRAINT", 283, - "SEQUENCE", 284, - "UNKNOWN", 285, - "WITH", 286, - "MAX", 287, - "MIN", 288, - "FIRST", 289, - "RANDOM", 290, + "TAO_GT", 257, + "TAO_GE", 258, + "TAO_LT", 259, + "TAO_LE", 260, + "TAO_EQ", 261, + "TAO_NE", 262, + "TAO_EXIST", 263, + "TAO_AND", 264, + "TAO_OR", 265, + "TAO_NOT", 266, + "TAO_IN", 267, + "TAO_TWIDDLE", 268, + "TAO_BOOLEAN", 269, + "TAO_PLUS", 270, + "TAO_MINUS", 271, + "TAO_MULT", 272, + "TAO_DIV", 273, + "TAO_UMINUS", 274, + "TAO_NUMBER", 275, + "TAO_RPAREN", 276, + "TAO_LPAREN", 277, + "TAO_IDENT", 278, + "TAO_STRING", 279, + "TAO_UNKNOWN", 280, + "TAO_UNSIGNED", 281, + "TAO_SIGNED", 282, + "TAO_DOUBLE", 283, + "TAO_CONSTRAINT", 284, + "TAO_SEQUENCE", 285, + "TAO_WITH", 286, + "TAO_MAX", 287, + "TAO_MIN", 288, + "TAO_FIRST", 289, + "TAO_RANDOM", 290, "-unknown-", -1 /* ends search */ }; @@ -220,41 +220,41 @@ char * yyreds[] = "-no such reduction-", "constraint : bool_or", "constraint : preference", - "preference : MIN bool_or", - "preference : MAX bool_or", - "preference : WITH bool_or", - "preference : FIRST", - "preference : RANDOM", - "bool_or : bool_or OR bool_and", + "preference : TAO_MIN bool_or", + "preference : TAO_MAX bool_or", + "preference : TAO_WITH bool_or", + "preference : TAO_FIRST", + "preference : TAO_RANDOM", + "bool_or : bool_or TAO_OR bool_and", "bool_or : bool_and", - "bool_and : bool_and AND bool_compare", + "bool_and : bool_and TAO_AND bool_compare", "bool_and : bool_compare", - "bool_compare : expr_in EQ expr_in", - "bool_compare : expr_in NE expr_in", - "bool_compare : expr_in GT expr_in", - "bool_compare : expr_in GE expr_in", - "bool_compare : expr_in LT expr_in", - "bool_compare : expr_in LE expr_in", + "bool_compare : expr_in TAO_EQ expr_in", + "bool_compare : expr_in TAO_NE expr_in", + "bool_compare : expr_in TAO_GT expr_in", + "bool_compare : expr_in TAO_GE expr_in", + "bool_compare : expr_in TAO_LT expr_in", + "bool_compare : expr_in TAO_LE expr_in", "bool_compare : expr_in", - "expr_in : expr_twiddle IN IDENT", + "expr_in : expr_twiddle TAO_IN TAO_IDENT", "expr_in : expr_twiddle", - "expr_twiddle : expr TWIDDLE expr", + "expr_twiddle : expr TAO_TWIDDLE expr", "expr_twiddle : expr", - "expr : expr PLUS term", - "expr : expr MINUS term", + "expr : expr TAO_PLUS term", + "expr : expr TAO_MINUS term", "expr : term", - "term : term MULT factor_not", - "term : term DIV factor_not", + "term : term TAO_MULT factor_not", + "term : term TAO_DIV factor_not", "term : factor_not", - "factor_not : NOT factor", + "factor_not : TAO_NOT factor", "factor_not : factor", - "factor : LPAREN bool_or RPAREN", - "factor : EXIST IDENT", - "factor : IDENT", - "factor : NUMBER", - "factor : MINUS NUMBER", - "factor : STRING", - "factor : BOOLEAN", + "factor : TAO_LPAREN bool_or TAO_RPAREN", + "factor : TAO_EXIST TAO_IDENT", + "factor : TAO_IDENT", + "factor : TAO_NUMBER", + "factor : TAO_MINUS TAO_NUMBER", + "factor : TAO_STRING", + "factor : TAO_BOOLEAN", }; #endif /* YYDEBUG */ # line 1 "/usr/ccs/bin/yaccpar" @@ -790,115 +790,115 @@ int yyparse() { case 1: -# line 38 "constraint.y" -{ yyval.constraint_ = new ACE_Unary_Constraint(CONSTRAINT, yypvt[-0].constraint_); } break; +# line 38 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Unary_Constraint(TAO_CONSTRAINT, yypvt[-0].constraint_); } break; case 2: -# line 40 "constraint.y" +# line 40 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 3: -# line 44 "constraint.y" -{ yyval.constraint_ = new ACE_Unary_Constraint(MIN, yypvt[-0].constraint_); } break; +# line 44 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Unary_Constraint(TAO_MIN, yypvt[-0].constraint_); } break; case 4: -# line 46 "constraint.y" -{ yyval.constraint_ = new ACE_Unary_Constraint(MAX, yypvt[-0].constraint_); } break; +# line 46 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Unary_Constraint(TAO_MAX, yypvt[-0].constraint_); } break; case 5: -# line 48 "constraint.y" -{ yyval.constraint_ = new ACE_Unary_Constraint(WITH, yypvt[-0].constraint_); } break; +# line 48 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Unary_Constraint(TAO_WITH, yypvt[-0].constraint_); } break; case 6: -# line 50 "constraint.y" -{ yyval.constraint_ = new ACE_Noop_Constraint(FIRST); } break; +# line 50 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Noop_Constraint(TAO_FIRST); } break; case 7: -# line 52 "constraint.y" -{ yyval.constraint_ = new ACE_Noop_Constraint(RANDOM); } break; +# line 52 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Noop_Constraint(TAO_RANDOM); } break; case 8: -# line 56 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(OR, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 56 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_OR, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 9: -# line 58 "constraint.y" +# line 58 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 10: -# line 62 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(AND, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 62 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_AND, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 11: -# line 64 "constraint.y" +# line 64 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 12: -# line 68 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(EQ, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 68 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_EQ, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 13: -# line 70 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(NE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 70 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_NE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 14: -# line 72 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(GT, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 72 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_GT, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 15: -# line 74 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(GE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 74 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_GE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 16: -# line 76 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(LT, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 76 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_LT, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 17: -# line 78 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(LE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 78 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_LE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 18: -# line 80 "constraint.y" +# line 80 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 19: -# line 84 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(IN, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 84 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_IN, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 20: -# line 86 "constraint.y" +# line 86 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 21: -# line 90 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(TWIDDLE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 90 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_TWIDDLE, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 22: -# line 92 "constraint.y" +# line 92 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 23: -# line 96 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(PLUS, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 96 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_PLUS, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 24: -# line 98 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(MINUS, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 98 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_MINUS, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 25: -# line 100 "constraint.y" +# line 100 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 26: -# line 104 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(MULT, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 104 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_MULT, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 27: -# line 106 "constraint.y" -{ yyval.constraint_ = new ACE_Binary_Constraint(DIV, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; +# line 106 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Binary_Constraint(TAO_DIV, yypvt[-2].constraint_, yypvt[-0].constraint_); } break; case 28: -# line 108 "constraint.y" +# line 108 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 29: -# line 112 "constraint.y" -{ yyval.constraint_ = new ACE_Unary_Constraint(NOT, yypvt[-0].constraint_); } break; +# line 112 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Unary_Constraint(TAO_NOT, yypvt[-0].constraint_); } break; case 30: -# line 114 "constraint.y" +# line 114 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 31: -# line 118 "constraint.y" +# line 118 "Trader/constraint.y" { yyval.constraint_ = yypvt[-1].constraint_; } break; case 32: -# line 120 "constraint.y" -{ yyval.constraint_ = new ACE_Unary_Constraint(EXIST, yypvt[-0].constraint_); } break; +# line 120 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Unary_Constraint(TAO_EXIST, yypvt[-0].constraint_); } break; case 33: -# line 122 "constraint.y" +# line 122 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 34: -# line 124 "constraint.y" +# line 124 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 35: -# line 126 "constraint.y" -{ yyval.constraint_ = new ACE_Unary_Constraint(UMINUS, yypvt[-0].constraint_); } break; +# line 126 "Trader/constraint.y" +{ yyval.constraint_ = new TAO_Unary_Constraint(TAO_UMINUS, yypvt[-0].constraint_); } break; case 36: -# line 128 "constraint.y" +# line 128 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; case 37: -# line 130 "constraint.y" +# line 130 "Trader/constraint.y" { yyval.constraint_ = yypvt[-0].constraint_; } break; # line 532 "/usr/ccs/bin/yaccpar" } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.cpp b/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.cpp index 832d7ca5870..2e8ffd460c1 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.cpp @@ -6,24 +6,29 @@ TAO_Dynamic_Property::TAO_Dynamic_Property(const char* name) { } -CosTradingDynamic::DynamicProp_ptr +CosTradingDynamic::DynamicProp* TAO_Dynamic_Property::register_handler(const char* name, CORBA::TypeCode_ptr returned_type, const CORBA::Any& extra_info, TAO_DP_Evaluation_Handler* handler) { string prop_name(name); - CosTradingDynamic::DynamicProp_ptr dp_struct = 0; - HANDLER_MAP::iterator handlers_iter = this->handlers_.find(prop_name); + CosTradingDynamic::DynamicProp* dp_struct = 0; + TAO_Dynamic_Property::HANDLER_MAP::iterator handlers_iter = + this->handlers_.find(prop_name); + // Set up the handler to receive evaluations for prop_name if (handlers_iter == this->handlers_.end()) this->handlers_[prop_name] = handler; - + + // Create the dp_struct for this dynamic property. dp_struct = new CosTradingDynamic::DynamicProp; if (dp_struct != 0) { - dp_struct->eval_if = - CosTradingDynamic::DynamicPropEval::_duplicate (this); + CORBA::Environment env; + + dp_struct->eval_if = this->_this (env); + TAO_CHECK_ENV_RETURN (env, dp_struct); dp_struct->returned_type = CORBA::TypeCode::_duplicate (returned_type); dp_struct->extra_info = extra_info; @@ -53,8 +58,8 @@ TAO_Dynamic_Property::evalDP(const char* name, CORBA::TypeCode_ptr returned_type, const CORBA::Any& extra_info, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTradingDynamic::DPEvalFailure) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTradingDynamic::DPEvalFailure)) { string prop_name(name); CORBA::Any* result = 0; @@ -63,13 +68,13 @@ TAO_Dynamic_Property::evalDP(const char* name, if (handlers_iter != this->handlers_.end()) { TAO_DP_Evaluation_Handler* handler = (*handlers_iter).second; - result = handler->evalDP(extra_info); + result = handler->evalDP (extra_info, _env); - if (! returned_type->equal(result->type())) - TAO_THROW (CosTradingDynamic::DPEvalFailure()); + if (! returned_type->equal(result->type(), _env)) + TAO_THROW_RETURN (CosTradingDynamic::DPEvalFailure(), result); } else - throw (CosTradingDynamic::DPEvalFailure()); + TAO_THROW_RETURN (CosTradingDynamic::DPEvalFailure(), result); return result; } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.h b/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.h index ecd2754d684..0a49db13ca1 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Dynamic_Property.h @@ -20,7 +20,17 @@ #include <map> #include <string> -#include "CosTradingS.h" + +#if defined (OS_NO_NAMESPACE) +#define queue foobar +#endif /* OS_NO_NAMESPACE */ + +#include "orbsvcs/CosTradingS.h" + +#if defined (OS_NO_NAMESPACE) +#undef queue +#endif /* OS_NO_NAMESPACE */ + class TAO_DP_Evaluation_Handler { @@ -28,7 +38,7 @@ public: virtual CORBA::Any* evalDP(const CORBA::Any& extra_info, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTradingDynamic::DPEvalFailure) = 0; + TAO_THROW_SPEC ((CosTradingDynamic::DPEvalFailure)) = 0; }; @@ -46,7 +56,7 @@ public: TAO_Dynamic_Property(const char* name = "Dynamic Property"); - CosTradingDynamic::DynamicProp_ptr + CosTradingDynamic::DynamicProp* register_handler(const char* name, CORBA::TypeCode_ptr returned_type, const CORBA::Any& extra_info, @@ -63,8 +73,8 @@ public: CORBA::TypeCode_ptr returned_type, const CORBA::Any& extra_info, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTradingDynamic::DPEvalFailure); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTradingDynamic::DPEvalFailure)); // Point of demultiplexing. private: diff --git a/TAO/orbsvcs/orbsvcs/Trader/Interpreter.h b/TAO/orbsvcs/orbsvcs/Trader/Interpreter.h index b98d73ff180..08dee14637a 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Interpreter.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Interpreter.h @@ -16,7 +16,6 @@ #ifndef TAO_INTERPRETER_H #define TAO_INTERPRETER_H -#include "CosTradingC.h" #include "Constraint.h" #include "Constraint_Nodes.h" diff --git a/TAO/orbsvcs/orbsvcs/Trader/Link.cpp b/TAO/orbsvcs/orbsvcs/Trader/Link.cpp index aaedfa27adc..b4fa77fb75a 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Link.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Link.cpp @@ -19,155 +19,196 @@ #define TAO_LINK_C #include "Link.h" +#include "Locking.h" +#include "Trader_Base.h" - -template <class TRADER> -TAO_Link<TRADER>::TAO_Link (const TRADER &trader) - : trader_ (trader) +template <class TRADER, class MAP_LOCK_TYPE> +TAO_Link<TRADER,MAP_LOCK_TYPE>::TAO_Link (TRADER &trader) + : trader_ (trader), + TAO_Trader_Components <POA_CosTrading::Link> (trader.trading_components ()), + TAO_Link_Attributes <POA_CosTrading::Link> (trader.link_attributes ()), + TAO_Support_Attributes <POA_CosTrading::Link> (trader.support_attributes ()) { } -template <class TRADER> -TAO_Link<TRADER>::~TAO_Link (void) +template <class TRADER, class MAP_LOCK_TYPE> +TAO_Link<TRADER,MAP_LOCK_TYPE>::~TAO_Link (void) { } -template <class TRADER> void -TAO_Link<TRADER>:: +template <class TRADER, class MAP_LOCK_TYPE> void +TAO_Link<TRADER,MAP_LOCK_TYPE>:: add_link (const char *name, CosTrading::Lookup_ptr target, CosTrading::FollowOption def_pass_on_follow_rule, CosTrading::FollowOption limiting_follow_rule, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Link::IllegalLinkName, CosTrading::Link::DuplicateLinkName, CosTrading::InvalidLookupRef, CosTrading::Link::DefaultFollowTooPermissive, - CosTrading::Link::LimitingFollowTooPermissive) -{ - TAO_THROW (CORBA::SystemException ()); -} - -template <class TRADER> void -TAO_Link<TRADER>::remove_link (const char *name, - CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::Link::IllegalLinkName, - CosTrading::Link::UnknownLinkName) -{ - TAO_THROW (CORBA::SystemException ()); -} - -template <class TRADER> CosTrading::Link::LinkInfo * -TAO_Link<TRADER>::describe_link (const char *name, - CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::SystemException, - CosTrading::Link::IllegalLinkName, - CosTrading::Link::UnknownLinkName) -{ - TAO_THROW (CORBA::SystemException ()); -} - -template <class TRADER> CosTrading::LinkNameSeq * -TAO_Link<TRADER>::list_links (CosTrading::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + CosTrading::Link::LimitingFollowTooPermissive)) { - TAO_THROW (CORBA::SystemException ()); -} - -template <class TRADER> void -TAO_Link<TRADER>::modify_link (const char *name, - CosTrading::FollowOption def_pass_on_follow_rule, - CosTrading::FollowOption limiting_follow_rule, + TAO_WRITE_GUARD (MAP_LOCK_TYPE, + ace_mon, + this->links_.lock ()); + + // Ensure the link name is valid. + if (! TAO_Trader_Base::is_valid_identifier_name (name)) + TAO_THROW (CosTrading::Link::IllegalLinkName (name)); + + // Ensure this isn't a duplicate link name. + string link_name (name); + LINKS::iterator links_iter = this->links_.find (link_name); + if (links_iter != this->links_.end ()) + TAO_THROW (CosTrading::Link::DuplicateLinkName (name)); + + // Ensure the lookup_ptr isn't nil. + if (target == CosTrading::Lookup::_nil()) + TAO_THROW (CosTrading::InvalidLookupRef (target)); + + // Ensure that the default link behavior isn't stronger than the + // limiting link behavior. + if (def_pass_on_follow_rule > limiting_follow_rule) + TAO_THROW (CosTrading::Link::DefaultFollowTooPermissive + (def_pass_on_follow_rule, limiting_follow_rule)); + + // Ensure that the limiting link behavior for this link doesn't + // exceed the maximum allowed for a link. + if (limiting_follow_rule < this->max_link_follow_policy (_env)) + TAO_THROW (CosTrading::Link::LimitingFollowTooPermissive + (limiting_follow_rule, this->max_link_follow_policy (_env))); + + // Create a link info structure for this link of the federation. + CosTrading::Link::LinkInfo link_info; + link_info.target = target; + link_info.target_reg = target->register_if (_env); + link_info.def_pass_on_follow_rule = def_pass_on_follow_rule; + link_info.limiting_follow_rule = limiting_follow_rule; + TAO_CHECK_ENV_RETURN (_env,); + + // Insert this link into the collection of links. + this->links_.insert (link_name, link_info); +} + +template <class TRADER, class MAP_LOCK_TYPE> void +TAO_Link<TRADER,MAP_LOCK_TYPE>::remove_link (const char *name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Link::IllegalLinkName, - CosTrading::Link::UnknownLinkName, - CosTrading::Link::DefaultFollowTooPermissive, - CosTrading::Link::LimitingFollowTooPermissive) -{ - TAO_THROW (CORBA::SystemException ()); -} - -template <class TRADER> -CosTrading::Lookup_ptr -TAO_Lookup<TRADER>::lookup_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Lookup::_duplicate (this->trader_.trading_components ().lookup_if ()); -} - -template <class TRADER> -CosTrading::Register_ptr -TAO_Lookup<TRADER>::register_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + CosTrading::Link::UnknownLinkName)) { - return CosTrading::Register::_duplicate (this->trader_.trading_components ().register_if ()); -} + TAO_WRITE_GUARD (MAP_LOCK_TYPE, + ace_mon, + this->links_.lock ()); -template <class TRADER> -CosTrading::Link_ptr -TAO_Lookup<TRADER>::link_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Link::_duplicate (this->trader_.trading_components ().link_if ()); -} + // Ensure the link name is valid. + if (! TAO_Trader_Base::is_valid_identifier_name (name)) + TAO_THROW (CosTrading::Link::IllegalLinkName (name)); -template <class TRADER> -CosTrading::Proxy_ptr -TAO_Lookup<TRADER>::proxy_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Proxy::_duplicate (this->trader_.trading_components ().proxy_if ()); -} + // Ensure this isn't a duplicate link name. + string link_name (name); + LINKS::iterator links_iter = this->links_.find (link_name); + if (links_iter == this->links_.end ()) + TAO_THROW (CosTrading::Link::UnknownLinkName (name)); -template <class TRADER> -CosTrading::Admin_ptr -TAO_Lookup<TRADER>::admin_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Admin::_duplicate (this->trader_.trading_components ().admin_if ()); + // Erase the link state from the map. + this->links_.erase (links_iter); } -template <class TRADER> -CORBA::Boolean -TAO_Lookup<TRADER>::supports_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_modifiable_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Lookup<TRADER>::supports_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) +template <class TRADER, class MAP_LOCK_TYPE> CosTrading::Link::LinkInfo * +TAO_Link<TRADER,MAP_LOCK_TYPE>::describe_link (const char *name, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::SystemException, + CosTrading::Link::IllegalLinkName, + CosTrading::Link::UnknownLinkName)) { - return this->trader_.support_attributes ().supports_dynamic_properties (); -} + TAO_READ_GUARD_RETURN (MAP_LOCK_TYPE, + ace_mon, + this->links_.lock (), + (CosTrading::Link::LinkInfo*) 0); -template <class TRADER> -CORBA::Boolean -TAO_Lookup<TRADER>::supports_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_proxy_offers (); -} + // Ensure the link name is valid. + if (! TAO_Trader_Base::is_valid_identifier_name (name)) + TAO_THROW_RETURN (CosTrading::Link::IllegalLinkName (name), 0); -template <class TRADER> -CosTrading::TypeRepository_ptr -TAO_Lookup<TRADER>::type_repos (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::TypeRepository::_duplicate - (this->trader_.support_attributes ().type_repos ()); -} - -template <class TRADER> -CosTrading::FollowOption -TAO_Link<TRADER>::max_link_follow_policy (CORBA::Environment &env) -{ - return this->trader_.link_attributes ().max_link_follow_policy (); + // Ensure this isn't a duplicate link name. + string link_name (name); + LINKS::iterator links_iter = this->links_.find (link_name); + if (links_iter == this->links_.end ()) + TAO_THROW_RETURN (CosTrading::Link::UnknownLinkName (name), 0); + + // return the link infor for this link name. + return &(*links_iter).second; +} + +template <class TRADER, class MAP_LOCK_TYPE> CosTrading::LinkNameSeq* +TAO_Link<TRADER,MAP_LOCK_TYPE>::list_links (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) +{ + TAO_READ_GUARD_RETURN (MAP_LOCK_TYPE, + ace_mon, + this->links_.lock (), + (CosTrading::LinkNameSeq*) 0); + + // Allocate space for the link names. + CORBA::ULong size = this->links_.size (), i = 0; + CosTrading::LinkName* link_seq = + CosTrading::LinkNameSeq::allocbuf (size); + + // Copy the link names into the buffer. + for (LINKS::iterator links_iter = this->links_.begin (); + links_iter != this->links_.end (); + links_iter++) + link_seq[i++] = CORBA::string_dup ((*links_iter).first.data ()); + + // Return a sequence of the buf names. + return new CosTrading::LinkNameSeq (i, i, link_seq, 1); +} + +template <class TRADER, class MAP_LOCK_TYPE> void +TAO_Link<TRADER,MAP_LOCK_TYPE>:: +modify_link (const char *name, + CosTrading::FollowOption def_pass_on_follow_rule, + CosTrading::FollowOption limiting_follow_rule, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::Link::IllegalLinkName, + CosTrading::Link::UnknownLinkName, + CosTrading::Link::DefaultFollowTooPermissive, + CosTrading::Link::LimitingFollowTooPermissive)) +{ + TAO_WRITE_GUARD (MAP_LOCK_TYPE, + ace_mon, + this->links_.lock ()); + + // Ensure the link name is valid. + if (! TAO_Trader_Base::is_valid_identifier_name (name)) + TAO_THROW (CosTrading::Link::IllegalLinkName (name)); + + // Ensure this isn't a duplicate link name. + string link_name (name); + LINKS::iterator links_iter = this->links_.find (link_name); + if (links_iter == this->links_.end ()) + TAO_THROW (CosTrading::Link::UnknownLinkName (name)); + + // Ensure that the default link behavior isn't stronger than the + // limiting link behavior. + if (def_pass_on_follow_rule > limiting_follow_rule) + TAO_THROW (CosTrading::Link::DefaultFollowTooPermissive + (def_pass_on_follow_rule, limiting_follow_rule)); + + // Ensure that the limiting link behavior for this link doesn't + // exceed the maximum allowed for a link. + if (limiting_follow_rule < this->max_link_follow_policy (_env)) + TAO_THROW (CosTrading::Link::LimitingFollowTooPermissive + (limiting_follow_rule, this->max_link_follow_policy (_env))); + + // Adjust the link settings + CosTrading::Link::LinkInfo& link_info = (*links_iter).second; + link_info.def_pass_on_follow_rule = def_pass_on_follow_rule; + link_info.limiting_follow_rule = limiting_follow_rule; } #endif /* TAO_LINK_C */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Link.h b/TAO/orbsvcs/orbsvcs/Trader/Link.h index cf8d8afb06c..b10e5a73c79 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Link.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Link.h @@ -19,14 +19,20 @@ #ifndef TAO_LINK_H #define TAO_LINK_H -#include "CosTradingS.h" - -template <class TRADER> -class TAO_Link : public POA_CosTrading::Link +#include "Attributes.h" +#include "Monitor.h" +#include <string> +#include <map> + +template <class TRADER, class MAP_LOCK_TYPE> +class TAO_Link : + public TAO_Trader_Components <POA_CosTrading::Link>, + public TAO_Support_Attributes <POA_CosTrading::Link>, + public TAO_Link_Attributes <POA_CosTrading::Link> { public: - TAO_Link (const TRADER &trader); + TAO_Link (TRADER &trader); ~TAO_Link (void); @@ -35,84 +41,154 @@ public: CosTrading::FollowOption def_pass_on_follow_rule, CosTrading::FollowOption limiting_follow_rule, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Link::IllegalLinkName, CosTrading::Link::DuplicateLinkName, CosTrading::InvalidLookupRef, CosTrading::Link::DefaultFollowTooPermissive, - CosTrading::Link::LimitingFollowTooPermissive); - + CosTrading::Link::LimitingFollowTooPermissive)); + // BEGIN SPEC + // The add_link operation allows a trader subsequently to use the + // service of another trader in the performance of its own trading + // service operations. + + // The "name" parameter is used in subsequent link management + // operations to identify the intended link. If the parameter is not + // legally formed, then the IllegalLinkName exception is raised. An + // exception of DuplicateLinkName is raised if the link name already + // exists. The link name is also used as a component in a sequence + // of name components in naming a trader for resolving or forwarding + // operations. The sequence of context relative link names provides + // a path to a trader. + + // The "target" parameter identifies the Lookup interface at which + // the trading service provided by the target trader can be + // accessed. Should the Lookup interface parameter be nil, then an + // exception of InvalidLookupRef is raised. The target interface is + // used to obtain the associated Register interface, which will be + // subsequently returned as part of a describe_link operation and + // invoked as part of a resolve operation. + + // The "def_pass_on_follow_rule" parameter specifies the default + // link behavior for the link if no link behavior is specified on an + // importer's query request. If the "def_pass_on_follow_rule" + // exceeds the "limiting_follow_rule" specified in the next + // parameter, then a DefaultFollowTooPermissive exception is + // raised. + + // The "limiting_follow_rule" parameter specifies the most + // permissive link follow behavior that the link is willing to + // tolerate. The exception LimitingFollowTooPermissive is raised if + // this parameter exceeds the trader's attribute of + // "max_link_follow_policy" at the time of the link's creation. Note + // it is possible for a link's "limiting_follow_rule" to exceed the + // trader's "max_link_follow_policy" later in the life of a link, as + // it is possible that the trader could set its + // "max_link_follow_policy" to a more restrictive value after the + // creation of the link. + // END SPEC + virtual void remove_link (const char *name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Link::IllegalLinkName, - CosTrading::Link::UnknownLinkName); - + CosTrading::Link::UnknownLinkName)); + + // BEGIN SPEC + // The remove_link operation removes all knowledge of the target + // trader. The target trader cannot be used subsequently to resolve, + // forward, or propagate trading operations from this trader. + + // The "name" parameter identifies the link to be removed. The + // exception IllegalLinkName is raised if the link is formed poorly + // and the UnknownLinkName exception is raised if the named link is + // not in the trader. + // END SPEC + virtual CosTrading::Link::LinkInfo* describe_link (const char *name, CORBA::Environment&) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Link::IllegalLinkName, - CosTrading::Link::UnknownLinkName); - + CosTrading::Link::UnknownLinkName)); + + // BEGIN SPEC + // The describe_link operation returns information on a link held in + // the trader. + + // The "name" parameter identifies the link whose description is + // required. For a malformed link name, the exception + // IllegalLinkName is raised. An UnknownLinkName exception is raised + // if the named link is not found in the trader. + + // The operation returns a LinkInfo structure comprising: ° the + // Lookup interface of the target trading service, ° the Register + // interface of the target trading service, and ° the default, as + // well as the limiting follow behavior of the named link. + + // If the target service does not support the Register interface, + // then that field of the LinkInfo structure is nil. Given the + // description of the Register::resolve() operation in "Resolve + // Operation" on page 16-45, most implementations will opt for + // determining the Register interface when add_link is called and + // storing that information statically with the rest of the link + // state. + // END SPEC + virtual CosTrading::LinkNameSeq* list_links (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - + TAO_THROW_SPEC ((CORBA::SystemException)); + + // BEGIN SPEC + // The list_links operation returns a list of the names of all + // trading links within the trader. The names can be used + // subsequently for other management operations, such as + // describe_link or remove_link. + // END SPEC + virtual void modify_link (const char *name, CosTrading::FollowOption def_pass_on_follow_rule, CosTrading::FollowOption limiting_follow_rule, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Link::IllegalLinkName, + TAO_THROW_SPEC ((CosTrading::Link::IllegalLinkName, CosTrading::Link::UnknownLinkName, CosTrading::Link::DefaultFollowTooPermissive, - CosTrading::Link::LimitingFollowTooPermissive); + CosTrading::Link::LimitingFollowTooPermissive)); + + // BEGIN SPEC + // The modify_link operation is used to change the existing link + // follow behaviors of an identified link. The Lookup interface + // reference of the target trader and the name of the link cannot be + // changed. + + // The "name" parameter identifies the link whose follow behaviors + // are to be changed. A poorly formed "name" raises the + // IllegalLinkName exception. An UnknownLinkName exception is raised + // if the link name is not known to the trader. + + // The "def_pass_on_follow_rule" parameter specifies the new default + // link behavior for this link. If the "def_pass_on_follow_rule" + // exceeds the "limiting_follow_rule" specified in the next + // parameter, then a DefaultFollowTooPermissive exception is + // raised. + + // The "limiting_follow_rule" parameter specifies the new limit for + // the follow behavior of this link. The exception + // LimitingFollowTooPermissive is raised if the value exceeds the + // current "max_link_follow_policy" of the trader. + // END SPEC + +private: - // = CosTrading::TraderComponents methods. + typedef TAO_Monitor + < + map <string, CosTrading::Link::LinkInfo, less <string> >, + MAP_LOCK_TYPE + > + LINKS; - virtual CosTrading::Lookup_ptr lookup_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns an object reference to the Lookup interface of the trader. - // Returns nil if the trader does not support Lookup interface. - - virtual CosTrading::Register_ptr register_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Register interface of the trader. - // Returns nil if the trader does not support Register interface. - - virtual CosTrading::Link_ptr link_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Link interface of the trader. - // Returns nil if the trader does not support Link interface. - - virtual CosTrading::Proxy_ptr proxy_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference to the Proxy interface of the trader. - // Returns nil if the trader does not support Proxy interface. + LINKS links_; + // The collection of link connecting this trader to others in the + // federation. - virtual CosTrading::Admin_ptr admin_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Admin interface of the trader. - // Returns nil if the trader does not support Admin interface. - - // = CosTrading::SupportAttributes methods. - - virtual CORBA::Boolean supports_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::TypeRepository_ptr type_repos (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - - // = CosTrading::LinkAttributes methods. - - virtual CosTrading::FollowOption max_link_follow_policy (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); - -private: TRADER &trader_; }; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Locking.h b/TAO/orbsvcs/orbsvcs/Trader/Locking.h new file mode 100644 index 00000000000..7a583405dc9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Trader/Locking.h @@ -0,0 +1,57 @@ +/* -*- C++ -*- */ + +// ========================================================================= +// $Id$ +// +// = LIBRARY +// Trading +// +// = FILENAME +// Locking.h +// +// = AUTHOR +// Marina Spivak <marina@cs.wustl.edu> +// Seth Widoff <sbw1@cs.wustl.edu> +// Irfan Pyarali <irfan@cs.wustl.edu> +// +// ========================================================================== +#ifndef TAO_LOCKING_H +#define TAO_LOCKING_H + +#if defined (OS_NO_NAMESPACE) +#define queue booga +#endif /* OS_NO_NAMESPACE */ + +#include "tao/corba.h" + +#if defined (OS_NO_NAMESPACE) +#undef queue +#endif /* OS_NO_NAMESPACE */ + + +// Macros for obtaining read/write locks that are +// automatically released at the end of scope. +// In case of failure, CORBA::SystemException is thrown. + +#define TAO_WRITE_GUARD(MUTEX,OBJ,LOCK) \ +ACE_Write_Guard<MUTEX> OBJ (LOCK); \ +if (OBJ.locked () == 0) \ + TAO_THROW (CORBA::UNKNOWN (CORBA::COMPLETED_NO)); + +#define TAO_READ_GUARD(MUTEX,OBJ,LOCK) \ +ACE_Read_Guard<MUTEX> OBJ (LOCK); \ +if (OBJ.locked () == 0) \ + TAO_THROW (CORBA::UNKNOWN (CORBA::COMPLETED_NO)); + +#define TAO_WRITE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ +ACE_Write_Guard<MUTEX> OBJ (LOCK); \ +if (OBJ.locked () == 0) \ + TAO_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_NO), RETURN); + +#define TAO_READ_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ +ACE_Read_Guard<MUTEX> OBJ (LOCK); \ +if (OBJ.locked () == 0) \ + TAO_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_NO), RETURN); + +#endif /* TAO_LOCKING_H */ + diff --git a/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp b/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp index 424bb687fa8..daed84a1435 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp @@ -1,6 +1,6 @@ /* -*- C++ -*- */ -// ======================================================================== +// ===================================================================== // $Id$ // // = LIBRARY @@ -13,7 +13,7 @@ // Marina Spivak <marina@cs.wustl.edu> // Seth Widoff <sbw1@cs.wustl.edu> // -// ======================================================================== +// ===================================================================== #if !defined (TAO_LOOKUP_C) #define TAO_LOOKUP_C @@ -40,7 +40,10 @@ const char* TAO_Lookup<TRADER>::NAME = "Trader: Lookup"; template <class TRADER> TAO_Lookup<TRADER>::TAO_Lookup (TRADER &trader) - : trader_ (trader) + : trader_ (trader), + TAO_Trader_Components<POA_CosTrading::Lookup> (trader.trading_components ()), + TAO_Support_Attributes<POA_CosTrading::Lookup> (trader.support_attributes ()), + TAO_Import_Attributes<POA_CosTrading::Lookup> (trader.import_attributes ()) { } @@ -61,17 +64,17 @@ query (const char *type, CosTrading::OfferIterator_out returned_offer_iterator, CosTrading::PolicyNameSeq_out returned_limits_applied, CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType, - CosTrading::IllegalConstraint, - CosTrading::Lookup::IllegalPreference, - CosTrading::Lookup::IllegalPolicyName, - CosTrading::Lookup::PolicyTypeMismatch, - CosTrading::Lookup::InvalidPolicyValue, - CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName, - CosTrading::DuplicatePolicyName) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::IllegalServiceType, + CosTrading::UnknownServiceType, + CosTrading::IllegalConstraint, + CosTrading::Lookup::IllegalPreference, + CosTrading::Lookup::IllegalPolicyName, + CosTrading::Lookup::PolicyTypeMismatch, + CosTrading::Lookup::InvalidPolicyValue, + CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName, + CosTrading::DuplicatePolicyName)) { // Initializing out parameters returned_offers = new CosTrading::OfferSeq; @@ -87,9 +90,10 @@ query (const char *type, CosTrading::TypeRepository_ptr type_repos = support_attrs.type_repos (); CosTradingRepos::ServiceTypeRepository_ptr rep = - CosTradingRepos::ServiceTypeRepository::_narrow (type_repos); + CosTradingRepos::ServiceTypeRepository::_narrow (type_repos, env); + TAO_CHECK_ENV_RETURN (env,); TAO_Policies policies (this->trader_, in_policies, env); - TAO_CHECK_ENV_RETURN (env); + TAO_CHECK_ENV_RETURN (env,); // If type is not found, there is nothing to consider - return. // Else we found the service type....proceed with lookup. @@ -105,7 +109,7 @@ query (const char *type, policies, ordered_offers, env); - TAO_CHECK_ENV_RETURN (env); + TAO_CHECK_ENV_RETURN (env,); // Fill the return sequence and iterator with the bountiful results. this->fill_receptacles (type, @@ -115,7 +119,7 @@ query (const char *type, returned_offers, returned_offer_iterator, env); - TAO_CHECK_ENV_RETURN (env); + TAO_CHECK_ENV_RETURN (env,); // Return the limits applied during the course of the lookup. returned_limits_applied = policies.limits_applied (); @@ -131,12 +135,12 @@ perform_lookup (const char* type, TAO_Policies& policies, LOOKUP_OFFER_LIST& ordered_offers, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalConstraint, + TAO_THROW_SPEC ((CosTrading::IllegalConstraint, CosTrading::Lookup::IllegalPreference, CosTrading::Lookup::PolicyTypeMismatch, CosTrading::Lookup::InvalidPolicyValue, CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType) + CosTrading::UnknownServiceType)) { // TAO_Offer_Filter -- ensures that we don't consider offers with // modifiable or dynamic properties if the Trader doesn't support @@ -147,15 +151,16 @@ perform_lookup (const char* type, // determines whether an offer meets those constraints. // TAO_Preference_Interpreter -- parses the preference string and // orders offers according to those constraints. - TYPE_STRUCT type_struct (rep->fully_describe_type (type, _env)); - TAO_CHECK_ENV_RETURN (env); - TAO_Offer_Filter offer_filter (type_struct, policies); - TAO_Constraint_Validator validator (type_struct); + TYPE_STRUCT type_struct (rep->fully_describe_type (type, env)); + TAO_CHECK_ENV_RETURN (env,); + TAO_Offer_Filter offer_filter (type_struct.ptr (), policies, env); + TAO_Constraint_Validator validator (type_struct.ptr ()); TAO_Constraint_Interpreter constr_inter (validator, constraint, env); - TAO_CHECK_ENV_RETURN (env); + TAO_CHECK_ENV_RETURN (env,); TAO_Preference_Interpreter pref_inter (validator, preferences, env); - TAO_CHECK_ENV_RETURN (env); - CORBA::ULong return_card = policies.return_card (); + TAO_CHECK_ENV_RETURN (env,); + CORBA::ULong return_card = policies.return_card (env); + TAO_CHECK_ENV_RETURN (env,); // Try to find the map of offers of desired service type. this->lookup_one_type (type, @@ -170,8 +175,9 @@ perform_lookup (const char* type, // subtypes. Additional properties on the subtype are generally // ignored. This is as it should be, consistent with the notions of // type inheritence. - if (! policies.exact_type_match ()) + if (! policies.exact_type_match (env)) { + TAO_CHECK_ENV_RETURN (env,); this->lookup_all_subtypes (type, service_type_map, rep, @@ -179,6 +185,7 @@ perform_lookup (const char* type, pref_inter, offer_filter); } + TAO_CHECK_ENV_RETURN (env,); // Pull the matched offers out of the pref_inter in order, and stick // them in a queue. The offers in the queue will be emptied into @@ -272,11 +279,11 @@ lookup_all_subtypes (const char* type, list<char*> sub_types, unconsidered_types; CosTradingRepos::ServiceTypeRepository::SpecifiedServiceTypes sst; TYPE_NAME_SEQ all_types (service_type_map.list_all_types ()); - + // All types save the supertype are initially unconsidered. sub_types.push_back ((char *) type); for (int i = all_types->length () - 1; i >= 0; i--) - unconsidered_types.push_back (all_types[i]); + unconsidered_types.push_back ((char*)((const char*) all_types[i])); unconsidered_types.remove ((char *) type); // Iterate over the remaining subtypes to locate their subtypes. @@ -300,7 +307,7 @@ lookup_all_subtypes (const char* type, { type_struct = rep->describe_type (type_name, TAO_TRY_ENV); } - TAO_CATCH_ANY + TAO_CATCHANY { break; } @@ -342,8 +349,8 @@ fill_receptacles (const char* type, CosTrading::OfferSeq*& offers, CosTrading::OfferIterator_ptr& offer_itr, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName) + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName)) { // BEGIN SPEC // The returned offers are passed back in one of two ways (or a @@ -360,7 +367,7 @@ fill_receptacles (const char* type, LOOKUP_OFFER_LIST::iterator ordered_offers_iterator = ordered_offers.begin (); TAO_Property_Filter prop_filter (desired_props, env); - TAO_CHECK_ENV_RETURN (env); + TAO_CHECK_ENV_RETURN (env,); // RETURNING: Calculate how many offers go into the sequence // Calculate how many go into the iterator @@ -384,11 +391,8 @@ fill_receptacles (const char* type, // Create an iterator implementation TAO_Offer_Iterator *oi = this->create_offer_iterator (type, prop_filter); - offer_itr = oi->_duplicate (oi); - - // Register the iterator with the orb. - CORBA::BOA_var boa = _boa(); - boa->obj_is_ready (oi); + offer_itr = oi->_this (env); + TAO_CHECK_ENV_RETURN (env,); // Add to the iterator for (i = 0; @@ -433,167 +437,4 @@ create_offer_iterator (const char *type, return iterator; } - -template <class TRADER> -CosTrading::Lookup_ptr -TAO_Lookup<TRADER>::lookup_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Lookup::_duplicate (this->trader_.trading_components ().lookup_if ()); -} - -template <class TRADER> -CosTrading::Register_ptr -TAO_Lookup<TRADER>::register_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Register::_duplicate (this->trader_.trading_components ().register_if ()); -} - -template <class TRADER> -CosTrading::Link_ptr -TAO_Lookup<TRADER>::link_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Link::_duplicate (this->trader_.trading_components ().link_if ()); -} - -template <class TRADER> -CosTrading::Proxy_ptr -TAO_Lookup<TRADER>::proxy_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Proxy::_duplicate (this->trader_.trading_components ().proxy_if ()); -} - -template <class TRADER> -CosTrading::Admin_ptr -TAO_Lookup<TRADER>::admin_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Admin::_duplicate (this->trader_.trading_components ().admin_if ()); -} - -template <class TRADER> -CORBA::Boolean -TAO_Lookup<TRADER>::supports_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_modifiable_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Lookup<TRADER>::supports_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_dynamic_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Lookup<TRADER>::supports_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_proxy_offers (); -} - -template <class TRADER> -CosTrading::TypeRepository_ptr -TAO_Lookup<TRADER>::type_repos (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::TypeRepository::_duplicate - (this->trader_.support_attributes ().type_repos ()); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::def_search_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_search_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::max_search_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_search_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::def_match_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_match_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::max_match_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_match_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::def_return_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_return_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::max_return_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_return_card (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::max_list (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_list (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::def_hop_count (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_hop_count (); -} - -template <class TRADER> -CORBA::ULong -TAO_Lookup<TRADER>::max_hop_count (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_hop_count (); -} - -template <class TRADER> -CosTrading::FollowOption -TAO_Lookup<TRADER>::def_follow_policy (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().def_follow_policy (); -} - -template <class TRADER> -CosTrading::FollowOption -TAO_Lookup<TRADER>::max_follow_policy (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.import_attributes ().max_follow_policy (); -} - - #endif /* TAO_LOOKUP_C */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Lookup.h b/TAO/orbsvcs/orbsvcs/Trader/Lookup.h index 35efd553f52..1b9f7b1c591 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Lookup.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Lookup.h @@ -19,17 +19,18 @@ #ifndef TAO_LOOKUP_H #define TAO_LOOKUP_H -#include "CosTradingS.h" #include "Policies.h" #include "Offer_Filter.h" -#include "Offer_Filter.h" #include "Property_Filter.h" #include "Offer_Iterator.h" #include "Constraint_Interpreter.h" #include "Preference_Interpreter.h" template<class TRADER> -class TAO_Lookup : public POA_CosTrading::Lookup +class TAO_Lookup : + public TAO_Trader_Components<POA_CosTrading::Lookup>, + public TAO_Support_Attributes<POA_CosTrading::Lookup>, + public TAO_Import_Attributes<POA_CosTrading::Lookup> // // = TITLE // This class implements CosTrading::Lookup IDL interface. @@ -51,7 +52,7 @@ public: CosTrading::OfferIterator_out offer_itr, CosTrading::PolicyNameSeq_out limits_applied, CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, CosTrading::IllegalConstraint, @@ -61,7 +62,7 @@ public: CosTrading::Lookup::InvalidPolicyValue, CosTrading::IllegalPropertyName, CosTrading::DuplicatePropertyName, - CosTrading::DuplicatePolicyName); + CosTrading::DuplicatePolicyName)); // BEGIN SPEC // The query operation is the means by which an object can obtain @@ -142,91 +143,6 @@ public: // returned. // END SPEC - // = CosTrading::TraderComponents methods. - virtual CosTrading::Lookup_ptr lookup_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns an object reference to the Lookup interface of the trader. - // Returns nil if the trader does not support Lookup interface. - - virtual CosTrading::Register_ptr register_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Register interface of the trader. - // Returns nil if the trader does not support Register interface. - - virtual CosTrading::Link_ptr link_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Link interface of the trader. - // Returns nil if the trader does not support Link interface. - - virtual CosTrading::Proxy_ptr proxy_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference to the Proxy interface of the trader. - // Returns nil if the trader does not support Proxy interface. - - virtual CosTrading::Admin_ptr admin_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Admin interface of the trader. - // Returns nil if the trader does not support Admin interface. - - // = CosTrading::ImportAttributes methods. - - virtual CORBA::ULong def_search_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_search_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // Search cardinality determines the maximum number of offers searched - // before not considering other offers. - - virtual CORBA::ULong def_match_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_match_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // Match cardinality determines the maximum number of offers - // matched to the constraints before not considering other offers.. - - virtual CORBA::ULong def_return_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_return_card (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // Return cardinality determines the maximum number of offers marked - // to return before not considering other offers. - - - virtual CORBA::ULong max_list (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong def_hop_count (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::ULong max_hop_count (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::FollowOption def_follow_policy (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::FollowOption max_follow_policy (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - // = CosTrading::SupportAttributes methods. - - virtual CORBA::Boolean supports_modifiable_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_dynamic_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_proxy_offers (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::TypeRepository_ptr type_repos (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - static const char* NAME; // Handy Typedefs @@ -255,12 +171,12 @@ private: TAO_Policies& policies, LOOKUP_OFFER_LIST& ordered_offers, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalConstraint, + TAO_THROW_SPEC ((CosTrading::IllegalConstraint, CosTrading::Lookup::IllegalPreference, CosTrading::Lookup::PolicyTypeMismatch, CosTrading::Lookup::InvalidPolicyValue, CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType); + CosTrading::UnknownServiceType)); // This method has three phases. The first phase passes the // offer_map through the constraint interpreter, winnowing away // those offers that don't match the validated constraint. The @@ -294,8 +210,8 @@ private: CosTrading::OfferSeq*& offers, CosTrading::OfferIterator_ptr& offer_itr, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName); + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName)); // This method takes the list of ordered offers and places a number // of them in the sequence of returned offers and the rest into thr // iterator. In addition, fill_receptacles uses the diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp index 3978db18496..fe3f79fda25 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp @@ -4,11 +4,12 @@ TAO_Offer_Filter:: TAO_Offer_Filter (SERVICE_TYPE_REPOS::TypeStruct* type_struct, - TAO_Policies& policies) - : search_card_ (policies.search_card ()), - match_card_ (policies.match_card ()), - dp_ (policies.use_dynamic_properties ()), - mod_ (policies.use_modifiable_properties ()) + TAO_Policies& policies, + CORBA::Environment& _env) + : search_card_ (policies.search_card (_env)), + match_card_ (policies.match_card (_env)), + dp_ (policies.use_dynamic_properties (_env)), + mod_ (policies.use_modifiable_properties (_env)) { SERVICE_TYPE_REPOS::PropStructSeq& prop_seq = type_struct->props; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h index 99b937aa544..ceed69eeb5c 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h @@ -17,7 +17,6 @@ #ifndef TAO_OFFER_FILTER_H #define TAO_OFFER_FILTER_H -#include "CosTradingC.h" #include "Policies.h" #include "Property_Evaluator.h" @@ -45,7 +44,8 @@ public: typedef CosTradingRepos::ServiceTypeRepository SERVICE_TYPE_REPOS; TAO_Offer_Filter (SERVICE_TYPE_REPOS::TypeStruct* type_struct, - TAO_Policies& policies); + TAO_Policies& policies, + CORBA::Environment& _env); // Glean from the TypeStruct and Policy setting the appropriate way // to screen unsuitable offers from consideration. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.cpp index 17b7412be0e..7ca466e05cc 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.cpp @@ -31,24 +31,44 @@ TAO_Offer_Id_Iterator::~TAO_Offer_Id_Iterator (void) CORBA::ULong TAO_Offer_Id_Iterator::max_left(CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::UnknownMaxLeft) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::UnknownMaxLeft)) { return this->ids_.size (); } void -TAO_Offer_Id_Iterator::destroy(void) - TAO_THROW_SPEC (CORBA::SystemException) +TAO_Offer_Id_Iterator::destroy(CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) { - CORBA::release (this); + // Remove self from POA + // + // Note that there is no real error checking here as we can't do + // much about errors here anyway + // + + TAO_TRY + { + PortableServer::POA_var poa = this->_default_POA (TAO_TRY_ENV); + TAO_CHECK_ENV; + PortableServer::ObjectId_var id = poa->servant_to_id (this, TAO_TRY_ENV); + TAO_CHECK_ENV; + + poa->deactivate_object (id.in (), TAO_TRY_ENV); + } + TAO_CATCHANY + { + } + TAO_ENDTRY; + + delete this; } CORBA::Boolean TAO_Offer_Id_Iterator::next_n(CORBA::ULong n, CosTrading::OfferIdSeq_out _ids, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { // Calculate the number of Ids to be returned in this . int items_left = this->ids_.size(), diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.h b/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.h index 65c3f083b8d..6338ce59941 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Id_Iterator.h @@ -17,11 +17,20 @@ #ifndef TAO_OFFER_ID_ITERATOR_H #define TAO_OFFER_ID_ITERATOR_H -#include "CosTradingS.h" #include <deque> #include <queue> #include <string> +#if defined (OS_NO_NAMESPACE) +#define queue foobar +#endif /* OS_NO_NAMESPACE */ + +#include "orbsvcs/CosTradingS.h" + +#if defined (OS_NO_NAMESPACE) +#undef queue +#endif /* OS_NO_NAMESPACE */ + class TAO_Offer_Id_Iterator : public POA_CosTrading::OfferIdIterator // = TITLE // Silly little iterator that contains the overflow of offer ids @@ -45,8 +54,8 @@ class TAO_Offer_Id_Iterator : public POA_CosTrading::OfferIdIterator ~TAO_Offer_Id_Iterator (void); virtual CORBA::ULong max_left(CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::UnknownMaxLeft); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::UnknownMaxLeft)); // The max_left operation returns the number of offer identifiers // remaining in the iterator. The exception UnknownMaxLeft is raised // if the iterator cannot determine the remaining number of offer @@ -54,7 +63,7 @@ class TAO_Offer_Id_Iterator : public POA_CosTrading::OfferIdIterator // identifiers through lazy evaluation). virtual void destroy(CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // The destroy operation destroys the iterator. No further // operations can be invoked on an iterator after it has been // destroyed. @@ -62,7 +71,7 @@ class TAO_Offer_Id_Iterator : public POA_CosTrading::OfferIdIterator virtual CORBA::Boolean next_n(CORBA::ULong _n, CosTrading::OfferIdSeq_out _ids, CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // The next_n operation returns a set of offer identifiers in the // output parameter "ids." The operation returns n offer identifiers // if there are at least n offer identifiers remaining in the diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.cpp index 00cd485c512..5a0d1cc8004 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.cpp @@ -1,6 +1,6 @@ /* -*- C++ -*- */ -// ============================================================================ +// ======================================================================== // $Id$ // // = LIBRARY @@ -13,7 +13,8 @@ // Marina Spivak <marina@cs.wustl.edu> // Seth Widoff <sbw1@cs.wustl.edu> // -// ============================================================================ +// ======================================================================== + #define ACE_BUILD_DLL #include "Offer_Iterator.h" @@ -29,10 +30,30 @@ TAO_Offer_Iterator::~TAO_Offer_Iterator (void) } void -TAO_Offer_Iterator::destroy (void) - TAO_THROW_SPEC (CORBA::SystemException) +TAO_Offer_Iterator::destroy (CORBA::Environment& env) + TAO_THROW_SPEC ((CORBA::SystemException)) { - CORBA::release (this); + // Remove self from POA + // + // Note that there is no real error checking here as we can't do + // much about errors here anyway + // + + TAO_TRY + { + PortableServer::POA_var poa = this->_default_POA (TAO_TRY_ENV); + TAO_CHECK_ENV_RETURN (env,); + PortableServer::ObjectId_var id = poa->servant_to_id (this, TAO_TRY_ENV); + TAO_CHECK_ENV_RETURN (env,); + + poa->deactivate_object (id.in (), TAO_TRY_ENV); + } + TAO_CATCHANY + { + } + TAO_ENDTRY; + + delete this; } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.h b/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.h index c35865b08e0..9f74af2b6e1 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterator.h @@ -18,7 +18,6 @@ #ifndef TAO_OFFER_ITERATOR_H #define TAO_OFFER_ITERATOR_H -#include "CosTradingS.h" #include "Property_Filter.h" class TAO_Export TAO_Offer_Iterator : @@ -45,7 +44,7 @@ public: virtual ~TAO_Offer_Iterator (void); virtual void destroy (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // BEGIN SPEC // The destroy operation destroys the iterator. No further // operations can be invoked on an iterator after it has been @@ -58,8 +57,8 @@ public: // iterate over. virtual CORBA::ULong max_left (CORBA::Environment &env) = 0 - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::UnknownMaxLeft); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::UnknownMaxLeft)); // BEGIN SPEC // The max_left operation returns the number of service offers @@ -72,7 +71,7 @@ public: virtual CORBA::Boolean next_n (CORBA::ULong n, CosTrading::OfferSeq_out offers, CORBA::Environment &env) = 0 - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // BEGIN SPEC // The next_n operation returns a set of service offers in the // output parameter "offers." The operation returns n service offers diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.cpp b/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.cpp index 15f94117f95..e433eaa9023 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.cpp @@ -32,18 +32,18 @@ TAO_Offer_Modifier (const char* type_name, void TAO_Offer_Modifier:: -delete_properties (CosTrading::PropertyNameSeq& deletes, +delete_properties (const CosTrading::PropertyNameSeq& deletes, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Register::UnknownPropertyName, + TAO_THROW_SPEC ((CosTrading::Register::UnknownPropertyName, CosTrading::Register::MandatoryProperty, CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName) + CosTrading::DuplicatePropertyName)) { PROP_NAMES delete_me; // Validate that the listed property names can be deleted for (int i = 0, length = deletes.length (); i < length; i++) { - CosTrading::PropertyName dname = deletes[i]; + CosTrading::PropertyName dname = (char*)((const char *) deletes[i]); if (! TAO_Trader_Base::is_valid_identifier_name (dname)) TAO_THROW (CosTrading::IllegalPropertyName (dname)); else @@ -61,7 +61,7 @@ delete_properties (CosTrading::PropertyNameSeq& deletes, // Delete those properties from the offer. for (i = 0; i < length; i++) { - string prop_name = (char *) deletes[i]; + string prop_name = (const char *) deletes[i]; this->props_.erase (prop_name); } } @@ -70,16 +70,17 @@ void TAO_Offer_Modifier:: merge_properties (const CosTrading::PropertySeq& modifies, CORBA::Environment& _env) - throw (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName, - CosTrading::Register::ReadonlyProperty) + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName, + CosTrading::Register::ReadonlyProperty)) { PROP_NAMES modify_me; // Ensure that the proposed changes aren't to readonly properties or // otherwise invalid. for (int i = 0, length = modifies.length (); i < length; i++) { - const CosTrading::PropertyName mname = (const char *) modifies[i].name; + CosTrading::PropertyName mname = + (char*) ((const char *) modifies[i].name); if (! TAO_Trader_Base::is_valid_identifier_name (mname)) TAO_THROW (CosTrading::IllegalPropertyName (mname)); else diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.h b/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.h index adbccf2eaa0..ba88157daaf 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Modifier.h @@ -17,7 +17,6 @@ #ifndef ACE_OFFER_MODIFIER_H #define ACE_OFFER_MODIFIER_H -#include "CosTradingC.h" #include "Trader_Base.h" #include <set> #include <map> @@ -38,20 +37,20 @@ public: // Modify an <offer> of type <type>, whose properties are described // by <type_struct> - void delete_properties (CosTrading::PropertyNameSeq& deletes, + void delete_properties (const CosTrading::PropertyNameSeq& deletes, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Register::UnknownPropertyName, + TAO_THROW_SPEC ((CosTrading::Register::UnknownPropertyName, CosTrading::Register::MandatoryProperty, CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName); + CosTrading::DuplicatePropertyName)); // Delete the properties whose names were given to the // constructor. Ensure we don't delete mandatory properties. void merge_properties (const CosTrading::PropertySeq& modifies, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, CosTrading::DuplicatePropertyName, - CosTrading::Register::ReadonlyProperty); + CosTrading::Register::ReadonlyProperty)); // Copy to the destination the union of the source and destination // properties. In the case of duplicate properties, update the // destination with the source's value. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp b/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp index c7b6228508a..97b7ec3b373 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp @@ -17,10 +17,10 @@ const char* TAO_Policies::POLICY_NAMES[] = }; TAO_Policies::TAO_Policies (TAO_Trader_Base& trader, - CosTrading::PolicySeq& policies, + const CosTrading::PolicySeq& policies, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::IllegalPolicyName, - CosTrading::DuplicatePolicyName) + TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPolicyName, + CosTrading::DuplicatePolicyName)) : trader_ (trader), policies_ (USE_PROXY_OFFERS + 1) { @@ -34,7 +34,7 @@ TAO_Policies::TAO_Policies (TAO_Trader_Base& trader, index = -1; if (length < ACE_OS::strlen (POLICY_NAMES[HOP_COUNT])) - TAO_THROW (CosTrading::Lookup::IllegalPolicyName (pol_name)) + TAO_THROW (CosTrading::Lookup::IllegalPolicyName (pol_name)); switch (pol_name[0]) { @@ -74,7 +74,7 @@ TAO_Policies::TAO_Policies (TAO_Trader_Base& trader, if (this->policies_[index] != 0) TAO_THROW (CosTrading::DuplicatePolicyName (pol_name)); else - this->policies_[index] = &(policies[j]); + this->policies_[index] = (CosTrading::Policy *) &(policies[j]); } } } @@ -82,7 +82,7 @@ TAO_Policies::TAO_Policies (TAO_Trader_Base& trader, CORBA::ULong TAO_Policies::ulong_prop (POLICY_TYPE pol, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { CORBA::ULong return_value = 0, max_value; TAO_Import_Attributes_Impl& import_attrs = @@ -113,8 +113,9 @@ TAO_Policies::ulong_prop (POLICY_TYPE pol, CosTrading::PolicyValue& value = policy->value; CORBA::TypeCode* type = value.type (); - if (!type->equal (CORBA::_tc_ulong)) - TAO_THROW (CosTrading::Lookup::PolicyTypeMismatch (*policy)); + if (!type->equal (CORBA::_tc_ulong, _env)) + TAO_THROW_RETURN (CosTrading::Lookup::PolicyTypeMismatch (*policy), + return_value); else value >>= return_value; @@ -123,27 +124,27 @@ TAO_Policies::ulong_prop (POLICY_TYPE pol, else this->limits_.push_back ((char *) POLICY_NAMES[pol]); } - + return return_value; } CORBA::ULong TAO_Policies::search_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return this->ulong_prop (SEARCH_CARD, _env); } CORBA::ULong -TAO_Policies::match_card (CORBA::Environment& env_) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) +TAO_Policies::match_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return this->ulong_prop (MATCH_CARD, _env); } CORBA::ULong -TAO_Policies::return_card (CORBA::Environment& env_) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) +TAO_Policies::return_card (CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return this->ulong_prop (RETURN_CARD, _env); } @@ -151,7 +152,7 @@ TAO_Policies::return_card (CORBA::Environment& env_) CORBA::Boolean TAO_Policies::boolean_prop (POLICY_TYPE pol, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { CORBA::Boolean def_value = (CORBA::Boolean) 1, return_value = (CORBA::Boolean) 1; @@ -177,8 +178,9 @@ TAO_Policies::boolean_prop (POLICY_TYPE pol, CosTrading::PolicyValue& value = policy->value; CORBA::TypeCode* type = value.type (); - if (!type->equal (CORBA::_tc_boolean)) - TAO_THROW (CosTrading::Lookup::PolicyTypeMismatch (*policy)); + if (!type->equal (CORBA::_tc_boolean, _env)) + TAO_THROW_RETURN (CosTrading::Lookup::PolicyTypeMismatch (*policy), + return_value); else value >>= to_boolean (return_value); @@ -194,28 +196,28 @@ TAO_Policies::boolean_prop (POLICY_TYPE pol, CORBA::Boolean TAO_Policies::use_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return this->boolean_prop (USE_MODIFIABLE_PROPERTIES, _env); } CORBA::Boolean TAO_Policies::use_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return this->boolean_prop (USE_DYNAMIC_PROPERTIES, _env); } CORBA::Boolean TAO_Policies::use_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return this->boolean_prop (USE_PROXY_OFFERS, _env); } CORBA::Boolean TAO_Policies::exact_type_match (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return this->boolean_prop (EXACT_TYPE_MATCH, _env); } @@ -223,23 +225,68 @@ TAO_Policies::exact_type_match (CORBA::Environment& _env) CosTrading::TraderName* TAO_Policies::starting_trader (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch, - CosTrading::Lookup::InvalidPolicyValue) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch, + CosTrading::Lookup::InvalidPolicyValue)) { return 0; } CosTrading::FollowOption -TAO_Policies::link_follow_rule (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch, - CosTrading::Lookup::InvalidPolicyValue) +TAO_Policies::link_follow_rule (const char* link_name, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch, + CosTrading::Lookup::InvalidPolicyValue)) { - return CosTrading::local_only; + CosTrading::FollowOption return_value = CosTrading::local_only; + CosTrading::Link_var link + (this->trader_.trading_components ().link_if ()); + TAO_CHECK_ENV_RETURN (_env, return_value); + + if (link != CosTrading::Link::_nil ()) + { + CosTrading::Link::LinkInfo_var + link_info (link->describe_link (link_name, _env)); + CosTrading::FollowOption trader_max_follow_policy = + this->trader_.import_attributes ().max_follow_policy (); + + if (this->policies_[LINK_FOLLOW_RULE] != 0) + { + CosTrading::FollowOption query_link_follow_rule; + CosTrading::FollowOption link_limiting_follow_rule = + link_info->limiting_follow_rule; + CosTrading::Policy* policy = this->policies_[LINK_FOLLOW_RULE]; + CosTrading::PolicyValue& value = policy->value; + CORBA::TypeCode* type = value.type (); + + // Extract the link follow rule + if (!type->equal (CosTrading::_tc_FollowOption, _env)) + TAO_THROW_RETURN (CosTrading::Lookup::PolicyTypeMismatch (*policy), + return_value); + else + // value >>= query_link_follow_rule; + ; + + return_value = (query_link_follow_rule < trader_max_follow_policy) + ? query_link_follow_rule : trader_max_follow_policy; + return_value = (return_value < link_limiting_follow_rule) + ? return_value : link_limiting_follow_rule; + } + else + { + CosTrading::FollowOption link_def_follow_rule = + this->trader_.import_attributes ().max_follow_policy (); + + return_value = (link_def_follow_rule < trader_max_follow_policy) + ? link_def_follow_rule : trader_max_follow_policy; + } + } + + return return_value; } CORBA::ULong TAO_Policies::hop_count (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)) { return (CORBA::ULong) 0; } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Policies.h b/TAO/orbsvcs/orbsvcs/Trader/Policies.h index 733b0283173..e3863757936 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Policies.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Policies.h @@ -17,13 +17,12 @@ #ifndef TAO_POLICIES_H #define TAO_POLICIES_H -#include "CosTradingC.hh" -#include "Trader_Base.h" - // STL fun stuff. #include <vector> #include <deque> +#include "Trader_Base.h" + class TAO_Policies // // = TITLE @@ -58,10 +57,10 @@ public: static const char * POLICY_NAMES[]; TAO_Policies (TAO_Trader_Base& trader, - CosTrading::PolicySeq& policies, + const CosTrading::PolicySeq& policies, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::IllegalPolicyName, - CosTrading::DuplicatePolicyName); + TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPolicyName, + CosTrading::DuplicatePolicyName)); // BEGIN SPEC // The "policies" parameter allows the importer to specify how the @@ -86,7 +85,7 @@ public: // END SPEC CORBA::ULong search_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // BEGIN SPEC // The "search_card" policy indicates to the trader the maximum @@ -98,7 +97,7 @@ public: // END SPEC CORBA::ULong match_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // BEGIN SPEC // The "match_card" policy indicates to the trader the maximum @@ -110,7 +109,7 @@ public: // END SPEC CORBA::ULong return_card (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // BEGIN SPEC // The "return_card" policy indicates to the trader the maximum @@ -124,7 +123,7 @@ public: // = Offer consideration policies CORBA::Boolean use_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // BEGIN SPEC // The "use_modifiable_properties" policy indicates whether the @@ -137,7 +136,7 @@ public: // END SPEC CORBA::Boolean use_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // BEGIN SPEC // The "use_dynamic_properties" policy indicates whether the trader @@ -150,7 +149,7 @@ public: // END SPEC CORBA::Boolean use_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // BEGIN SPEC // The "use_proxy_offers" policy indicates whether the trader should @@ -162,7 +161,7 @@ public: // END SPEC CORBA::Boolean exact_type_match (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // BEGIN SPEC // The "exact_type_match" policy indicates to the trader whether the @@ -174,16 +173,58 @@ public: // = Federated trader policies (not implemented yet) CosTrading::TraderName* starting_trader (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch, - CosTrading::Lookup::InvalidPolicyValue); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch, + CosTrading::Lookup::InvalidPolicyValue)); + // BEGIN SPEC + // The "starting_trader" policy facilitates the distribution of the + // trading service itself. It allows an importer to scope a search + // by choosing to explicitly navigate the links of the trading + // graph. If the policy is used in a query invocation it is + // recommended that it be the first policy-value pair; this + // facilitates an optimal forwarding of the query operation. A + // "policies" parameter need not include a value for the + // "starting_trader" policy. Where this policy is present, the first + // name component is compared against the name held in each link. If + // no match is found, the InvalidPolicyValue exception is + // raised. Otherwise, the trader invokes query() on the Lookup + // interface held by the named link, but passing the + // "starting_trader" policy with the first component removed. + // END SPEC - CosTrading::FollowOption link_follow_rule (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch, - CosTrading::Lookup::InvalidPolicyValue); + CosTrading::FollowOption link_follow_rule (const char* link_name, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch, + CosTrading::Lookup::InvalidPolicyValue)); + // BEGIN SPEC + //The "link_follow_rule" policy indicates how the client wishes + //links to be followed in the resolution of its query. See the + //discussion in "Link Follow Behavior" on page 16-16 for details. + // END SPEC + + // This method returns the link_follow_rule for a link whose name is + // <link_name> using the following formula: + // if the importer specified a link_follow_rule policy + // min(trader.max_follow_policy, link.limiting_follow_rule, + // query.link_follow_rule) + // else min(trader.max_follow_policy, link.limiting_follow_rule, + // trader.def_follow_policy) CORBA::ULong hop_count (CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); + // BEGIN SPEC + // The "hop_count" policy indicates to the trader the maximum number + // of hops across federation links that should be tolerated in the + // resolution of this query. The hop_count at the current trader is + // determined by taking the minimum of the trader's max_hop_count + // attribute and the importer's hop_count policy, if provided, or + // the trader's def_hop_count attribute if it is not. If the + // resulting value is zero, then no federated queries are + // permitted. If it is greater than zero, then it must be + // decremented before passing on to a federated trader. + // END SPEC + + // = Return the limits applied. CosTrading::PolicyNameSeq* limits_applied (void); @@ -203,12 +244,12 @@ private: CORBA::ULong ulong_prop (POLICY_TYPE pol, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // Reconclile a ULong property with its default. CORBA::Boolean boolean_prop (POLICY_TYPE pol, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::PolicyTypeMismatch); + TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // Reconcile a Boolean property with its debault. POL_QUEUE limits_; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.cpp b/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.cpp index 84ccd1e98ff..885e574a471 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.cpp @@ -76,7 +76,7 @@ TAO_Policy_Manager::starting_trader (CosTrading::TraderName* name) { CosTrading::Policy& policy = this->fetch_next_policy (); policy.name = POLICY_NAMES[STARTING_TRADER]; - policy.value <<= *name; + // policy.value <<= *name; } void diff --git a/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.h b/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.h index 3b4129ed82d..08cebe8bc4f 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Policy_Manager.h @@ -17,7 +17,15 @@ #ifndef TAO_POLICY_MANAGER_H #define TAO_POLICY_MANAGER_H -#include "CosTradingC.hh" +#if defined (OS_NO_NAMESPACE) +#define queue foobar +#endif /* OS_NO_NAMESPACE */ + +#include "orbsvcs/CosTradingC.h" + +#if defined (OS_NO_NAMESPACE) +#undef queue +#endif /* OS_NO_NAMESPACE */ class TAO_Policy_Manager // = TITLE diff --git a/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.cpp b/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.cpp index 78059433a3d..55fd85864a8 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.cpp @@ -23,16 +23,16 @@ TAO_Preference_Interpreter:: TAO_Preference_Interpreter(CosTradingRepos::ServiceTypeRepository::TypeStruct* ts, const char* preference, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::Lookup::IllegalPreference) + TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPreference)) : TAO_Interpreter () { TAO_Constraint_Validator type_checker(ts); if (TAO_Interpreter::is_empty_string(preference)) - this->root_ = new TAO_Noop_Constraint(FIRST); + this->root_ = new TAO_Noop_Constraint(TAO_FIRST); else { - if (this->build_tree(preference) != 0) + if (this->build_tree (preference) != 0) TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); if (type_checker.validate (this->root_) == -1) @@ -42,15 +42,16 @@ TAO_Preference_Interpreter(CosTradingRepos::ServiceTypeRepository::TypeStruct* t TAO_Preference_Interpreter:: TAO_Preference_Interpreter(TAO_Constraint_Validator& validator, - const char* preference) - TAO_THROW (CosTrading::Lookup::IllegalPreference) - : TAO_Interpreter () + const char* preference, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPreference)) + : TAO_Interpreter () { if (TAO_Interpreter::is_empty_string(preference)) - this->root_ = new TAO_Noop_Constraint(FIRST); + this->root_ = new TAO_Noop_Constraint(TAO_FIRST); else { - if (this->build_tree(preference) != 0) + if (this->build_tree (preference) != 0) TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); if (validator.validate (this->root_) == -1) @@ -103,7 +104,7 @@ remove_offer (CosTrading::OfferId& offer_id, if (offer_beg != offer_end) { - if (expr_type == WITH || expr_type == MAX) + if (expr_type == TAO_WITH || expr_type == TAO_MAX) { offer_end--; offer_id = (*offer_end).second.first; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.h b/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.h index 5878c034312..7ff86a6ba17 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Preference_Interpreter.h @@ -41,12 +41,12 @@ public: TAO_Preference_Interpreter(CosTradingRepos::ServiceTypeRepository::TypeStruct* ts, const char* preference, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::Lookup::IllegalPreference); + TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPreference)); TAO_Preference_Interpreter(TAO_Constraint_Validator& validator, const char* preference, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::Lookup::IllegalPreference); + TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPreference)); // Parse the preference string, determining first if it's // valid. Throw an IllegalPreference exception if the preference diff --git a/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.cpp index 2953b7dc6f2..bd3017ddfe4 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.cpp @@ -26,6 +26,7 @@ TAO_Property_Evaluator(CosTrading::Offer& offer, int TAO_Property_Evaluator::is_dynamic_property (int index) { + CORBA::Environment env; int return_value = 0, num_properties = this->props_.length(); @@ -36,7 +37,7 @@ TAO_Property_Evaluator::is_dynamic_property (int index) CORBA::Any& value = this->props_[index].value; CORBA::TypeCode* type = value.type(); - if (type->equal(CosTradingDynamic::_tc_DynamicProp)) + if (type->equal(CosTradingDynamic::_tc_DynamicProp, env)) return_value = 1; } @@ -46,9 +47,9 @@ TAO_Property_Evaluator::is_dynamic_property (int index) CORBA::Any* TAO_Property_Evaluator::property_value(int index, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTradingDynamic::DPEvalFailure) + TAO_THROW_SPEC ((CosTradingDynamic::DPEvalFailure)) { - CORBA::Any* prop_val = CORBA::Any::_nil(); + CORBA::Any* prop_val = 0; if (! this->is_dynamic_property(index)) prop_val = &(this->props_[index].value); @@ -61,11 +62,11 @@ TAO_Property_Evaluator::property_value(int index, CORBA::Any& value = this->props_[index].value; // Extract the DP_Struct. - value >>= dp_struct; + //value >>= dp_struct; dp_eval = dp_struct.eval_if; if (CORBA::is_nil (dp_eval)) - throw (CosTradingDynamic::DPEvalFailure ()); + TAO_THROW_RETURN (CosTradingDynamic::DPEvalFailure (), prop_val); else { CORBA::TypeCode* type = dp_struct.returned_type; @@ -74,13 +75,15 @@ TAO_Property_Evaluator::property_value(int index, TAO_TRY { // Retrieve the value of the dynamic property. - prop_val = dp_eval->evalDP(name, type, info); + prop_val = dp_eval->evalDP(name, type, info, TAO_TRY_ENV); } - TAO_CATCH (CORBA::SystemException excp) + TAO_CATCH (CORBA::SystemException, excp) { - TAO_THROW (CosTradingDynamic::DPEvalFailure (name, type, info)); + TAO_THROW_RETURN + (CosTradingDynamic::DPEvalFailure (name, type, info), + prop_val); } - TAO_TRYEND; + TAO_ENDTRY; } } @@ -98,7 +101,7 @@ TAO_Property_Evaluator::property_type(int index) // Extract type information from the DP_Struct. CORBA::Any& value = this->props_[index].value; DP_Struct dp_struct; - value >>= dp_struct; + //value >>= dp_struct; // Grab a pointer to the returned_type description prop_type = CORBA::TypeCode::_duplicate(dp_struct.returned_type); @@ -114,8 +117,8 @@ TAO_Property_Evaluator_By_Name:: TAO_Property_Evaluator_By_Name (CosTrading::PropertySeq& properties, CORBA::Environment& _env, CORBA::Boolean supports_dp) - TAO_THROW_SPEC (CosTrading::DuplicatePropertyName, - CosTrading::IllegalPropertyName) + TAO_THROW_SPEC ((CosTrading::DuplicatePropertyName, + CosTrading::IllegalPropertyName)) : TAO_Property_Evaluator (properties, supports_dp) { string prop_name; @@ -175,14 +178,14 @@ is_dynamic_property(const char* property_name) CORBA::Any* TAO_Property_Evaluator_By_Name::property_value(const char* property_name, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTradingDynamic::DPEvalFailure) + TAO_THROW_SPEC ((CosTradingDynamic::DPEvalFailure)) { - CORBA::Any* prop_value = CORBA::Any::_nil(); + CORBA::Any* prop_value = 0; string prop_name(property_name); Lookup_Table_Iter lookup_iter = this->table_.find(prop_name); // If the property name is in the map, delegate evaluation to our - // superclass. Otherwise, through an exception. + // superclass. Otherwise, throw an exception. if (lookup_iter != this->table_.end()) { int index = (*lookup_iter).second; @@ -200,7 +203,7 @@ TAO_Property_Evaluator_By_Name::property_type(const char* property_name) Lookup_Table_Iter lookup_iter = this->table_.find(prop_name); // If the property name is in the map, delegate evaluation to our - // superclass. Otherwise, through an exception. + // superclass. Otherwise, throw an exception. if (lookup_iter != this->table_.end()) { int index = (*lookup_iter).second; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.h b/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.h index 0fc88b18752..1b89f7c7301 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Property_Evaluator.h @@ -23,17 +23,14 @@ #if defined (OS_NO_NAMESPACE) #define queue uncouth -#define map foobar #endif /* OS_NO_NAMESPACE */ -#include "ace/OS.h" +#include "orbsvcs/CosTradingC.h" #if defined (OS_NO_NAMESPACE) -#undef map #undef queue #endif /* OS_NO_NAMESPACE */ -#include "CosTradingC.h" class TAO_Property_Evaluator // @@ -65,7 +62,7 @@ public: // 0 when the index is out of bounds. CORBA::Any* property_value(int index, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTradingDynamic::DPEvalFailure); + TAO_THROW_SPEC ((CosTradingDynamic::DPEvalFailure)); // Returns value of the property whose index is <index>. If the // property at that index is dynamic and the trader supports dynamic // properties, then the property_value method will obtain the value @@ -111,8 +108,8 @@ public: TAO_Property_Evaluator_By_Name (CosTrading::PropertySeq& properties, CORBA::Environment& _env, CORBA::Boolean supports_dp = 1) - TAO_THROW_SPEC (CosTrading::DuplicatePropertyName, - CosTrading::IllegalPropertyName); + TAO_THROW_SPEC ((CosTrading::DuplicatePropertyName, + CosTrading::IllegalPropertyName)); TAO_Property_Evaluator_By_Name(CosTrading::Offer& offer, CORBA::Boolean supports_dp = 1); @@ -127,7 +124,7 @@ public: CORBA::Any* property_value(const char* property_name, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTradingDynamic::DPEvalFailure); + TAO_THROW_SPEC ((CosTradingDynamic::DPEvalFailure)); // This method is identical to its counterpart in // TAO_Property_Evaluator, except property_value first discovers the // index through a string matching lookup. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.cpp b/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.cpp index ffa0d1655e0..1692b46a144 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.cpp @@ -5,13 +5,13 @@ TAO_Property_Filter:: TAO_Property_Filter (const SPECIFIED_PROPS& desired_props, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName) + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName)) : policy_ (desired_props._d ()) { if (this->policy_ == CosTrading::Lookup::some) { - PropertyNameSeq& prop_seq = desired_props.prop_names (); + const PropertyNameSeq& prop_seq = desired_props.prop_names (); int length = prop_seq.length (); for (int i = 0; i < length; i++) @@ -41,7 +41,7 @@ TAO_Property_Filter (const TAO_Property_Filter& prop_filter) } void -TAO_Property_Filter::filter_offer (const CosTrading::Offer& source, +TAO_Property_Filter::filter_offer (CosTrading::Offer& source, CosTrading::Offer& destination) { PROP_QUEUE prop_queue; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.h b/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.h index 5777de4ab8b..efdc335c71c 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Property_Filter.h @@ -20,18 +20,8 @@ #include <set> #include <deque> -#if defined (OS_NO_NAMESPACE) -#define map yadda -#endif /* OS_NO_NAMESPACE */ - -#include "ace/OS.h" -#include "CosTradingC.h" #include "Trader_Base.h" -#if defined (OS_NO_NAMESPACE) -#undef map -#endif /* OS_NO_NAMESPACE */ - class TAO_Property_Filter // = TITLE // @@ -45,13 +35,13 @@ public: TAO_Property_Filter (const SPECIFIED_PROPS& desired_props, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName); + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName)); // Verify that the specified properties are correct. TAO_Property_Filter (const TAO_Property_Filter& prop_filter); - void filter_offer (const CosTrading::Offer& source, + void filter_offer (CosTrading::Offer& source, CosTrading::Offer& destination); // Copy the desired properties from the source offer to the // destination offer. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Proxy.cpp b/TAO/orbsvcs/orbsvcs/Trader/Proxy.cpp index d5e075c3cce..0e9e17a82ef 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Proxy.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Proxy.cpp @@ -21,8 +21,10 @@ #include "Proxy.h" template <class TRADER> -TAO_Proxy<TRADER>::TAO_Proxy (const TRADER &trader) - : trader_ (trader) +TAO_Proxy<TRADER>::TAO_Proxy (TRADER &trader) + : trader_ (trader), + TAO_Trader_Components <POA_CosTrading::Proxy> (trader.trading_components ()), + TAO_Support_Attributes <POA_CosTrading::Proxy> (trader.support_attributes ()) { } @@ -39,7 +41,7 @@ TAO_Proxy<TRADER>::export_proxy (CosTrading::Lookup_ptr target, const char * recipe, const CosTrading::PolicySeq& policies_to_pass_on, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, CosTrading::InvalidLookupRef, @@ -49,95 +51,43 @@ TAO_Proxy<TRADER>::export_proxy (CosTrading::Lookup_ptr target, CosTrading::MissingMandatoryProperty, CosTrading::Proxy::IllegalRecipe, CosTrading::DuplicatePropertyName, - CosTrading::DuplicatePolicyName) + CosTrading::DuplicatePolicyName)) { - TAO_THROW (CORBA::SystemException ()); + TAO_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_NO), 0); } template <class TRADER> void TAO_Proxy<TRADER>::withdraw_proxy (const char *id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Proxy::NotProxyOfferId) + CosTrading::Proxy::NotProxyOfferId)) { - TAO_THROW (CORBA::SystemException ()); + TAO_THROW (CORBA::UNKNOWN (CORBA::COMPLETED_NO)); } template <class TRADER> CosTrading::Proxy::ProxyInfo * TAO_Proxy<TRADER>::describe_proxy (const char *id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Proxy::NotProxyOfferId) + CosTrading::Proxy::NotProxyOfferId)) { - TAO_THROW (CORBA::SystemException ()); + TAO_THROW_RETURN (CORBA::UNKNOWN (CORBA::COMPLETED_NO), 0); } -template <class TRADER> -CosTrading::Lookup_ptr -TAO_Proxy<TRADER>::lookup_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Lookup::_duplicate (this->trader_.trading_components ().lookup_if ()); -} - -template <class TRADER> -CosTrading::Register_ptr -TAO_Proxy<TRADER>::register_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Register::_duplicate (this->trader_.trading_components ().register_if ()); -} - -template <class TRADER> -CosTrading::Link_ptr -TAO_Proxy<TRADER>::link_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Link::_duplicate (this->trader_.trading_components ().link_if ()); -} - -template <class TRADER> -CosTrading::Proxy_ptr -TAO_Proxy<TRADER>::proxy_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Proxy::_duplicate (this->trader_.trading_components ().proxy_if ()); -} - -template <class TRADER> -CosTrading::Proxy_ptr -TAO_Proxy<TRADER>::admin_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Admin::_duplicate (this->trader_.trading_components ().admin_if ()); -} - -template <class TRADER> -CORBA::Boolean -TAO_Proxy<TRADER>::supports_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_modifiable_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Proxy<TRADER>::supports_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) +template <class TRADER> void +TAO_Proxy<TRADER>::list_proxies (CORBA::ULong how_many, + CosTrading::OfferIdSeq*& ids, + CosTrading::OfferIdIterator_ptr& id_itr, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::NotImplemented)) { - return this->trader_.support_attributes ().supports_dynamic_properties (); + TAO_THROW (CORBA::UNKNOWN (CORBA::COMPLETED_NO)); } -template <class TRADER> -CORBA::Boolean -TAO_Proxy<TRADER>::supports_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_proxy_offers (); -} #endif /* TAO_PROXY_C */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Proxy.h b/TAO/orbsvcs/orbsvcs/Trader/Proxy.h index a06dc450f60..67f3c2677b8 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Proxy.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Proxy.h @@ -19,14 +19,16 @@ #ifndef TAO_PROXY_H #define TAO_PROXY_H -#include "CosTradingS.h" +#include "Attributes.h" template <class TRADER> -class TAO_Proxy : public POA_CosTrading::Proxy +class TAO_Proxy : + public TAO_Trader_Components <POA_CosTrading::Proxy>, + public TAO_Support_Attributes <POA_CosTrading::Proxy> { public: - TAO_Proxy (const TRADER &trader); + TAO_Proxy (TRADER &trader); ~TAO_Proxy (void); @@ -38,7 +40,7 @@ public: const char * recipe, const CosTrading::PolicySeq& policies_to_pass_on, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, CosTrading::InvalidLookupRef, @@ -48,22 +50,22 @@ public: CosTrading::MissingMandatoryProperty, CosTrading::Proxy::IllegalRecipe, CosTrading::DuplicatePropertyName, - CosTrading::DuplicatePolicyName); + CosTrading::DuplicatePolicyName)); virtual void withdraw_proxy (const char *id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Proxy::NotProxyOfferId); + CosTrading::Proxy::NotProxyOfferId)); virtual CosTrading::Proxy::ProxyInfo * describe_proxy (const char *id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Proxy::NotProxyOfferId); + CosTrading::Proxy::NotProxyOfferId)); // = CosTrading::TraderComponents methods. @@ -71,48 +73,9 @@ public: CosTrading::OfferIdSeq*& ids, CosTrading::OfferIdIterator_ptr& id_itr, CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::NotImplemented); - - virtual CosTrading::Lookup_ptr lookup_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns an object reference to the Lookup interface of the trader. - // Returns nil if the trader does not support Lookup interface. - - virtual CosTrading::Register_ptr register_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Register interface of the trader. - // Returns nil if the trader does not support Register interface. - - virtual CosTrading::Link_ptr link_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Link interface of the trader. - // Returns nil if the trader does not support Link interface. - - virtual CosTrading::Proxy_ptr proxy_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference to the Proxy interface of the trader. - // Returns nil if the trader does not support Proxy interface. - - virtual CosTrading::Admin_ptr admin_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Admin interface of the trader. - // Returns nil if the trader does not support Admin interface. - - // = CosTrading::SupportAttributes methods. - - virtual CORBA::Boolean supports_modifiable_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_dynamic_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_proxy_offers (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::TypeRepository_ptr type_repos (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::NotImplemented)); + private: TRADER &trader_; }; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.cpp index c696ceda9b5..5dadb8746d4 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.cpp @@ -40,8 +40,8 @@ TAO_Query_Only_Offer_Iterator::add_offer (CosTrading::OfferId offer_id, CORBA::ULong TAO_Query_Only_Offer_Iterator::max_left (CORBA::Environment& _env) - TAO_THROW_SPEC(CORBA::SystemException, - CosTrading::UnknownMaxLeft) + TAO_THROW_SPEC((CORBA::SystemException, + CosTrading::UnknownMaxLeft)) { return this->offers_.size (); } @@ -50,7 +50,7 @@ CORBA::Boolean TAO_Query_Only_Offer_Iterator::next_n (CORBA::ULong n, OfferSeq_out offers, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { offers = new CosTrading::OfferSeq; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.h b/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.h index e8e80fcfcb8..b0610c4481b 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Query_Only_Offer_Iterator.h @@ -43,13 +43,13 @@ public: virtual CORBA::Boolean next_n (CORBA::ULong n, CosTrading::OfferSeq_out offers, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // Deposit at maximum n offers into the return sequence and return 1, // or return 0 if the iterator is done and no offers are returned. virtual CORBA::ULong max_left (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::UnknownMaxLeft); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::UnknownMaxLeft)); // Return the number of items left in the iterator. void add_offer (CosTrading::OfferId offer_id, diff --git a/TAO/orbsvcs/orbsvcs/Trader/Register.cpp b/TAO/orbsvcs/orbsvcs/Trader/Register.cpp index cbe719b8ee0..565b1788afa 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Register.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Register.cpp @@ -19,8 +19,8 @@ #define TAO_REGISTER_C #include "Register.h" -#include "Locking.h" #include "Property_Evaluator.h" +#include "Trader_Base.h" #include <iostream.h> #include <algorithm> @@ -29,7 +29,9 @@ const char* TAO_Register<TRADER>::NAME = "Trader: Register"; template <class TRADER> TAO_Register<TRADER>::TAO_Register (TRADER &trader) - : trader_ (trader) + : trader_ (trader), + TAO_Trader_Components<POA_CosTrading::Register> (trader.trading_components ()), + TAO_Support_Attributes<POA_CosTrading::Register> (trader.support_attributes ()) { } @@ -43,7 +45,7 @@ TAO_Register<TRADER>::export (CORBA::Object_ptr reference, const char *type, const CosTrading::PropertySeq &properties, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Register::InvalidObjectRef, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, @@ -52,7 +54,7 @@ TAO_Register<TRADER>::export (CORBA::Object_ptr reference, CosTrading::PropertyTypeMismatch, CosTrading::ReadonlyDynamicProperty, CosTrading::MissingMandatoryProperty, - CosTrading::DuplicatePropertyName) + CosTrading::DuplicatePropertyName)) { // Get service type map TRADER::SERVICE_TYPE_MAP &service_type_map = @@ -64,8 +66,9 @@ TAO_Register<TRADER>::export (CORBA::Object_ptr reference, CosTrading::TypeRepository_ptr type_repos = support_attrs.type_repos (); CosTradingRepos::ServiceTypeRepository_ptr rep = - CosTradingRepos::ServiceTypeRepository::_narrow (type_repos); - + CosTradingRepos::ServiceTypeRepository::_narrow (type_repos, _env); + TAO_CHECK_ENV_RETURN (_env, 0); + // Yank our friend, the type struct, and confirm that the given // properties match the type definition. TYPE_STRUCT* type_struct = rep->fully_describe_type (type, _env); @@ -74,9 +77,10 @@ TAO_Register<TRADER>::export (CORBA::Object_ptr reference, // Oops the type is masked, we shouldn't let exporters know the type // exists. if (type_struct->masked) - TAO_THROW (CosTrading::UnknownServiceType (type)); + TAO_THROW_RETURN (CosTrading::UnknownServiceType (type), 0); - this->validate_properties (type, type_struct, properties, _env); + this->validate_properties (type, type_struct, + (CosTrading::PropertySeq) properties, _env); TAO_CHECK_ENV_RETURN (_env, 0); offer.reference = (reference->_duplicate (reference)); @@ -99,10 +103,10 @@ TAO_Register<TRADER>::export (CORBA::Object_ptr reference, template <class TRADER> void TAO_Register<TRADER>::withdraw (const char *id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Register::ProxyOfferId) + CosTrading::Register::ProxyOfferId)) { // Get service type map. TRADER::SERVICE_TYPE_MAP &service_type_map = @@ -114,10 +118,10 @@ TAO_Register<TRADER>::withdraw (const char *id, template <class TRADER> CosTrading::Register::OfferInfo * TAO_Register<TRADER>::describe (const char *id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Register::ProxyOfferId) + CosTrading::Register::ProxyOfferId)) { // Get service type map. char* type = 0; @@ -127,7 +131,7 @@ TAO_Register<TRADER>::describe (const char *id, // Perform a lookup to find the offer. CosTrading::Offer* offer = service_type_map.lookup_offer ((CosTrading::OfferId) id, type, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env, (CosTrading::Register::OfferInfo *) 0); CosTrading::Register::OfferInfo *offer_info = new CosTrading::Register::OfferInfo (); @@ -144,7 +148,7 @@ TAO_Register<TRADER>::modify (const char *id, const CosTrading::PropertyNameSeq& del_list, const CosTrading::PropertySeq& modify_list, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::NotImplemented, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, @@ -155,12 +159,12 @@ TAO_Register<TRADER>::modify (const char *id, CosTrading::ReadonlyDynamicProperty, CosTrading::Register::MandatoryProperty, CosTrading::Register::ReadonlyProperty, - CosTrading::DuplicatePropertyName) + CosTrading::DuplicatePropertyName)) { // Throw an exception if the trader is not configured // to support properties modification. - if (! this->supports_modifiable_properties ()) - TAO_THROW_SPEC (CosTrading::NotImplemented ()); + if (! this->supports_modifiable_properties (_env)) + TAO_THROW (CosTrading::NotImplemented ()); else { char* type = 0; @@ -169,28 +173,30 @@ TAO_Register<TRADER>::modify (const char *id, CosTrading::TypeRepository_ptr type_repos = support_attrs.type_repos (); CosTradingRepos::ServiceTypeRepository_ptr rep = - CosTradingRepos::ServiceTypeRepository::_narrow (type_repos); + CosTradingRepos::ServiceTypeRepository::_narrow (type_repos, _env); + TAO_CHECK_ENV_RETURN (_env,); TRADER::SERVICE_TYPE_MAP &service_type_map = this->trader_.service_type_map (); CosTrading::Offer* offer = service_type_map.lookup_offer ((CosTrading::OfferId) id, type, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env,); if (offer != 0) { // Yank our friend, the type struct. TYPE_STRUCT* type_struct = rep->describe_type (type, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env,); TAO_Offer_Modifier offer_mod (type, type_struct, *offer); // Delete, add, and change properties of the offer. - this->validate_properties (type, type_struct, modify_list, _env); - TAO_CHECK_ENV_RETURN (_env); + this->validate_properties (type, type_struct, + (CosTrading::PropertySeq) modify_list, _env); + TAO_CHECK_ENV_RETURN (_env,); offer_mod.delete_properties (del_list, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env,); offer_mod.merge_properties (modify_list, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env,); // Alter our reference to the offer. offer_mod.affect_change (); @@ -202,11 +208,11 @@ template <class TRADER> void TAO_Register<TRADER>::withdraw_using_constraint (const char *type, const char *constr, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, CosTrading::IllegalConstraint, - CosTrading::Register::NoMatchingOffers) + CosTrading::Register::NoMatchingOffers)) { int num_removed = 0; deque<CosTrading::OfferId_var> ids; @@ -215,7 +221,7 @@ TAO_Register<TRADER>::withdraw_using_constraint (const char *type, CosTrading::TypeRepository_ptr type_repos = support_attrs.type_repos (); CosTradingRepos::ServiceTypeRepository_ptr rep = - CosTradingRepos::ServiceTypeRepository::_narrow (type_repos); + CosTradingRepos::ServiceTypeRepository::_narrow (type_repos, _env); TRADER::SERVICE_TYPE_MAP &service_type_map = this->trader_.service_type_map (); CORBA::Boolean dp_support = @@ -223,7 +229,7 @@ TAO_Register<TRADER>::withdraw_using_constraint (const char *type, // Retrieve the type struct TYPE_STRUCT* type_struct = rep->describe_type (type, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env,); // Try to find the map of offers of desired service type. TRADER::SERVICE_TYPE_MAP::Local_Offer_Iterator* @@ -232,7 +238,8 @@ TAO_Register<TRADER>::withdraw_using_constraint (const char *type, if (offer_iter != 0) { TAO_Constraint_Validator validator (type_struct); - TAO_Constraint_Interpreter constr_inter (validator, constr); + TAO_Constraint_Interpreter constr_inter (validator, constr, _env); + TAO_CHECK_ENV_RETURN (_env,); while (offer_iter->has_more_offers ()) { @@ -251,26 +258,69 @@ TAO_Register<TRADER>::withdraw_using_constraint (const char *type, } if (ids.size () == 0) - throw CosTrading::Register::NoMatchingOffers (constr); + TAO_THROW (CosTrading::Register::NoMatchingOffers (constr)); else { - for (deque<CosTrading::OfferId_var::iterator id_iter = ids.begin (); + for (deque<CosTrading::OfferId_var>::iterator id_iter = ids.begin (); id_iter != ids.end (); id_iter++) - service_type_map.remove_offer (ids.front ()); + { + service_type_map.remove_offer + ((CosTrading::OfferId) ids.front ().in (), _env); + } } } template <class TRADER> CosTrading::Register_ptr TAO_Register<TRADER>::resolve (const CosTrading::TraderName &name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Register::IllegalTraderName, CosTrading::Register::UnknownTraderName, - CosTrading::Register::RegisterNotSupported) + CosTrading::Register::RegisterNotSupported)) { - TAO_THROW_RETURN (CORBA::SystemException (), - CosTrading::Register::_nil ()); + // Determine if the first link is a legal link name. + if (! TAO_Trader_Base::is_valid_identifier_name (name[0])) + TAO_THROW_RETURN (CosTrading::Register::IllegalTraderName (name), + CosTrading::Register::_nil ()); + + // Grab a reference to the link interface, and get a link description. + CosTrading::Link_var link (this->link_if (_env)); + TAO_CHECK_ENV_RETURN (_env, CosTrading::Register::_nil ()); + CosTrading::Link::LinkInfo_var link_info; + + TAO_TRY + { + // Ensure that the link to the next trader exists. + link_info = link->describe_link (name[0], TAO_TRY_ENV); + TAO_CHECK_ENV; + } + TAO_CATCHANY + { + TAO_THROW_RETURN (CosTrading::Register::UnknownTraderName (name), + CosTrading::Register::_nil ()); + } + TAO_ENDTRY; + + // Ensure that the register pointer isn't nil. + if (link_info->target_reg == CosTrading::Register::_nil ()) + TAO_THROW_RETURN (CosTrading::Register::RegisterNotSupported (name), + CosTrading::Register::_nil ()); + + CosTrading::Register_ptr return_value = link_info->target_reg; + + if (name.length () > 1) + { + // Create a new Trader Name with the first link removed. + CosTrading::TraderName trader_name (name.length () - 1); + for (int i = trader_name.length () - 1; i >= 0; i--) + trader_name[i] = name[i + 1]; + + return_value = link_info->target_reg->resolve (trader_name, _env); + TAO_CHECK_ENV_RETURN (_env, CosTrading::Register::_nil ()); + } + + return return_value; } template <class TRADER> void @@ -279,18 +329,18 @@ validate_properties (const char* type, TYPE_STRUCT* type_struct, CosTrading::PropertySeq& properties, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, CosTrading::PropertyTypeMismatch, CosTrading::ReadonlyDynamicProperty, CosTrading::MissingMandatoryProperty, - CosTrading::DuplicatePropertyName) + CosTrading::DuplicatePropertyName)) { typedef CosTradingRepos::ServiceTypeRepository SERVICE_TYPE_REPOS; int length = properties.length (); SERVICE_TYPE_REPOS::PropStructSeq& prop_types = type_struct->props; TAO_Property_Evaluator_By_Name prop_eval (properties, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env,); // Perform property validation length = prop_types.length (); @@ -310,7 +360,7 @@ validate_properties (const char* type, } else { - if (! prop_type->equal (prop_struct.value_type)) + if (! prop_type->equal (prop_struct.value_type, _env)) { // Offer cannot redefine the type of an property. const CosTrading::Property* prop = prop_eval.get_property (prop_name); @@ -323,78 +373,4 @@ validate_properties (const char* type, } } -template <class TRADER> -CosTrading::Lookup_ptr -TAO_Register<TRADER>::lookup_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Lookup::_duplicate (this->trader_.trading_components ().lookup_if ()); -} - -template <class TRADER> -CosTrading::Register_ptr -TAO_Register<TRADER>::register_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Register::_duplicate (this->trader_.trading_components ().register_if ()); -} - -template <class TRADER> -CosTrading::Link_ptr -TAO_Register<TRADER>::link_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Link::_duplicate (this->trader_.trading_components ().link_if ()); -} - -template <class TRADER> -CosTrading::Proxy_ptr -TAO_Register<TRADER>::proxy_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Proxy::_duplicate (this->trader_.trading_components ().proxy_if ()); -} - -template <class TRADER> -CosTrading::Admin_ptr -TAO_Register<TRADER>::admin_if (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::Admin::_duplicate (this->trader_.trading_components ().admin_if ()); -} - - -template <class TRADER> -CORBA::Boolean -TAO_Register<TRADER>::supports_modifiable_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_modifiable_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Register<TRADER>::supports_dynamic_properties (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_dynamic_properties (); -} - -template <class TRADER> -CORBA::Boolean -TAO_Register<TRADER>::supports_proxy_offers (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return this->trader_.support_attributes ().supports_proxy_offers (); -} - -template <class TRADER> -CosTrading::TypeRepository_ptr -TAO_Register<TRADER>::type_repos (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) -{ - return CosTrading::TypeRepository::_duplicate - (this->trader_.support_attributes ().type_repos ()); -} - #endif /* TAO_REGISTER_C */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Register.h b/TAO/orbsvcs/orbsvcs/Trader/Register.h index 784fa895383..36975416071 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Register.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Register.h @@ -18,14 +18,15 @@ #define ACE_REGISTER_H #include "Offer_Modifier.h" -#include "CosTradingS.h" #include <map> #include <string> #include <deque> template <class TRADER> -class TAO_Register : public POA_CosTrading::Register +class TAO_Register : + public TAO_Trader_Components<POA_CosTrading::Register>, + public TAO_Support_Attributes<POA_CosTrading::Register> // // = TITLE // This class implements CosTrading::Register IDL interface. @@ -40,7 +41,7 @@ public: const char *type, const CosTrading::PropertySeq& properties, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Register::InvalidObjectRef, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, @@ -49,7 +50,7 @@ public: CosTrading::PropertyTypeMismatch, CosTrading::ReadonlyDynamicProperty, CosTrading::MissingMandatoryProperty, - CosTrading::DuplicatePropertyName); + CosTrading::DuplicatePropertyName)); // BEGIN SPEC // The export operation is the means by which a service is @@ -106,10 +107,10 @@ public: // END SPEC virtual void withdraw (const char *id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Register::ProxyOfferId); + CosTrading::Register::ProxyOfferId)); // BEGIN SPEC // The withdraw operation removes the service offer from the trader @@ -127,10 +128,10 @@ public: virtual CosTrading::Register::OfferInfo* describe (const char * id, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, - CosTrading::Register::ProxyOfferId); + CosTrading::Register::ProxyOfferId)); // BEGIN SPEC // The describe operation returns the information about an offered @@ -150,7 +151,7 @@ public: const CosTrading::PropertyNameSeq& del_list, const CosTrading::PropertySeq& modify_list, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::NotImplemented, CosTrading::IllegalOfferId, CosTrading::UnknownOfferId, @@ -161,7 +162,7 @@ public: CosTrading::ReadonlyDynamicProperty, CosTrading::Register::MandatoryProperty, CosTrading::Register::ReadonlyProperty, - CosTrading::DuplicatePropertyName); + CosTrading::DuplicatePropertyName)); // BEGIN SPEC // The modify operation is used to change the description of a @@ -219,11 +220,11 @@ public: virtual void withdraw_using_constraint (const char *type, const char *constr, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, CosTrading::IllegalConstraint, - CosTrading::Register::NoMatchingOffers); + CosTrading::Register::NoMatchingOffers)); // BEGIN SPEC // The withdraw_using_constraint operation withdraws a set of offers @@ -251,10 +252,10 @@ public: virtual CosTrading::Register_ptr resolve (const CosTrading::TraderName &name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::Register::IllegalTraderName, CosTrading::Register::UnknownTraderName, - CosTrading::Register::RegisterNotSupported); + CosTrading::Register::RegisterNotSupported)); // BEGIN SPEC // This operation is used to resolve a context relative name for @@ -278,49 +279,7 @@ public: // return the Register interface reference to their client (another // trader). // END SPEC - - // = TraderComponents IDL interface methods. - - // = CosTrading::TraderComponents methods. - virtual CosTrading::Lookup_ptr lookup_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns an object reference to the Lookup interface of the trader. - // Returns nil if the trader does not support Lookup interface. - - virtual CosTrading::Register_ptr register_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Register interface of the trader. - // Returns nil if the trader does not support Register interface. - - virtual CosTrading::Link_ptr link_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Link interface of the trader. - // Returns nil if the trader does not support Link interface. - - virtual CosTrading::Proxy_ptr proxy_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference to the Proxy interface of the trader. - // Returns nil if the trader does not support Proxy interface. - - virtual CosTrading::Admin_ptr admin_if (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - // Returns object reference for the Admin interface of the trader. - // Returns nil if the trader does not support Admin interface. - - // = Support_Attributes IDL interface methods. - - virtual CORBA::Boolean supports_modifiable_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_dynamic_properties (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CORBA::Boolean supports_proxy_offers (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - - virtual CosTrading::TypeRepository_ptr type_repos (CORBA::Environment& env) - TAO_THROW_SPEC (CORBA::SystemException); - + static const char* NAME; protected: @@ -331,11 +290,11 @@ protected: TYPE_STRUCT* type_struct, CosTrading::PropertySeq& properties, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, CosTrading::PropertyTypeMismatch, CosTrading::ReadonlyDynamicProperty, CosTrading::MissingMandatoryProperty, - CosTrading::DuplicatePropertyName); + CosTrading::DuplicatePropertyName)); // Type is a known service type. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.cpp index 789234c9ff0..4f9d4190b27 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.cpp @@ -48,8 +48,8 @@ TAO_Register_Offer_Iterator<TRADER>::add_offer (CosTrading::OfferId id, template <class TRADER> CORBA::ULong TAO_Register_Offer_Iterator<TRADER>::max_left (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::UnknownMaxLeft) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::UnknownMaxLeft)) { return this->offer_ids_.size (); } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.h b/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.h index 153f9bd328c..133a771ab35 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Register_Offer_Iterator.h @@ -47,13 +47,13 @@ public: virtual CORBA::Boolean next_n (CORBA::ULong n, CosTrading::OfferSeq_out offers, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // Deposit at maximum n offers into the return sequence and return 1, // or return 0 if the iterator is done and no offers are returned. virtual CORBA::ULong max_left (CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, - CosTrading::UnknownMaxLeft); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::UnknownMaxLeft)); // Throws CosTrading::UnknownMaxLeft since with the presence of // "Register" functionality, the iterator cannot guarantee that // the trader will have all the offers it has now when the time diff --git a/TAO/orbsvcs/orbsvcs/Trader/Sequences.idl b/TAO/orbsvcs/orbsvcs/Trader/Sequences.idl deleted file mode 100644 index 31b03a31cd7..00000000000 --- a/TAO/orbsvcs/orbsvcs/Trader/Sequences.idl +++ /dev/null @@ -1,23 +0,0 @@ -// ============================================================================ -// $Id$ -// -// = LIBRARY -// orbsvcs -// -// = FILENAME -// Sequences.idl -// -// = AUTHOR -// Seth Widoff <sbw1@cs.wustl.edu> -// ============================================================================ - -// Used for extracting simple sequences from anys. - -typedef sequence<short> ShortSeq; -typedef sequence<unsigned short> UShortSeq; -typedef sequence<long> LongSeq; -typedef sequence<unsigned long> ULongSeq; -typedef sequence<boolean> BooleanSeq; -typedef sequence<float> FloatSeq; -typedef sequence<double> DoubleSeq; -typedef sequence<string> StringSeq; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp index 4ea0aa8924b..d77e3656703 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp @@ -3,6 +3,7 @@ #define TAO_SERVICE_TYPE_MAP_C #include "Service_Type_Map.h" +#include "Offer_Id_Iterator.h" template <class LOCK_TYPE> TAO_Service_Type_Map<LOCK_TYPE>::TAO_Service_Type_Map (void) @@ -14,7 +15,7 @@ TAO_Service_Type_Map<LOCK_TYPE>::Local_Offer_Iterator* TAO_Service_Type_Map<LOCK_TYPE>::get_offers (const char* type) { // Construct a Local_Offer_Iterator - ACE_READ_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), 0); Local_Offer_Iterator* iterator = 0; string service_type (type); @@ -34,7 +35,7 @@ TAO_Service_Type_Map<LOCK_TYPE>::get_offers (const char* type) template <class LOCK_TYPE> int TAO_Service_Type_Map<LOCK_TYPE>::add_type (const char* type) { - ACE_WRITE_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_WRITE_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), -1); int return_value = -1; string service_type (type); @@ -57,7 +58,7 @@ TAO_Service_Type_Map<LOCK_TYPE>::add_type (const char* type) template <class LOCK_TYPE> int TAO_Service_Type_Map<LOCK_TYPE>::remove_type (const char* type) { - ACE_WRITE_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_WRITE_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), -1); int return_value = -1; string service_type (type); @@ -78,7 +79,7 @@ TAO_Service_Type_Map<LOCK_TYPE>:: insert_offer (const char* type, const CosTrading::Offer& offer) { - ACE_READ_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), 0); char* return_value = 0; string service_type (type); @@ -92,7 +93,7 @@ insert_offer (const char* type, OFFER_MAP &offer_map = mc.first; HUGE_NUMBER& starting_number = mc.second; - ACE_WRITE_GUARD (LOCK_TYPE, ace_mon, offer_map.lock ()); + ACE_WRITE_GUARD_RETURN (LOCK_TYPE, ace_mon, offer_map.lock (), 0); return_value = this->generate_offer_id (type, starting_number); offer_map[starting_number++] = offer; @@ -105,7 +106,7 @@ template <class LOCK_TYPE> int TAO_Service_Type_Map<LOCK_TYPE>:: remove_offer (const char* type, HUGE_NUMBER id) { - ACE_READ_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), -1); int return_value = -1; SERVICE_TYPE_MAP::iterator type_iter; @@ -118,7 +119,7 @@ remove_offer (const char* type, HUGE_NUMBER id) OFFER_MAP_PLUS_COUNTER& mc = (*type_iter).second; OFFER_MAP &offer_map = mc.first; - ACE_WRITE_GUARD (LOCK_TYPE, ace_mon, offer_map.lock ()); + ACE_WRITE_GUARD_RETURN (LOCK_TYPE, ace_mon, offer_map.lock (), -1); offer_iter = offer_map.find (id); if (offer_iter != offer_map.end ()) @@ -135,8 +136,8 @@ template <class LOCK_TYPE> int TAO_Service_Type_Map<LOCK_TYPE>:: remove_offer (const CosTrading::OfferId offer_id, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId, - CosTrading::UnknownOfferId) + TAO_THROW_SPEC ((CosTrading::IllegalOfferId, + CosTrading::UnknownOfferId)) { char* stype = 0; HUGE_NUMBER index = -1; @@ -145,7 +146,7 @@ remove_offer (const CosTrading::OfferId offer_id, TAO_CHECK_ENV_RETURN (_env, -1); if (this->remove_offer (stype, index) == -1) - TAO_THROW (CosTrading::UnknownOfferId (offer_id), -1); + TAO_THROW_RETURN (CosTrading::UnknownOfferId (offer_id), -1); return 0; } @@ -155,15 +156,15 @@ TAO_Service_Type_Map<LOCK_TYPE>:: lookup_offer (const CosTrading::OfferId offer_id, char*& type_name, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId, - CosTrading::UnknownOfferId) + TAO_THROW_SPEC ((CosTrading::IllegalOfferId, + CosTrading::UnknownOfferId)) { HUGE_NUMBER index; CosTrading::Offer* offer = 0; this->parse_offer_id (offer_id, type_name, index, _env); TAO_CHECK_ENV_RETURN (_env, offer); - if ((offer = this->lookup_offer (type_name, index, _env)) == 0) + if ((offer = this->lookup_offer (type_name, index)) == 0) TAO_THROW_RETURN (CosTrading::UnknownOfferId (offer_id), offer); return offer; @@ -174,8 +175,8 @@ template <class LOCK_TYPE> CosTrading::Offer* TAO_Service_Type_Map<LOCK_TYPE>:: lookup_offer (const CosTrading::OfferId offer_id, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId, - CosTrading::UnknownOfferId) + TAO_THROW_SPEC ((CosTrading::IllegalOfferId, + CosTrading::UnknownOfferId)) { char* type_name; HUGE_NUMBER index; @@ -184,7 +185,7 @@ lookup_offer (const CosTrading::OfferId offer_id, this->parse_offer_id (offer_id, type_name, index, _env); TAO_CHECK_ENV_RETURN (_env, offer); - if ((offer = this->lookup_offer (type_name, index, _env)) == 0) + if ((offer = this->lookup_offer (type_name, index)) == 0) TAO_THROW_RETURN (CosTrading::UnknownOfferId (offer_id), offer); return offer; @@ -194,7 +195,7 @@ template <class LOCK_TYPE> CosTrading::Offer* TAO_Service_Type_Map<LOCK_TYPE>:: lookup_offer (const char* type, HUGE_NUMBER id) { - ACE_READ_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), 0); CosTrading::Offer* return_value = 0; SERVICE_TYPE_MAP::iterator type_iter = @@ -210,7 +211,7 @@ lookup_offer (const char* type, HUGE_NUMBER id) if (offer_iter != offer_map.end ()) return_value = &((*offer_iter).second); } - + return return_value; } @@ -219,7 +220,7 @@ TAO_Service_Type_Map<LOCK_TYPE>::Random_Offer_Locator* TAO_Service_Type_Map<LOCK_TYPE>::lookup_offers (const char* type) { // Construct a Random_Offer_Locator. - ACE_READ_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), 0); Random_Offer_Locator* iterator = 0; string service_type (type); @@ -243,16 +244,16 @@ TAO_Service_Type_Map<LOCK_TYPE>::retrieve_all_offer_ids (void) // map, cramming offer_id strings into a newly constructed // TAO_Offer_Id_Iterator. TAO_Offer_Id_Iterator* id_iterator = new TAO_Offer_Id_Iterator (); - ACE_READ_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), 0); for (SERVICE_TYPE_MAP::iterator type_iter = this->type_map_.begin (); type_iter != this->type_map_.end (); type_iter++) { - string& service_type = (*type_iter).first; + char* service_type = (char *) (*type_iter).first.data (); OFFER_MAP& offer_map = (*type_iter).second.first; - ACE_READ_GUARD (LOCK_TYPE, ace_mon, offer_map.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, offer_map.lock (), 0); for (OFFER_MAP::iterator offer_iter = offer_map.begin(); offer_iter != offer_map.end(); @@ -260,7 +261,7 @@ TAO_Service_Type_Map<LOCK_TYPE>::retrieve_all_offer_ids (void) { HUGE_NUMBER offer_index = (*offer_iter).first; CosTrading::OfferId_var offer_id = - this->generate_offer_id (service_type.data (), offer_index); + this->generate_offer_id (service_type, offer_index); id_iterator->insert_id (offer_id); } @@ -272,7 +273,7 @@ TAO_Service_Type_Map<LOCK_TYPE>::retrieve_all_offer_ids (void) template <class LOCK_TYPE> TAO_Service_Type_Map<LOCK_TYPE>::TYPE_NAME_SEQ* TAO_Service_Type_Map<LOCK_TYPE>::list_all_types (void) { - ACE_READ_GUARD (LOCK_TYPE, ace_mon, this->type_map_.lock ()); + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, this->type_map_.lock (), 0); CORBA::ULong i = 0; TYPE_NAME* type_names = TYPE_NAME_SEQ::allocbuf (this->type_map_.size ()); @@ -290,10 +291,10 @@ TAO_Service_Type_Map<LOCK_TYPE>::parse_offer_id (const char *offer_id, char*&service_type, HUGE_NUMBER& id, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId) + TAO_THROW_SPEC ((CosTrading::IllegalOfferId)) { // Get service type: it is everything from 17th character to the end. - service_type = offer_id + 16; + service_type = (char *) offer_id + 16; // Get id: temporarily put the end of string character where the service // type starts, convert to number, replace the character back. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.h b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.h index 54116a5a9fb..c2637e634d6 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.h @@ -17,27 +17,14 @@ #ifndef TAO_SERVICE_TYPE_MAP_H #define TAO_SERVICE_TYPE_MAP_H -#if defined (OS_NO_NAMESPACE) -#define queue sillything -#define map mommy -#endif /* OS_NO_NAMESPACE */ - #include "Trader_Base.h" -#include "Offer_Id_Iterator.h" #include "Monitor.h" -#include "ace/OS.h" - -#if defined (OS_NO_NAMESPACE) -#undef queue -#undef map -#endif /* OS_NO_NAMESPACE */ -#include <map> -#include <string> +class TAO_Offer_Id_Iterator; template <class LOCK_TYPE> class TAO_Service_Type_Map -// = TITLE +// = DESCRIPTION // The TAO_Service_Type_Map encapsulates the mapping of service // types to those offers exported with that service types. The // underlying structure is a map of maps. The first maps maps the @@ -93,8 +80,8 @@ public: int remove_offer (const CosTrading::OfferId offer_id, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId, - CosTrading::UnknownOfferId); + TAO_THROW_SPEC ((CosTrading::IllegalOfferId, + CosTrading::UnknownOfferId)); int remove_offer (const char* type, HUGE_NUMBER id); // Remove an offers whose id is <offer_id>. Returns 0 on success, -1 @@ -104,16 +91,16 @@ public: CosTrading::Offer* lookup_offer (const CosTrading::OfferId offer_id, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId, - CosTrading::UnknownOfferId); + TAO_THROW_SPEC ((CosTrading::IllegalOfferId, + CosTrading::UnknownOfferId)); // Lookup an offer whose offer_id is <offer_id>, and return // it. Otherwise, throw the appropriate exception. CosTrading::Offer* lookup_offer (const CosTrading::OfferId offer_id, char*& type_name, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId, - CosTrading::UnknownOfferId); + TAO_THROW_SPEC ((CosTrading::IllegalOfferId, + CosTrading::UnknownOfferId)); // Lookup an offer whose OfferId is <offer_id> and return in // <type_name> the type name of the object. Type name is just a // pointer to a location in offer_id, so DON'T DELETE IT. @@ -222,7 +209,7 @@ private: char* &service_type, HUGE_NUMBER& id, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalOfferId); + TAO_THROW_SPEC ((CosTrading::IllegalOfferId)); // Take in a previously generated offer id and return the type // and id that were used to generate the offer id. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp index 92639fbb155..0be61a9c68a 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp @@ -18,6 +18,7 @@ #if !defined (TAO_SERVICE_TYPE_REPOSITORY_C) #define TAO_SERVICE_TYPE_REPOSITORY_C +#include "Locking.h" #include "Service_Type_Repository.h" template <class MAP_LOCK_TYPE> @@ -43,9 +44,11 @@ SERVICE_TYPE_REPOS::IncarnationNumber TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: incarnation (CORBA::Environment& _env) { - ACE_READ_GUARD (MAP_LOCK_TYPE, - ace_mon, - this->type_map_.lock ()); + SERVICE_TYPE_REPOS::IncarnationNumber inc_num; + TAO_READ_GUARD_RETURN (MAP_LOCK_TYPE, + ace_mon, + this->type_map_.lock (), + inc_num); return incarnation_; } @@ -57,7 +60,7 @@ add_type (const char * name, const SERVICE_TYPE_REPOS::PropStructSeq& props, const SERVICE_TYPE_REPOS::ServiceTypeNameSeq& super_types, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, SERVICE_TYPE_REPOS::ServiceTypeExists, SERVICE_TYPE_REPOS::InterfaceTypeMismatch, @@ -65,33 +68,37 @@ add_type (const char * name, CosTrading::DuplicatePropertyName, SERVICE_TYPE_REPOS::ValueTypeRedefinition, CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::DuplicateServiceTypeName) + SERVICE_TYPE_REPOS::DuplicateServiceTypeName)) { PROP_MAP prop_map; SUPER_TYPE_MAP super_map; SERVICE_TYPE_REPOS::TypeStruct info; SERVICE_TYPE_MAP::iterator type_iterator; + SERVICE_TYPE_REPOS::IncarnationNumber inc_num; - ACE_WRITE_GUARD (MAP_LOCK_TYPE, - ace_mon, - this->type_map_.lock ()); + TAO_WRITE_GUARD_RETURN (MAP_LOCK_TYPE, + ace_mon, + this->type_map_.lock (), + inc_num); // make sure Type name is valid if (! TAO_Trader_Base::is_valid_identifier_name (name)) - TAO_THROW (CosTrading::IllegalServiceType (name)); + TAO_THROW_RETURN (CosTrading::IllegalServiceType (name), + this->incarnation_); // check if the service type already exists. type_iterator = this->type_map_.find (name); if (type_iterator != this->type_map_.end ()) - TAO_THROW (SERVICE_TYPE_REPOS::ServiceTypeExists (name)); + TAO_THROW_RETURN (SERVICE_TYPE_REPOS::ServiceTypeExists (name), + this->incarnation_); // make sure all property names are valid and appear only once. this->validate_properties (props, prop_map, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env, this->incarnation_); // check that all super_types exist, and none are duplicated. this->validate_supertypes (super_types, super_map, _env); - TAO_CHECK_ENV_RETURN (_env) + TAO_CHECK_ENV_RETURN (_env, this->incarnation_); // make sure interface name is legal. // this->validate_interface (if_name) forthcoming @@ -99,7 +106,7 @@ add_type (const char * name, // collect and make sure that properties of all supertypes and this type // are compatible. We can use prop_map and super_types_map for the job. this->validate_inheritance (prop_map, super_map, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_CHECK_ENV_RETURN (_env, this->incarnation_); // we can now use prop_map to construct a sequence of all properties the // this type. @@ -107,14 +114,14 @@ add_type (const char * name, info.props = props; info.super_types = super_types; info.masked = 0; - info.incarnation = incarnation_; + info.incarnation = this->incarnation_; this->update_type_map (name, info, prop_map, super_map); // increment incarnation number - incarnation_.low++; + this->incarnation_.low++; // if we wrapped around in lows... - if (incarnation_.low == 0) - incarnation_.high++; + if (this->incarnation_.low == 0) + this->incarnation_.high++; return this->type_map_[name].type_info_.incarnation; } @@ -124,17 +131,17 @@ void TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: remove_type (const char * name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::HasSubTypes) + SERVICE_TYPE_REPOS::HasSubTypes)) { if (! TAO_Trader_Base::is_valid_identifier_name (name)) TAO_THROW (CosTrading::IllegalServiceType (name)); - ACE_WRITE_GUARD (MAP_LOCK_TYPE, - ace_mon, - this->type_map_.lock ()); + TAO_WRITE_GUARD (MAP_LOCK_TYPE, + ace_mon, + this->type_map_.lock ()); // check if the type exists. SERVICE_TYPE_MAP::iterator type_iterator = this->type_map_.find (name); @@ -172,11 +179,12 @@ SERVICE_TYPE_REPOS::ServiceTypeNameSeq* TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: list_types (const SERVICE_TYPE_REPOS::SpecifiedServiceTypes& which_types, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + TAO_THROW_SPEC ((CORBA::SystemException)) { - ACE_READ_GUARD (MAP_LOCK_TYPE, - ace_mon, - this->type_map_.lock ()); + TAO_READ_GUARD_RETURN (MAP_LOCK_TYPE, + ace_mon, + this->type_map_.lock (), + (SERVICE_TYPE_REPOS::ServiceTypeNameSeq*) 0); SERVICE_TYPE_REPOS::ServiceTypeNameSeq_ptr result = new SERVICE_TYPE_REPOS::ServiceTypeNameSeq (); @@ -221,22 +229,25 @@ SERVICE_TYPE_REPOS::TypeStruct* TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: describe_type (const char * name, CORBA::Environment& _env) - throw (CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::IllegalServiceType, + CosTrading::UnknownServiceType)) { if (! TAO_Trader_Base::is_valid_identifier_name (name)) - TAO_THROW_SPEC (CosTrading::IllegalServiceType (name)); + TAO_THROW_RETURN (CosTrading::IllegalServiceType (name), + (SERVICE_TYPE_REPOS::TypeStruct*) 0); - ACE_READ_GUARD (MAP_LOCK_TYPE, - ace_mon, - this->type_map_.lock ()); + TAO_READ_GUARD_RETURN (MAP_LOCK_TYPE, + ace_mon, + this->type_map_.lock (), + (SERVICE_TYPE_REPOS::TypeStruct*) 0); // make sure the type exists. SERVICE_TYPE_MAP::iterator type_iterator = this->type_map_.find (name); if (type_iterator == this->type_map_.end ()) - TAO_THROW (CosTrading::UnknownServiceType (name)); - + TAO_THROW_RETURN (CosTrading::UnknownServiceType (name), + (SERVICE_TYPE_REPOS::TypeStruct*) 0); + // return appropriate information about the type. SERVICE_TYPE_REPOS::TypeStruct* descr = new SERVICE_TYPE_REPOS::TypeStruct; SERVICE_TYPE_REPOS::TypeStruct & s = (*type_iterator).second.type_info_; @@ -251,21 +262,24 @@ SERVICE_TYPE_REPOS::TypeStruct* TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: fully_describe_type (const char * name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType) + CosTrading::UnknownServiceType)) { if (! TAO_Trader_Base::is_valid_identifier_name (name)) - TAO_THROW (CosTrading::IllegalServiceType (name)); + TAO_THROW_RETURN (CosTrading::IllegalServiceType (name), + (SERVICE_TYPE_REPOS::TypeStruct*) 0); - ACE_READ_GUARD (MAP_LOCK_TYPE, - ace_mon, - this->type_map_.lock ()); + TAO_READ_GUARD_RETURN (MAP_LOCK_TYPE, + ace_mon, + this->type_map_.lock (), + (SERVICE_TYPE_REPOS::TypeStruct*) 0); // make sure the type exists. SERVICE_TYPE_MAP::iterator type_iterator = this->type_map_.find (name); if (type_iterator == this->type_map_.end ()) - TAO_THROW (CosTrading::UnknownServiceType (name)); + TAO_THROW_RETURN (CosTrading::UnknownServiceType (name), + (SERVICE_TYPE_REPOS::TypeStruct*) 0); // return appropriate information about the type. SERVICE_TYPE_REPOS::TypeStruct* descr = @@ -289,15 +303,15 @@ void TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: mask_type (const char * name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::AlreadyMasked) + SERVICE_TYPE_REPOS::AlreadyMasked)) { if (! TAO_Trader_Base::is_valid_identifier_name (name)) TAO_THROW (CosTrading::IllegalServiceType (name)); - ACE_WRITE_GUARD (MAP_LOCK_TYPE, + TAO_WRITE_GUARD (MAP_LOCK_TYPE, ace_mon, this->type_map_.lock ()); @@ -320,15 +334,15 @@ void TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: unmask_type (const char * name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::NotMasked) + SERVICE_TYPE_REPOS::NotMasked)) { if (! TAO_Trader_Base::is_valid_identifier_name (name)) TAO_THROW (CosTrading::IllegalServiceType (name)); - ACE_WRITE_GUARD (MAP_LOCK_TYPE, + TAO_WRITE_GUARD (MAP_LOCK_TYPE, ace_mon, this->type_map_.lock ()); @@ -348,11 +362,11 @@ unmask_type (const char * name, template <class MAP_LOCK_TYPE> void TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: -validate_properties (SERVICE_TYPE_REPOS::PropStructSeq& props, +validate_properties (const SERVICE_TYPE_REPOS::PropStructSeq& props, PROP_MAP& prop_map, - CORBA::Environment& _env) const - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName) + CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName)) { for (CORBA::ULong i = 0; i < props.length (); i++) { @@ -362,7 +376,11 @@ validate_properties (SERVICE_TYPE_REPOS::PropStructSeq& props, else { string prop_name (n); - if (! prop_map.insert (make_pair (prop_name, &props[i])).second) + SERVICE_TYPE_REPOS::PropStruct* prop_struct = + (SERVICE_TYPE_REPOS::PropStruct *) &props[i]; + + if (! prop_map.insert + (make_pair (prop_name, prop_struct)).second) TAO_THROW (CosTrading::DuplicatePropertyName (n)); } } @@ -370,16 +388,16 @@ validate_properties (SERVICE_TYPE_REPOS::PropStructSeq& props, template <class MAP_LOCK_TYPE> void TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: -validate_supertypes (SERVICE_TYPE_REPOS::ServiceTypeNameSeq& super_types, +validate_supertypes (const SERVICE_TYPE_REPOS::ServiceTypeNameSeq& super_types, SUPER_TYPE_MAP& super_map, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalServiceType, + TAO_THROW_SPEC ((CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, - CosTrading::DuplicatePropertyName) + CosTrading::DuplicatePropertyName)) { for (CORBA::ULong i = 0; i < super_types.length (); i++) { - char* type = super_types[i]; + char* type = (char*)((const char*)super_types[i]); if (! TAO_Trader_Base::is_valid_identifier_name (type)) TAO_THROW (CosTrading::IllegalServiceType (type)); @@ -402,8 +420,8 @@ template <class MAP_LOCK_TYPE> void TAO_Service_Type_Repository<MAP_LOCK_TYPE> ::validate_inheritance (PROP_MAP& prop_map, SUPER_TYPE_MAP& super_map, - CORBA::Environment& _env) const - TAO_THROW (SERVICE_TYPE_REPOS::ValueTypeRedefinition) + CORBA::Environment& _env) + TAO_THROW_SPEC ((SERVICE_TYPE_REPOS::ValueTypeRedefinition)) { SERVICE_TYPE_REPOS::PropertyMode mode; // for each super_type @@ -429,18 +447,20 @@ TAO_Service_Type_Repository<MAP_LOCK_TYPE> SERVICE_TYPE_REPOS::PropStruct& property_in_map = *(prop_map[prop_name]); - if (! property.value_type->equal (property_in_map.value_type)) + if (! property.value_type->equal (property_in_map.value_type, _env)) { - this->value_type_redef (property, property_in_map, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_THROW (SERVICE_TYPE_REPOS::ValueTypeRedefinition + (property.name, property, + property_in_map.name, property_in_map)); } // Mode of the parent type has to be the same or less // restrictive. if (property.mode >= property_in_map.mode) { - this->value_type_redef (property, property_in_map, _env); - TAO_CHECK_ENV_RETURN (_env); + TAO_THROW (SERVICE_TYPE_REPOS::ValueTypeRedefinition + (property.name, property, + property_in_map.name, property_in_map)); } } } @@ -449,22 +469,6 @@ TAO_Service_Type_Repository<MAP_LOCK_TYPE> template <class MAP_LOCK_TYPE> void TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: -value_type_redef (const SERVICE_TYPE_REPOS::PropStruct& prop1, - const SERVICE_TYPE_REPOS::PropStruct& prop2, - CORBA::Environment& _env) const - TAO_THROW_SPEC (SERVICE_TYPE_REPOS::ValueTypeRedefinition) -{ - SERVICE_TYPE_REPOS::ValueTypeRedefinition excep; - excep.definition_1 = prop1; - excep.definition_2 = prop2; - excep.type_1 = prop1.name; - excep.type_2 = prop2.name; - TAO_THROW (excep); -} - - -template <class MAP_LOCK_TYPE> void -TAO_Service_Type_Repository<MAP_LOCK_TYPE>:: update_type_map (const char* name, SERVICE_TYPE_REPOS::TypeStruct& info, PROP_MAP& prop_map, diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h index e5dfe08f28f..2317c3d4723 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h @@ -20,23 +20,10 @@ #include <list> #include "Trader_Base.h" - -// ACE includes -#if defined (OS_NO_NAMESPACE) -#define map foobar -#endif /* OS_NO_NAMESPACE */ - -#include "CosTradingS.h" #include "Monitor.h" -#include "ace/OS.h" - -#if defined (OS_NO_NAMESPACE) -#undef map -#endif /* OS_NO_NAMESPACE */ typedef CosTradingRepos::ServiceTypeRepository SERVICE_TYPE_REPOS; - template <class MAP_LOCK_TYPE> class TAO_Service_Type_Repository : public POA_CosTradingRepos::ServiceTypeRepository @@ -60,7 +47,7 @@ public: const SERVICE_TYPE_REPOS::PropStructSeq& props, const SERVICE_TYPE_REPOS::ServiceTypeNameSeq& super_types, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, SERVICE_TYPE_REPOS::ServiceTypeExists, SERVICE_TYPE_REPOS::InterfaceTypeMismatch, @@ -68,7 +55,7 @@ public: CosTrading::DuplicatePropertyName, SERVICE_TYPE_REPOS::ValueTypeRedefinition, CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::DuplicateServiceTypeName); + SERVICE_TYPE_REPOS::DuplicateServiceTypeName)); // BEGIN SPEC // The add_type operation enables the creation of new service types @@ -116,10 +103,10 @@ public: virtual void remove_type (const char * name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::HasSubTypes); + SERVICE_TYPE_REPOS::HasSubTypes)); // BEGIN SPEC // The remove_type operation removes the named type from the service @@ -134,7 +121,7 @@ public: virtual SERVICE_TYPE_REPOS::ServiceTypeNameSeq* list_types (const SERVICE_TYPE_REPOS::SpecifiedServiceTypes& which_types, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException); + TAO_THROW_SPEC ((CORBA::SystemException)); // BEGIN SPEC // The list_types operation permits a client to obtain the names of @@ -150,9 +137,9 @@ public: virtual SERVICE_TYPE_REPOS::TypeStruct* describe_type (const char * name, CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException, + TAO_THROW_SPEC ((CORBA::SystemException, CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType); + CosTrading::UnknownServiceType)); // BEGIN SPEC // The describe_type operation permits a client to obtain the // details for a particular service type. ° If "name" is malformed, @@ -164,9 +151,9 @@ public: virtual SERVICE_TYPE_REPOS::TypeStruct* fully_describe_type (const char * name, CORBA::Environment& _env) - throw (CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::IllegalServiceType, + CosTrading::UnknownServiceType)); // BEGIN SPEC // The fully_describe_type operation permits a client to obtain the // details for a particular service type. The property sequence @@ -181,10 +168,10 @@ public: virtual void mask_type (const char * name, CORBA::Environment& _env) - throw (CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::AlreadyMasked); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::IllegalServiceType, + CosTrading::UnknownServiceType, + SERVICE_TYPE_REPOS::AlreadyMasked)); // BEGIN SPEC // The mask_type operation permits the deprecation of a particular // type (i.e., after being masked, exporters will no longer be able @@ -200,10 +187,10 @@ public: virtual void unmask_type (const char * name, CORBA::Environment& _env) - throw (CORBA::SystemException, - CosTrading::IllegalServiceType, - CosTrading::UnknownServiceType, - SERVICE_TYPE_REPOS::NotMasked); + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::IllegalServiceType, + CosTrading::UnknownServiceType, + SERVICE_TYPE_REPOS::NotMasked)); // BEGIN SPEC // The unmask_type undeprecates a type (i.e., after being unmasked, // exporters will be able to resume advertisement of offers of that @@ -218,12 +205,12 @@ public: static const char * NAME; private: - - typedef list<string> TYPE_LIST; struct Type_Info { // storage structure for information pertinent to the type. + typedef list<string> TYPE_LIST; + SERVICE_TYPE_REPOS::TypeStruct type_info_; // standard type info. @@ -240,7 +227,7 @@ private: typedef TAO_Monitor < TYPE_MAP, - TAO_Null_Mutex + MAP_LOCK_TYPE > SERVICE_TYPE_MAP; typedef map @@ -257,35 +244,29 @@ private: less < string > > SUPER_TYPE_MAP; - void validate_properties (SERVICE_TYPE_REPOS::PropStructSeq& props, - PROP_MAP& prop_map - CORBA::Environment& _env) const - TAO_THROW_SPEC (CosTrading::IllegalPropertyName, - CosTrading::DuplicatePropertyName); + void validate_properties (const SERVICE_TYPE_REPOS::PropStructSeq& props, + PROP_MAP& prop_map, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::IllegalPropertyName, + CosTrading::DuplicatePropertyName)); // Confirm that the properties in props have valid names, and aren't // duplicated. Cram those properties into the prop_map. - void validate_supertypes (SERVICE_TYPE_REPOS::ServiceTypeNameSeq& super_types, - SUPER_TYPE_MAP& super_map + void validate_supertypes (const SERVICE_TYPE_REPOS::ServiceTypeNameSeq& super_types, + SUPER_TYPE_MAP& super_map, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalServiceType, + TAO_THROW_SPEC ((CosTrading::IllegalServiceType, CosTrading::UnknownServiceType, - CosTrading::DuplicatePropertyName); + CosTrading::DuplicatePropertyName)); // Confirm that the each super type exists, and cram them into super_map. void validate_inheritance (PROP_MAP& prop_map, - SUPER_TYPE_MAP& super_map - CORBA::Environment& _env) const - TAO_THROW_SPEC (SERVICE_TYPE_REPOS::ValueTypeRedefinition); + SUPER_TYPE_MAP& super_map, + CORBA::Environment& _env) + TAO_THROW_SPEC ((SERVICE_TYPE_REPOS::ValueTypeRedefinition)); // Ensure that properties of a super_type aren't having their types // or retstrictions redefined. - - void value_type_redef (const SERVICE_TYPE_REPOS::PropStruct& prop1, - const SERVICE_TYPE_REPOS::PropStruct& prop2, - CORBA::Environment& _env) const - TAO_THROW_SPEC (SERVICE_TYPE_REPOS::ValueTypeRedefinition); - // Construct a ValueTypeRedefinition exception and throw it. - + void update_type_map (const char* name, SERVICE_TYPE_REPOS::TypeStruct& type, PROP_MAP& prop_map, diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp b/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp index fa33739367d..c6dd48d12eb 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp @@ -28,29 +28,74 @@ template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::TAO_Trader (Trader_Components components) { - typedef TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE> TRADER_SELF; + CORBA::Environment env; + for (int i = LOOKUP_IF; i <= LINK_IF; i++) + this->ifs_[i] = 0; - if (ACE_BIT_ENABLED (components, ADMIN)) - this->trading_components ().admin_if (new TAO_Admin<TRADER_SELF> (*this)); if (ACE_BIT_ENABLED (components, LOOKUP)) - this->trading_components ().lookup_if (new TAO_Lookup<TRADER_SELF> (*this)); - if (ACE_BIT_ENABLED (components, REGISTER)) - this->trading_components ().register_if (new TAO_Register<TRADER_SELF> (*this)); - if (ACE_BIT_ENABLED (components, LINK)) - this->trading_components ().link_if (new TAO_Link<TRADER_SELF> (*this)); - if (ACE_BIT_ENABLED (components, PROXY)) - this->trading_components ().proxy_if (new TAO_Proxy<TRADER_SELF> (*this)); + { + TAO_Lookup<TRADER_SELF>* lookup = new TAO_Lookup<TRADER_SELF> (*this); + this->trading_components ().lookup_if (lookup->_this (env)); + this->ifs_[LOOKUP_IF] = lookup; + } + else if (ACE_BIT_ENABLED (components, REGISTER)) + { + TAO_Register<TRADER_SELF>* reg = new TAO_Register<TRADER_SELF> (*this); + this->trading_components ().register_if (reg->_this (env)); + this->ifs_[REGISTER_IF] = reg; + } + else if (ACE_BIT_ENABLED (components, ADMIN)) + { + TAO_Admin<TRADER_SELF>* admin = new TAO_Admin<TRADER_SELF> (*this); + this->trading_components ().admin_if (admin->_this (env)); + this->ifs_[ADMIN_IF] = admin; + } + else if (ACE_BIT_ENABLED (components, PROXY)) + { + TAO_Proxy<TRADER_SELF>* proxy = new TAO_Proxy<TRADER_SELF> (*this); + this->trading_components ().proxy_if (proxy->_this (env)); + this->ifs_[PROXY_IF] = proxy; + } + else if (ACE_BIT_ENABLED (components, LINK)) + { + TAO_Link<TRADER_SELF, MAP_LOCK_TYPE>* link = + new TAO_Link<TRADER_SELF, MAP_LOCK_TYPE> (*this); + this->trading_components ().link_if (link->_this (env)); + this->ifs_[LINK_IF] = link; + } } template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::~TAO_Trader () { - CORBA::release (this->trading_components ().lookup_if ()); - CORBA::release (this->trading_components ().register_if ()); - CORBA::release (this->trading_components ().link_if ()); - CORBA::release (this->trading_components ().proxy_if ()); - CORBA::release (this->trading_components ().admin_if ()); - CORBA::release (this->support_attributes ().type_repos ()); + // Remove Trading Components from POA + // + // Note that there is no real error checking here as we can't do + // much about errors here anyway + // + + for (int i = LOOKUP_IF; i <= LINK_IF; i++) + { + if (this->ifs_[i] != 0) + { + TAO_TRY + { + PortableServer::POA_var poa = + this->ifs_[i]->_default_POA (TAO_TRY_ENV); + TAO_CHECK_ENV; + PortableServer::ObjectId_var id = + poa->servant_to_id (this->ifs_[i], TAO_TRY_ENV); + TAO_CHECK_ENV; + poa->deactivate_object (id.in (), TAO_TRY_ENV); + } + TAO_CATCHANY + { + } + TAO_ENDTRY; + + delete this->ifs_[i]; + } + } } template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> @@ -60,10 +105,10 @@ TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::service_type_map (void) return this->service_type_map_; } -template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> TAO_Lock & +template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> ACE_Lock & TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE>::lock (void) { return this->lock_; } - + #endif /* TAO_TRADER_C */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader.h b/TAO/orbsvcs/orbsvcs/Trader/Trader.h index 4a53110753d..f6347dd09c0 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader.h @@ -20,19 +20,10 @@ #define TAO_TRADER_H // ACE includes -#if defined (OS_NO_NAMESPACE) -#define map foobar -#endif /* OS_NO_NAMESPACE */ - -#include "CosTradingS.h" #include "Trader_Base.h" #include "Monitor.h" #include "Service_Type_Map.h" -#if defined (OS_NO_NAMESPACE) -#undef map -#endif /* OS_NO_NAMESPACE */ - template <class TRADER_LOCK_TYPE, class MAP_LOCK_TYPE> class TAO_Trader : public TAO_Trader_Base // @@ -44,13 +35,14 @@ class TAO_Trader : public TAO_Trader_Base // TAO_Trader contains all the components that together represent // a single trader. Based on its constructor arguments, // TAO_Trader creates instances of appropriate interface - // implementations as well as instances of objects common to more than one - // interface (offers, attributes, etc.). TAO_Trader also enforces - // the proper order on all initializations. TAO_Trader acts like - // a "glue" class that creates appropriate components, holds everything - // together, and enforces order. - // TAO_Trader is parametrized by two types of locks: one for its service - // service offers, one for its state (configuration). + // implementations as well as instances of objects common to + // more than one interface (offers, attributes, etc.). + // TAO_Trader also enforces the proper order on all + // initializations. TAO_Trader acts like a "glue" class that + // creates appropriate components, holds everything together, + // and enforces order. TAO_Trader is parameterized by two types + // of locks: one for its service service offers, one for its + // state (configuration). { public: @@ -67,6 +59,7 @@ public: typedef TAO_Service_Type_Map<MAP_LOCK_TYPE> SERVICE_TYPE_MAP; typedef SERVICE_TYPE_MAP::Local_Offer_Iterator LOCAL_OFFER_ITER; + typedef MAP_LOCK_TYPE LOCK_TYPE; TAO_Trader (Trader_Components components = LOOKUP); // Constructor which based on its arguments will create @@ -80,10 +73,12 @@ public: SERVICE_TYPE_MAP& service_type_map (void); // Accessor for the structure with all the service offers. - TAO_Lock &lock (void); + ACE_Lock &lock (void); // returns the trader protected: + + typedef TAO_Trader<TRADER_LOCK_TYPE, MAP_LOCK_TYPE> TRADER_SELF; SERVICE_TYPE_MAP service_type_map_; // A monitor (i.e. an STL map + a lock) serving as a storage for @@ -92,8 +87,12 @@ protected: // a counter + a map (a monitor) of offers for that service type. A map of offers for // a service type (an internal map) is a mapping from a number ids to offers. - TAO_Lock_Adapter<TRADER_LOCK_TYPE> lock_; + ACE_Lock_Adapter<TRADER_LOCK_TYPE> lock_; // lock that guards the state of the trader (its configuration). + + enum { LOOKUP_IF, REGISTER_IF, ADMIN_IF, PROXY_IF, LINK_IF }; + + PortableServer::ServantBase* ifs_[5]; }; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader_Base.h b/TAO/orbsvcs/orbsvcs/Trader/Trader_Base.h index c416ac281c3..6838ba03b1b 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader_Base.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader_Base.h @@ -19,11 +19,10 @@ #ifndef TAO_TRADER_BASE_H #define TAO_TRADER_BASE_H -#include "Attributes.h" - #include <string> #include <map> +#include "Attributes.h" class TAO_Export TAO_Trader_Base // @@ -65,7 +64,7 @@ public: // = Accessor for trader's lock. - virtual TAO_Lock &lock (void) = 0; + virtual ACE_Lock &lock (void) = 0; // return lock that guards trader's current configuration. static CORBA::Boolean is_valid_identifier_name (const char* ident); diff --git a/TAO/orbsvcs/orbsvcs/Trader/constraint.l b/TAO/orbsvcs/orbsvcs/Trader/constraint.l index 321fe33724e..76ab1b2cb6c 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/constraint.l +++ b/TAO/orbsvcs/orbsvcs/Trader/constraint.l @@ -17,13 +17,13 @@ #include "Constraint_Nodes.h" #include "Constraint_Tokens.h" -static ACE_Literal_Constraint* extract_string(const char*); +static TAO_Literal_Constraint* extract_string(const char*); -#define ACE_YY_LEX_DEBUG +#define TAO_YY_LEX_DEBUG -#ifdef ACE_CONSTRAINT_DEBUG -#define ACE_YY_LEX_DEBUG ACE_OS::fprintf(stderr, "%s\n", yytext) -#endif /* ACE_CONSTRAINT_DEBUG */ +#ifdef TAO_CONSTRAINT_DEBUG +#define TAO_YY_LEX_DEBUG TAO_OS::fprintf(stderr, "%s\n", yytext) +#endif /* TAO_CONSTRAINT_DEBUG */ %} @@ -41,70 +41,70 @@ unknown [^ \t] %% -min { ACE_YY_LEX_DEBUG; return MIN; } -max { ACE_YY_LEX_DEBUG; return MAX; } -first { ACE_YY_LEX_DEBUG; return FIRST; } -random { ACE_YY_LEX_DEBUG; return RANDOM; } -with { ACE_YY_LEX_DEBUG; return WITH; } -exist { ACE_YY_LEX_DEBUG; return EXIST; } -not { ACE_YY_LEX_DEBUG; return NOT; } -and { ACE_YY_LEX_DEBUG; return AND; } -or { ACE_YY_LEX_DEBUG; return OR; } -in { ACE_YY_LEX_DEBUG; return IN; } -"~" { ACE_YY_LEX_DEBUG; return TWIDDLE; } -"+" { ACE_YY_LEX_DEBUG; return PLUS; } -"-" { ACE_YY_LEX_DEBUG; return MINUS; } -"*" { ACE_YY_LEX_DEBUG; return MULT; } -"/" { ACE_YY_LEX_DEBUG; return DIV; } -"<" { ACE_YY_LEX_DEBUG; return LT; } -"<=" { ACE_YY_LEX_DEBUG; return LE; } -">" { ACE_YY_LEX_DEBUG; return GT; } -">=" { ACE_YY_LEX_DEBUG; return GE; } -"==" { ACE_YY_LEX_DEBUG; return EQ; } -"!=" { ACE_YY_LEX_DEBUG; return NE; } -"(" { ACE_YY_LEX_DEBUG; return LPAREN; } -")" { ACE_YY_LEX_DEBUG; return RPAREN; } +min { TAO_YY_LEX_DEBUG; return TAO_MIN; } +max { TAO_YY_LEX_DEBUG; return TAO_MAX; } +first { TAO_YY_LEX_DEBUG; return TAO_FIRST; } +random { TAO_YY_LEX_DEBUG; return TAO_RANDOM; } +with { TAO_YY_LEX_DEBUG; return TAO_WITH; } +exist { TAO_YY_LEX_DEBUG; return TAO_EXIST; } +not { TAO_YY_LEX_DEBUG; return TAO_NOT; } +and { TAO_YY_LEX_DEBUG; return TAO_AND; } +or { TAO_YY_LEX_DEBUG; return TAO_OR; } +in { TAO_YY_LEX_DEBUG; return TAO_IN; } +"~" { TAO_YY_LEX_DEBUG; return TAO_TWIDDLE; } +"+" { TAO_YY_LEX_DEBUG; return TAO_PLUS; } +"-" { TAO_YY_LEX_DEBUG; return TAO_MINUS; } +"*" { TAO_YY_LEX_DEBUG; return TAO_MULT; } +"/" { TAO_YY_LEX_DEBUG; return TAO_DIV; } +"<" { TAO_YY_LEX_DEBUG; return TAO_LT; } +"<=" { TAO_YY_LEX_DEBUG; return TAO_LE; } +">" { TAO_YY_LEX_DEBUG; return TAO_GT; } +">=" { TAO_YY_LEX_DEBUG; return TAO_GE; } +"==" { TAO_YY_LEX_DEBUG; return TAO_EQ; } +"!=" { TAO_YY_LEX_DEBUG; return TAO_NE; } +"(" { TAO_YY_LEX_DEBUG; return TAO_LPAREN; } +")" { TAO_YY_LEX_DEBUG; return TAO_RPAREN; } TRUE { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Boolean)TRUE_CON); - ACE_YY_LEX_DEBUG; return BOOLEAN; + new TAO_Literal_Constraint(CORBA::B_TRUE); + TAO_YY_LEX_DEBUG; return TAO_BOOLEAN; } FALSE { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Boolean)FALSE_CON); - ACE_YY_LEX_DEBUG; return BOOLEAN; + new TAO_Literal_Constraint(CORBA::B_FALSE); + TAO_YY_LEX_DEBUG; return TAO_BOOLEAN; } {integer} { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Long)atoi(yytext)); - ACE_YY_LEX_DEBUG; return NUMBER; + new TAO_Literal_Constraint((CORBA::Long)atoi(yytext)); + TAO_YY_LEX_DEBUG; return TAO_NUMBER; } {float} { yylval.constraint_ = - new ACE_Literal_Constraint((CORBA::Double)atof(yytext)); - ACE_YY_LEX_DEBUG; return NUMBER; + new TAO_Literal_Constraint((CORBA::Double)atof(yytext)); + TAO_YY_LEX_DEBUG; return TAO_NUMBER; } {string} { yylval.constraint_ = extract_string(yytext); - ACE_YY_LEX_DEBUG; return STRING; + TAO_YY_LEX_DEBUG; return TAO_STRING; } {ident} { yylval.constraint_ = - new ACE_Property_Constraint(yytext); - ACE_YY_LEX_DEBUG; return IDENT; + new TAO_Property_Constraint(yytext); + TAO_YY_LEX_DEBUG; return TAO_IDENT; } {unknown} { - ACE_YY_LEX_DEBUG; return UNKNOWN; + TAO_YY_LEX_DEBUG; return TAO_UNKNOWN; } %% -ACE_Literal_Constraint* +TAO_Literal_Constraint* extract_string(const char* total) { int prev_slash = 0, ctr = 0; char str[BUFSIZ], - *tmp = total + 1; + *tmp = (char*) total + 1; while (*tmp != '\0') { @@ -126,5 +126,5 @@ extract_string(const char* total) } str[ctr - 1] = '\0'; - return new ACE_Literal_Constraint(str); + return new TAO_Literal_Constraint(str); }
\ No newline at end of file diff --git a/TAO/orbsvcs/orbsvcs/Trader/constraint.y b/TAO/orbsvcs/orbsvcs/Trader/constraint.y index 7334cadf5f2..b6ead834a7e 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/constraint.y +++ b/TAO/orbsvcs/orbsvcs/Trader/constraint.y @@ -19,114 +19,114 @@ //#define YYDEBUG 1 %} -%token GT GE LT LE EQ NE EXIST AND OR NOT IN TWIDDLE BOOLEAN -%token PLUS MINUS MULT DIV UMINUS NUMBER -%token RPAREN LPAREN -%token IDENT STRING -%token UNSIGNED_INTEGER SIGNED_INTEGER DOUBLE CONSTRAINT SEQUENCE UNKNOWN -%token WITH MAX MIN FIRST RANDOM +%token TAO_GT TAO_GE TAO_LT TAO_LE TAO_EQ TAO_NE TAO_EXIST +%token TAO_AND TAO_OR TAO_NOT TAO_IN TAO_TWIDDLE TAO_BOOLEAN +%token TAO_PLUS TAO_MINUS TAO_MULT TAO_DIV TAO_UMINUS TAO_NUMBER +%token TAO_RPAREN TAO_LPAREN TAO_IDENT TAO_STRING TAO_UNKNOWN +%token TAO_UNSIGNED TAO_SIGNED TAO_DOUBLE TAO_CONSTRAINT TAO_SEQUENCE +%token TAO_WITH TAO_MAX TAO_MIN TAO_FIRST TAO_RANDOM %start constraint -%type <constraint_> IDENT NUMBER STRING BOOLEAN +%type <constraint_> TAO_IDENT TAO_NUMBER TAO_STRING TAO_BOOLEAN %type <constraint_> constraint preference bool_or bool_and bool_compare %type <constraint_> expr_in expr_twiddle expr term factor_not factor %% constraint: bool_or - { $$ = new ACE_Unary_Constraint(CONSTRAINT, $1); } + { $$ = new TAO_Unary_Constraint(TAO_CONSTRAINT, $1); } | preference { $$ = $1; } ; -preference: MIN bool_or -{ $$ = new ACE_Unary_Constraint(MIN, $2); } - | MAX bool_or -{ $$ = new ACE_Unary_Constraint(MAX, $2); } - | WITH bool_or -{ $$ = new ACE_Unary_Constraint(WITH, $2); } - | FIRST -{ $$ = new ACE_Noop_Constraint(FIRST); } - | RANDOM -{ $$ = new ACE_Noop_Constraint(RANDOM); } +preference: TAO_MIN bool_or +{ $$ = new TAO_Unary_Constraint(TAO_MIN, $2); } + | TAO_MAX bool_or +{ $$ = new TAO_Unary_Constraint(TAO_MAX, $2); } + | TAO_WITH bool_or +{ $$ = new TAO_Unary_Constraint(TAO_WITH, $2); } + | TAO_FIRST +{ $$ = new TAO_Noop_Constraint(TAO_FIRST); } + | TAO_RANDOM +{ $$ = new TAO_Noop_Constraint(TAO_RANDOM); } ; -bool_or: bool_or OR bool_and - { $$ = new ACE_Binary_Constraint(OR, $1, $3); } +bool_or: bool_or TAO_OR bool_and + { $$ = new TAO_Binary_Constraint(TAO_OR, $1, $3); } | bool_and { $$ = $1; } ; -bool_and: bool_and AND bool_compare - { $$ = new ACE_Binary_Constraint(AND, $1, $3); } +bool_and: bool_and TAO_AND bool_compare + { $$ = new TAO_Binary_Constraint(TAO_AND, $1, $3); } | bool_compare { $$ = $1; } ; -bool_compare: expr_in EQ expr_in - { $$ = new ACE_Binary_Constraint(EQ, $1, $3); } - | expr_in NE expr_in - { $$ = new ACE_Binary_Constraint(NE, $1, $3); } - | expr_in GT expr_in - { $$ = new ACE_Binary_Constraint(GT, $1, $3); } - | expr_in GE expr_in - { $$ = new ACE_Binary_Constraint(GE, $1, $3); } - | expr_in LT expr_in - { $$ = new ACE_Binary_Constraint(LT, $1, $3); } - | expr_in LE expr_in - { $$ = new ACE_Binary_Constraint(LE, $1, $3); } +bool_compare: expr_in TAO_EQ expr_in + { $$ = new TAO_Binary_Constraint(TAO_EQ, $1, $3); } + | expr_in TAO_NE expr_in + { $$ = new TAO_Binary_Constraint(TAO_NE, $1, $3); } + | expr_in TAO_GT expr_in + { $$ = new TAO_Binary_Constraint(TAO_GT, $1, $3); } + | expr_in TAO_GE expr_in + { $$ = new TAO_Binary_Constraint(TAO_GE, $1, $3); } + | expr_in TAO_LT expr_in + { $$ = new TAO_Binary_Constraint(TAO_LT, $1, $3); } + | expr_in TAO_LE expr_in + { $$ = new TAO_Binary_Constraint(TAO_LE, $1, $3); } | expr_in { $$ = $1; } ; -expr_in: expr_twiddle IN IDENT - { $$ = new ACE_Binary_Constraint(IN, $1, $3); } +expr_in: expr_twiddle TAO_IN TAO_IDENT + { $$ = new TAO_Binary_Constraint(TAO_IN, $1, $3); } | expr_twiddle { $$ = $1; } ; -expr_twiddle: expr TWIDDLE expr - { $$ = new ACE_Binary_Constraint(TWIDDLE, $1, $3); } +expr_twiddle: expr TAO_TWIDDLE expr + { $$ = new TAO_Binary_Constraint(TAO_TWIDDLE, $1, $3); } | expr { $$ = $1; } ; -expr: expr PLUS term - { $$ = new ACE_Binary_Constraint(PLUS, $1, $3); } - | expr MINUS term - { $$ = new ACE_Binary_Constraint(MINUS, $1, $3); } +expr: expr TAO_PLUS term + { $$ = new TAO_Binary_Constraint(TAO_PLUS, $1, $3); } + | expr TAO_MINUS term + { $$ = new TAO_Binary_Constraint(TAO_MINUS, $1, $3); } | term { $$ = $1; } ; -term: term MULT factor_not - { $$ = new ACE_Binary_Constraint(MULT, $1, $3); } - | term DIV factor_not - { $$ = new ACE_Binary_Constraint(DIV, $1, $3); } +term: term TAO_MULT factor_not + { $$ = new TAO_Binary_Constraint(TAO_MULT, $1, $3); } + | term TAO_DIV factor_not + { $$ = new TAO_Binary_Constraint(TAO_DIV, $1, $3); } | factor_not { $$ = $1; } ; -factor_not: NOT factor - { $$ = new ACE_Unary_Constraint(NOT, $2); } +factor_not: TAO_NOT factor + { $$ = new TAO_Unary_Constraint(TAO_NOT, $2); } | factor { $$ = $1; } ; -factor: LPAREN bool_or RPAREN +factor: TAO_LPAREN bool_or TAO_RPAREN { $$ = $2; } - | EXIST IDENT - { $$ = new ACE_Unary_Constraint(EXIST, $2); } - | IDENT + | TAO_EXIST TAO_IDENT + { $$ = new TAO_Unary_Constraint(TAO_EXIST, $2); } + | TAO_IDENT { $$ = $1; } - | NUMBER + | TAO_NUMBER { $$ = $1; } - | MINUS NUMBER - { $$ = new ACE_Unary_Constraint(UMINUS, $2); } - | STRING + | TAO_MINUS TAO_NUMBER + { $$ = new TAO_Unary_Constraint(TAO_UMINUS, $2); } + | TAO_STRING { $$ = $1; } - | BOOLEAN + | TAO_BOOLEAN { $$ = $1; } ; |