@@ -432,16 +432,19 @@ static void configure_cli11_tdd_ul_dl_args(CLI::App& app, du_high_unit_tdd_ul_dl
432432{
433433 configure_cli11_tdd_ul_dl_pattern_args (app, tdd_ul_dl_params.pattern1 );
434434 // TDD pattern 2.
435- // NOTE: CLI11 needs that the life of the variable last longer than the call of callback function. Therefore, the
436- // pattern2_cfg variable needs to be static.
437- tdd_ul_dl_params.pattern2 .emplace ();
438- CLI::App* pattern2_sub_cmd =
435+ // NOTE: As the pattern2 can be configured in the common cell and not in the cell, use a different variable to parse
436+ // the cell pattern 2 property. If the pattern 2 is present for the cell, update the cell pattern 2 value, otherwise
437+ // do nothing (this will cause that the cell pattern 2 value equals than the common cell TDD pattern 2). CLI11 needs
438+ // that the life of the variable last longer than the call of callback function. Therefore, the pattern2_cfg variable
439+ // needs to be static.
440+ tdd_ul_dl_pattern_unit_config pattern2_cfg;
441+ CLI::App* pattern2_sub_cmd =
439442 add_subcommand (app, " pattern2" , " TDD UL DL pattern2 configuration parameters" )->configurable ();
440- configure_cli11_tdd_ul_dl_pattern_args (*pattern2_sub_cmd, *tdd_ul_dl_params. pattern2 );
443+ configure_cli11_tdd_ul_dl_pattern_args (*pattern2_sub_cmd, pattern2_cfg );
441444 auto tdd_pattern2_verify_callback = [&]() {
442445 CLI::App* sub_cmd = app.get_subcommand (" pattern2" );
443- if (sub_cmd->count () = = 0 ) {
444- tdd_ul_dl_params.pattern2 .reset ( );
446+ if (sub_cmd->count () ! = 0 ) {
447+ tdd_ul_dl_params.pattern2 .emplace (pattern2_cfg );
445448 }
446449 };
447450 pattern2_sub_cmd->parse_complete_callback (tdd_pattern2_verify_callback);
@@ -1072,14 +1075,19 @@ static void configure_cli11_common_cell_args(CLI::App& app, du_high_unit_base_ce
10721075 configure_cli11_prach_args (*prach_subcmd, cell_params.prach_cfg );
10731076
10741077 // TDD UL DL configuration.
1075- cell_params.tdd_ul_dl_cfg .emplace ();
1076- CLI::App* tdd_ul_dl_subcmd =
1078+ // NOTE: As the cell TDD pattern can be configured in the common cell and not in the cell, use a different variable to
1079+ // parse the cell TDD property. If the TDD pattern is present for the cell, update the cell TDD pattern value,
1080+ // otherwise do nothing (this will cause that the cell TDD pattern value equals than the common cell TDD pattern).
1081+ // CLI11 needs that the life of the variable last longer than the call of callback function. Therefore, the
1082+ // cell_tdd_pattern variable needs to be static.
1083+ static du_high_unit_tdd_ul_dl_config cell_tdd_pattern;
1084+ CLI::App* tdd_ul_dl_subcmd =
10771085 add_subcommand (app, " tdd_ul_dl_cfg" , " TDD UL DL configuration parameters" )->configurable ();
1078- configure_cli11_tdd_ul_dl_args (*tdd_ul_dl_subcmd, *cell_params. tdd_ul_dl_cfg );
1086+ configure_cli11_tdd_ul_dl_args (*tdd_ul_dl_subcmd, cell_tdd_pattern );
10791087 auto tdd_ul_dl_verify_callback = [&]() {
10801088 CLI::App* tdd_sub_cmd = app.get_subcommand (" tdd_ul_dl_cfg" );
1081- if (tdd_sub_cmd->count () = = 0 ) {
1082- cell_params.tdd_ul_dl_cfg .reset ( );
1089+ if (tdd_sub_cmd->count () ! = 0 ) {
1090+ cell_params.tdd_ul_dl_cfg .emplace (cell_tdd_pattern );
10831091 }
10841092 };
10851093 tdd_ul_dl_subcmd->parse_complete_callback (tdd_ul_dl_verify_callback);
0 commit comments