コード例 #1
0
int main(int argc,char *argv[])
{
	try
	{
		// Initialise the device server
		//----------------------------------------
		Tango::Util *tg = Tango::Util::init(argc,argv);

		// Create the device server singleton 
		//	which will create everything
		//----------------------------------------
		tg->server_init(false);

		// Run the endless loop
		//----------------------------------------
		cout << "Ready to accept request" << endl;
		tg->server_run();
	}
	catch (bad_alloc)
	{
		cout << "Can't allocate memory to store device object !!!" << endl;
		cout << "Exiting" << endl;
	}
	catch (CORBA::Exception &e)
	{
		Tango::Except::print_exception(e);
		
		cout << "Received a CORBA_Exception" << endl;
		cout << "Exiting" << endl;
	}
	Tango::Util::instance()->server_cleanup();
	return(0);
}
コード例 #2
0
ファイル: main.cpp プロジェクト: MaxIV-KitsControls/EPU61
int main(int argc, char *argv[])
{
  INSTALL_CRASH_HANDLER;

	Tango::Util *tg = 0;
	try
	{
		//- bootstraping for yat Socket
    yat::Socket::init();

	  //- bootstraping for galil stuffs
    galil::ObjectManager::init();

		// Initialise the device server
		//----------------------------------------
		tg = Tango::Util::init(argc,argv);

		// Create the device server singleton 
		//	which will create everything
		//----------------------------------------
		tg->server_init(false);

		// Run the endless loop
		//----------------------------------------
		cout << "Ready to accept request" << endl;
		tg->server_run();

	}
	catch (const bad_alloc&)
	{
		cout << "Can't allocate memory to store device object !!!" << endl;
		cout << "Exiting" << endl;
  } 
	catch (CORBA::Exception &e)
	{
		Tango::Except::print_exception(e);
		
		cout << "Received a CORBA_Exception" << endl;
		cout << "Exiting" << endl;
	}
	catch (...)
	{
		cout << "Received an unknown exception" << endl;
		cout << "Exiting" << endl;
	}

  try
  {
	  tg->server_cleanup();
  }
  catch (...)
  {
    //- ignore any error from "server_cleanup"
  }

  //- release galil stuffs
  galil::ObjectManager::close();

	//- bootstraping for yat Socket
  yat::Socket::terminate();

	return(0);
}