Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

TAO_Codeset_Manager Class Reference

The encapsulation of logic for codeset negotiation. More...

#include <Codeset_Manager.h>

Collaboration diagram for TAO_Codeset_Manager:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_Codeset_Manager ()
 ~TAO_Codeset_Manager ()
void set_codeset (TAO_Tagged_Components &) const
 Called by an object of TAO_Acceptor to set NCS and CCS values for Char/Wchar in to the Object Reference. More...

void set_tcs (TAO_Profile &theProfile, TAO_Transport &)
 Called from an object of "TAO_GIOP_Invocation" to set TCS on the Transport. More...

void process_service_context (TAO_ServerRequest &)
 Called from an Object of TAO_Messaging for every request at server side to process service context and set TCS for Char/WChar. More...

void generate_service_context (TAO_Operation_Details &, TAO_Transport &)
 Called by a client object to generate service context at this time Transport has the TCS for Char and WChar. More...

void set_ncs_c (CONV_FRAME::CodeSetId ncs)
 Called by the resource factory to set the native char codeset id. More...

void set_ncs_w (CONV_FRAME::CodeSetId ncs, int maxbytes=0)
 Called by the resource factory to set the native wchar codeset id. The maxbytes value is used to communicate the width of untranslated wide characters on the stream. This size may be smaller than the size of a wchar_t. More...

int add_char_translator (const char *name)
 Called by the resource factory to add a potential codeset translator for char data. The actual factory will be added to the list later, if its ncs matches that of the codeset manager. More...

int add_wchar_translator (const char *name)
 Called by the resource factory to add a potential codeset translator for wchar data. The actual factory will be added to the list later, if its ncs matches that of the codeset manager. More...

void configure_codeset_factories ()
 Called by the resource factory to signify the end of initialization. This will traverse the list of named codeset translator factories and add any of those that have a native codeset id matching the manager's native codeset id. More...


Static Public Attributes

CONV_FRAME::CodeSetId default_char_codeset = TAO_DEFAULT_CHAR_CODESET_ID
 NCS for char is defaulted to ISO 8859-1:1987; Latin Alphabet No. 1. More...

CONV_FRAME::CodeSetId default_wchar_codeset = TAO_DEFAULT_WCHAR_CODESET_ID
 NCS for wchar is defaulted to 0 (not used), but people wishing to provide a non-compliant default wchar codeset may do so. More...


Private Types

typedef ACE_Unbounded_Set<
TAO_Codeset_Item * > 
TAO_CodesetFactorySet
typedef ACE_Unbounded_Set_Iterator<
TAO_Codeset_Item * > 
TAO_CodesetFactorySetItor

Private Methods

CONV_FRAME::CodeSetId computeTCS (CONV_FRAME::CodeSetComponent &, CONV_FRAME::CodeSetComponent &)
 returns the TCS for Char / Wchar. More...

int isElementOf (CONV_FRAME::CodeSetId, CONV_FRAME::CodeSetComponent &)
 Checks whether the NCS is a part of CCS. More...

CONV_FRAME::CodeSetId intersectionOf (CONV_FRAME::CodeSetComponent &, CONV_FRAME::CodeSetComponent &)
 Find the Intersection of Client and Server CCS's. More...

int isCompatible (CONV_FRAME::CodeSetId, CONV_FRAME::CodeSetId)
int init_codeset_factories_i (TAO_CodesetFactorySet &, CONV_FRAME::CodeSetComponent &)
 Initialise the specific type codeset factories. More...

TAO_Codeset_Translator_Factoryget_char_trans (CONV_FRAME::CodeSetId)
TAO_Codeset_Translator_Factoryget_wchar_trans (CONV_FRAME::CodeSetId)
TAO_Codeset_Translator_Factoryget_translator_i (TAO_CodesetFactorySet &, CONV_FRAME::CodeSetId)

Private Attributes

CONV_FRAME::CodeSetComponentInfo codeset_info_
TAO_CodesetFactorySet char_factories_
TAO_CodesetFactorySet wchar_factories_

Detailed Description

The encapsulation of logic for codeset negotiation.

