TAO_PG::Properties_Encoder Class Reference

#include <PG_Properties_Encoder.h>

Collaboration diagram for TAO_PG::Properties_Encoder:

Collaboration graph
[legend]
List of all members.

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_Encoderoperator= (const Properties_Encoder &rhs)

Private Attributes

NamedValueVec values_

Detailed Description

A helper to assemble a set of properties into a PortableGroup::Properties structure.

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.


Member Typedef Documentation

typedef ACE_Vector< NamedValue, 10 > TAO_PG::Properties_Encoder::NamedValueVec [private]
 

Definition at line 64 of file PG_Properties_Encoder.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_PG::Properties_Encoder::Properties_Encoder  ) 
 

Construct an empty set of properties.

Definition at line 24 of file PG_Properties_Encoder.cpp.

00025 {
00026 }

TAO_PG::Properties_Encoder::~Properties_Encoder  ) 
 

standard destructor

Definition at line 28 of file PG_Properties_Encoder.cpp.

00029 {
00030 }

TAO_PG::Properties_Encoder::Properties_Encoder const Properties_Encoder rhs  )  [private]
 


Member Function Documentation

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(), PortableGroup::Value, and values_.

00036 {
00037   NamedValue nv(name, value);
00038   values_.push_back(nv);
00039 }

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, TAO_PG::Properties_Encoder::NamedValue::name_, PortableGroup::Properties, ACE_Vector< T, DEFAULT_SIZE >::size(), CORBA::string_dup(), PortableGroup::Property::val, PortableGroup::Value, TAO_PG::Properties_Encoder::NamedValue::value_, 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]
 


Member Data Documentation

NamedValueVec TAO_PG::Properties_Encoder::values_ [private]
 

Definition at line 90 of file PG_Properties_Encoder.h.

Referenced by add(), and encode().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 14:05:33 2006 for TAO_PortableGroup by doxygen 1.3.6