00001 // This may look like C, but it's really -*- C++ -*- 00002 00003 //====================================================================== 00004 /* 00005 * @file Codeset_Manager_i.h 00006 * 00007 * $Id: Codeset_Manager_i.h 84860 2009-03-17 10:17:38Z johnnyw $ 00008 * 00009 * Interface for the TAO CodeSet Manager. 00010 * 00011 * @author Phil Mesnier 00012 */ 00013 //====================================================================== 00014 00015 #ifndef TAO_CODESET_MANAGER_I_H 00016 #define TAO_CODESET_MANAGER_I_H 00017 00018 #include /**/ "ace/pre.h" 00019 00020 #include "tao/CONV_FRAMEC.h" 00021 #include "tao/Codeset_Manager.h" 00022 #include "tao/Codeset/codeset_export.h" 00023 #include "tao/Codeset/Codeset_Descriptor.h" 00024 00025 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00026 # pragma once 00027 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00028 00029 #include "ace/Unbounded_Set.h" 00030 #include "ace/Dynamic_Service_Dependency.h" 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 class TAO_Profile; 00035 class TAO_Transport; 00036 class TAO_Operation_Details; 00037 00038 class TAO_ServerRequest; 00039 class TAO_Tagged_Components; 00040 class TAO_Codeset_Descriptor; 00041 00042 // **************************************************************** 00043 00044 /** 00045 * @class TAO_Codeset_Manager 00046 * 00047 * @brief The encapsulation of logic for codeset negotiation 00048 * 00049 * The Codeset Manager is owned by the ORB_Core, initialized through Resource 00050 * Factory configuration options. The codeset manager participates in profile 00051 * creation by servers and connection establishment by clients. The involvement 00052 * is necessary to supply a codeset component to the profile including for both 00053 * chars and wide chars the native code set and any conversion code sets for 00054 * which translators are available. The codeset manager is also responsible for 00055 * determining the transmission codesets based an the local and remote codeset 00056 * information. The transmission codesets are communicated via a service 00057 * context attached to the first request sent on the new connection. 00058 * 00059 */ 00060 00061 class TAO_Codeset_Export TAO_Codeset_Manager_i : 00062 public TAO_Codeset_Manager 00063 { 00064 00065 public: 00066 /// NCS for char is defaulted to ISO 8859-1:1987; Latin Alphabet 00067 /// No. 1 00068 static CONV_FRAME::CodeSetId default_char_codeset; 00069 /// NCS for wchar is defaulted to 0 (not used), but people wishing 00070 /// to provide a non-compliant default wchar codeset may do so. 00071 static CONV_FRAME::CodeSetId default_wchar_codeset; 00072 00073 TAO_Codeset_Manager_i (void); 00074 ~TAO_Codeset_Manager_i (void); 00075 00076 /// Called by an object of TAO_Acceptor to set NCS and CCS values 00077 /// for Char/Wchar in to the Object Reference. 00078 void set_codeset (TAO_Tagged_Components& ) const; 00079 /// 00080 /// Called from an object of "TAO_GIOP_Invocation" to set TCS on the 00081 /// Transport 00082 void set_tcs (TAO_Profile &theProfile, TAO_Transport &); 00083 00084 /// Called from an Object of TAO_Messaging for every request at 00085 /// server side to process service context and set TCS for 00086 /// Char/WChar 00087 void process_service_context (TAO_ServerRequest &); 00088 00089 /// Called by a client object to generate service context 00090 /// at this time Transport has the TCS for Char and WChar 00091 void generate_service_context (TAO_Operation_Details&, TAO_Transport & ); 00092 00093 /// Called by the resource factory to signify the end of 00094 /// initialization. This will traverse the list of named codeset 00095 /// translator factories and add any of those that have a native 00096 /// codeset id matching the manager's native codeset id. 00097 void open(TAO_ORB_Core& core); 00098 00099 virtual TAO_Codeset_Descriptor_Base *char_codeset_descriptor (void); 00100 virtual TAO_Codeset_Descriptor_Base *wchar_codeset_descriptor (void); 00101 00102 private: 00103 // Compute the TCS for Char/WChar asper the CORBA Specification 00104 CONV_FRAME::CodeSetId computeTCS (CONV_FRAME::CodeSetComponent &, 00105 CONV_FRAME::CodeSetComponent &); 00106 00107 // Find CodesetId in the codeset component 00108 int isElementOf (CONV_FRAME::CodeSetId, 00109 CONV_FRAME::CodeSetComponent & ); 00110 00111 // find the intersection of CodesetIds between Client and Server CCS 00112 CONV_FRAME::CodeSetId intersectionOf (CONV_FRAME::CodeSetComponent &, 00113 CONV_FRAME::CodeSetComponent &); 00114 00115 // determine compatibility between two codesets via the codeset 00116 // registry 00117 int isCompatible (CONV_FRAME::CodeSetId, CONV_FRAME::CodeSetId); 00118 00119 // traverse the list of codeset factories, populating the list of 00120 // conversion codeset values with the translated codeset id from 00121 // each factory that has a matching native codeset. Those factories 00122 // that do not have a matching codeset are not retained in the list. 00123 int init_ccs (TAO_Codeset_Descriptor&, 00124 CONV_FRAME::CodeSetComponent&); 00125 00126 // get the translator between our ncs_c and the supplied tcs_c 00127 TAO_Codeset_Translator_Base * get_char_trans (CONV_FRAME::CodeSetId); 00128 00129 // get the translator between our ncs_w and the supplied tcs_w 00130 TAO_Codeset_Translator_Base * get_wchar_trans (CONV_FRAME::CodeSetId); 00131 00132 TAO_Codeset_Translator_Base * get_translator_i (TAO_Codeset_Descriptor&, 00133 CONV_FRAME::CodeSetId); 00134 00135 void get_ncs (CONV_FRAME::CodeSetId &ncsc, CONV_FRAME::CodeSetId& ncsw); 00136 00137 // The CodeSetComponentInfo struct contains all of the information 00138 // regarding the code sets this application recognizes. This is 00139 // where the native code set for both char and wchar are stored. 00140 CONV_FRAME::CodeSetComponentInfo codeset_info_; 00141 00142 TAO_Codeset_Descriptor char_descriptor_; 00143 TAO_Codeset_Descriptor wchar_descriptor_; 00144 }; 00145 00146 TAO_END_VERSIONED_NAMESPACE_DECL 00147 00148 #include /**/ "ace/post.h" 00149 00150 #endif /* TAO_CODESET_MANAGER_I_H */