The Codeset Manager is owned by the ORB_Core, initialized through Resource Factory configuration options. The codeset manager participates in profile creation by servers and connection establishment by clients. The involvement is necessary to supply a codeset component to the profile including for both chars and wide chars the native code set and any conversion code sets for which translators are available. The codeset manager is also responsible for determining the transmission codesets based an the local and remote codeset information. The transmission codesets are communicated via a service context attached to the first request sent on the new connection.

Definition at line 101 of file Codeset_Manager.h.


Member Typedef Documentation

typedef ACE_Unbounded_Set<TAO_Codeset_Item*> TAO_Codeset_Manager::TAO_CodesetFactorySet [private]
 

Definition at line 161 of file Codeset_Manager.h.

typedef ACE_Unbounded_Set_Iterator<TAO_Codeset_Item*> TAO_Codeset_Manager::TAO_CodesetFactorySetItor [private]
 

Definition at line 165 of file Codeset_Manager.h.


Constructor & Destructor Documentation

TAO_Codeset_Manager::TAO_Codeset_Manager  
 

Definition at line 31 of file Codeset_Manager.cpp.

References codeset_info_, default_char_codeset, default_wchar_codeset, CONV_FRAME::CodeSetComponentInfo::ForCharData, and CONV_FRAME::CodeSetComponentInfo::ForWcharData.

00032   :codeset_info_ (),
00033    char_factories_ (),
00034    wchar_factories_ ()
00035 {
00036   this->codeset_info_.ForCharData.native_code_set =
00037     TAO_Codeset_Manager::default_char_codeset;
00038   this->codeset_info_.ForWcharData.native_code_set =
00039     TAO_Codeset_Manager::default_wchar_codeset;
00040 }

TAO_Codeset_Manager::~TAO_Codeset_Manager  
 

Definition at line 42 of file Codeset_Manager.cpp.

References ACE_Unbounded_Set< TAO_Codeset_Item * >::begin, char_factories_, ACE_Unbounded_Set< TAO_Codeset_Item * >::end, ACE_Unbounded_Set< TAO_Codeset_Item * >::reset, and wchar_factories_.

00043 {
00044   // Cleanup the character map
00045   TAO_CodesetFactorySetItor cf_end = this->char_factories_.end ();
00046   TAO_CodesetFactorySetItor cf_iter = this->char_factories_.begin ();
00047   for (;cf_iter != cf_end; ++cf_iter)
00048     delete *cf_iter;
00049 
00050   this->char_factories_.reset ();
00051 
00052   // Cleanup the wide character map
00053   cf_end = this->wchar_factories_.end ();
00054   cf_iter = this->wchar_factories_.begin ();
00055   for (;cf_iter != cf_end; ++cf_iter)
00056     delete *cf_iter;
00057 
00058   this->wchar_factories_.reset ();
00059 }


Member Function Documentation

int TAO_Codeset_Manager::add_char_translator const char *    name
 

Called by the resource factory to add a potential codeset translator for char data. The actual factory will be added to the list later, if its ncs matches that of the codeset manager.

Definition at line 263 of file Codeset_Manager.cpp.

References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_NEW_RETURN, char_factories_, ACE_Unbounded_Set< TAO_Codeset_Item * >::insert, and LM_ERROR.

Referenced by TAO_Default_Resource_Factory::init.

00264 {
00265   TAO_Codeset_Item *item = 0;
00266   ACE_NEW_RETURN (item, TAO_Codeset_Item (name), -1);
00267   if (this->char_factories_.insert (item) == -1)
00268     ACE_ERROR_RETURN ((LM_ERROR,
00269                 ACE_LIB_TEXT ("(%P|%t) Unable to add Codeset ")
00270                 ACE_LIB_TEXT ("factories for %s: %p\n"),
00271                 name), -1);
00272   return 0;
00273 }

int TAO_Codeset_Manager::add_wchar_translator const char *    name
 

Called by the resource factory to add a potential codeset translator for wchar data. The actual factory will be added to the list later, if its ncs matches that of the codeset manager.

Definition at line 276 of file Codeset_Manager.cpp.

References ACE_ERROR_RETURN, ACE_LIB_TEXT, ACE_NEW_RETURN, ACE_Unbounded_Set< TAO_Codeset_Item * >::insert, LM_ERROR, and wchar_factories_.

