Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / Codeset / Codeset_Manager_i.h
blob4a8bf88670aa9d7855941c297de8f01002f22306
1 //======================================================================
2 /*
3 * @file Codeset_Manager_i.h
5 * Interface for the TAO CodeSet Manager.
7 * @author Phil Mesnier
8 */
9 //======================================================================
11 #ifndef TAO_CODESET_MANAGER_I_H
12 #define TAO_CODESET_MANAGER_I_H
14 #include /**/ "ace/pre.h"
16 #include "tao/CONV_FRAMEC.h"
17 #include "tao/Codeset_Manager.h"
18 #include "tao/Codeset/codeset_export.h"
19 #include "tao/Codeset/Codeset_Descriptor.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
22 # pragma once
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
25 #include "ace/Unbounded_Set.h"
26 #include "ace/Dynamic_Service_Dependency.h"
28 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
30 class TAO_Profile;
31 class TAO_Transport;
32 class TAO_Operation_Details;
34 class TAO_ServerRequest;
35 class TAO_Tagged_Components;
36 class TAO_Codeset_Descriptor;
38 // ****************************************************************
40 /**
41 * @class TAO_Codeset_Manager
43 * @brief The encapsulation of logic for codeset negotiation
45 * The Codeset Manager is owned by the ORB_Core, initialized through Resource
46 * Factory configuration options. The codeset manager participates in profile
47 * creation by servers and connection establishment by clients. The involvement
48 * is necessary to supply a codeset component to the profile including for both
49 * chars and wide chars the native code set and any conversion code sets for
50 * which translators are available. The codeset manager is also responsible for
51 * determining the transmission codesets based an the local and remote codeset
52 * information. The transmission codesets are communicated via a service
53 * context attached to the first request sent on the new connection.
56 class TAO_Codeset_Export TAO_Codeset_Manager_i :
57 public TAO_Codeset_Manager
59 public:
60 /// NCS for char is defaulted to ISO 8859-1:1987; Latin Alphabet
61 /// No. 1
62 static CONV_FRAME::CodeSetId default_char_codeset;
63 /// NCS for wchar is defaulted to 0 (not used), but people wishing
64 /// to provide a non-compliant default wchar codeset may do so.
65 static CONV_FRAME::CodeSetId default_wchar_codeset;
67 TAO_Codeset_Manager_i ();
68 ~TAO_Codeset_Manager_i () = default;
70 /// Called by an object of TAO_Acceptor to set NCS and CCS values
71 /// for Char/Wchar in to the Object Reference.
72 void set_codeset (TAO_Tagged_Components&) const;
73 ///
74 /// Called from an object of "TAO_GIOP_Invocation" to set TCS on the
75 /// Transport
76 void set_tcs (TAO_Profile &theProfile, TAO_Transport &);
78 /// Called from an Object of TAO_Messaging for every request at
79 /// server side to process service context and set TCS for
80 /// Char/WChar
81 void process_service_context (TAO_ServerRequest &);
83 /// Called by a client object to generate service context
84 /// at this time Transport has the TCS for Char and WChar
85 void generate_service_context (TAO_Operation_Details&, TAO_Transport & );
87 /// Called by the resource factory to signify the end of
88 /// initialization. This will traverse the list of named codeset
89 /// translator factories and add any of those that have a native
90 /// codeset id matching the manager's native codeset id.
91 void open(TAO_ORB_Core& core);
93 virtual TAO_Codeset_Descriptor_Base *char_codeset_descriptor ();
94 virtual TAO_Codeset_Descriptor_Base *wchar_codeset_descriptor ();
96 private:
97 // Compute the TCS for Char/WChar asper the CORBA Specification
98 CONV_FRAME::CodeSetId computeTCS (CONV_FRAME::CodeSetComponent &,
99 CONV_FRAME::CodeSetComponent &);
101 // Find CodesetId in the codeset component
102 int isElementOf (CONV_FRAME::CodeSetId,
103 CONV_FRAME::CodeSetComponent & );
105 // find the intersection of CodesetIds between Client and Server CCS
106 CONV_FRAME::CodeSetId intersectionOf (CONV_FRAME::CodeSetComponent &,
107 CONV_FRAME::CodeSetComponent &);
109 // determine compatibility between two codesets via the codeset
110 // registry
111 int isCompatible (CONV_FRAME::CodeSetId, CONV_FRAME::CodeSetId);
113 // traverse the list of codeset factories, populating the list of
114 // conversion codeset values with the translated codeset id from
115 // each factory that has a matching native codeset. Those factories
116 // that do not have a matching codeset are not retained in the list.
117 int init_ccs (TAO_Codeset_Descriptor&,
118 CONV_FRAME::CodeSetComponent&);
120 // get the translator between our ncs_c and the supplied tcs_c
121 TAO_Codeset_Translator_Base * get_char_trans (CONV_FRAME::CodeSetId);
123 // get the translator between our ncs_w and the supplied tcs_w
124 TAO_Codeset_Translator_Base * get_wchar_trans (CONV_FRAME::CodeSetId);
126 TAO_Codeset_Translator_Base * get_translator_i (TAO_Codeset_Descriptor&,
127 CONV_FRAME::CodeSetId);
129 void get_ncs (CONV_FRAME::CodeSetId &ncsc, CONV_FRAME::CodeSetId& ncsw);
131 // The CodeSetComponentInfo struct contains all of the information
132 // regarding the code sets this application recognizes. This is
133 // where the native code set for both char and wchar are stored.
134 CONV_FRAME::CodeSetComponentInfo codeset_info_;
136 TAO_Codeset_Descriptor char_descriptor_;
137 TAO_Codeset_Descriptor wchar_descriptor_;
140 TAO_END_VERSIONED_NAMESPACE_DECL
142 #include /**/ "ace/post.h"
144 #endif /* TAO_CODESET_MANAGER_I_H */