#include <PG_Properties_Encoder.h>
Collaboration diagram for TAO_PG::Properties_Encoder:
Public Member Functions | |
Properties_Encoder () | |
~Properties_Encoder () | |
standard destructor | |
void | add (const char *name, const PortableGroup::Value &value) |
void | encode (PortableGroup::Properties *property_set) const |
Private Types | |
typedef ACE_Vector< NamedValue, 10 > | NamedValueVec |
Private Member Functions | |
Properties_Encoder (const Properties_Encoder &rhs) | |
Properties_Encoder & | operator= (const Properties_Encoder &rhs) |
Private Attributes | |
NamedValueVec | values_ |
Classes | |
struct | NamedValue |
To use a Properties_Encoder: Create it. Add properties to it using the add method. Allocate a new PortableGroup::Properties. Use the encode method to transfer the properties into the PortableGroup::Properties.
Definition at line 44 of file PG_Properties_Encoder.h.
typedef ACE_Vector< NamedValue, 10 > TAO_PG::Properties_Encoder::NamedValueVec [private] |
Definition at line 64 of file PG_Properties_Encoder.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_PG::Properties_Encoder::Properties_Encoder | ( | ) |
TAO_PG::Properties_Encoder::~Properties_Encoder | ( | ) |
TAO_PG::Properties_Encoder::Properties_Encoder | ( | const Properties_Encoder & | rhs | ) | [private] |
void TAO_PG::Properties_Encoder::add | ( | const char * | name, | |
const PortableGroup::Value & | value | |||
) |
add a name/value property to the Properties_Encoder.
Definition at line 33 of file PG_Properties_Encoder.cpp.
References ACE_Vector< T, DEFAULT_SIZE >::push_back(), and values_.
void TAO_PG::Properties_Encoder::encode | ( | PortableGroup::Properties * | property_set | ) | const |
Encode all properties in this Properties_Encoder into a PortableGroup::Properties.
Definition at line 41 of file PG_Properties_Encoder.cpp.
References ACE_ASSERT, PortableGroup::Property::nam, ACE_Vector< T, DEFAULT_SIZE >::size(), CORBA::string_dup(), PortableGroup::Property::val, and values_.
00043 { 00044 ACE_ASSERT (property_set != 0); 00045 size_t count = values_.size(); 00046 property_set->length(count); 00047 for( size_t nItem = 0; nItem < count; ++nItem ) 00048 { 00049 const NamedValue & nv = values_[nItem]; 00050 PortableGroup::Property & property = (*property_set)[nItem]; 00051 PortableGroup::Name & nsName = property.nam; 00052 PortableGroup::Value & anyValue = property.val; 00053 // assign the value 00054 anyValue = (nv.value_); 00055 00056 // assign the name 00057 // @@: This restricts the name to a single level with no "kind" 00058 // @@: remove this restriction (?) 00059 nsName.length(1); 00060 CosNaming::NameComponent & nc = nsName[0]; 00061 00062 nc.id = CORBA::string_dup (nv.name_.c_str()); 00063 // nc.kind defaults to empty. Leave it that way (for now) 00064 } 00065 }
Properties_Encoder& TAO_PG::Properties_Encoder::operator= | ( | const Properties_Encoder & | rhs | ) | [private] |