Referenced by TAO_Default_Resource_Factory::init.

00277 {
00278   TAO_Codeset_Item *item = 0;
00279   ACE_NEW_RETURN (item, TAO_Codeset_Item (name), -1);
00280   if (this->wchar_factories_.insert (item) == -1)
00281     ACE_ERROR_RETURN ((LM_ERROR,
00282                 ACE_LIB_TEXT ("(%P|%t) Unable to add Codeset ")
00283                 ACE_LIB_TEXT ("factories for %s: %p\n"),
00284                 name),-1);
00285   return 0;
00286 }

CONV_FRAME::CodeSetId TAO_Codeset_Manager::computeTCS CONV_FRAME::CodeSetComponent  ,
CONV_FRAME::CodeSetComponent  
[private]
 

returns the TCS for Char / Wchar.

Definition at line 225 of file Codeset_Manager.cpp.

References ACE_DECLARE_NEW_CORBA_ENV, ACE_THROW_RETURN, intersectionOf, isCompatible, isElementOf, and CONV_FRAME::CodeSetComponent::native_code_set.

Referenced by set_tcs.

00227 {
00228   if (remote.native_code_set == local.native_code_set)
00229     return local.native_code_set;
00230 
00231   if (this->isElementOf (remote.native_code_set, local))
00232     return remote.native_code_set;
00233 
00234   if (this->isElementOf (local.native_code_set, remote))
00235     return local.native_code_set;
00236 
00237   CONV_FRAME::CodeSetId tcs;
00238   if ((tcs = this->intersectionOf (remote, local)) == 0)
00239     if (isCompatible (local.native_code_set, remote.native_code_set))
00240       return remote.native_code_set;
00241     else
00242       {
00243         ACE_DECLARE_NEW_CORBA_ENV;
00244         ACE_THROW_RETURN(CORBA::CODESET_INCOMPATIBLE(),0);
00245       }
00246   return tcs;
00247 }

void TAO_Codeset_Manager::configure_codeset_factories  
 

Called by the resource factory to signify the end of initialization. This will traverse the list of named codeset translator factories and add any of those that have a native codeset id matching the manager's native codeset id.

Definition at line 289 of file Codeset_Manager.cpp.

References ACE_ERROR, ACE_LIB_TEXT, codeset_info_, CONV_FRAME::CodeSetComponentInfo::ForWcharData, init_codeset_factories_i, LM_ERROR, and ACE_OutputCDR::wchar_maxbytes.

Referenced by TAO_Default_Resource_Factory::init.

00290 {
00291   if (init_codeset_factories_i (this->char_factories_,
00292                                 this->codeset_info_.ForCharData) == -1)
00293       ACE_ERROR ((LM_ERROR,
00294                   ACE_LIB_TEXT ("TAO (%P|%t) failed to init char ")
00295                   ACE_LIB_TEXT ("codeset factories\n")));
00296   if (init_codeset_factories_i (this->wchar_factories_,
00297                                 this->codeset_info_.ForWcharData) == -1)
00298       ACE_ERROR ((LM_ERROR,
00299                   ACE_LIB_TEXT ("TAO (%P|%t) failed to init wchar ")
00300                   ACE_LIB_TEXT ("codeset factories\n")));
00301   if (this->codeset_info_.ForWcharData.native_code_set == 0)
00302     ACE_OutputCDR::wchar_maxbytes(0); // disallow wchar when no ncs_w set
00303 }

void TAO_Codeset_Manager::generate_service_context TAO_Operation_Details  ,
TAO_Transport  
 

Called by a client object to generate service context at this time Transport has the TCS for Char and WChar.

Definition at line 159 of file Codeset_Manager.cpp.

References ACE_DEBUG, ACE_LIB_TEXT, CONV_FRAME::CodeSetContext::char_data, TAO_Transport::char_translator, codeset_info_, CONV_FRAME::CodeSetComponentInfo::ForCharData, CONV_FRAME::CodeSetComponentInfo::ForWcharData, LM_DEBUG, TAO_Operation_Details::request_service_context, TAO_Service_Context::set_context, TAO_ENCAP_BYTE_ORDER, TAO_Codeset_Translator_Factory::tcs, CONV_FRAME::CodeSetContext::wchar_data, and TAO_Transport::wchar_translator.

