diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-20 15:39:52 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-20 15:39:52 +0000 |
commit | b2836d69a05ca9ac8e47d062a33acf22f3dead47 (patch) | |
tree | aa19039420913927cc0b5c9bf1c68e762869f473 | |
parent | b597c0ff93850f6d65d201d570b4e6ab4528544e (diff) | |
download | ATCD-b2836d69a05ca9ac8e47d062a33acf22f3dead47.tar.gz |
wrapped TAO_THROW_SPEC arguments with double parens
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.cpp | 176 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.h | 68 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Trader/Offer_Iterators_T.cpp | 56 |
3 files changed, 150 insertions, 150 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.cpp b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.cpp index 22d5e701334..9a39fcf6324 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.cpp @@ -2,16 +2,16 @@ // ======================================================================== // $Id$ -// -// = LIBRARY +// +// = LIBRARY // orbsvcs -// -// = FILENAME +// +// = FILENAME // Constraint_Interpreter.cpp -// +// // = AUTHOR // Seth Widoff <sbw1@cs.wustl.edu> -// +// // ======================================================================== #include "ace/OS.h" @@ -29,21 +29,21 @@ TAO_Interpreter::~TAO_Interpreter (void) int TAO_Interpreter::build_tree(const char* constraints) { - TAO_Lex_String_Input::reset((char*)constraints); + TAO_Lex_String_Input::reset((char*)constraints); int return_value = 0; yyval.constraint_ = 0; return_value = ::yyparse(); - + if (return_value == 0 && yyval.constraint_ != 0) this->root_ = yyval.constraint_; else { while (yylex() > 0) - ; + ; this->root_ = 0; } - + return return_value; } @@ -57,15 +57,15 @@ TAO_Interpreter::is_empty_string(const char* str) { int i = 0; while (str[i] != '\0') - { - if (str[i] != ' ') - break; + { + if (str[i] != ' ') + break; - i++; - } + i++; + } if (str[i] == '\0') - return_value = 1; + return_value = 1; } return return_value; @@ -79,7 +79,7 @@ TAO_Constraint_Interpreter:: TAO_Constraint_Interpreter (const CosTradingRepos::ServiceTypeRepository::TypeStruct& ts, const char* constraints, CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalConstraint) + TAO_THROW_SPEC ((CosTrading::IllegalConstraint)) : TAO_Interpreter () { TAO_Constraint_Validator type_checker (ts); @@ -89,29 +89,29 @@ TAO_Constraint_Interpreter (const CosTradingRepos::ServiceTypeRepository::TypeSt else { if (this->build_tree (constraints) != 0) - TAO_THROW (CosTrading::IllegalConstraint (constraints)); + TAO_THROW (CosTrading::IllegalConstraint (constraints)); if (type_checker.validate (this->root_) == -1) - TAO_THROW (CosTrading::IllegalConstraint (constraints)); + TAO_THROW (CosTrading::IllegalConstraint (constraints)); } } TAO_Constraint_Interpreter:: TAO_Constraint_Interpreter(TAO_Constraint_Validator& validator, - const char* constraints, - CORBA::Environment& _env) - TAO_THROW_SPEC (CosTrading::IllegalConstraint) + const char* constraints, + CORBA::Environment& _env) + TAO_THROW_SPEC ((CosTrading::IllegalConstraint)) { if (TAO_Interpreter::is_empty_string (constraints)) this->root_ = new TAO_Literal_Constraint ((CORBA::Boolean) 1); else { if (this->build_tree (constraints) != 0) - TAO_THROW (CosTrading::IllegalConstraint (constraints)); - + TAO_THROW (CosTrading::IllegalConstraint (constraints)); + if (validator.validate (this->root_) == -1) - TAO_THROW (CosTrading::IllegalConstraint (constraints)); - } + TAO_THROW (CosTrading::IllegalConstraint (constraints)); + } } TAO_Constraint_Interpreter::~TAO_Constraint_Interpreter (void) @@ -137,8 +137,8 @@ TAO_Constraint_Interpreter::evaluate(TAO_Constraint_Evaluator& evaluator) TAO_Preference_Interpreter:: TAO_Preference_Interpreter(const CosTradingRepos::ServiceTypeRepository::TypeStruct& ts, - const char* preference, - CORBA::Environment& _env) + const char* preference, + CORBA::Environment& _env) TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPreference)) : TAO_Interpreter () { @@ -149,17 +149,17 @@ TAO_Preference_Interpreter(const CosTradingRepos::ServiceTypeRepository::TypeStr else { if (this->build_tree (preference) != 0) - TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); + TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); if (type_checker.validate (this->root_) == -1) - TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); + TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); } } TAO_Preference_Interpreter:: TAO_Preference_Interpreter(TAO_Constraint_Validator& validator, - const char* preference, - CORBA::Environment& _env) + const char* preference, + CORBA::Environment& _env) TAO_THROW_SPEC ((CosTrading::Lookup::IllegalPreference)) : TAO_Interpreter () { @@ -168,10 +168,10 @@ TAO_Preference_Interpreter(TAO_Constraint_Validator& validator, else { if (this->build_tree (preference) != 0) - TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); - + TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); + if (validator.validate (this->root_) == -1) - TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); + TAO_THROW (CosTrading::Lookup::IllegalPreference (preference)); } } @@ -179,7 +179,7 @@ TAO_Preference_Interpreter::~TAO_Preference_Interpreter() { } -void +void TAO_Preference_Interpreter:: order_offer (CosTrading::Offer* offer, CosTrading::OfferId offer_id) @@ -188,7 +188,7 @@ order_offer (CosTrading::Offer* offer, this->order_offer (evaluator, offer, offer_id); } -void +void TAO_Preference_Interpreter:: order_offer (TAO_Constraint_Evaluator& evaluator, CosTrading::Offer* offer, @@ -197,62 +197,62 @@ order_offer (TAO_Constraint_Evaluator& evaluator, if (this->root_ != 0) { Preference_Info pref_info; - + pref_info.offer_ = offer; pref_info.offer_id_ = offer_id; pref_info.evaluated_ = CORBA::B_TRUE; if (evaluator.evaluate_preference (this->root_, pref_info.value_) == 0) - { - // If the evaluation succeeds, insert the node into the - // correct place in the queue. - TAO_Expression_Type expr_type = this->root_->expr_type (); + { + // If the evaluation succeeds, insert the node into the + // correct place in the queue. + TAO_Expression_Type expr_type = this->root_->expr_type (); - if (expr_type == TAO_FIRST || + if (expr_type == TAO_FIRST || (expr_type == TAO_WITH && ! ACE_static_cast (CORBA::Boolean, pref_info.value_))) - this->offers_.enqueue_tail (pref_info); - else - this->offers_.enqueue_head (pref_info); - - if (expr_type == TAO_MIN || expr_type == TAO_MAX) - { - Ordered_Offers::ITERATOR offer_iter (this->offers_); - - // Push the new item down the list until the min/max - // criterion is satisfied. Observe the evaluation - // failed / evaluation suceeded partion in the list. - offer_iter.advance (); - for (int i = 1; - ! offer_iter.done (); - offer_iter.advance (), i++) - { - Preference_Info* current_offer; - offer_iter.next (current_offer); - - // Maintain the sorted order in the first partition. - if (current_offer->evaluated_ == CORBA::B_TRUE && - ((expr_type == TAO_MIN && - pref_info.value_ > current_offer->value_) || - (expr_type == TAO_MAX && - pref_info.value_ < current_offer->value_))) - { + this->offers_.enqueue_tail (pref_info); + else + this->offers_.enqueue_head (pref_info); + + if (expr_type == TAO_MIN || expr_type == TAO_MAX) + { + Ordered_Offers::ITERATOR offer_iter (this->offers_); + + // Push the new item down the list until the min/max + // criterion is satisfied. Observe the evaluation + // failed / evaluation suceeded partion in the list. + offer_iter.advance (); + for (int i = 1; + ! offer_iter.done (); + offer_iter.advance (), i++) + { + Preference_Info* current_offer; + offer_iter.next (current_offer); + + // Maintain the sorted order in the first partition. + if (current_offer->evaluated_ == CORBA::B_TRUE && + ((expr_type == TAO_MIN && + pref_info.value_ > current_offer->value_) || + (expr_type == TAO_MAX && + pref_info.value_ < current_offer->value_))) + { // Swap the out of order pair - this->offers_.set (*current_offer, i - 1); - this->offers_.set (pref_info, i); - } - else - break; - } - } - } + this->offers_.set (*current_offer, i - 1); + this->offers_.set (pref_info, i); + } + else + break; + } + } + } else - { - // If the evaluation fails, just tack the sucker onto the - // end of the queue. - pref_info.evaluated_ = CORBA::B_FALSE; - this->offers_.enqueue_tail (pref_info); - } + { + // If the evaluation fails, just tack the sucker onto the + // end of the queue. + pref_info.evaluated_ = CORBA::B_FALSE; + this->offers_.enqueue_tail (pref_info); + } } } @@ -271,7 +271,7 @@ remove_offer (CosTrading::Offer*& offer, offer = pref_info.offer_; offer_id = pref_info.offer_id_; } - + return return_value; } @@ -284,7 +284,7 @@ remove_offer (CosTrading::Offer*& offer) } -int +int TAO_Preference_Interpreter::num_offers (void) { return this->offers_.size(); @@ -305,19 +305,19 @@ TAO_Lex_String_Input::copy_into(char* buf, int max_size) { int chars_left = TAO_Lex_String_Input::end_ - TAO_Lex_String_Input::current_; int n = (max_size > chars_left) ? chars_left : max_size; - + if (n > 0) { memcpy(buf, TAO_Lex_String_Input::current_, n); TAO_Lex_String_Input::current_ += n; } - + return n; } void TAO_Lex_String_Input::reset(char* input_string) -{ +{ TAO_Lex_String_Input::string_ = input_string; TAO_Lex_String_Input::current_ = input_string; TAO_Lex_String_Input::end_ = input_string + diff --git a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.h b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.h index d22d439dfeb..cea9236e2c9 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.h +++ b/TAO/orbsvcs/orbsvcs/Trader/Constraint_Interpreter.h @@ -3,15 +3,15 @@ // ======================================================================== // $Id$ // -// = LIBRARY +// = LIBRARY // orbsvcs -// -// = FILENAME +// +// = FILENAME // Constraint_Interpreter.h -// +// // = AUTHOR // Seth Widoff <sbw1@cs.wustl.edu> -// +// // ======================================================================== #ifndef TAO_CONSTRAINT_INTERPRETER_H @@ -27,21 +27,21 @@ class TAO_Interpreter // = TITLE // TAO_Interpreter is the superclass for all interpreters. Its -// build tree method invokes the yacc parser to parse a constraint -// or preference string. -{ +// build tree method invokes the yacc parser to parse a constraint +// or preference string. +{ protected: TAO_Interpreter (void) : root_ (0) {} ~TAO_Interpreter (void); - + int build_tree (const char* preferences); // Using the Yacc generated parser, construct an expression // tree representing <constraints> from the tokens returned by it. static int is_empty_string (const char* str); - + TAO_Constraint* root_; // The root of the expression tree, not equal to null if build_tree // successfully builds a tree from the constraints. @@ -57,7 +57,7 @@ class TAO_Constraint_Interpreter : public TAO_Interpreter // TAO_Constraint_Interpreter will, given a constraint string whose // syntax and semantics comply with the trader specification for the // constraint language, determine if a CosTrading::Offer meets the -// constraints. +// constraints. // // = DESCRIPTION // TAO_Constraint_Interpreter will first build an expression tree @@ -69,28 +69,28 @@ class TAO_Constraint_Interpreter : public TAO_Interpreter // whether the offer meets the constraints. { public: - + TAO_Constraint_Interpreter (const CosTradingRepos::ServiceTypeRepository::TypeStruct& ts, const char* constraints, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalConstraint); - + TAO_THROW_SPEC ((CosTrading::IllegalConstraint)); + TAO_Constraint_Interpreter (TAO_Constraint_Validator& validator, const char* constraints, CORBA::Environment& env) - TAO_THROW_SPEC (CosTrading::IllegalConstraint); + TAO_THROW_SPEC ((CosTrading::IllegalConstraint)); // This constructor builds an expression tree representing the // constraint specified in <constraints>, and throws an Illegal // Constraint exception if the constraint given has syntax errors or // semantic errors, such as mismatched types. - + ~TAO_Constraint_Interpreter (void); // Destructor CORBA::Boolean evaluate (CosTrading::Offer* offer); CORBA::Boolean evaluate (TAO_Constraint_Evaluator& evaluator); - + // Determine whether an offer fits the constraints with which the // tree was constructed. This method is thread safe (hopefully). }; @@ -127,14 +127,14 @@ public: // Parse the preference string, determining first if it's // valid. Throw an IllegalPreference exception if the preference - // doesn't conform to the BNF grammar for preferences. - + // doesn't conform to the BNF grammar for preferences. + ~TAO_Preference_Interpreter(void); // Destructor void order_offer (CosTrading::Offer* offer, CosTrading::OfferId offer_id = 0); - + void order_offer (TAO_Constraint_Evaluator& evaluator, CosTrading::Offer* offer, CosTrading::OfferId offer_id = 0); @@ -143,11 +143,11 @@ public: int remove_offer (CosTrading::Offer*& offer, CosTrading::OfferId& offer_id); - + int remove_offer (CosTrading::Offer*& offer); - // Remove the next offer. The offer returned will be the next in the + // Remove the next offer. The offer returned will be the next in the // ordering determined by the preference string. - + int num_offers (void); // Return the number of offers remaining in the ordering. @@ -156,24 +156,24 @@ private: TAO_Preference_Interpreter (const TAO_Preference_Interpreter&); TAO_Preference_Interpreter& operator= (const TAO_Preference_Interpreter&); // Disallow copying. - + struct Preference_Info { CORBA::Boolean evaluated_; // True if the preference evaluation didn't return an error for this offer. - + TAO_Literal_Constraint value_; // The value of the preference evaluation. CosTrading::OfferId offer_id_; // The offer id of this offer. - + CosTrading::Offer* offer_; // A pointer to the offer. }; - - typedef ACE_Unbounded_Queue<Preference_Info> Ordered_Offers; - + + typedef ACE_Unbounded_Queue<Preference_Info> Ordered_Offers; + Ordered_Offers offers_; // The ordered list of offers. }; @@ -192,7 +192,7 @@ extern int yylex(void); #define YY_INPUT(b, r, ms) (r = TAO_Lex_String_Input::copy_into(b, ms)) #undef yyerror -#define yyerror(x) +#define yyerror(x) class TAO_Lex_String_Input // = TITLE @@ -201,14 +201,14 @@ class TAO_Lex_String_Input // EOF, and call TAO_Lex_String_Input::reset() with the new string, // prior to calling yyparse. { -public: +public: static void reset(char* input_string); // Reset the lex input. - + static int copy_into(char* buf, int max_size); // Method lex will call to read from the input string. - + private: static char* string_; @@ -220,7 +220,7 @@ private: // The union used by lex and yacc to build the Abstract Syntax Tree. typedef union { - TAO_Constraint* constraint_; + TAO_Constraint* constraint_; } YYSTYPE; extern YYSTYPE yylval; diff --git a/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterators_T.cpp b/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterators_T.cpp index 680cc604768..4ed2327581e 100644 --- a/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterators_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Trader/Offer_Iterators_T.cpp @@ -2,10 +2,10 @@ // ============================================================================ // $Id$ -// +// // = LIBRARY // orbsvcs -// +// // = FILENAME // Offer_Iterators_T.cpp // @@ -23,7 +23,7 @@ template <class MAP_LOCK_TYPE> TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>:: TAO_Register_Offer_Iterator (TAO_Offer_Database<MAP_LOCK_TYPE> &db, - const TAO_Property_Filter& pfilter) + const TAO_Property_Filter& pfilter) : TAO_Offer_Iterator (pfilter), db_ (db) { @@ -45,59 +45,59 @@ TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>:: template <class MAP_LOCK_TYPE> void TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>:: add_offer (CosTrading::OfferId id, - const CosTrading::Offer* offer) + const CosTrading::Offer* offer) { this->offer_ids_.enqueue_tail (id); } -template <class MAP_LOCK_TYPE> CORBA::ULong +template <class MAP_LOCK_TYPE> CORBA::ULong TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>:: -max_left (CORBA::Environment& _env) - TAO_THROW_SPEC ((CORBA::SystemException, - CosTrading::UnknownMaxLeft)) +max_left (CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException, + CosTrading::UnknownMaxLeft)) { return this->offer_ids_.size (); } -template <class MAP_LOCK_TYPE> CORBA::Boolean +template <class MAP_LOCK_TYPE> CORBA::Boolean TAO_Register_Offer_Iterator<MAP_LOCK_TYPE>:: -next_n (CORBA::ULong n, +next_n (CORBA::ULong n, CosTrading::OfferSeq_out offers, - CORBA::Environment& _env) - TAO_THROW_SPEC (CORBA::SystemException) + CORBA::Environment& _env) + TAO_THROW_SPEC ((CORBA::SystemException)) { CORBA::ULong ret_offers = 0; - + CORBA::ULong max_possible_offers_in_sequence = (n < this->offer_ids_.size ()) ? n : this->offer_ids_.size (); ACE_NEW_RETURN (offers, CosTrading::OfferSeq, CORBA::B_FALSE); - offers->length (max_possible_offers_in_sequence); - + offers->length (max_possible_offers_in_sequence); + // While there are entries left and we haven't filled <offers> // with requested number. - while (! this->offer_ids_.is_empty () - && n > ret_offers) + while (! this->offer_ids_.is_empty () + && n > ret_offers) { - // If offer is found, put it into the sequence. + // If offer is found, put it into the sequence. // remove this id irrespective of whether the offer is found // or not. CosTrading::OfferId id; this->offer_ids_.dequeue_head (id); - + TAO_TRY - { - CosTrading::OfferId_var offerid_var (id); - CosTrading::Offer* offer = this->db_.lookup_offer (id, TAO_TRY_ENV); - TAO_CHECK_ENV; - - if (offer != 0) + { + CosTrading::OfferId_var offerid_var (id); + CosTrading::Offer* offer = this->db_.lookup_offer (id, TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (offer != 0) this->pfilter_.filter_offer (offer, offers[ret_offers++]); - } + } TAO_CATCHANY {} - TAO_ENDTRY; + TAO_ENDTRY; } - + // Reset the length to the correct value offers->length (ret_offers); |