TAO_CosTrader
2.1.0
|
This class abstracts away the details of obtaining property values and property types. Since the procedure for obtaining the value or type of a dynamic property is disparate from the method for a static property, TAO_Property_Evaluator provides methods that will unify the two approaches under a single interface. Since dynamic properties aren't necessarily supported by a trader, this class accounts for that contingency. The use of indexed lookups allows them to occur in constant time on the CORBA sequences, but requires that the client know the layout of properties ahead of time. More...
#include <Trader_Utils.h>
Public Member Functions | |
TAO_Property_Evaluator (const CosTrading::PropertySeq &properties, CORBA::Boolean supports_dp=1) | |
TAO_Property_Evaluator (CosTrading::Offer &offer, CORBA::Boolean supports_dp=1) | |
virtual | ~TAO_Property_Evaluator (void) |
Clean up dynamic properties. | |
int | is_dynamic_property (int index) |
CORBA::Any * | property_value (int index) |
CORBA::TypeCode_ptr | property_type (int index) |
Protected Types | |
typedef CosTradingDynamic::DynamicProp | DP_Struct |
typedef CosTradingDynamic::DynamicPropEval | DP_Eval |
Protected Attributes | |
const CosTrading::PropertySeq & | props_ |
int | supports_dp_ |
CORBA::Any ** | dp_cache_ |
Private Member Functions | |
TAO_Property_Evaluator (const TAO_Property_Evaluator &) | |
TAO_Property_Evaluator & | operator= (const TAO_Property_Evaluator &) |
This class abstracts away the details of obtaining property values and property types. Since the procedure for obtaining the value or type of a dynamic property is disparate from the method for a static property, TAO_Property_Evaluator provides methods that will unify the two approaches under a single interface. Since dynamic properties aren't necessarily supported by a trader, this class accounts for that contingency. The use of indexed lookups allows them to occur in constant time on the CORBA sequences, but requires that the client know the layout of properties ahead of time.
typedef CosTradingDynamic::DynamicPropEval TAO_Property_Evaluator::DP_Eval [protected] |
typedef CosTradingDynamic::DynamicProp TAO_Property_Evaluator::DP_Struct [protected] |
TAO_Property_Evaluator::TAO_Property_Evaluator | ( | const CosTrading::PropertySeq & | properties, |
CORBA::Boolean | supports_dp = 1 |
||
) |
TAO_Property_Evaluator::TAO_Property_Evaluator | ( | CosTrading::Offer & | offer, |
CORBA::Boolean | supports_dp = 1 |
||
) |
Construct an instance of TAO_Property_Evaluator that operates on an <offer> where the support for dynamic properties is dictated by <supports_dynamic_properties>.
TAO_Property_Evaluator::~TAO_Property_Evaluator | ( | void | ) | [virtual] |
Clean up dynamic properties.
TAO_Property_Evaluator::TAO_Property_Evaluator | ( | const TAO_Property_Evaluator & | ) | [private] |
int TAO_Property_Evaluator::is_dynamic_property | ( | int | index | ) |
Returns 1 if the property at index <index> is dynamic. Returns a 0 when the index is out of bounds.
TAO_Property_Evaluator& TAO_Property_Evaluator::operator= | ( | const TAO_Property_Evaluator & | ) | [private] |
CORBA::TypeCode_ptr TAO_Property_Evaluator::property_type | ( | int | index | ) |
Returns the type of the property whose index is <index>. If the property is dynamic and the trader supports dynamic properties, then the method returns the <returned_type> field of the CosTradingDynamic::DynamicProp struct associated with the property name. If the index is out of bounds, the method returns a null pointer (that is, 0).
CORBA::Any * TAO_Property_Evaluator::property_value | ( | int | index | ) |
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 of the dynamic property using the evalDP method on the CosTradingDynamic::DynamicPropEval interface, passing on a CosTradingDynamic::DPEvalFailure exception on failure. If the property index is undefined, the method returns a null pointer.
CORBA::Any** TAO_Property_Evaluator::dp_cache_ [protected] |
In order for the client to treat the results of property_value uniformly, we need to collect the dynamically allocated anys retrieved from dynamic properties and free them upon deletion. If we didn't do this, then the property_value method would leak or cause seg faults, since the client wouldn't be able to tell whether or not the return value should be freed.
const CosTrading::PropertySeq& TAO_Property_Evaluator::props_ [protected] |
The offer from which the TAO_Property_Evaluator extracts property information.
int TAO_Property_Evaluator::supports_dp_ [protected] |