The policy manager implementation. More...
#include <Tagged_Components.h>
Public Member Functions | |
TAO_Tagged_Components (void) | |
Constructor. | |
void | set_orb_type (CORBA::ULong orb_type) |
The the IOP::TAG_ORB_TYPE component value. | |
int | get_orb_type (CORBA::ULong &orb_type) const |
void | set_code_sets (const CONV_FRAME::CodeSetComponentInfo &) |
void | set_code_sets (CONV_FRAME::CodeSetComponentInfo &) |
int | get_code_sets (const CONV_FRAME::CodeSetComponentInfo *&) const |
int | get_code_sets (CONV_FRAME::CodeSetComponentInfo &) const |
void | set_component (const IOP::TaggedComponent &component) |
void | set_component (IOP::TaggedComponent &component) |
int | get_component (IOP::TaggedComponent &component) const |
int | remove_component (IOP::ComponentId id) |
int | encode (TAO_OutputCDR &cdr) const |
Marshal the list. | |
int | decode (TAO_InputCDR &cdr) |
Demarshal the list. | |
IOP::MultipleComponentProfile & | components (void) |
Private Member Functions | |
void | set_code_sets_i (CONV_FRAME::CodeSetComponent &lhs, CONV_FRAME::CodeSetComponent &rhs) |
Helper method to implement set_code_sets(). | |
void | set_known_component_i (const IOP::TaggedComponent &component) |
Helper methods to implement set_component(). | |
void | set_component_i (const IOP::TaggedComponent &component) |
void | set_component_i (IOP::TaggedComponent &component) |
void | add_component_i (const IOP::TaggedComponent &component) |
void | add_component_i (IOP::TaggedComponent &component) |
void | set_component_i (IOP::ComponentId tag, TAO_OutputCDR &cdr) |
int | remove_known_component_i (IOP::ComponentId tag) |
Helper methods to implement remove_component(). | |
int | remove_component_i (IOP::ComponentId tag) |
int | get_known_component_i (IOP::TaggedComponent &component) const |
Helper methods to implement set_component(). | |
int | get_component_i (IOP::TaggedComponent &component) const |
bool | known_tag (IOP::ComponentId tag) const |
Is tag a well-known component? | |
bool | unique_tag (IOP::ComponentId tag) const |
Does tag show up only once? | |
Private Attributes | |
CORBA::ULong | orb_type_ |
The ORB_TYPE component value. | |
CONV_FRAME::CodeSetComponentInfo | code_sets_ |
The ORB_TYPE component value. | |
IOP::MultipleComponentProfile | components_ |
CORBA::Octet | orb_type_set_ |
A flag for each component... | |
CORBA::Octet | code_sets_set_ |
The policy manager implementation.
This class is used to manipulate and access the <components> field of an IIOP profile (and other GIOP profiles). The definition for that field is simply a sequence of the following structures: typedef unsigned long ComponentId; struct TaggedComponent { ComponentId tag; sequence<octet> component_data; }; the real motivation is to minimize the marshaling and demarshaling of the <component_data> field for certain critical components.
Definition at line 57 of file Tagged_Components.h.
TAO_Tagged_Components::TAO_Tagged_Components | ( | void | ) |
Constructor.
Definition at line 8 of file Tagged_Components.inl.
: orb_type_ (0), orb_type_set_ (0), code_sets_set_ (0) { }
void TAO_Tagged_Components::add_component_i | ( | const IOP::TaggedComponent & | component | ) | [private] |
Definition at line 227 of file Tagged_Components.cpp.
{ // @@ TODO Some components can show up multiple times, others // can't find out and take appropiate action. CORBA::ULong l = this->components_.length (); this->components_.length (l + 1); this->components_[l] = component; }
void TAO_Tagged_Components::add_component_i | ( | IOP::TaggedComponent & | component | ) | [private] |
Definition at line 213 of file Tagged_Components.cpp.
{ // @@ TODO Some components can show up multiple times, others // can't find out and take appropiate action. CORBA::ULong l = this->components_.length (); this->components_.length (l + 1); this->components_[l].tag = component.tag; CORBA::ULong max = component.component_data.maximum (); CORBA::ULong len = component.component_data.length (); CORBA::Octet* buf = component.component_data.get_buffer (1); this->components_[l].component_data.replace (max, len, buf, 1); }
IOP::MultipleComponentProfile & TAO_Tagged_Components::components | ( | void | ) |
Read/Write access to the underlying MutipleComponentProfile. Added by request from Chris Hafey <chris@stentorsoft.com>
Definition at line 77 of file Tagged_Components.inl.
{ return this->components_; }
int TAO_Tagged_Components::decode | ( | TAO_InputCDR & | cdr | ) |
Demarshal the list.
Definition at line 312 of file Tagged_Components.cpp.
{ // Mark the well-known components as removed this->orb_type_set_ = 0; this->code_sets_set_ = 0; if (!(cdr >> this->components_)) { return 0; } CORBA::ULong const l = this->components_.length (); for (CORBA::ULong i = 0; i != l; ++i) { const IOP::TaggedComponent &component = this->components_[i]; if (this->known_tag (component.tag)) { this->set_known_component_i (component); } } return 1; }
int TAO_Tagged_Components::encode | ( | TAO_OutputCDR & | cdr | ) | const |
Marshal the list.
Definition at line 306 of file Tagged_Components.cpp.
{ return (cdr << this->components_); }
int TAO_Tagged_Components::get_code_sets | ( | const CONV_FRAME::CodeSetComponentInfo *& | ci | ) | const |
Gets a reference of the IOP::TAG_CODE_SETS component value, return 0 if the component is not present.
Definition at line 27 of file Tagged_Components.inl.
{ if (this->code_sets_set_ == 1) { ci = &this->code_sets_; } return this->code_sets_set_; }
int TAO_Tagged_Components::get_code_sets | ( | CONV_FRAME::CodeSetComponentInfo & | ci | ) | const |
Gets a copy of the IOP::TAG_CODE_SETS component value, return 0 if the component is not present.
Definition at line 39 of file Tagged_Components.inl.
{ if (this->code_sets_set_ == 1) { ci = this->code_sets_; } return this->code_sets_set_; }
int TAO_Tagged_Components::get_component | ( | IOP::TaggedComponent & | component | ) | const |
Get a copy of the component identified by <component.tag>, return 0 if the component is not present.
Definition at line 289 of file Tagged_Components.cpp.
{ for (CORBA::ULong i = 0; i != this->components_.length (); ++i) { if (component.tag == this->components_[i].tag) { component = this->components_[i]; return 1; } } return 0; }
int TAO_Tagged_Components::get_component_i | ( | IOP::TaggedComponent & | component | ) | const [private] |
int TAO_Tagged_Components::get_known_component_i | ( | IOP::TaggedComponent & | component | ) | const [private] |
Helper methods to implement set_component().
int TAO_Tagged_Components::get_orb_type | ( | CORBA::ULong & | orb_type | ) | const |
Gets the IOP::TAG_ORB_TYPE component value, return 0 if the component is not present.
Definition at line 16 of file Tagged_Components.inl.
{ if (this->orb_type_set_ == 1) { orb_type = this->orb_type_; } return this->orb_type_set_; }
bool TAO_Tagged_Components::known_tag | ( | IOP::ComponentId | tag | ) | const [private] |
Is tag a well-known component?
Definition at line 51 of file Tagged_Components.inl.
{
return (tag == IOP::TAG_ORB_TYPE
|| tag == IOP::TAG_CODE_SETS);
}
int TAO_Tagged_Components::remove_component | ( | IOP::ComponentId | id | ) |
Remove a component, if present. Return number of components removed.
Definition at line 237 of file Tagged_Components.cpp.
{ if (this->known_tag (id)) { return this->remove_known_component_i (id); } else { return this->remove_component_i (id); } }
int TAO_Tagged_Components::remove_component_i | ( | IOP::ComponentId | tag | ) | [private] |
Definition at line 270 of file Tagged_Components.cpp.
{ CORBA::ULong src = 0, dest = 0; CORBA::ULong len = this->components_.length (); for (;src != len;++src) { if ( tag != this->components_[src].tag) { this->components_[dest] = this->components_[src]; ++dest; } } this->components_.length (dest); return src - dest; }
int TAO_Tagged_Components::remove_known_component_i | ( | IOP::ComponentId | tag | ) | [private] |
Helper methods to implement remove_component().
Definition at line 250 of file Tagged_Components.cpp.
{ if (tag == IOP::TAG_ORB_TYPE) { this->orb_type_ = 0; this->orb_type_set_ = 0; return 1; } else if (tag == IOP::TAG_CODE_SETS) { this->code_sets_set_ = 0; return 1; } else { return 0; } }
void TAO_Tagged_Components::set_code_sets | ( | CONV_FRAME::CodeSetComponentInfo & | ci | ) |
Definition at line 47 of file Tagged_Components.cpp.
{ this->set_code_sets_i (this->code_sets_.ForCharData, ci.ForCharData); this->set_code_sets_i (this->code_sets_.ForWcharData, ci.ForWcharData); this->code_sets_set_ = 1; TAO_OutputCDR cdr; cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); cdr << this->code_sets_; this->set_component_i (IOP::TAG_CODE_SETS, cdr); }
void TAO_Tagged_Components::set_code_sets | ( | const CONV_FRAME::CodeSetComponentInfo & | ci | ) |
The the IOP::TAG_CODE_SETS component value, the first version copies the data, the second version steal all the sequence buffers.
Definition at line 33 of file Tagged_Components.cpp.
{ this->code_sets_ = ci; this->code_sets_set_ = 1; TAO_OutputCDR cdr; cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); cdr << this->code_sets_; this->set_component_i (IOP::TAG_CODE_SETS, cdr); }
void TAO_Tagged_Components::set_code_sets_i | ( | CONV_FRAME::CodeSetComponent & | lhs, | |
CONV_FRAME::CodeSetComponent & | rhs | |||
) | [private] |
Helper method to implement set_code_sets().
Definition at line 61 of file Tagged_Components.cpp.
{ lhs.native_code_set = rhs.native_code_set; CORBA::ULong const max = rhs.conversion_code_sets.maximum (); CORBA::ULong const len = rhs.conversion_code_sets.length (); CONV_FRAME::CodeSetId *buffer = rhs.conversion_code_sets.get_buffer (true); lhs.conversion_code_sets.replace (max, len, buffer, true); }
void TAO_Tagged_Components::set_component | ( | IOP::TaggedComponent & | component | ) |
Insert the component into the list, but efficiently stealing the contents of the octet sequence.
Definition at line 116 of file Tagged_Components.cpp.
{ if (this->known_tag (component.tag)) { this->set_known_component_i (component); } if (this->unique_tag (component.tag)) { this->set_component_i (component); } else { this->add_component_i (component); } }
void TAO_Tagged_Components::set_component | ( | const IOP::TaggedComponent & | component | ) |
Insert the component into the list, making a copy of the octet sequence.
Definition at line 98 of file Tagged_Components.cpp.
{ if (this->known_tag (component.tag)) { this->set_known_component_i (component); } if (this->unique_tag (component.tag)) { this->set_component_i (component); } else { this->add_component_i (component); } }
void TAO_Tagged_Components::set_component_i | ( | const IOP::TaggedComponent & | component | ) | [private] |
Definition at line 178 of file Tagged_Components.cpp.
{ // @@ TODO Some components can show up multiple times, others // can't find out and take appropiate action. for (CORBA::ULong i = 0; i != this->components_.length (); ++i) { if (component.tag == this->components_[i].tag) { this->components_[i] = component; return; } } this->add_component_i (component); }
void TAO_Tagged_Components::set_component_i | ( | IOP::TaggedComponent & | component | ) | [private] |
Definition at line 195 of file Tagged_Components.cpp.
{ for (CORBA::ULong i = 0; i != this->components_.length (); ++i) { if (component.tag == this->components_[i].tag) { CORBA::ULong max = component.component_data.maximum (); CORBA::ULong len = component.component_data.length (); CORBA::Octet* buf = component.component_data.get_buffer (1); this->components_[i].component_data.replace (max, len, buf, 1); return; } } this->add_component_i (component); }
void TAO_Tagged_Components::set_component_i | ( | IOP::ComponentId | tag, | |
TAO_OutputCDR & | cdr | |||
) | [private] |
Definition at line 75 of file Tagged_Components.cpp.
{ IOP::TaggedComponent component; component.tag = tag; // Make a *copy* of the CDR stream... size_t length = cdr.total_length (); component.component_data.length (static_cast<CORBA::ULong> (length)); CORBA::Octet *buf = component.component_data.get_buffer (); for (const ACE_Message_Block *i = cdr.begin (); i != 0; i = i->cont ()) { ACE_OS::memcpy (buf, i->rd_ptr (), i->length ()); buf += i->length (); } this->set_component_i (component); }
void TAO_Tagged_Components::set_known_component_i | ( | const IOP::TaggedComponent & | component | ) | [private] |
Helper methods to implement set_component().
Definition at line 134 of file Tagged_Components.cpp.
{ TAO_InputCDR cdr (reinterpret_cast<const char*> ( component.component_data.get_buffer ()), component.component_data.length ()); CORBA::Boolean byte_order; if (!(cdr >> ACE_InputCDR::to_boolean (byte_order))) { return; } cdr.reset_byte_order (static_cast<int> (byte_order)); if (component.tag == IOP::TAG_ORB_TYPE) { CORBA::ULong orb_type; if (!(cdr >> orb_type)) { return; } this->orb_type_ = orb_type; this->orb_type_set_ = 1; } else if (component.tag == IOP::TAG_CODE_SETS) { CONV_FRAME::CodeSetComponentInfo ci; if (!(cdr >> ci)) { return; } this->set_code_sets_i (this->code_sets_.ForCharData, ci.ForCharData); this->set_code_sets_i (this->code_sets_.ForWcharData, ci.ForWcharData); this->code_sets_set_ = 1; } }
void TAO_Tagged_Components::set_orb_type | ( | CORBA::ULong | orb_type | ) |
The the IOP::TAG_ORB_TYPE component value.
Definition at line 20 of file Tagged_Components.cpp.
{ this->orb_type_ = orb_type; this->orb_type_set_ = 1; TAO_OutputCDR cdr; cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER); cdr << this->orb_type_; this->set_component_i (IOP::TAG_ORB_TYPE, cdr); }
bool TAO_Tagged_Components::unique_tag | ( | IOP::ComponentId | tag | ) | const [private] |
Does tag show up only once?
Definition at line 59 of file Tagged_Components.inl.
{ return (tag == IOP::TAG_ORB_TYPE || tag == IOP::TAG_CODE_SETS || tag == IOP::TAG_POLICIES || tag == TAO_TAG_ENDPOINTS // || tag == IOP::TAG_ALTERNATE_IIOP_ADDRESS || tag == IOP::TAG_COMPLETE_OBJECT_KEY || tag == IOP::TAG_ENDPOINT_ID_POSITION || tag == IOP::TAG_LOCATION_POLICY || tag == IOP::TAG_FT_PRIMARY || tag == IOP::TAG_FT_GROUP || tag == IOP::TAG_DCE_STRING_BINDING || tag == IOP::TAG_DCE_BINDING_NAME || tag == IOP::TAG_DCE_NO_PIPES); }
CONV_FRAME::CodeSetComponentInfo TAO_Tagged_Components::code_sets_ [private] |
The ORB_TYPE component value.
Definition at line 152 of file Tagged_Components.h.
Definition at line 160 of file Tagged_Components.h.
IOP::MultipleComponentProfile TAO_Tagged_Components::components_ [private] |
The rest of the components, to be compliant we cannot drop a bunch of them.
Definition at line 156 of file Tagged_Components.h.
CORBA::ULong TAO_Tagged_Components::orb_type_ [private] |
The ORB_TYPE component value.
Definition at line 149 of file Tagged_Components.h.
A flag for each component...
Definition at line 159 of file Tagged_Components.h.