be_init.cpp

Go to the documentation of this file.
00001 // $Id: be_init.cpp 77620 2007-03-08 21:40:54Z shuston $
00002 
00003 #include "global_extern.h"
00004 #include "be_extern.h"
00005 #include "../../tao/Version.h"
00006 
00007 int
00008 BE_save_orb_args (int &argc, char *argv[])
00009 {
00010   int i = 1;
00011   ACE_CString holder;
00012 
00013   while (i < argc)
00014     {
00015       if (ACE_OS::strncmp (argv[i], "-ORB", 4) == 0)
00016         {
00017           holder += ACE_CString (argv[i]);
00018           holder += " ";
00019 
00020           // Could be another -ORBxxx arg or an IDL compiler arg.
00021           if (*argv[i + 1] == '-')
00022             {
00023               ++i;
00024               continue;
00025             }
00026 
00027           // No-copy constructor.
00028           ACE_CString tmp (argv[i + 1],
00029                            0,
00030                            false);
00031 
00032           // If the arg ends with either .idl or .pidl, we're done.
00033 
00034           size_t len = tmp.length ();
00035           ssize_t pos = tmp.find (".idl");
00036 
00037           if (len - pos == 4)
00038             {
00039               return 0;
00040             }
00041 
00042           pos = tmp.find (".pidl");
00043 
00044           if (len - pos == 5)
00045             {
00046               return 0;
00047             }
00048 
00049           // If we're here, the next arg goes with the preceding -ORBxxx.
00050           holder += tmp;
00051           holder += " ";
00052           i += 2;
00053         }
00054       else
00055         {
00056           ++i;
00057         }
00058     }
00059 
00060   be_global->orb_args (holder);
00061 
00062   return 0;
00063 }
00064 
00065 // 'ac' must be passed in by reference, because it is also
00066 // passed by reference to ORB_init, which may modify it.
00067 // After BE_ifr_init returns to main() the modified argc
00068 // must be passed to DRV_parse_args().
00069 int
00070 BE_ifr_orb_init (int &ac, char *av[])
00071 {
00072   try
00073     {
00074       be_global->orb (CORBA::ORB_init (ac,
00075                                        av,
00076                                        0));
00077     }
00078   catch (const CORBA::Exception& ex)
00079     {
00080       ex._tao_print_exception (ACE_TEXT ("BE_ifr_orb_init"));
00081 
00082       return 1;
00083     }
00084 
00085   return 0;
00086 }
00087 
00088 TAO_IFR_BE_Export void
00089 BE_version (void)
00090 {
00091   ACE_DEBUG ((LM_DEBUG,
00092               "%s %s\n",
00093               ACE_TEXT ("TAO_IFR_BE, version"),
00094               ACE_TEXT (TAO_VERSION)));
00095 }
00096 
00097 TAO_IFR_BE_Export int
00098 BE_init (int &argc, char *argv[])
00099 {
00100   // Initialize BE global data object.
00101   ACE_NEW_RETURN (be_global,
00102                   BE_GlobalData,
00103                   -1);
00104 
00105   int status = BE_save_orb_args (argc, argv);
00106 
00107   if (status != 0)
00108     {
00109       return status;
00110     }
00111 
00112   idl_global->using_ifr_backend (true);
00113 
00114   return BE_ifr_orb_init (argc, argv);
00115 }
00116 
00117 TAO_IFR_BE_Export void
00118 BE_post_init (char *[], long)
00119 {
00120 }
00121 

Generated on Sun Jan 27 16:31:52 2008 for TAO_IFR by doxygen 1.3.6