diff options
author | sbw1 <sbw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-10 03:46:48 +0000 |
---|---|---|
committer | sbw1 <sbw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-04-10 03:46:48 +0000 |
commit | d3aecb310eeec36ec592d48741839c488ef2613e (patch) | |
tree | 41c20d229b04269bc355c11b1e056a66472d7645 /TAO | |
parent | 1886273be99fd7cbd75d5bef5cb2d162d5454d5e (diff) | |
download | ATCD-d3aecb310eeec36ec592d48741839c488ef2613e.tar.gz |
Fixed a bunch of things. Damned if I remember what.
The list_types method on Service_Type_Repository was broker. I fixed that.
I optimized the subtype_lookup method on Lookup.
limits_applied now returns the correct results.
moved the IncarnationNumber comparison operators up to Trader.{h,cpp}
That's it I think.
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp | 75 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Lookup.h | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp | 63 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h | 23 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Policies.cpp | 33 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Policies.h | 18 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp | 67 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h | 10 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Trader.cpp | 20 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Trader.h | 10 |
14 files changed, 196 insertions, 140 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp index d3b790adcd3..d2befe8dc47 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.cpp @@ -709,7 +709,7 @@ operator== (CORBA::Double left, const TAO_Literal_Constraint& right) } int -operator== (const TAO_Sequences::StringSeq::Manager& left, +operator== (const TAO_String_Manager& left, const TAO_Literal_Constraint& right) { int result = 0; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h index e5ea4c0be48..e5b922084af 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Nodes.h @@ -254,7 +254,7 @@ class TAO_Literal_Constraint : public TAO_Constraint const TAO_Literal_Constraint& right); friend int - operator== (const TAO_Sequences::StringSeq::Manager& left, + operator== (const TAO_String_Manager& left, const TAO_Literal_Constraint& right); // = Arithmetic operators. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp index 7ed1065ff52..70897a7157b 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Validator.cpp @@ -398,9 +398,7 @@ int TAO_Constraint_Validator:: visit_property(TAO_Property_Constraint* literal) { - // Ensure that the property actually exists in the service type. - string prop_map(literal->name()); - return (this->type_map_.find(prop_map) != this->type_map_.end()) ? 0 : -1; + return 0; } CORBA::TypeCode* diff --git a/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp b/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp index 1728fa41f1c..80dd4e0362f 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Lookup.cpp @@ -128,6 +128,7 @@ query (const char *type, rep, policies, ordered_offers, + returned_limits_applied, env); TAO_CHECK_ENV_RETURN (env,); @@ -141,9 +142,6 @@ query (const char *type, returned_offer_iterator, env); TAO_CHECK_ENV_RETURN (env,); - - // Return the limits applied during the course of the lookup. - returned_limits_applied = policies.limits_applied (); // Determine if we should perform a federated query, and if so // construct a sequence of links to follow. @@ -183,6 +181,7 @@ perform_lookup (const char* type, CosTradingRepos::ServiceTypeRepository_ptr rep, TAO_Policies& policies, LOOKUP_OFFER_LIST& ordered_offers, + PolicyNameSeq_out returned_limits_applied, CORBA::Environment& env) TAO_THROW_SPEC ((CosTrading::IllegalConstraint, CosTrading::Lookup::IllegalPreference, @@ -229,6 +228,7 @@ perform_lookup (const char* type, { TAO_CHECK_ENV_RETURN (env,); this->lookup_all_subtypes (type, + type_struct->incarnation, service_type_map, rep, constr_inter, @@ -252,6 +252,9 @@ perform_lookup (const char* type, else break; } + + // Take note of the limits applied in this query. + returned_limits_applied = offer_filter.limits_applied (); } template <class TRADER> void @@ -301,6 +304,7 @@ lookup_one_type (const char* type, template <class TRADER> void TAO_Lookup<TRADER>:: lookup_all_subtypes (const char* type, + SERVICE_TYPE_REPOS::IncarnationNumber& inc_num, SERVICE_TYPE_MAP& service_type_map, CosTradingRepos::ServiceTypeRepository_ptr rep, TAO_Constraint_Interpreter& constr_inter, @@ -328,12 +332,33 @@ lookup_all_subtypes (const char* type, // been located and their offers considered, or we've exhausted the // cardinality constraints. - TYPE_LIST sub_types, unconsidered_types; + typedef deque<char*> TYPE_LIST; + typedef deque<pair <SERVICE_TYPE_REPOS::IncarnationNumber, char*> > + TYPE_NUM_LIST; + + TYPE_NAME_SEQ all_types; + TYPE_NUM_LIST sub_types; + TYPE_LIST unconsidered_types; + CosTradingRepos::ServiceTypeRepository::SpecifiedServiceTypes sst; - TYPE_NAME_SEQ all_types (service_type_map.list_all_types ()); + + // Optimization: Since a subtype can't have a higher incarnation + // number than a supertype, we don't need to consider those + // types with lower incarnation numbers. + sst._d (SERVICE_TYPE_REPOS::since); + sst.incarnation (inc_num); + + // TAO_TRY + // { + CORBA::Environment env; + all_types = rep->list_types (sst, env); + // TAO_CHECK_ENV; + // } + // TAO_CATCHANY { return; } + // TAO_ENDTRY; // All types save the supertype are initially unconsidered. - sub_types.push_back ((char *) type); + sub_types.push_back (make_pair (inc_num, (char *) type)); for (int i = all_types->length () - 1; i >= 0; i--) { if (ACE_OS::strcmp (type, all_types[i]) != 0) @@ -346,8 +371,10 @@ lookup_all_subtypes (const char* type, while (! sub_types.empty () && offer_filter.ok_to_consider_more ()) { // For each potential supertype, iterate over the remaining types. - const char* super_type = sub_types.front (); + const char* super_type = sub_types.front ().second; + SERVICE_TYPE_REPOS::IncarnationNumber in = sub_types.front ().first; sub_types.pop_front (); + for (int j = unconsidered_types.size () - 1; j >= 0 && offer_filter.ok_to_consider_more (); j--) @@ -369,20 +396,27 @@ lookup_all_subtypes (const char* type, } TAO_ENDTRY; - // Determine if the prospective type is a subtype of the current - // one -- that is, has the current one as its supertype. - for (int k = type_struct->super_types.length () - 1; - k >= 0 && - ACE_OS::strcmp ((const char *) type_struct->super_types[k], - super_type); - k--) - ; + // If this incarnation number is less than the supertype's, + // this can't be a subtype. + if (type_struct->incarnation > in) + { + // Determine if the prospective type is a subtype of the current + // one -- that is, has the current one as its supertype. + for (int k = type_struct->super_types.length () - 1; + k >= 0; k--) + { + is_sub_type = (ACE_OS::strcmp + ((const char *) type_struct->super_types[k], + super_type) == 0); + + if (is_sub_type) + break; + } + } // If this type isn't a subtype, return it to the queue for // later consideration. - if (k < 0) - unconsidered_types.push_back ((char *) type_name); - else + if (is_sub_type) { // Otherwise, perform a constraint match on the type, and // add it to the queue of potential supertypes. @@ -391,8 +425,10 @@ lookup_all_subtypes (const char* type, constr_inter, pref_inter, offer_filter); - sub_types.push_back ((char *) type_name); + sub_types.push_back (make_pair (in, (char *) type_name)); } + else + unconsidered_types.push_back ((char *) type_name); } } } @@ -749,7 +785,6 @@ TAO_Lookup<TRADER> TAO_ENDTRY; } - int operator< (const CosTrading::Admin::OctetSeq_var& l, const CosTrading::Admin::OctetSeq_var& r) diff --git a/TAO/orbsvcs/orbsvcs/Trader/Lookup.h b/TAO/orbsvcs/orbsvcs/Trader/Lookup.h index 8c476892be8..c304bc9195a 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Lookup.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Lookup.h @@ -157,8 +157,7 @@ private: typedef TRADER::SERVICE_TYPE_MAP SERVICE_TYPE_MAP; typedef pair<CosTrading::OfferId, CosTrading::Offer*> OFFER; typedef deque<OFFER> LOOKUP_OFFER_LIST; - typedef deque<char*> TYPE_LIST; - + TAO_Offer_Iterator* create_offer_iterator (const char *type, const TAO_Property_Filter& filter); @@ -172,6 +171,7 @@ private: CosTradingRepos::ServiceTypeRepository_ptr rep, TAO_Policies& policies, LOOKUP_OFFER_LIST& ordered_offers, + PolicyNameSeq_out returned_limits_applied, CORBA::Environment& env) TAO_THROW_SPEC ((CosTrading::IllegalConstraint, CosTrading::Lookup::IllegalPreference, @@ -189,6 +189,7 @@ private: // submitted to each phase. void lookup_all_subtypes (const char* type, + SERVICE_TYPE_REPOS::IncarnationNumber& inc_num, SERVICE_TYPE_MAP& service_type_map, CosTradingRepos::ServiceTypeRepository_ptr rep, TAO_Constraint_Interpreter& constr_inter, diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp index fe3f79fda25..8ab65eac401 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.cpp @@ -8,6 +8,7 @@ TAO_Offer_Filter (SERVICE_TYPE_REPOS::TypeStruct* type_struct, CORBA::Environment& _env) : search_card_ (policies.search_card (_env)), match_card_ (policies.match_card (_env)), + return_card_ (policies.return_card (_env)), dp_ (policies.use_dynamic_properties (_env)), mod_ (policies.use_modifiable_properties (_env)) { @@ -21,12 +22,21 @@ TAO_Offer_Filter (SERVICE_TYPE_REPOS::TypeStruct* type_struct, mode != SERVICE_TYPE_REPOS::PROP_READONLY) this->mod_props_.insert (string (prop_seq[i].name)); } + + if (policies.exact_type_match (_env) == CORBA::B_TRUE) + this->limits_.insert + (string (TAO_Policies::POLICY_NAMES[TAO_Policies::EXACT_TYPE_MATCH])); + } CORBA::Boolean TAO_Offer_Filter::ok_to_consider (CosTrading::Offer* offer) { - CORBA::Boolean return_value = 1; + const char* use_mods = + TAO_Policies::POLICY_NAMES[TAO_Policies::USE_MODIFIABLE_PROPERTIES]; + const char* use_dyns = + TAO_Policies::POLICY_NAMES[TAO_Policies::USE_DYNAMIC_PROPERTIES]; + CORBA::Boolean return_value = CORBA::B_TRUE; TAO_Property_Evaluator prop_eval (*offer); // If we should screen offers, determine if this offer is unworthy @@ -46,14 +56,20 @@ TAO_Offer_Filter::ok_to_consider (CosTrading::Offer* offer) string prop_name (offer->properties[i].name); if (this->mod_props_.find (prop_name) != this->mod_props_.end ()) - return_value = 0; + { + this->limits_.insert (string (use_mods)); + return_value = 0; + } } if (! this->dp_ && return_value) { // Determine if this property is dynamic. if (prop_eval.is_dynamic_property (i)) - return_value = 0; + { + this->limits_.insert (string (use_dyns)); + return_value = 0; + } } if (return_value == 0) @@ -64,7 +80,15 @@ TAO_Offer_Filter::ok_to_consider (CosTrading::Offer* offer) // If we're good to go, consider this offer considered and decrement // the search cardinality counter. if (return_value) - this->search_card_--; + { + this->search_card_--; + if (this->search_card_ == 0) + { + string search_card = + TAO_Policies::POLICY_NAMES[TAO_Policies::SEARCH_CARD]; + this->limits_.insert (search_card); + } + } return return_value; } @@ -79,4 +103,35 @@ void TAO_Offer_Filter::matched_offer (void) { this->match_card_--; + this->return_card_--; + + if (this->match_card_ == 0) + { + string match_card = + TAO_Policies::POLICY_NAMES[TAO_Policies::MATCH_CARD]; + this->limits_.insert (match_card); + } + + if (this->return_card_ == 0) + { + string return_card = + TAO_Policies::POLICY_NAMES[TAO_Policies::MATCH_CARD]; + this->limits_.insert (return_card); + } +} + +CosTrading::PolicyNameSeq* +TAO_Offer_Filter::limits_applied (void) +{ + int i = 0; + CORBA::ULong size = this->limits_.size (); + CosTrading::PolicyName* temp = + CosTrading::PolicyNameSeq::allocbuf (size); + + for (NAMES::iterator p_iter = this->limits_.begin(); + p_iter != this->limits_.end (); + p_iter++) + temp[i++] = CORBA::string_dup ((*p_iter).data ()); + + return new CosTrading::PolicyNameSeq (i, i, temp, 1); } diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h index ceed69eeb5c..30ec30a994c 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Filter.h @@ -67,15 +67,30 @@ public: void matched_offer (void); // Signal that the Lookup method has matched an offer; decrement the // match_card. + + // = Return the limits applied. + CosTrading::PolicyNameSeq* limits_applied (void); + // BEGIN SPEC + // If any cardinality or other limits were applied by one or more + // traders in responding to a particular query, then the + // "limits_applied" parameter will contain the names of the policies + // which limited the query. The sequence of names returned in + // "limits_applied" from any federated or proxy queries must be + // concatenated onto the names of limits applied locally and + // returned. + // END SPEC private: - typedef set<string, less<string> > PROP_NAMES; - - PROP_NAMES mod_props_; + typedef set<string, less<string> > NAMES; + + NAMES mod_props_; // The set of the name of modifiable properties. + + NAMES limits_; + // Cardinality and property limitations applied. - CORBA::ULong search_card_, match_card_; + CORBA::ULong search_card_, match_card_, return_card_; // Keep track of the cardinalities. CORBA::Boolean dp_; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp b/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp index 3e229f96d3e..f2bfba6bd13 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Policies.cpp @@ -132,8 +132,6 @@ TAO_Policies::ulong_prop (POLICY_TYPE pol, if (max_value < return_value) return_value = max_value; - else - this->limits_.insert (string(POLICY_NAMES[pol])); } return return_value; @@ -200,8 +198,6 @@ TAO_Policies::boolean_prop (POLICY_TYPE pol, if (def_value == CORBA::B_FALSE) return_value = CORBA::B_FALSE; - else - this->limits_.insert (string (POLICY_NAMES[pol])); } else return_value = def_value; @@ -259,7 +255,6 @@ TAO_Policies::starting_trader (CORBA::Environment& _env) { ACE_NEW_RETURN (trader_name, CosTrading::TraderName, 0); // value >>= *trader_name; - this->limits_.insert (string (POLICY_NAMES[STARTING_TRADER])); } } @@ -291,16 +286,12 @@ TAO_Policies::link_follow_rule (CORBA::Environment& _env) ; if (return_value > max_follow_policy) - { - this->limits_.insert (string (POLICY_NAMES[LINK_FOLLOW_RULE])); - return_value = max_follow_policy; - } + return_value = max_follow_policy; } return return_value; } - CosTrading::FollowOption TAO_Policies::link_follow_rule (const char* link_name, CORBA::Environment& _env) @@ -335,8 +326,9 @@ TAO_Policies::link_follow_rule (const char* link_name, TAO_THROW_RETURN (CosTrading::Lookup::PolicyTypeMismatch (*policy), return_value); else - // value >>= query_link_follow_rule; - ; + { + // value >>= query_link_follow_rule; + } return_value = (query_link_follow_rule < trader_max_follow_policy) ? query_link_follow_rule : trader_max_follow_policy; @@ -383,28 +375,11 @@ TAO_Policies::request_id (CORBA::Environment& _env) ACE_NEW_RETURN (request_id, CosTrading::Admin::OctetSeq, 0); // value >>= *request_id; } - ; } return request_id; } -CosTrading::PolicyNameSeq* -TAO_Policies::limits_applied (void) -{ - int i = 0; - CORBA::ULong size = this->limits_.size (); - CosTrading::PolicyName* temp = - CosTrading::PolicyNameSeq::allocbuf (size); - - for (POL_SET::iterator p_iter = this->limits_.begin(); - p_iter != this->limits_.end (); - p_iter++) - temp[i++] = CORBA::string_dup ((*p_iter).data ()); - - return new CosTrading::PolicyNameSeq (i, i, temp, 1); -} - CosTrading::PolicySeq* TAO_Policies::policies_to_forward (void) { diff --git a/TAO/orbsvcs/orbsvcs/Trader/Policies.h b/TAO/orbsvcs/orbsvcs/Trader/Policies.h index a1708977eb5..82e1964d834 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Policies.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Policies.h @@ -237,18 +237,6 @@ public: // Return the request_id passed to the query method across a link to // another trader. - // = Return the limits applied. - CosTrading::PolicyNameSeq* limits_applied (void); - // BEGIN SPEC - // If any cardinality or other limits were applied by one or more - // traders in responding to a particular query, then the - // "limits_applied" parameter will contain the names of the policies - // which limited the query. The sequence of names returned in - // "limits_applied" from any federated or proxy queries must be - // concatenated onto the names of limits applied locally and - // returned. - // END SPEC - CosTrading::PolicySeq* policies_to_forward (void); // Policies to forward to the next trader in a directed federated query. @@ -263,7 +251,6 @@ public: private: typedef vector <CosTrading::Policy*> POL_VECTOR; - typedef set <string, less<string> > POL_SET; CORBA::ULong ulong_prop (POLICY_TYPE pol, CORBA::Environment& _env) @@ -274,10 +261,7 @@ private: CORBA::Environment& _env) TAO_THROW_SPEC ((CosTrading::Lookup::PolicyTypeMismatch)); // Reconcile a Boolean property with its debault. - - POL_SET limits_; - // The policies employed to date. - + POL_VECTOR policies_; // The policies indexable from the enumerated type. diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp index 69c8410bb92..ff54bdf0329 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Map.cpp @@ -200,13 +200,15 @@ lookup_offer (const char* type, HUGE_NUMBER id) CosTrading::Offer* return_value = 0; SERVICE_TYPE_MAP::iterator type_iter = this->type_map_.find (string (type)); - + if (type_iter != this->type_map_.end ()) { OFFER_MAP::iterator offer_iter; OFFER_MAP_PLUS_COUNTER& mc = (*type_iter).second; OFFER_MAP &offer_map = mc.first; + ACE_READ_GUARD_RETURN (LOCK_TYPE, ace_mon, offer_map.lock (), 0); + offer_iter = offer_map.find (id); if (offer_iter != offer_map.end ()) return_value = &((*offer_iter).second); diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp index 9635a6efe7a..39e4b8ad822 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.cpp @@ -190,42 +190,34 @@ list_types (const SERVICE_TYPE_REPOS::SpecifiedServiceTypes& which_types, ace_mon, *this->lock_, (SERVICE_TYPE_REPOS::ServiceTypeNameSeq*) 0); - - SERVICE_TYPE_REPOS::ServiceTypeNameSeq_ptr result = - new SERVICE_TYPE_REPOS::ServiceTypeNameSeq (); - + CORBA::ULong i = 0; + SERVICE_TYPE_REPOS::IncarnationNumber num; + CORBA::ULong length = this->type_map_.size (); + CosTrading::ServiceTypeName* types = + SERVICE_TYPE_REPOS::ServiceTypeNameSeq::allocbuf (length); + + if (types == 0) + return 0; if (which_types._d () == SERVICE_TYPE_REPOS::all) { - result->length (this->type_map_.size ()); - for (SERVICE_TYPE_MAP::iterator itr = this->type_map_.begin (); - itr != this->type_map_.end (); - itr++, i++) - (*result)[i] = CORBA::string_dup ((*itr).first.c_str ()); + num.high = 0; + num.low = 0; } else - { - SERVICE_TYPE_REPOS::IncarnationNumber num = - which_types.incarnation (); + num = which_types.incarnation (); - if (num > incarnation_) - result->length (0); - else - result->length (this->type_map_.size ()); - - for (SERVICE_TYPE_MAP::iterator itr = this->type_map_.begin (); - itr != this->type_map_.end (); - itr++, i++) - { - if (num < (*itr).second.type_info_.incarnation) - (*result)[i] = CORBA::string_dup ((*itr).first.c_str ()); - } - - result->length (i); + for (SERVICE_TYPE_MAP::iterator itr = this->type_map_.begin (); + itr != this->type_map_.end (); + itr++) + { + if (num < (*itr).second.type_info_.incarnation) + types[i++] = CORBA::string_dup ((*itr).first.c_str ()); } - return result; + return new SERVICE_TYPE_REPOS:: + ServiceTypeNameSeq (length, i, types, CORBA::B_TRUE); } @@ -505,24 +497,3 @@ update_type_map (const char* name, this->type_map_[name] = type; } - -int -operator< (const SERVICE_TYPE_REPOS::IncarnationNumber &l, - const SERVICE_TYPE_REPOS::IncarnationNumber &r) -{ - if (l.high < r.high) - return 1; - else if (l.high == r.high) - return (l.low < r.low); - else - return 0; -} - - -int -operator> (const SERVICE_TYPE_REPOS::IncarnationNumber &l, - const SERVICE_TYPE_REPOS::IncarnationNumber &r) -{ - return (r < l); -} - diff --git a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h index 6c184a32edd..01ca39249ed 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Service_Type_Repository.h @@ -22,8 +22,6 @@ #include "Trader.h" #include "Monitor.h" -typedef CosTradingRepos::ServiceTypeRepository SERVICE_TYPE_REPOS; - class TAO_Service_Type_Repository : public POA_CosTradingRepos::ServiceTypeRepository // @@ -290,14 +288,6 @@ private: // This are temporary functions, until the format of the incarnation number // will be changed in the spec. -int -operator> (const SERVICE_TYPE_REPOS::IncarnationNumber &l, - const SERVICE_TYPE_REPOS::IncarnationNumber &r); - -int -operator< (const SERVICE_TYPE_REPOS::IncarnationNumber &l, - const SERVICE_TYPE_REPOS::IncarnationNumber &r); - #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) #include "Service_Type_Repository.cpp" #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp b/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp index 6aa1af293fd..9f18a49ca6b 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader.cpp @@ -102,6 +102,26 @@ TAO_Trader_Base::is_valid_identifier_name (const char* ident) return return_value; } +int +operator< (const SERVICE_TYPE_REPOS::IncarnationNumber &l, + const SERVICE_TYPE_REPOS::IncarnationNumber &r) +{ + if (l.high < r.high) + return 1; + else if (l.high == r.high) + return (l.low < r.low); + else + return 0; +} + + +int +operator> (const SERVICE_TYPE_REPOS::IncarnationNumber &l, + const SERVICE_TYPE_REPOS::IncarnationNumber &r) +{ + return (r < l); +} + #include "Trader_T.h" TAO_Trader_Factory::TAO_TRADER* diff --git a/TAO/orbsvcs/orbsvcs/Trader/Trader.h b/TAO/orbsvcs/orbsvcs/Trader/Trader.h index affb209596c..e8015c17e20 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Trader.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Trader.h @@ -24,6 +24,8 @@ #include "Attributes.h" +typedef CosTradingRepos::ServiceTypeRepository SERVICE_TYPE_REPOS; + // Forward Declaration. class TAO_Trader_Base; @@ -106,5 +108,13 @@ protected: // Stores and allows access/modification of trader's link attributes. }; +int +operator> (const SERVICE_TYPE_REPOS::IncarnationNumber &l, + const SERVICE_TYPE_REPOS::IncarnationNumber &r); + +int +operator< (const SERVICE_TYPE_REPOS::IncarnationNumber &l, + const SERVICE_TYPE_REPOS::IncarnationNumber &r); + #endif /* TAO_TRADER_BASE_H */ |