be_init.cpp

Go to the documentation of this file.
00001 // be_init.cpp,v 1.7 2006/06/15 15:09:48 parsons Exp
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                            0);
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   ACE_DECLARE_NEW_CORBA_ENV;
00073   ACE_TRY
00074     {
00075       be_global->orb (CORBA::ORB_init (ac,
00076                                        av,
00077                                        0
00078                                        ACE_ENV_ARG_PARAMETER));
00079       ACE_TRY_CHECK;
00080     }
00081   ACE_CATCHANY
00082     {
00083       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
00084                            ACE_TEXT ("BE_ifr_orb_init"));
00085 
00086       return 1;
00087     }
00088   ACE_ENDTRY;
00089 
00090   return 0;
00091 }
00092 
00093 TAO_IFR_BE_Export void
00094 BE_version (void)
00095 {
00096   ACE_DEBUG ((LM_DEBUG,
00097               "%s %s\n",
00098               ACE_TEXT ("TAO_IFR_BE, version"),
00099               ACE_TEXT (TAO_VERSION)));
00100 }
00101 
00102 TAO_IFR_BE_Export int
00103 BE_init (int &argc, char *argv[])
00104 {
00105   // Initialize BE global data object.
00106   ACE_NEW_RETURN (be_global,
00107                   BE_GlobalData,
00108                   -1);
00109 
00110   int status = BE_save_orb_args (argc, argv);
00111 
00112   if (status != 0)
00113     {
00114       return status;
00115     }
00116 
00117   idl_global->using_ifr_backend (true);
00118 
00119   return BE_ifr_orb_init (argc, argv);
00120 }
00121 
00122 TAO_IFR_BE_Export void
00123 BE_post_init (char *[], long)
00124 {
00125 }
00126 

Generated on Thu Nov 9 14:11:49 2006 for TAO_IFR by doxygen 1.3.6