MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / ACE_TMAIN

Function ACE_TMAIN

performance-tests/bench/node_controller/main.cpp:584–796  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582};
583
584int ACE_TMAIN(int argc, ACE_TCHAR* argv[])
585{
586 const char* cstr = ACE_OS::getenv("BENCH_ROOT");
587 bench_root = cstr ? cstr : "";
588 if (bench_root.empty()) {
589 cstr = ACE_OS::getenv("DDS_ROOT");
590 const std::string dds_root{cstr ? cstr : ""};
591 if (dds_root.empty()) {
592 std::cerr << "ERROR: BENCH_ROOT or DDS_ROOT must be defined" << std::endl;
593 return 1;
594 }
595 bench_root = join_path(dds_root, "performance-tests", "bench");
596 }
597
598 TheServiceParticipant->default_configuration_file(
599 ACE_TEXT_CHAR_TO_TCHAR(join_path(bench_root, "control_opendds_config.ini").c_str()));
600
601 // Parse Arguments
602 DDS::DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv);
603
604 RunMode run_mode = RunMode::one_shot;
605 int domain = default_control_domain;
606 std::string name;
607
608 try {
609 if (argc == 1) {
610 std::cerr << "A valid run type is required" << std::endl;
611 throw 1;
612 }
613
614 const ACE_TCHAR* run_mode_arg = argv[1];
615 if (!ACE_OS::strcmp(run_mode_arg, ACE_TEXT("one-shot"))) {
616 run_mode = RunMode::one_shot;
617 } else if (!ACE_OS::strcmp(run_mode_arg, ACE_TEXT("daemon"))) {
618 run_mode = RunMode::daemon;
619 } else if (!ACE_OS::strcmp(run_mode_arg, ACE_TEXT("daemon-exit-on-error"))) {
620 run_mode = RunMode::daemon_exit_on_error;
621 } else {
622 std::cerr << "Invalid run mode: " << ACE_TEXT_ALWAYS_CHAR(run_mode_arg) << std::endl;
623 throw 1;
624 }
625
626 for (int i = 2; i < argc; i++) {
627 if (!ACE_OS::strcmp(argv[i], ACE_TEXT("--domain"))) {
628 domain = get_option_argument_int(i, argc, argv);
629 } else if (!ACE_OS::strcmp(argv[i], ACE_TEXT("--name"))) {
630 name = get_option_argument(i, argc, argv);
631 } else {
632 std::cerr << "Invalid option: " << ACE_TEXT_ALWAYS_CHAR(argv[i]) << std::endl;
633 return 1;
634 }
635 }
636 } catch(const int value) {
637 std::cerr << "See DDS_ROOT/performance-tests/bench/README.md for usage" << std::endl;
638 return value;
639 }
640
641 // Try to get a temp_dir

Callers

nothing calls this directly

Calls 15

join_pathFunction · 0.85
get_option_argument_intFunction · 0.85
create_temp_dirFunction · 0.85
instanceFunction · 0.85
run_cycleFunction · 0.85
ownerMethod · 0.80
delete_participantMethod · 0.80
get_option_argumentFunction · 0.50
emptyMethod · 0.45
create_participantMethod · 0.45
register_typeMethod · 0.45

Tested by

no test coverage detected