client/protocol/corba/CompatibleCorba.h

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------
00002 Name:      CompatibleCorba.h
00003 Project:   xmlBlaster.org
00004 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
00005 Comment:   Helper header to encapsulate all corba-implementor specific stuff
00006 Author:    <Michele Laghi> laghi@swissinfo.org
00007 ----------------------------------------------------------------------------*/
00008 
00009 #ifndef _COMPATIBLECORBA_H
00010 #define _COMPATIBLECORBA_H
00011 
00012 #include <string>
00013 
00014 /*
00015  * Implementor specific macros (for includes etc.)
00016  * The invocation of this header is done maximum one time per compilation unit. Since the server side 
00017  * will include different files than the client side (see SERVER_HEADER and CLIENT_HEADER) this might cause
00018  * problems in units acting as a server and a client. In such cases invoke it first as a server.
00019  */
00020 
00021 /******************************************************************
00022  *                      OMNIORB (Nils.Nilson@in-gmbh.de)
00023  ******************************************************************/
00024 #if defined(XMLBLASTER_OMNIORB)
00025 #define ORB_IS_THREAD_SAFE        true
00026 #ifdef SERVER_HEADER
00027 #  include <generated/xmlBlaster.h>
00028 #else
00029 #  include <generated/xmlBlaster.h> // client side include header
00030 #endif
00031 #define CORBA_HEADER              <omniORB4/CORBA.h>
00032 //#define CORBA_HEADER              <omniORB3/CORBA.h>
00033 #define COSCONTAINEMENT           <not_implemented.h>
00034 #define COSOBJECTIDENTITY         <not_implemented.h>
00035 #define COSREFERENCE              <not_implemented.h>
00036 #define COSEVENTCHANNELADMIN      <not_implemented.h>
00037 #define COSEVENTCOMM              <not_implemented.h>
00038 #define COSRELATIONSHIPS          <not_implemented.h>
00039 #define COSGRAPHS                 <not_implemented.h>
00040 #define COSTIME                   <not_implemented.h>
00041 #define COSGRAPHEXTENTSION        <not_implemented.h>
00042 #define COSTRADING                <not_implemented.h>
00043 #define COSNAMING                 <omniORB4/Naming.hh>
00044 //#define COSNAMING                 <omniORB3/Naming.hh>
00045 #define COSPROPERTY               <not_implemented.h>
00046 #define COSTRADINGREPOS           <not_implemented.h>
00047 #define COSTYPEDEVENTCHANNELADMIN <not_implemented.h>
00048 #define COSTYPEDEVENT             <not_implemented.h>
00049 #define UPDATE_THROW_SPECIFIER    
00050 #define PING_THROW_SPECIFIER      
00051 
00052 /******************************************************************
00053  *                      ORBACUS (OB-4.03) and (OB-4.1.0)
00054  ******************************************************************/
00055 #elif defined(XMLBLASTER_ORBACUS)
00056 #define ORB_IS_THREAD_SAFE        true
00057 #define CORBA_HEADER              <OB/CORBA.h>
00058 #define COSCONTAINEMENT           <not_implemented.h>
00059 #define COSOBJECTIDENTITY         <not_implemented.h>
00060 #define COSREFERENCE              <not_implemented.h>
00061 #define COSEVENTCHANNELADMIN      <OB/CosEventChannelAdmin.h>
00062 #define COSEVENTCOMM              <OB/CosEventComm.h>
00063 #define COSRELATIONSHIPS          <not_implemented.h>
00064 #define COSGRAPHS                 <not_implemented.h>
00065 #define COSTIME                   <not_implemented.h>
00066 #define COSGRAPHEXTENTSION        <not_implemented.h>
00067 #define COSTRADING                <not_implemented.h>
00068 #define COSNAMING                 <OB/CosNaming.h>
00069 #define COSPROPERTY               <OB/CosProperty.h>
00070 #define COSTRADINGREPOS           <not_implemented.h>
00071 #define COSTYPEDEVENTCHANNELADMIN <OB/CosTypedEventChannelAdmin.h>
00072 #define COSTYPEDEVENT             <OB/CosTypedEventComm.h>
00073 #define UPDATE_THROW_SPECIFIER    
00074 #define PING_THROW_SPECIFIER      
00075 
00076 # include CORBA_HEADER
00077 #ifdef SERVER_HEADER
00078 #  include <generated/xmlBlaster_skel.h>
00079 #else
00080 #  include <generated/xmlBlaster.h> // client side include header
00081 #endif
00082 
00083 /*****************************************************************
00084  *                     MICO (ver. 2.3.1)
00085  *****************************************************************/
00086 #elif defined(XMLBLASTER_MICO)
00087 # include <mico/version.h>
00088 # if MICO_BIN_VERSION < 0x02030b  // mico older MICO_VERSION 2.3.11
00089 #   define ORB_IS_THREAD_SAFE   false
00090 #   define MICO_INCLUDE_PREAFIX mico
00091 # else
00092 #   define ORB_IS_THREAD_SAFE   true
00093 #   define MICO_INCLUDE_PREAFIX coss
00094 # endif
00095 #ifdef SERVER_HEADER
00096 #  include <generated/xmlBlaster.h>
00097 #else
00098 #  include <generated/xmlBlaster.h> // client side include header
00099 #endif
00100 #define CORBA_HEADER              <CORBA.h>
00101 #define COSCONTAINEMENT           <MICO_INCLUDE_PREAFIX/CosContainment.h>
00102 #define COSOBJECTIDENTITY         <MICO_INCLUDE_PREAFIX/CosObjectIdentity.h>
00103 #define COSREFERENCE              <MICO_INCLUDE_PREAFIX/CosReference.h>
00104 #define COSEVENTCHANNELADMIN      <MICO_INCLUDE_PREAFIX/CosEventChannelAdmin.h>
00105 #define COSEVENTCOMM              <MICO_INCLUDE_PREAFIX/CosEventComm.h>
00106 #define COSRELATIONSHIPS          <MICO_INCLUDE_PREAFIX/CosRelationships.h>
00107 #define COSGRAPHS                 <MICO_INCLUDE_PREAFIX/CosGraphs.h>
00108 #define COSTIME                   <MICO_INCLUDE_PREAFIX/CosTime.h>
00109 #define COSGRAPHSEXTENSION        <MICO_INCLUDE_PREAFIX/CosGraphsExtension.h>
00110 #define COSTRADING                <MICO_INCLUDE_PREAFIX/CosTrading.h>
00111 #define COSNAMING                 <MICO_INCLUDE_PREAFIX/CosNaming.h>
00112 #define COSPROPERTY               <not_implemented.h>
00113 #define COSTRADINGREPOS           <MICO_INCLUDE_PREAFIX/CosTradingRepos.h>
00114 #define COSTYPEDEVENTCHANNELADMIN <not_implemented.h>
00115 #define COSTYPEDEVENT             <not_implemented.h>
00116 #define UPDATE_THROW_SPECIFIER    
00117 #define PING_THROW_SPECIFIER      
00118 
00119 /*****************************************************************
00120  *                     TAO (ver. 2.3.1)
00121  *****************************************************************/
00122 #elif defined(XMLBLASTER_TAO)
00123 #define ORB_IS_THREAD_SAFE        true
00124 #ifdef SERVER_HEADER
00125 #  include <generated/xmlBlasterS.h>
00126 #else
00127 #  include <generated/xmlBlasterC.h> // client side include header
00128 #endif
00129 #define CORBA_HEADER              <tao/corba.h>
00130 #define COSCONTAINEMENT           <not_implemented.h> // what is this ??
00131 #define COSOBJECTIDENTITY         <not_implemented.h>
00132 #define COSREFERENCE              <not_implemented.h>
00133 #define COSEVENTCHANNELADMIN      <orbsvcs/CosEventChannelAdminC.h>
00134 #define COSEVENTCOMM              <not_implemented.h>
00135 #define COSRELATIONSHIPS          <not_implemented.h>
00136 #define COSGRAPHS                 <not_implemented.h>
00137 #define COSTIME                   <orbsvcs/CosTimeC.h>
00138 #define COSGRAPHSEXTENSION        <not_implemented.h>
00139 #define COSTRADING                <not_implemented.h>
00140 #define COSNAMING                 <orbsvcs/CosNamingC.h>
00141 #define COSPROPERTY               <orbsvcs/CosPropertyServiceC.h>
00142 #define COSTRADINGREPOS           <not_implemented.h>
00143 #define COSTYPEDEVENTCHANNELADMIN <not_implemented.h>
00144 #define COSTYPEDEVENT             <not_implemented.h>
00145 #define UPDATE_THROW_SPECIFIER    ACE_THROW_SPEC (( CORBA::SystemException, serverIdl::XmlBlasterException ))
00146 #define PING_THROW_SPECIFIER      ACE_THROW_SPEC (( CORBA::SystemException ))
00147 
00148 
00149 /*****************************************************************
00150  *                     ORBIX 2000 (ver. 2.0 )
00151  *****************************************************************/
00152 #elif defined(XMLBLASTER_ORBIX)
00153 #define ORB_IS_THREAD_SAFE        true
00154 #ifdef SERVER_HEADER
00155 #  include <generated/xmlBlasterS.h>
00156 #  include <generated/xmlBlaster.h> // client side include header
00157 #else
00158 #  include <generated/xmlBlaster.h> // client side include header
00159 #endif
00160 #define CORBA_HEADER              <omg/orb.hh> 
00161 #define COSCONTAINEMENT           <not_implemented.h>
00162 #define COSOBJECTIDENTITY         <not_implemented.h>
00163 #define COSREFERENCE              <not_implemented.h>
00164 #define COSEVENTCHANNELADMIN      <omg/CosEventChannelAdmin.hh>
00165 #define COSEVENTCOMM              <omg/CosEventComm.hh>
00166 #define COSRELATIONSHIPS          <not_implemented.h>
00167 #define COSGRAPHS                 <not_implemented.h>
00168 #define COSTIME                   <not_implemented.h>
00169 #define COSGRAPHSEXTENSION        <not_implemented.h>
00170 #define COSTRADING                <omg/CosTrading.hh>
00171 #define COSNAMING                 <omg/CosNaming.hh>
00172 #define COSPROPERTY               <not_implemented.h>
00173 #define COSTRADINGREPOS           <omg/CosTradingRepos.hh>
00174 #define COSTYPEDEVENTCHANNELADMIN <not_implemented.h>
00175 #define COSTYPEDEVENT             <omg/CosTypedEventComm.hh>
00176 #define UPDATE_THROW_SPECIFIER    IT_THROW_DECL ((CORBA::SystemException))
00177 #define PING_THROW_SPECIFIER      IT_THROW_DECL ((CORBA::SystemException))
00178 
00179 #else
00180 #  error "You must #define XMLBLASTER_OMNIORB, XMLBLASTER_ORBACUS, XMLBLASTER_MICO, XMLBLASTER_TAO or XMLBLASTER_ORBIX in xmlBlaster/src/c++/client/protocol/corba/CompatibleCorba.h"
00181 #endif
00182 
00183 /**************************************************************
00184  *         GENERAL STUFF COMMON TO ALL IMPLEMENTORS 
00185  **************************************************************/
00186 #include CORBA_HEADER
00187 #undef   CORBA_HEADER
00188 
00189 #endif // _COMPATIBLECORBA_H
00190 
00191 std::string to_string(const CORBA::Exception &ex);
00192 
00193 
00194 # ifdef XBL_IDL_WITH_WSTRING
00195    // Note: This is switched off as the mico C++ client was loosing its ConnectQos wstring during send
00196    //       Marcel 2006/04
00197    // CORBA::WChar is equivalent to wchar_t
00198    void string2wstring(std::wstring &dest,const std::string &src);
00199    void wstring2string(std::string &dest,const std::wstring &src);
00200    std::wstring toWstring(const std::string &src);
00201    std::string toString(const std::wstring &src);
00202    // If changing in xmlBlaster.idl 
00203    //    'string' to 'wstring'  (typedef wstring XmlType;)
00204    //    This will lead to CORBA::WString_var
00205    std::string corbaWStringToString(const CORBA::WString_var &src);
00206    CORBA::WString_var toCorbaWString(const std::string &src);
00207 #else
00208    std::string corbaWStringToString(const char *src);
00209    const char* toCorbaWString(const std::string &src);
00210 # endif
00211