Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes

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.

Classes

struct  NamedValue

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

Definition at line 64 of file PG_Properties_Encoder.h.


Constructor & Destructor Documentation

TAO_PG::Properties_Encoder::Properties_Encoder (  ) 

Construct an empty set of properties.

Definition at line 24 of file PG_Properties_Encoder.cpp.

{
}

TAO_PG::Properties_Encoder::~Properties_Encoder (  ) 

standard destructor

Definition at line 28 of file PG_Properties_Encoder.cpp.

{
}

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.

{
  NamedValue nv(name, value);
  values_.push_back(nv);
}

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.

{
  ACE_ASSERT (property_set != 0);
  size_t count = values_.size();
  property_set->length(count);
  for( size_t nItem = 0; nItem < count; ++nItem )
  {
    const NamedValue & nv = values_[nItem];
    PortableGroup::Property & property = (*property_set)[nItem];
    PortableGroup::Name & nsName = property.nam;
    PortableGroup::Value & anyValue = property.val;
    // assign the value
    anyValue = (nv.value_);

    // assign the name
    // @@: This restricts the name to a single level with no "kind"
    // @@: remove this restriction (?)
    nsName.length(1);
    CosNaming::NameComponent & nc = nsName[0];

    nc.id = CORBA::string_dup (nv.name_.c_str());
    // nc.kind defaults to empty.  Leave it that way (for now)
  }
}

Properties_Encoder& TAO_PG::Properties_Encoder::operator= ( const Properties_Encoder rhs  )  [private]

Member Data Documentation

Definition at line 90 of file PG_Properties_Encoder.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines