From 7d4daa7ea6e86697541cea66a326b93e51571ad4 Mon Sep 17 00:00:00 2001 From: Jeff Ithier Date: Thu, 7 Nov 2024 01:29:34 +0100 Subject: [PATCH] [#490] Rename worst_case_memory_size to maximum_elements in slice example --- .../publish_subscribe_dynamic_data/src/publisher.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/cxx/publish_subscribe_dynamic_data/src/publisher.cpp b/examples/cxx/publish_subscribe_dynamic_data/src/publisher.cpp index 4baee32f..e8c34ea3 100644 --- a/examples/cxx/publish_subscribe_dynamic_data/src/publisher.cpp +++ b/examples/cxx/publish_subscribe_dynamic_data/src/publisher.cpp @@ -32,11 +32,11 @@ auto main() -> int { .open_or_create() .expect("successful service creation/opening"); - const uint64_t worst_case_memory_size = 1024; // NOLINT - auto publisher = service.publisher_builder() - .max_slice_len(worst_case_memory_size) - .create() - .expect("successful publisher creation"); + // Since the payload type is uint8_t, this number is the same as the number of bytes in the payload. + // For other types, number of bytes used by the payload will be max_slice_len * sizeof(Payload::ValueType) + const uint64_t maximum_elements = 1024; // NOLINT + auto publisher = + service.publisher_builder().max_slice_len(maximum_elements).create().expect("successful publisher creation"); auto counter = 0;