Referenced by TAO_Transport::generate_request_header.

00161 {
00162   TAO_Service_Context &service_cntx = opd.request_service_context ();
00163   CONV_FRAME::CodeSetContext codeset_cntx;
00164 
00165   // Generating codeset context
00166   // Assuming the TCS values from Transport will be defaulted
00167   TAO_Codeset_Translator_Factory *tf = trans.char_translator();
00168   codeset_cntx.char_data = tf ? tf->tcs() :
00169     this->codeset_info_.ForCharData.native_code_set;
00170   tf = trans.wchar_translator();
00171   codeset_cntx.wchar_data = tf ? tf->tcs() :
00172     this->codeset_info_.ForWcharData.native_code_set;
00173   if (TAO_debug_level > 2)
00174     ACE_DEBUG ((LM_DEBUG,
00175                 ACE_LIB_TEXT("(%P|%t) Codeset_Manager::generate_service_context ")
00176                 ACE_LIB_TEXT("using tcs_c = %08x, tcs_w = %08x\n"),
00177                 codeset_cntx.char_data,
00178                 codeset_cntx.wchar_data));
00179 
00180   TAO_OutputCDR codeset_cdr;
00181   codeset_cdr << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER);
00182   codeset_cdr << codeset_cntx;
00183 
00184   service_cntx.set_context (IOP::CodeSets,codeset_cdr);
00185 }

TAO_Codeset_Translator_Factory * TAO_Codeset_Manager::get_char_trans CONV_FRAME::CodeSetId    [private]
 

Definition at line 348 of file Codeset_Manager.cpp.

References codeset_info_, CONV_FRAME::CodeSetComponentInfo::ForCharData, and get_translator_i.

00349 {
00350   if (this->codeset_info_.ForCharData.native_code_set == tcs)
00351     return 0;
00352   return this->get_translator_i (this->char_factories_,tcs);
00353 }

TAO_Codeset_Translator_Factory * TAO_Codeset_Manager::get_translator_i TAO_CodesetFactorySet  ,
CONV_FRAME::CodeSetId   
[private]
 

Definition at line 364 of file Codeset_Manager.cpp.

References ACE_Unbounded_Set< TAO_Codeset_Item * >::begin, ACE_Unbounded_Set< TAO_Codeset_Item * >::end, and TAO_Codeset_Translator_Factory::tcs.

Referenced by get_char_trans, and get_wchar_trans.

00366 {
00367   TAO_CodesetFactorySetItor end = factset.end ();
00368   TAO_CodesetFactorySetItor iter = factset.begin ();
00369 
00370   for (; iter != end; iter++)
00371     {
00372       TAO_Codeset_Translator_Factory *fact = (*iter)->factory ();
00373       if (fact && tcs == fact->tcs())
00374           return fact;
00375     }
00376 
00377   return 0;
00378 }

TAO_Codeset_Translator_Factory * TAO_Codeset_Manager::get_wchar_trans CONV_FRAME::CodeSetId    [private]
 

Definition at line 356 of file Codeset_Manager.cpp.

References codeset_info_, CONV_FRAME::CodeSetComponentInfo::ForWcharData, and get_translator_i.

00357 {
00358   if (this->codeset_info_.ForWcharData.native_code_set == tcs)
00359     return 0;
00360   return this->get_translator_i (this->wchar_factories_,tcs);
00361 }

int TAO_Codeset_Manager::init_codeset_factories_i TAO_CodesetFactorySet  ,
CONV_FRAME::CodeSetComponent  
[private]
 

Initialise the specific type codeset factories.

Definition at line 307 of file Codeset_Manager.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_LIB_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_Unbounded_Set< TAO_Codeset_Item * >::begin, CONV_FRAME::CodeSetComponent::conversion_code_sets, ACE_Unbounded_Set< TAO_Codeset_Item * >::end, ACE_Dynamic_Service::instance, LM_DEBUG, LM_ERROR, CONV_FRAME::CodeSetComponent::native_code_set, TAO_Codeset_Translator_Factory::ncs, ACE_Unbounded_Set< TAO_Codeset_Item * >::size, and TAO_Codeset_Translator_Factory::tcs.

