コード例 #1
0
ファイル: Test.cpp プロジェクト: OspreyHub/ATCD
int
ACE_TMAIN (int, ACE_TCHAR *[])
{
  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt());

  one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
  one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

  TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), "IIOP_Factory");

  if (p1 != 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find IIOP_Factory\n")), -1);

  ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBANAME_Parser");

  if (p2 == 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBANAME_Parser\n")), -1);

  ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBALOC_Parser");

  if (p3 == 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBALOC_Parser\n")), -1);

  return 0;
}
コード例 #2
0
ファイル: Test.cpp プロジェクト: asdlei00/ACE
int
testSeparation (int , ACE_TCHAR *[])
{
  ACE_TRACE ("testSeparation");

  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt_Test (10));
  one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);

  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
  two->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

  const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");

  TAO_Protocol_Factory* p10 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);
  if (p10 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in one\n"), svcname), -1);

  TAO_Protocol_Factory* p11 =  ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), "IIOP_Factory");
  if (p11 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in two\n"), svcname), -1);

  svcname = ACE_TEXT ("CORBANAME_Parser");

  ACE_Service_Object* p20 =  ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
  if (p20 == 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1);

  ACE_Service_Object* p31 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
  if (p31 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in two\n"), svcname), -1);

  svcname = ACE_TEXT ("CORBALOC_Parser");

  ACE_Service_Object* p21 =  ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
  if (p21 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in one\n"), svcname), -1);

  ACE_Service_Object* p30 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
  if (p30 == 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in two\n"), svcname), -1);

  return 0;
}
コード例 #3
0
ファイル: rctld.cpp プロジェクト: ekpneo/soraCore
int
main(int argc, char *argv[])
{
  try {      
    // configure log verbosity globally
    // setting global default configuration file
    // parse robot (and CORBA) command-line parameters
    Miro::Robot::init(argc, argv);
 
    // overwrite DDS global defaults
    kn::DdsEntitiesFactorySvcParameters * ddsEntitiesParams = 
      kn::DdsEntitiesFactorySvcParameters::instance();
    
    // alter default parameters
    ddsEntitiesParams->defaultLibrary = "RapidQosLibrary";

    // configure DDS global setting
    kn::DdsSupport::init(argc, argv);


    // Hardcode participant name and participant Qos Profile
    ddsEntitiesParams->participants[0].participantName = "ProcessManager";
    ddsEntitiesParams->participants[0].profile = "RapidDefaultQos";

    // configure DDS global setting
    kn::DdsEntitiesFactorySvc ddsFactory;
    if (ddsFactory.init(ddsEntitiesParams) != 0)
      return -1;
    
    if (parseArgs(argc, argv) != 0)
      return -1;

    // somehow we miss the static includes otherwise
    ACE_Service_Config::open("rctld", 0, false);
    {
      ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> svcs = new ACE_Service_Gestalt(1024, true, false);

      string procCmd = "static ProcessManagerSvc \"" + procDirective + "\"";
      if (svcs->process_directive(procCmd.c_str()) != 0) {
        return 1;
      }

      if (systemInfo) {
        string sysInfoCmd = "static SystemInfoSvc \"" + sysInfoDirective + "\"";
        if (svcs->process_directive(sysInfoCmd.c_str()) != 0) {
          return 1;
        }
      }
    
      if (cmdMgr) {
        string cmdMgrCmd = "static CommandManagerSvc \"" + commandManagerDirective + "\"";
        if (svcs->process_directive(cmdMgrCmd.c_str()) != 0) {
          return 1;
        }
      }
    
      MIRO_LOG(LL_NOTICE, "Entering server loop.");
      Miro::ShutdownHandler shutdownHandler;
      while(!shutdownHandler.isShutdown()) {
        kn::this_thread::sleep_for(kn::microseconds(100000));
      }
      MIRO_LOG(LL_NOTICE, "End of server loop.");
    }
    ddsFactory.fini();

    MIRO_LOG(LL_NOTICE, "End of main server scope.");
  }
  catch (Miro::Exception const& e) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Miro exception:\n" << e);
  }
  catch (std::exception const& e) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected std-exception\n" << e.what());
  }
  catch (...) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected exception\n");
  }
  
  MIRO_LOG(LL_NOTICE, "bye");
  return 0;
}
コード例 #4
0
int
main(int argc, char *argv[])
{
  try {      
    // configure log verbosity globally
    // setting global default configuration file
    // parse robot (and CORBA) command-line parameters
    // create top-level server instance
    // configure ORB parameters globally
    Miro::Log::init(argc, argv);

    //    Miro::Server server(argc, argv);

    // overwrite DDS global defaults
    kn::DdsEntitiesFactorySvcParameters * ddsEntitiesParams = 
      kn::DdsEntitiesFactorySvcParameters::instance();
    
    // alter default parameters
    ddsEntitiesParams->defaultLibrary = "RapidQosLibrary";

    // configure DDS global setting
    kn::DdsSupport::init(argc, argv);

    // Hardcode participant name and participant Qos Profile
    ddsEntitiesParams->participants[0].participantName = "RapidExec";
    ddsEntitiesParams->participants[0].profile = "RapidDefaultQos";

    // configure DDS global setting
    kn::DdsEntitiesFactorySvc ddsFactory;
    if (ddsFactory.init(ddsEntitiesParams) != 0)
      return -1;
    
    if (parseArgs(argc, argv) != 0)
      return -1;


    ACE_Service_Config::open("CommandManagerSvc", 0, false);
    {
      ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> svcs = new ACE_Service_Gestalt(1024, true, false);

            // sequencer
      string sequencerSvc = "static CommandManagerSvc \"" + sequencerDirective + "\"";
      // string sequencerSvc = "dynamic CommandManagerSvc Service_Object * rapidCommanding:_make_rapid_CommandManagerSvc() \"" + sequencerDirective + "\"";
      if (svcs->process_directive(sequencerSvc.c_str()) != 0) {
        return 1;
      }
      
      MIRO_LOG(LL_NOTICE, "Entering server loop.");
      Miro::ShutdownHandler shutdownHandler;
      while(!shutdownHandler.isShutdown()) {
        kn::this_thread::sleep_for(kn::microseconds(100000));
      }
      MIRO_LOG(LL_NOTICE, "End of server loop.");
    }
    ddsFactory.fini();

    MIRO_LOG(LL_NOTICE, "End of main server scope.");
  }
  catch (std::exception const& e) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected std-exception\n" << e.what());
  }
  catch (...) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected exception\n");
  }

  MIRO_LOG(LL_NOTICE, "bye");
  return 0;
}
コード例 #5
0
ファイル: Test.cpp プロジェクト: asdlei00/ACE
int
testReusingGlobals (int , ACE_TCHAR *[])
{
  ACE_TRACE ("testReusingGlobals");

  {
    ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt (10, false));

    // The ACE_Service_Gestalt_Test will teardown all!
    one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
    one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

    const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
    TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);

    if (p1 != 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s locally\n"), svcname));
        return -1;
      }

    svcname = ACE_TEXT ("CORBANAME_Parser");
    ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);

    if (p2 == 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s localy\n"), svcname));
        return -1;
      }

    svcname = ACE_TEXT ("CORBALOC_Parser");
    ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);

    if (p3 == 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s locally\n"), svcname));
        return -1;
      }
  }


  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
  //  ACE_Service_Gestalt_Test two; // Use the ACE_Service_Repository::instance ()

  const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
  TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), svcname);

  if (p1 != 0)
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
      return -1;
    }

  svcname = ACE_TEXT ("CORBANAME_Parser");
  ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);

  if (p2 == 0) // You should be able to find the same stuff here, too
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
      return -1;
      }

  return 0;
}