00001 00002 //============================================================================= 00003 /** 00004 * @file Codeset_Translator_Factory_T.cpp 00005 * 00006 * $Id: Codeset_Translator_Factory_T.cpp 80140 2007-11-30 00:40:17Z jtc $ 00007 * 00008 * The template for creating a particular instance of a codeset translator 00009 * 00010 * 00011 * @author Phil Mesnier <mesnier_p@ociweb.com> 00012 */ 00013 //============================================================================= 00014 00015 #ifndef TAO_CODESET_TRANSLATOR_FACTORY_T_CPP 00016 #define TAO_CODESET_TRANSLATOR_FACTORY_T_CPP 00017 00018 #include "tao/Codeset/Codeset_Translator_Factory_T.h" 00019 #include "tao/debug.h" 00020 #include "tao/CDR.h" 00021 #include "ace/Log_Msg.h" 00022 00023 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00024 00025 template<class NCS_TO_TCS> 00026 TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::TAO_Codeset_Translator_Factory_T () : 00027 translator_(0) 00028 { 00029 } 00030 00031 template<class NCS_TO_TCS> 00032 TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::~TAO_Codeset_Translator_Factory_T () 00033 { 00034 delete translator_; 00035 } 00036 00037 template<class NCS_TO_TCS> 00038 int 00039 TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::init (int argc, ACE_TCHAR* argv[]) 00040 { 00041 this->TAO_Codeset_Translator_Factory::init (argc,argv); 00042 ACE_NEW_RETURN (translator_,NCS_TO_TCS,-1); 00043 if( TAO_debug_level > 0 ) 00044 ACE_DEBUG((LM_DEBUG, "TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::init() entered\n")); 00045 return 0; 00046 } 00047 00048 // ncs & tcs values set at compile time as a result of instantiating the 00049 // template. 00050 template<class NCS_TO_TCS> 00051 CONV_FRAME::CodeSetId 00052 TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::ncs () const 00053 { 00054 return this->translator_->ncs(); 00055 } 00056 00057 template<class NCS_TO_TCS> 00058 CONV_FRAME::CodeSetId 00059 TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::tcs () const 00060 { 00061 return this->translator_->tcs(); 00062 } 00063 00064 // Assign either a reference to teh existing translator or a new translator 00065 // for input CDR streams 00066 template<class NCS_TO_TCS> 00067 void 00068 TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::assign (TAO_InputCDR *cdr) const 00069 { 00070 if (cdr) 00071 { 00072 this->assign_i(cdr,this->translator_); 00073 } 00074 } 00075 00076 // Assign either a reference to teh existing translator or a new translator 00077 // for input CDR streams 00078 template<class NCS_TO_TCS> 00079 void 00080 TAO_Codeset_Translator_Factory_T<NCS_TO_TCS>::assign (TAO_OutputCDR *cdr) const 00081 { 00082 if (cdr) 00083 { 00084 this->assign_i(cdr,this->translator_); 00085 } 00086 } 00087 00088 TAO_END_VERSIONED_NAMESPACE_DECL 00089 00090 #endif /* TAO_CODESET_TRANSLATOR_FACTORY_T_CPP */