Referenced by configure_codeset_factories.

00309 {
00310   TAO_CodesetFactorySetItor end = factset.end ();
00311   TAO_CodesetFactorySetItor iter = factset.begin ();
00312 
00313   CONV_FRAME::CodeSetId ncs = cs_comp.native_code_set;
00314   cs_comp.conversion_code_sets.length(ACE_static_cast(CORBA::ULong,
00315                                                       factset.size()));
00316   CORBA::ULong index;
00317 
00318   for (index=0; iter != end; iter++)
00319     {
00320       const char *name = (*iter)->codeset_name ();
00321       TAO_Codeset_Translator_Factory *trans =
00322         ACE_Dynamic_Service<TAO_Codeset_Translator_Factory>::instance (name);
00323       if (trans == 0)
00324         {
00325           ACE_ERROR ((LM_ERROR,
00326                       ACE_LIB_TEXT ("TAO (%P|%t) Unable to load ")
00327                       ACE_LIB_TEXT ("CodeSet <%s>, %p\n"),
00328                       ACE_TEXT_CHAR_TO_TCHAR(name), ""));
00329           continue;
00330         }
00331       if (trans->ncs() == ncs)
00332         {
00333           (*iter)->factory (trans);
00334           cs_comp.conversion_code_sets[index++] = trans->tcs();
00335           if (TAO_debug_level > 2)
00336             ACE_DEBUG ((LM_DEBUG,
00337                         ACE_LIB_TEXT ("TAO (%P|%t) Loaded CodeSet <%s>, ")
00338                         ACE_LIB_TEXT ("ncs = %08x tcs = %08x\n"),
00339                         ACE_TEXT_CHAR_TO_TCHAR(name),
00340                         trans->ncs(),trans->tcs()));
00341         }
00342     }
00343   cs_comp.conversion_code_sets.length(index);
00344   return 0;
00345 }

CONV_FRAME::CodeSetId TAO_Codeset_Manager::intersectionOf CONV_FRAME::CodeSetComponent  ,
CONV_FRAME::CodeSetComponent  
[private]
 

Find the Intersection of Client and Server CCS's.

Definition at line 204 of file Codeset_Manager.cpp.

References CONV_FRAME::CodeSetComponent::conversion_code_sets, and isElementOf.

Referenced by computeTCS.

00206 {
00207   for(CORBA::ULong index=0L;
00208        index < cs_comp1.conversion_code_sets.length();
00209        ++index )
00210     if (this->isElementOf(cs_comp1.conversion_code_sets[index], cs_comp2))
00211       return cs_comp1.conversion_code_sets[index];
00212   return 0;
00213 }

int TAO_Codeset_Manager::isCompatible CONV_FRAME::CodeSetId   ,
CONV_FRAME::CodeSetId   
[private]
 

Definition at line 216 of file Codeset_Manager.cpp.

References ACE_Codeset_Registry::is_compatible.

Referenced by computeTCS.

00218 {
00219   // Call the is_compatible method of ACE_Codeset_Registry
00220   return ACE_Codeset_Registry::is_compatible(cs1,cs2);
00221 }

int TAO_Codeset_Manager::isElementOf CONV_FRAME::CodeSetId   ,
CONV_FRAME::CodeSetComponent  
[private]
 

Checks whether the NCS is a part of CCS.

Definition at line 189 of file Codeset_Manager.cpp.

References CONV_FRAME::CodeSetComponent::conversion_code_sets.

Referenced by computeTCS, and intersectionOf.

00191 {
00192   for (CORBA::ULong i=0L;
00193        i < cs_comp.conversion_code_sets.length();
00194        ++i )
00195     {
00196       if (id == cs_comp.conversion_code_sets[i])
00197         return 1;
00198     }
00199   return 0;
00200 }

void TAO_Codeset_Manager::process_service_context TAO_ServerRequest  
 

Called from an Object of TAO_Messaging for every request at server side to process service context and set TCS for Char/WChar.

Definition at line 119 of file Codeset_Manager.cpp.

