Skip to content

Commit 1587acb

Browse files
authored
Merge branch 'master' into micro
2 parents c86efce + 6b75d87 commit 1587acb

File tree

9 files changed

+628
-640
lines changed

9 files changed

+628
-640
lines changed

.github/workflows/1_run_interoperability_tests.yml

Lines changed: 81 additions & 376 deletions
Large diffs are not rendered by default.

.github/workflows/ci_dustdds.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI DustDDS
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- 'srcRs/DustDDS/**'
8+
9+
jobs:
10+
create_bin_release:
11+
name: Create binary release
12+
runs-on: ubuntu-latest
13+
defaults:
14+
run:
15+
working-directory: srcRs/DustDDS
16+
steps:
17+
- name: Checkout sources
18+
uses: actions/checkout@v4
19+
- name: Build executable
20+
run: cargo build --package dust_dds_shape_main_linux --release
21+
- name: Rename executable
22+
run: |
23+
version=$( cargo tree --package dust_dds --depth 0 --prefix none | tr -d 'dust_dds v' )
24+
cp ./target/release/dust_dds_shape_main_linux ./dust_dds-${version}_shape_main_linux
25+
mkdir artifacts
26+
zip --junk-paths artifacts/dust_dds-${version}_shape_main_linux.zip ./dust_dds-${version}_shape_main_linux
27+
- name: Upload executable artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: interoperability_executable
31+
path: srcRs/DustDDS/artifacts/

