Classes | |
class | Properties_Encoder |
struct | Properties_Encoder::NamedValue |
Functions | |
TAO_PortableGroup_Export CORBA::Boolean | get_property_value (const PortableGroup::Name &property_name, const PortableGroup::Properties &properties, PortableGroup::Value &property_value) |
TAO_PortableGroup_Export void | override_properties (const PortableGroup::Properties &overrides, PortableGroup::Properties &properties) |
|
Definition at line 11 of file PG_Property_Utils.cpp. References PortableGroup::Property::nam, PortableGroup::Properties, PortableGroup::Property::val, and PortableGroup::Value. Referenced by TAO_PG_GenericFactory::check_minimum_number_members(), and TAO_PG_GenericFactory::process_criteria().
00014 { 00015 const CORBA::ULong len = properties.length (); 00016 for (CORBA::ULong i = 0; i < len; ++i) 00017 { 00018 const PortableGroup::Property & property = properties[i]; 00019 if (property.nam == property_name) 00020 { 00021 property_value = property.val; 00022 return 1; 00023 } 00024 } 00025 00026 return 0; 00027 } |
|
If no property is overridden, the override in question will be appended to the "properties" list. Definition at line 30 of file PG_Property_Utils.cpp. References PortableGroup::Property::nam, PortableGroup::Properties, and PortableGroup::Property::val. Referenced by TAO_PG_PropertyManager::get_properties(), and TAO_PG_GenericFactory::process_criteria().
00033 { 00034 const CORBA::ULong num_overrides = overrides.length (); 00035 if (num_overrides == 0) 00036 return; 00037 00038 const CORBA::ULong old_length = properties.length (); 00039 00040 const CORBA::ULong new_length = 00041 (num_overrides > old_length ? num_overrides : old_length); 00042 00043 // Increase the length wholesale as much as possible. The idea is 00044 // to keep the cost of the incremental growth that may occur below 00045 // to a minimum. 00046 properties.length (new_length); 00047 00048 // @@ Slow O(n^2) operation. Note that it may be slower than O(n^2) 00049 // if the length of the property sequence must be increased 00050 // on-the-fly due to the allocations and copies incurred by such 00051 // an operation. 00052 for (CORBA::ULong i = 0; i < num_overrides; ++i) 00053 { 00054 const PortableGroup::Property &override = overrides[i]; 00055 00056 CORBA::ULong j = 0; 00057 for ( ; j < old_length; ++j) 00058 if (properties[j].nam == override.nam) 00059 { 00060 properties[j].val = override.val; 00061 break; 00062 } 00063 00064 // No property to override. Append the override. 00065 if (j == old_length) 00066 { 00067 // @@ Slow incremental growth! In order to set the length 00068 // only once, i.e. a priori, instead of multiple times a 00069 // searches in the override list and the property list 00070 // must be performed to determine how many additional 00071 // properties from the override list must be appended to 00072 // the properties list. Depending on the size of each 00073 // list, such an operation may be just as slow as this 00074 // operation. 00075 const CORBA::ULong current_length = properties.length (); 00076 properties.length (current_length + 1); 00077 properties[current_length] = override; 00078 } 00079 } 00080 } |