References ACE_DEBUG, ACE_LIB_TEXT, TAO_Transport::char_translator, IOP::ServiceContext::context_data, IOP::ServiceContext::context_id, default_char_codeset, default_wchar_codeset, TAO_Service_Context::get_context, TAO_Transport::is_tcs_set, LM_DEBUG, TAO_ServerRequest::request_service_context, ACE_InputCDR::reset_byte_order, TAO_ServerRequest::transport, and TAO_Transport::wchar_translator.

00120 {
00121   if (request.transport()->is_tcs_set())
00122     return;
00123 
00124   // Get the service Context from an object of TAO_ServerRequest
00125   // and set the TCS values on the Transport
00126   TAO_Service_Context &service_cntx = request.request_service_context ();
00127   IOP::ServiceContext context;
00128   context.context_id = IOP::CodeSets;
00129   CONV_FRAME::CodeSetId tcs_c = TAO_Codeset_Manager::default_char_codeset;
00130   CONV_FRAME::CodeSetId tcs_w = TAO_Codeset_Manager::default_wchar_codeset;
00131 
00132   if (service_cntx.get_context(context))
00133     {
00134       // Convert the Service Context to Codeset Context
00135       const char *buffer =
00136         ACE_reinterpret_cast(const char*,context.context_data.get_buffer ());
00137 
00138       TAO_InputCDR cdr (buffer,context.context_data.length ());
00139       CORBA::Boolean byte_order;
00140       if (cdr >> TAO_InputCDR::to_boolean (byte_order))
00141         {
00142           cdr.reset_byte_order (ACE_static_cast (int, byte_order));
00143           cdr >> tcs_c;
00144           cdr >> tcs_w;
00145         }
00146     }
00147 
00148   if (TAO_debug_level > 2)
00149     ACE_DEBUG ((LM_DEBUG,
00150                 ACE_LIB_TEXT("(%P|%t) Codeset_Manager::process_service_context ")
00151                 ACE_LIB_TEXT("using tcsc = %08x, tcsw = %08x\n"),
00152                 tcs_c,tcs_w));
00153 
00154   request.transport()->char_translator(this->get_char_trans (tcs_c));
00155   request.transport()->wchar_translator(this->get_wchar_trans (tcs_w));
00156 }

void TAO_Codeset_Manager::set_codeset TAO_Tagged_Components   const
 

Called by an object of TAO_Acceptor to set NCS and CCS values for Char/Wchar in to the Object Reference.

Definition at line 62 of file Codeset_Manager.cpp.

References TAO_Tagged_Components::set_code_sets.

00063 {
00064   tc.set_code_sets (this->codeset_info_);
00065 }

void TAO_Codeset_Manager::set_ncs_c CONV_FRAME::CodeSetId    ncs
 

Called by the resource factory to set the native char codeset id.

Definition at line 250 of file Codeset_Manager.cpp.

References codeset_info_, and CONV_FRAME::CodeSetComponentInfo::ForCharData.

Referenced by TAO_Default_Resource_Factory::init.

00251 {
00252   this->codeset_info_.ForCharData.native_code_set = ncs;
00253 }

void TAO_Codeset_Manager::set_ncs_w CONV_FRAME::CodeSetId    ncs,
int    maxbytes = 0
 

Called by the resource factory to set the native wchar codeset id. The maxbytes value is used to communicate the width of untranslated wide characters on the stream. This size may be smaller than the size of a wchar_t.

Definition at line 256 of file Codeset_Manager.cpp.

References codeset_info_, CONV_FRAME::CodeSetComponentInfo::ForWcharData, and ACE_OutputCDR::wchar_maxbytes.

Referenced by TAO_Default_Resource_Factory::init.

00257 {
00258   this->codeset_info_.ForWcharData.native_code_set = ncs;
00259   ACE_OutputCDR::wchar_maxbytes(mb);
00260 }

void TAO_Codeset_Manager::set_tcs TAO_Profile   theProfile,
TAO_Transport  
 

Called from an object of "TAO_GIOP_Invocation" to set TCS on the Transport.

Definition at line 68 of file Codeset_Manager.cpp.

References ACE_DEBUG, ACE_LIB_TEXT, TAO_Transport::char_translator, computeTCS, default_char_codeset, default_wchar_codeset, CONV_FRAME::CodeSetComponentInfo::ForCharData, CONV_FRAME::CodeSetComponentInfo::ForWcharData, TAO_Tagged_Components::get_code_sets, TAO_Transport::is_tcs_set, LM_DEBUG, TAO_Profile::tagged_components, and TAO_Transport::wchar_translator.