srcCxx/shape_main.cxx

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ class ShapeOptions {
281281
useconds_t periodic_announcement_period_us;
282282

283283
unsigned int datafrag_size;
284+
char* cft_expression;
285+
286+
int size_modulo;
284287

285288
public:
286289
//-------------------------------------------------------------
@@ -338,6 +341,9 @@ class ShapeOptions {
338341
periodic_announcement_period_us = 0;
339342

340343
datafrag_size = 0; // Default: 0 (means not set)
344+
cft_expression = NULL;
345+
346+
size_modulo = 0; // 0 means disabled
341347
}
342348

343349
//-------------------------------------------------------------
@@ -346,6 +352,7 @@ class ShapeOptions {
346352
STRING_FREE(topic_name);
347353
STRING_FREE(color);
348354
STRING_FREE(partition);
355+
STRING_FREE(cft_expression);
349356
}
350357

351358
//-------------------------------------------------------------
@@ -413,6 +420,13 @@ class ShapeOptions {
413420
printf(" announcement period in ms. Default 0 (off)\n");
414421
printf(" --datafrag-size <bytes> : set the data fragment size (default: 0, means\n");
415422
printf(" not set)\n");
423+
printf(" --cft <expression> : ContentFilteredTopic filter expression (quotes\n");
424+
printf(" required around the expression). Cannot be used with\n");
425+
printf(" -c on subscriber applications\n");
426+
printf(" --size-modulo <int> : If set, the modulo operation is applied to the\n");
427+
printf(" shapesize. This will make that shapesize is in the\n");
428+
printf(" range [1,N]. This only applies if shapesize is\n");
429+
printf(" increased (-z 0)\n");
416430
}
417431

418432
//-------------------------------------------------------------
@@ -425,7 +439,7 @@ class ShapeOptions {
425439
logger.log_message("please specify publish [-P] or subscribe [-S]", Verbosity::ERROR);
426440
return false;
427441
}
428-
if ( publish && subscribe ) {
442+
if (publish && subscribe) {
429443
logger.log_message("please specify only one of: publish [-P] or subscribe [-S]", Verbosity::ERROR);
430444
return false;
431445
}
@@ -442,6 +456,9 @@ class ShapeOptions {
442456
if (publish && take_read_next_instance == false ) {
443457
logger.log_message("warning: --take-read ignored on publisher applications", Verbosity::ERROR);
444458
}
459+
if (publish && cft_expression != NULL) {
460+
logger.log_message("warning: --cft ignored on publisher applications", Verbosity::ERROR);
461+
}
445462
if (subscribe && shapesize != 20) {
446463
logger.log_message("warning: shapesize [-z] ignored on subscriber applications", Verbosity::ERROR);
447464
}
@@ -477,6 +494,13 @@ class ShapeOptions {
477494
logger.log_message("warning: use of take/read_next_instance() not available, using take/read()", Verbosity::ERROR);
478495
}
479496
#endif
497+
if (size_modulo > 0 && shapesize != 0) {
498+
logger.log_message("warning: --size-modulo has no effect unless shapesize (-z) is set to 0", Verbosity::ERROR);
499+
}
500+
if (subscribe && color != NULL && cft_expression != NULL) {
501+
logger.log_message("error: cannot specify both --cft and -c/--color for subscriber applications", Verbosity::ERROR);
502+
return false;
503+
}
480504

481505
return true;
482506
}
@@ -504,7 +528,9 @@ class ShapeOptions {
504528
{"take-read", no_argument, NULL, 'K'},
505529
{"time-filter", required_argument, NULL, 'i'},
506530
{"periodic-announcement", required_argument, NULL, 'N'},
507-
{"datafrag-size", required_argument, NULL, 'F'},
531+
{"datafrag-size", required_argument, NULL, 'Z'},
532+
{"cft", required_argument, NULL, 'F'},
533+
{"size-modulo", required_argument, NULL, 'Q'},
508534
{NULL, 0, NULL, 0 }
509535
};
510536

@@ -889,7 +915,7 @@ class ShapeOptions {
889915
periodic_announcement_period_us = (useconds_t) converted_param * 1000;
890916
break;
891917
}
892-
case 'F': {
918+
case 'Z': {
893919
unsigned int converted_param = 0;
894920
if (sscanf(optarg, "%u", &converted_param) == 0) {
895921
logger.log_message("unrecognized value for datafrag-size "
@@ -907,6 +933,17 @@ class ShapeOptions {
907933
parse_ok = false;
908934
}
909935
datafrag_size = converted_param;
936+
case 'F':
937+
cft_expression = strdup(optarg);
938+
break;
939+
case 'Q': {
940+
int converted_param = 0;
941+
if (sscanf(optarg, "%d", &converted_param) == 0 || converted_param < 1) {
942+
logger.log_message("incorrect value for size-modulo, must be >=1", Verbosity::ERROR);
943+
parse_ok = false;
944+
} else {
945+
size_modulo = converted_param;
946+
}
910947
break;
911948
}
912949
case '?':
@@ -1643,19 +1680,26 @@ class ShapeApplication {
16431680
logger.log_message(" HistoryDepth = " + std::to_string(dr_qos.history FIELD_ACCESSOR.depth), Verbosity::DEBUG);
16441681
}
16451682

1646-
if ( options->color != NULL ) {
1683+
if ( options->cft_expression != NULL || options->color != NULL) {
16471684
/* For Connext Micro color will be always NULL */
16481685
#if !defined(RTI_CONNEXT_MICRO)
16491686
/* filter on specified color */
16501687
ContentFilteredTopic *cft = NULL;
1651-
StringSeq cf_params;
1688+
StringSeq cf_params;
16521689

16531690
for (unsigned int i = 0; i < options->num_topics; ++i) {
16541691
const std::string filtered_topic_name_str =
16551692
std::string(options->topic_name) +
16561693
(i > 0 ? std::to_string(i) : "") +
16571694
"_filtered";
16581695
const char* filtered_topic_name = filtered_topic_name_str.c_str();
1696+
const char* filter_expr = nullptr;
1697+
1698+
if (options->cft_expression != NULL) {
1699+
filter_expr = options->cft_expression;
1700+
cft = dp->create_contentfilteredtopic(filtered_topic_name, topics[i], filter_expr, cf_params);
1701+
logger.log_message(" ContentFilterTopic = \"" + std::string(filter_expr) + "\"", Verbosity::DEBUG);
1702+
} else if (options->color != NULL) {
16591703
#if defined(RTI_CONNEXT_DDS)
16601704
char parameter[64];
16611705
snprintf(parameter, 64, "'%s'", options->color);
@@ -1688,7 +1732,7 @@ class ShapeApplication {
16881732
return false;
16891733
}
16901734

1691-
printf("Create reader for topic: %s color: %s\n", cft->get_name() NAME_ACCESSOR, options->color );
1735+
printf("Create reader for topic: %s\n", cft->get_name() NAME_ACCESSOR);
16921736
drs[i] = dynamic_cast<ShapeTypeDataReader *>(sub->create_datareader(cft, dr_qos, NULL, LISTENER_STATUS_MASK_NONE));
16931737
if (drs[i] == NULL) {
16941738
logger.log_message("failed to create datareader[" + std::to_string(i) + "] topic: " + topics[i]->get_name(), Verbosity::ERROR);
@@ -1888,6 +1932,7 @@ class ShapeApplication {
18881932
if (sample_info->instance_state != ALIVE_INSTANCE_STATE) {
18891933
ShapeType shape_key;
18901934
shape_initialize_w_color(shape_key, NULL);
1935+
18911936
#if defined(EPROSIMA_FAST_DDS)
18921937
shape_key.color FIELD_ACCESSOR = instance_handle_color[sample_info->instance_handle] NAME_ACCESSOR;
18931938
#elif defined(RTI_CONNEXT_MICRO)
@@ -1996,7 +2041,13 @@ class ShapeApplication {
19962041
moveShape(&shape);
19972042

19982043
if (options->shapesize == 0) {
1999-
shape.shapesize FIELD_ACCESSOR += 1;
2044+
if (options->size_modulo > 0) {
2045+
// Size cannot be 0, so increase it after modulo operation
2046+
shape.shapesize FIELD_ACCESSOR =
2047+
(shape.shapesize FIELD_ACCESSOR % options->size_modulo) + 1;
2048+
} else {
2049+
shape.shapesize FIELD_ACCESSOR += 1;
2050+
}
20002051
}
20012052

20022053
#if !defined(RTI_CONNEXT_MICRO)

0 commit comments

Comments
 (0)