#include <Trader_Constraint_Visitors.h>
Inheritance diagram for TAO_Trader_Constraint_Evaluator:
Public Member Functions | |
TAO_Trader_Constraint_Evaluator (CosTrading::Offer *offer, CORBA::Boolean supports_dynamic_properties=1) | |
Constructor. | |
virtual int | visit_property (TAO_Property_Constraint *literal) |
Copy the value of the property into the result container. | |
Private Attributes | |
TAO_Property_Evaluator | prop_eval_ |
Definition at line 45 of file Trader_Constraint_Visitors.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Trader_Constraint_Evaluator::TAO_Trader_Constraint_Evaluator | ( | CosTrading::Offer * | offer, | |
CORBA::Boolean | supports_dynamic_properties = 1 | |||
) |
Constructor.
Definition at line 8 of file Trader_Constraint_Visitors.cpp.
References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::open(), CosTrading::Offer::properties, and TAO_Constraint_Evaluator::props_.
00010 : prop_eval_ (*offer, supports_dp) 00011 { 00012 this->props_.close (); 00013 this->props_.open (); 00014 int length = offer->properties.length (); 00015 00016 // Create a map of property names to their values. 00017 for (int i = 0; i < length; i++) 00018 { 00019 CORBA::String_var name = (const char*) offer->properties[i].name; 00020 this->props_.bind (name, i); 00021 } 00022 }
int TAO_Trader_Constraint_Evaluator::visit_property | ( | TAO_Property_Constraint * | literal | ) | [virtual] |
Copy the value of the property into the result container.
Reimplemented from TAO_Constraint_Evaluator.
Definition at line 26 of file Trader_Constraint_Visitors.cpp.
References TAO_Property_Constraint::name(), prop_eval_, TAO_Property_Evaluator::property_value(), and TAO_Constraint_Evaluator::queue_.
00027 { 00028 int return_value = -1, prop_index = 0; 00029 // Handle case where property is not, in fact, mapped to a value 00030 CORBA::String_var prop_name ((const char*) literal->name ()); 00031 00032 if (this->props_.find (prop_name, prop_index) == 0) 00033 { 00034 00035 CORBA::Any *value = 0; 00036 // Retrieve the value of the property from the Property_Evaluator 00037 try 00038 { 00039 value = this->prop_eval_.property_value (prop_index); 00040 } 00041 catch (const CORBA::Exception&) 00042 { 00043 return -1; 00044 } 00045 00046 if (value != 0) 00047 { 00048 this->queue_.enqueue_head (TAO_Literal_Constraint (value)); 00049 return_value = 0; 00050 } 00051 } 00052 00053 return return_value; 00054 }
Utility with which to evaluate the properties of an offer, be they dyanmic or static.
Definition at line 57 of file Trader_Constraint_Visitors.h.
Referenced by visit_property().