00001 // -*- C++ -*- 00002 00003 // =================================================================== 00004 /** 00005 * @file Codeset_Translator_Factory_T.h 00006 * 00007 * $Id: Codeset_Translator_Factory_T.h 71473 2006-03-10 07:19:20Z jtc $ 00008 * 00009 * @author Phil Mesnier <mesnier_p@ociweb.com> 00010 */ 00011 // =================================================================== 00012 00013 #ifndef TAO_CODESET_TRANSLATOR_FACTORY_T_H 00014 #define TAO_CODESET_TRANSLATOR_FACTORY_T_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/Codeset/Codeset_Translator_Factory.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 00025 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 /** 00028 * @class TAO_Codeset_Translator_Factory_T 00029 * 00030 * @brief Template for translator factory classes. 00031 * 00032 * The template argument is the actual translator class. The factory creates an 00033 * instance of the translator during initialization. Other than that, the 00034 * template returns the actual values for the native and translated codeset 00035 * ids, and performs the translator assignment to the CDR objects as needed. 00036 */ 00037 00038 template<class NCS_TO_TCS> 00039 class TAO_Codeset_Translator_Factory_T 00040 : public TAO_Codeset_Translator_Factory 00041 { 00042 public: 00043 00044 TAO_Codeset_Translator_Factory_T (); 00045 virtual ~TAO_Codeset_Translator_Factory_T (); 00046 00047 /// initialize the factory service object. Instantiates the translator. 00048 int init( int argc, ACE_TCHAR* argv[]); 00049 00050 /// ncs returns the translator's native codeset ID. 00051 CONV_FRAME::CodeSetId ncs () const; 00052 /// tcs returns the translator's transmission codeset ID. 00053 CONV_FRAME::CodeSetId tcs () const; 00054 00055 /// Assign the translator to the input CDR. The inherited assign_i is used 00056 /// to assign either a char or wchar translator, depending on the base type 00057 /// of NCS_TO_TCS. A null input CDR is permitted, in which case assign is a 00058 /// no-op. 00059 virtual void assign (TAO_InputCDR *) const; 00060 /// Assign the translator to the output CDR. The inherited assign_i is used 00061 /// to assign either a char or wchar translator, depending on the base type 00062 /// of NCS_TO_TCS. A null output CDR is permitted, in which case assign is a 00063 /// no-op. 00064 virtual void assign (TAO_OutputCDR *) const; 00065 00066 private: 00067 NCS_TO_TCS *translator_; 00068 }; 00069 00070 TAO_END_VERSIONED_NAMESPACE_DECL 00071 00072 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00073 # pragma once 00074 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00075 00076 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00077 #include "tao/Codeset/Codeset_Translator_Factory_T.cpp" 00078 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00079 00080 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00081 #pragma implementation ("Codeset_Translator_Factory_T.cpp") 00082 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00083 00084 #include /**/ "ace/post.h" 00085 #endif /* TAO_Codeset_Translator_Factory_T */