当前位置: 首页>>代码示例>>C++>>正文


C++ ORB_var::register_value_factory方法代码示例

本文整理汇总了C++中corba::ORB_var::register_value_factory方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_var::register_value_factory方法的具体用法?C++ ORB_var::register_value_factory怎么用?C++ ORB_var::register_value_factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在corba::ORB_var的用法示例。


在下文中一共展示了ORB_var::register_value_factory方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

int
main (int argc, char** argv)
{
	std::cout << "Qedo Assembly Factory" << std::endl;

	CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

	//
	// register valuetype factories
	//
	CORBA::ValueFactoryBase_var factory;
	factory = new Qedo::CookieFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/Cookie:1.0", factory);
	factory = new Qedo::ConfigValueFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/ConfigValue:1.0", factory);

	Qedo::AssemblyFactoryImpl* assembly_factory = new Qedo::AssemblyFactoryImpl(orb);

	try
	{
		assembly_factory->initialize();
	}
	catch (Qedo::AssemblyFactoryImpl::CannotInitialize&)
	{
		std::cerr << "Cannot initialize Assembly Factory... exiting." << std::endl;
		orb->destroy();
		exit (1);
	}

	orb->run();
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:31,代码来源:assf.cpp

示例2:

/**
 * the executable starts a HomeFinder
 */
int
main (int argc, char** argv)
{
	std::cout << "Qedo Home Finder" << std::endl;

	CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

	//
	// register valuetype factories
	//
	CORBA::ValueFactoryBase* factory;
	factory = new Qedo::CookieFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/Cookie:1.0", factory);

	Qedo::HomeFinderImpl* home_finder = new Qedo::HomeFinderImpl(orb);

	try
	{
		home_finder->initialize();
	}
	catch (Qedo::HomeFinderImpl::CannotInitialize&)
	{
		std::cerr << "Cannot initialize Home Finder... exiting." << std::endl;
		orb->destroy();
		exit (1);
	}

	NORMAL_OUT("Qedo Home Finder is up and running ...")
	orb->run();
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:34,代码来源:HomeFinder.cpp

示例3: ExpandEnvironmentStrings

/**
 * start the server for the assembly factory object
 */
int
main (int argc, char** argv)
{
	std::cout << "Qedo Assembly Factory " << QEDO_VERSION << std::endl;

	// get the qedo dir
#ifdef _WIN32
	TCHAR tchBuffer[256];
	LPTSTR lpszSystemInfo = tchBuffer;
	DWORD dwResult = ExpandEnvironmentStrings("%QEDO%", lpszSystemInfo, 256); 
	Qedo::g_qedo_dir.append(lpszSystemInfo);
#else
	char *e = getenv("QEDO");
	if(e) Qedo::g_qedo_dir.append(e);
#endif

	CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

	//
	// register valuetype factories
	//
	CORBA::ValueFactoryBase* factory;
	factory = new Qedo::CookieFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/Cookie:1.0", factory);
	factory = new Qedo::ConfigValueFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/ConfigValue:1.0", factory);

	Qedo::AssemblyFactoryImpl* assembly_factory = new Qedo::AssemblyFactoryImpl(orb);

	try
	{
		assembly_factory->initialize();
	}
	catch (Qedo::AssemblyFactoryImpl::CannotInitialize&)
	{
		std::cerr << "Cannot initialize Assembly Factory... exiting." << std::endl;
		orb->destroy();
		exit (1);
	}
	std::cout << "Qedo Assembly Factory Server is up and running ...\n";
	orb->run();
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:46,代码来源:qassf.cpp

示例4:

//
// entry point
//
::Components::HomeExecutorBase_ptr
create_CutleryHomeE(void)
{
// BEGIN USER INSERT SECTION create_CutleryHome
	int dummy = 0;
	CORBA::ORB_var orb = CORBA::ORB_init (dummy, 0);

	CORBA::ValueFactoryBase* oldFact;
    oldFact = orb->register_value_factory ("IDL:omg.org/Components/Cookie:1.0", new dinner::CookieFactory_impl());
// END USER INSERT SECTION create_CutleryHome

    return new ::dinner::CutleryHomeImpl();
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:16,代码来源:dinner_CutleryImpl.cpp

示例5: MessageFactory

int
ACE_TMAIN (
  int        argc,
  ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

      MessageFactory *mf = new MessageFactory ();
      CORBA::String_var id = _tc_Message->id ();

      ACE_DEBUG ((LM_DEBUG, "Registering factory reference\n"));
      orb->register_value_factory (id.in (), mf);

      ACE_DEBUG ((LM_DEBUG, "Unregistering factory reference\n"));
      orb->unregister_value_factory (id.in ());

      ACE_DEBUG ((LM_DEBUG, "Value factory destructor flag: %i\n", MessageFactory::destructorInvoked_));

      ACE_DEBUG ((LM_DEBUG, "Actively removing reference\n"));
      mf->_remove_ref ();

      ACE_DEBUG ((LM_DEBUG, "Value factory destructor flag: %i\n", MessageFactory::destructorInvoked_));

      ACE_DEBUG ((LM_DEBUG, "Shutting down / destroying ORB\n"));
      orb->shutdown (true);
      orb->destroy ();

      if (MessageFactory::destructorInvoked_ == 1)
        {
          ACE_DEBUG ((LM_ERROR, "Test passed: value factory destructor was invoked as expected\n"));
          return 0;
        }
      else
        {
          ACE_DEBUG ((LM_ERROR, "Test failed: value factory destructor was not invoked\n"));
          return 1;
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("CORBA exception caught during execution");
      return -1;
    }
  catch (...)
    {
      ACE_DEBUG ((LM_ERROR, "Non-CORBA exception caught during execution"));
      return -1;
    }
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:51,代码来源:client.cpp

示例6:

//
// entry point
//
::Components::HomeExecutorBase_ptr
create_ObserverHomeE(void)
{
// BEGIN USER INSERT SECTION create_ObserverHome
	// This is a preliminary hack to register the valuetype factories
	int dummy = 0;
	CORBA::ORB_var orb = CORBA::ORB_init (dummy, 0);

	CORBA::ValueFactoryBase_var oldFact;
	oldFact = orb->register_value_factory ("IDL:dinner/PhilosopherState:1.0", new dinner::PhilosopherStateFactory_impl() );
// END USER INSERT SECTION create_ObserverHome

    return new ::dinner::ObserverHomeImpl();
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:17,代码来源:dinner_ObserverImpl.cpp

示例7:

//
// cleaner object for a ValueFactory
// 
ValueFactoryCleaner::ValueFactoryCleaner (class CORBA::ValueFactoryBase* factory, char* repid)
: factory_ (factory), is_registered_(false), repid_(repid)
{
	int dummy = 0;
    CORBA::ORB_var orb = CORBA::ORB_init (dummy, 0);

	// check whether there is already a factory
	if (orb->lookup_value_factory( repid ))
	{
		DEBUG_OUT3("..... factory for ", repid, " already registered");
	}
	else
	{
		DEBUG_OUT2( "..... register factory for ", repid );
		orb->register_value_factory( repid, factory_ );
		is_registered_ = true;
	}
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:21,代码来源:RefCountBase.cpp

示例8: sigemptyset

/**
 * start the server for the assembly factory object
 */
int
main (int argc, char** argv)
{
	std::cout << "Qedo Assembly Factory " << QEDO_VERSION << std::endl;

	for (int i = 1; i < argc; i++)
	{
		if (! strcmp (argv[i], "--verbose"))
		{
			Qedo::debug_output = true;
		}
	}

	//
	// get the qedo dir
	//
	Qedo::g_qedo_dir = Qedo::getEnvironment( "QEDO" );
	if(Qedo::g_qedo_dir == "")
	{
	    std::cout << "Missing Environment Variable QEDO" << std::endl;
	    Qedo::g_qedo_dir.append("./");
	}
	std::cout << "..... Qedo directory is " << Qedo::g_qedo_dir << std::endl;

	//
	// init ORB
	//
	orb = CORBA::ORB_init (argc, argv);

	//
	// register valuetype factories
	//
	CORBA::ValueFactoryBase* factory;
	factory = new Qedo::CookieFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/Cookie:1.0", factory);
	factory = new Qedo::ConfigValueFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/ConfigValue:1.0", factory);

	Qedo::AssemblyFactoryImpl* assembly_factory = new Qedo::AssemblyFactoryImpl(orb);

	try
	{
		assembly_factory->initialize();
	}
	catch (Qedo::AssemblyFactoryImpl::CannotInitialize&)
	{
		std::cerr << "Cannot initialize Assembly Factory... exiting." << std::endl;
		orb->destroy();
		exit (1);
	}

#ifdef HAVE_SIGACTION
	 struct sigaction act;

    /* Assign sig_chld as our SIGINT handler */
    act.sa_handler = handle_sigint;

    /* We don't want to block any other signals in this example */
    sigemptyset(&act.sa_mask);

    /*
     * Make these values effective. If we were writing a real 
     * application, we would probably save the old value instead of 
     * passing NULL.
     */
    if (sigaction(SIGINT, &act, NULL) < 0) 
    {
		 std::cerr << "sigaction failed" << std::endl;
        return 1;
    }
#else
	signal ( SIGINT, handle_sigint );
#endif

	std::cout << "Qedo Assembly Factory Server is up and running ...\n";
	orb->run();
	return 0;
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:81,代码来源:qassf.cpp

示例9: catch

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  int status = 0;

  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      ::Test::vtp_init *vtp_factory = 0;
      ACE_NEW_THROW_EX (vtp_factory,
                        ::Test::vtp_init,
                        CORBA::NO_MEMORY ());
      CORBA::ValueFactoryBase_var vtp_factory_owner = vtp_factory;

      orb->register_value_factory (vtp_factory->tao_repository_id (),
                                   vtp_factory);

      if (parse_args (argc, argv) != 0)
        return 1;

      CORBA::Object_var object =
        orb->string_to_object (ior);

      Test::A_var server =
        Test::A::_narrow (object.in ());

      if (CORBA::is_nil (server.in ()))
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("Object reference <%s> is nil\n"),
                             ior),
                            1);
        }

      status |= test_strings (server.in ());

      status |= test_sequences (server.in ());

      status |= test_arrays (server.in ());

      status |= test_structs (server.in ());

      status |= test_unions (server.in ());

      status |= test_valueboxes (server.in ());

      status |= test_valuetypes (server.in (), vtp_factory);

      status |= test_exceptions (server.in ());

      server->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Caught exception in client:");
      return 1;
    }

  return status;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:64,代码来源:client.cpp

示例10: strdup

/**
 * the executable starts a HomeFinder
 */
int
main (int argc, char** argv)
{

	// create arguments for ORB_init
	char *orb_argv[27];
	int orb_argc=argc;
	int orb_n = 0;
	for (orb_n = 0; orb_n < argc; orb_n++)
	{
		orb_argv[orb_n] = strdup(argv[orb_n]);
	};

	// check for Host Name Resolving
	std::string resolve = Qedo::ConfigurationReader::instance()->lookup_config_value ("/General/ResolveHostName");
	if (!resolve.compare("false"))
	{
		
		orb_argv[orb_argc] = "-ORBNoResolve";
		orb_argc++;
	};


	std::cout << "Qedo Home Finder " << QEDO_VERSION << " " << QEDO_REVISION << std::endl;

	orb = CORBA::ORB_init (orb_argc, orb_argv);
	Qedo::set_ORB(orb);

#ifdef HAVE_LIBPTHREAD
	// block SIGINT
	// Only the signal thread will handle this signal
	sigset_t sigs;
	sigset_t osigs;
	sigemptyset (&sigs);
	sigaddset (&sigs, SIGINT);
	assert(pthread_sigmask (SIG_BLOCK, &sigs, &osigs) == 0);

	// this thread will do the signal handling
	Qedo::QedoThread* signal_thread;

	signal_thread = Qedo::qedo_startDetachedThread(signal_handler_thread,0);

#else // HAVE_LIBPTHREAD
#ifdef HAVE_SIGACTION
	 struct sigaction act;

    /* Assign sig_chld as our SIGINT handler */
    act.sa_handler = handle_sigint;

    /* We don't want to block any other signals in this example */
    sigemptyset(&act.sa_mask);

    /*
     * Make these values effective. If we were writing a real
     * application, we would probably save the old value instead of
     * passing NULL.
     */
    if (sigaction(SIGINT, &act, NULL) < 0)
    {
		 std::cerr << "sigaction failed" << std::endl;
        return 1;
    }
#else // HAVE_SIGACTION
	 signal ( SIGINT, handle_sigint );
#endif // HAVE_SIGACTION
#endif // HAVE_LIBPTHREAD


	//
	// register valuetype factories
	//
	CORBA::ValueFactoryBase* factory;
	factory = new Qedo::CookieFactory_impl();
    orb->register_value_factory("IDL:omg.org/Components/Cookie:1.0", factory);

	Qedo::HomeFinderImpl* home_finder = new Qedo::HomeFinderImpl(orb);

	try
	{
		home_finder->initialize();
	}
	catch (Qedo::HomeFinderImpl::CannotInitialize&)
	{
		std::cerr << "Cannot initialize Home Finder... exiting." << std::endl;
		orb->destroy();
		exit (1);
	}

	NORMAL_OUT ("Qedo Home Finder is up and running ...")
	orb->run();

#ifdef HAVE_LIBPTHREAD
	// It is not sure, that only SIGINT will break the orb/run
	// so we have to terminate the signal thread here also
	signal_handler_thread_stop = true;
	signal_thread->stop();
	signal_thread->join();
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:101,代码来源:HomeFinder.cpp

示例11: catch

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return 1;

      // Obtain reference to the object
      CORBA::Object_var tmp =
        orb->string_to_object(ior);

      OBV_FactoryTest::Test_var test =
        OBV_FactoryTest::Test::_narrow(tmp.in ());

      if (CORBA::is_nil (test.in ()))
      {
        ACE_ERROR_RETURN ((LM_DEBUG,
                           "Nil OBV_FactoryTest::Test reference <%s>\n",
                           ior),
                          1);
      }

      // Check if we get the correct exception with minor code because no
      // factory has been set.
      if (!no_factory (test.in ()))
        return 1;

      // Create factories.
      OBV_FactoryTest::BaseValue_init *base_factory = 0;
      ACE_NEW_RETURN (base_factory,
                      OBV_FactoryTest::BaseValue_init,
                      1); // supplied by mapping

      orb->register_value_factory (base_factory->tao_repository_id (),
                                   base_factory);
      base_factory->_remove_ref (); // release ownership

      OBV_FactoryTest::Value1_init *value1_factory = 0;
      ACE_NEW_RETURN (value1_factory,
                      OBV_FactoryTest::Value1_init,
                      1); // supplied by mapping

      orb->register_value_factory (value1_factory->tao_repository_id (),
                                   value1_factory);
      value1_factory->_remove_ref ();

      OBV_FactoryTest::Value2_init *value2_factory = 0;
      ACE_NEW_RETURN (value2_factory,
                      Value2_init_impl,
                      1); // custom implementation

      orb->register_value_factory (value2_factory->tao_repository_id (),
                                   value2_factory);
      value2_factory->_remove_ref ();

      // Now perform the test. I don't check return values.
      // I just hope to get MARSHAL.
      OBV_FactoryTest::BaseValue_var base_value =
        test->get_base_value ();

      OBV_FactoryTest::Value1_var value1 =
        test->get_value1 ();

      OBV_FactoryTest::Value2_var value2 =
        test->get_value2 ();

      // Test factories.

      value2 = value2_factory->create_default (1);

      OBV_FactoryTest::BaseValue::BV_Data data;
      data.value = 2;

      value2 = value2_factory->create (1, data);

      ACE_DEBUG ((LM_DEBUG, "(%P|%t) client - test finished\n"));

      test->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught:");
      return 1;
    }

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:93,代码来源:client.cpp

示例12: owner_transfer

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      // All factories are kindly provided by
      // compiler so we just to put everything in a right order.

      // Create and register factory for BaseNode.
      BaseNode_init *bn_factory = 0;
      ACE_NEW_RETURN (bn_factory,
                      BaseNode_init,
                      1);

      orb->register_value_factory (bn_factory->tao_repository_id (),
                                   bn_factory);
      bn_factory->_remove_ref (); // release ownership

      // Create and register factory for TreeController.
      TreeController_init *tc_factory = 0;
      ACE_NEW_RETURN (tc_factory,
                      TreeController_init,
                      1);

      orb->register_value_factory (tc_factory->tao_repository_id (),
                                   tc_factory);
      tc_factory->_remove_ref (); // release ownership

      // Create and register factory for StringNode.
      StringNode_init *sn_factory = 0;
      ACE_NEW_RETURN (sn_factory,
                      StringNode_init,
                      1);

      orb->register_value_factory (sn_factory->tao_repository_id (),
                                   sn_factory);
      sn_factory->_remove_ref (); // release ownership

      //Well, done with factories.

      CORBA::Object_var poa_object =
        orb->resolve_initial_references("RootPOA");

      PortableServer::POA_var root_poa =
        PortableServer::POA::_narrow (poa_object.in ());

      if (CORBA::is_nil (root_poa.in ()))
        ACE_ERROR_RETURN ((LM_ERROR,
                           " (%P|%t) Panic: nil RootPOA\n"),
                          1);

      PortableServer::POAManager_var poa_manager =
        root_poa->the_POAManager ();

      if (parse_args (argc, argv) != 0)
        return 1;

      Test_impl *test_impl;
      ACE_NEW_RETURN (test_impl,
                      Test_impl (orb.in ()),
                      1);

      PortableServer::ServantBase_var owner_transfer(test_impl);

      PortableServer::ObjectId_var id =
        root_poa->activate_object (test_impl);

      CORBA::Object_var object = root_poa->id_to_reference (id.in ());

      Test_var test = Test::_narrow (object.in ());

      CORBA::String_var ior =
        orb->object_to_string (test.in ());

      // If the ior_output_file exists, output the ior to it
      FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
      if (output_file == 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Cannot open output file for writing IOR: %s",
                           ior_output_file),
                              1);
      ACE_OS::fprintf (output_file, "%s", ior.in ());
      ACE_OS::fclose (output_file);

      poa_manager->activate ();

      orb->run ();

      ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n"));

      root_poa->destroy (1, 1);

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught:");
//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:101,代码来源:server.cpp

示例13: attributes

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  // Register the default factory in the Service Configurator.
  // If your platform supports static constructors then you can
  // simply using the ACE_STATIC_SVC_DEFINE() macro, unfortunately TAO
  // must run on platforms where static constructors do not work well,
  // so we have to explicitly invoke this function.
  TAO_EC_Default_Factory::init_svcs ();

  // The exception macros are described in $ACE_ROOT/docs/exceptions.html
  // and defined in $ACE_ROOT/ace/CORBA_macros.h.
  // If your platform supports native exceptions, and TAO was compiled
  // with native exception support then you can simply use try/catch
  // and avoid the argument.
  // Unfortunately many embedded systems cannot use exceptions due to
  // the space and time overhead.
  //
  try
    {
      // **************** HERE STARTS THE ORB SETUP

      // Create the ORB, pass the argv list for parsing.
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      // Parse the arguments, you usually want to do this after
      // invoking ORB_init() because ORB_init() will remove all the
      // -ORB options from the command line.
      if (parse_args (argc, argv) == -1)
        {
          ACE_ERROR ((LM_ERROR,
                      "Usage: Service [-m udp_mcast_addr]\n"));
          return 1;
        }

      if (valuetype)
        {
          Hello::ValueTypeData_init *vb_factory = 0;
          ACE_NEW_RETURN (vb_factory,
                          Hello::ValueTypeData_init,
                          1); // supplied by mapping

          orb->register_value_factory (vb_factory->tao_repository_id (),
                                       vb_factory);
          vb_factory->_remove_ref (); // release ownership
        }

      // This is the standard code to get access to the POA and
      // activate it.
      // The POA starts in the holding state, if it is not activated
      // it will not process any requests.
      CORBA::Object_var object =
        orb->resolve_initial_references ("RootPOA");
      PortableServer::POA_var poa =
        PortableServer::POA::_narrow (object.in ());
      PortableServer::POAManager_var poa_manager =
        poa->the_POAManager ();
      poa_manager->activate ();

      // **************** THAT COMPLETS THE ORB SETUP

      // **************** HERE START THE LOCAL EVENT CHANNEL SETUP

      // This structure is used to define the startup time event
      // channel configuration.
      // This structure is described in
      //
      // $TAO_ROOT/docs/ec_options.html
      //
      TAO_EC_Event_Channel_Attributes attributes (poa.in (),
                                                  poa.in ());

      // Create the Event Channel implementation class
      TAO_EC_Event_Channel ec_impl (attributes);

      // Activate the Event Channel, depending on the configuration
      // that may involve creating some threads.
      // But it should always be invoked because several internal data
      // structures are initialized at that point.
      ec_impl.activate ();

      // The event channel is activated as any other CORBA servant.
      // In this case we use the simple implicit activation with the
      // RootPOA
      RtecEventChannelAdmin::EventChannel_var event_channel =
        ec_impl._this ();

      // **************** THAT COMPLETES THE LOCAL EVENT CHANNEL SETUP

      // **************** HERE STARTS THE FEDERATION SETUP

      // The next step is to setup the multicast gateways.
      // There are two gateways involved, one sends the locally
      // generated events to the federated peers, the second gateway
      // receives multicast traffic and turns it into local events.

      // The sender requires a helper object to select what
      // multicast group will carry what traffic, this is the
      // so-called 'Address Server'.
//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:receiver.cpp

示例14:

int
main (int argc, char** argv)
{
	cout << "Test Client for Stream Container" << endl;

	CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

    orb->register_value_factory ("IDL:omg.org/Components/FacetDescription:1.0", new FacetDescriptionFactory_impl());
	orb->register_value_factory ("IDL:omg.org/Components/ReceptacleDescription:1.0", new ReceptacleDescriptionFactory_impl());
    orb->register_value_factory ("IDL:omg.org/Components/SubscriberDescription:1.0", new SubscriberDescriptionFactory_impl());
    orb->register_value_factory ("IDL:omg.org/Components/EmitterDescription:1.0", new EmitterDescriptionFactory_impl());
    orb->register_value_factory ("IDL:omg.org/Components/ConsumerDescription:1.0", new ConsumerDescriptionFactory_impl());
    orb->register_value_factory ("IDL:omg.org/Components/ComponentPortDescription:1.0", new ComponentPortDescriptionFactory_impl());
    orb->register_value_factory ("IDL:omg.org/Components/Cookie:1.0", new CookieFactory_impl());

	CosNaming::NamingContext_var ns;

	try
	{
		CORBA::Object_var ns_obj = orb->resolve_initial_references ("NameService");
		ns = CosNaming::NamingContext::_narrow (ns_obj);
	}
	catch (CORBA::ORB::InvalidName&)
	{
		cerr << "Name Service not found" << endl;
		orb->destroy();
		exit (1);
	}
	catch (CORBA::SystemException&)
	{
		cerr << "Cannot narrow object reference of Name Service" << endl;
		orb->destroy();
		exit (1);
	}

	if (CORBA::is_nil (ns))
	{
		cerr << "Name Service is nil" << endl;
		orb->destroy();
		exit (1);
	}

	// Now get the Component Server Activator from the Name Service, use the name TETRA/Activators/<hostname>
	char hostname[256];
	if (gethostname (hostname, 256))
	{
		cerr << "Cannot determine my hostname" << endl;
		orb->destroy();
		exit (1);
	}

	// Get the Server Activator
	Components::Deployment::ServerActivator_var server_activator = get_server_activator (orb, ns, hostname);

	// Feed our test deployment into the Component Installer
	deploy_test_components (orb, ns, hostname);

	//
	// Begin tests
	//

	// Create Component Server
	Components::ConfigValues config;
	Components::ConfigValues config1;
	Components::Deployment::ComponentServer_var component_server;
	Components::Deployment::ComponentServer_var component_server1;
	Components::Deployment::ComponentServer_var component_server2;

	try
	{
		component_server = 	server_activator->create_component_server (config1);
	}
	catch (CORBA::Exception&)
	{
		cerr << "Exception during test run" << endl;
		orb->destroy();
		exit (1);
	}

	if (CORBA::is_nil (component_server))
	{
		cerr << "I got a nil reference for the created Component Server" << endl;
		orb->destroy();
		exit (1);
	}
#if 0
	try
	{
		component_server1 = 	server_activator->create_component_server (config1);
	}
	catch (CORBA::Exception&)
	{
		cerr << "Exception during test run" << endl;
		orb->destroy();
		exit (1);
	}

	if (CORBA::is_nil (component_server1))
	{
		cerr << "I got a nil reference for the created Component Server" << endl;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:qedo,代码行数:101,代码来源:main.cpp


注:本文中的corba::ORB_var::register_value_factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。