00070 {
00071    /// If tcs is already set on the transport then donot process,
00072    /// use existing transport as CDR have translators set.
00073    if (trans.is_tcs_set())
00074      {
00075        if(TAO_debug_level > 2)
00076          ACE_DEBUG((LM_DEBUG,
00077                     ACE_LIB_TEXT("(%P|%t) Codeset_Manager::set_tcs ")
00078                     ACE_LIB_TEXT("transport already set\n")));
00079        return;
00080      }
00081 
00082    TAO_Tagged_Components& theTaggedComp = theProfile.tagged_components();
00083 
00084    CONV_FRAME::CodeSetComponentInfo remote;
00085    /// Get the codeset component
00086    if (theTaggedComp.get_code_sets(remote) == 0 )
00087    {
00088      if(TAO_debug_level > 2)
00089        ACE_DEBUG((LM_DEBUG,
00090                   ACE_LIB_TEXT("(%P|%t) Codeset_Manager::set_tcs ")
00091                   ACE_LIB_TEXT("No codeset componnet in profile\n")));
00092      remote.ForCharData.native_code_set =
00093        TAO_Codeset_Manager::default_char_codeset;
00094      remote.ForWcharData.native_code_set =
00095        TAO_Codeset_Manager::default_wchar_codeset;
00096    }
00097 
00098    CONV_FRAME::CodeSetId tcs = computeTCS (remote.ForCharData,
00099                                            this->codeset_info_.ForCharData);
00100    if (TAO_debug_level > 2)
00101      ACE_DEBUG ((LM_DEBUG,
00102                  ACE_LIB_TEXT("(%P|%t) Codeset_Manager::set_tcs ")
00103                  ACE_LIB_TEXT("setting char translator(%08x)\n"),
00104                  tcs));
00105    trans.char_translator(this->get_char_trans (tcs));
00106 
00107    tcs = computeTCS (remote.ForWcharData,
00108                      this->codeset_info_.ForWcharData);
00109 
00110    if (TAO_debug_level > 2)
00111      ACE_DEBUG ((LM_DEBUG,
00112                  ACE_LIB_TEXT("(%P|%t) Codeset_Manager::set_tcs ")
00113                  ACE_LIB_TEXT("setting wchar translator (%08x)\n"),
00114                  tcs));
00115    trans.wchar_translator(this->get_wchar_trans (tcs));
00116 }


Member Data Documentation

TAO_CodesetFactorySet TAO_Codeset_Manager::char_factories_ [private]
 

Definition at line 206 of file Codeset_Manager.h.

Referenced by add_char_translator, and ~TAO_Codeset_Manager.

CONV_FRAME::CodeSetComponentInfo TAO_Codeset_Manager::codeset_info_ [private]
 

Definition at line 203 of file Codeset_Manager.h.

Referenced by configure_codeset_factories, generate_service_context, get_char_trans, get_wchar_trans, set_ncs_c, set_ncs_w, and TAO_Codeset_Manager.

CONV_FRAME::CodeSetId TAO_Codeset_Manager::default_char_codeset = TAO_DEFAULT_CHAR_CODESET_ID [static]
 

NCS for char is defaulted to ISO 8859-1:1987; Latin Alphabet No. 1.

Definition at line 25 of file Codeset_Manager.cpp.

Referenced by process_service_context, set_tcs, and TAO_Codeset_Manager.

CONV_FRAME::CodeSetId TAO_Codeset_Manager::default_wchar_codeset = TAO_DEFAULT_WCHAR_CODESET_ID [static]
 

NCS for wchar is defaulted to 0 (not used), but people wishing to provide a non-compliant default wchar codeset may do so.

Definition at line 29 of file Codeset_Manager.cpp.

Referenced by process_service_context, set_tcs, and TAO_Codeset_Manager.

TAO_CodesetFactorySet TAO_Codeset_Manager::wchar_factories_ [private]
 

Definition at line 207 of file Codeset_Manager.h.

Referenced by add_wchar_translator, and ~TAO_Codeset_Manager.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:09:16 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002