TAO_Trader_Constraint_Evaluator Class Reference

#include <Trader_Constraint_Visitors.h>

Inheritance diagram for TAO_Trader_Constraint_Evaluator:

Inheritance graph
[legend]
Collaboration diagram for TAO_Trader_Constraint_Evaluator:

Collaboration graph
[legend]
List of all members.

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_

Constructor & Destructor Documentation

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 >::bind(), 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(), and CosTrading::Offer::properties.

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 }


Member Function Documentation

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 ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), TAO_Property_Constraint::name(), prop_eval_, and TAO_Property_Evaluator::property_value().

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       ACE_DECLARE_NEW_CORBA_ENV;
00035 
00036       CORBA::Any *value = 0;
00037       // Retrieve the value of the property from the Property_Evaluator
00038       ACE_TRY
00039         {
00040           value = this->prop_eval_.property_value (prop_index ACE_ENV_ARG_PARAMETER);
00041           ACE_TRY_CHECK;
00042         }
00043       ACE_CATCHANY
00044         {
00045           return -1;
00046         }
00047       ACE_ENDTRY;
00048       //      ACE_CHECK_RETURN (-1);
00049 
00050       if (value != 0)
00051         {
00052           this->queue_.enqueue_head (TAO_Literal_Constraint (value));
00053           return_value = 0;
00054         }
00055     }
00056 
00057   return return_value;
00058 }


Member Data Documentation

TAO_Property_Evaluator TAO_Trader_Constraint_Evaluator::prop_eval_ [private]
 

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().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:01:19 2006 for TAO_CosTrader by doxygen 1.3.6