Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21469] Fix windows issue with flow controller example #5142

Merged
merged 5 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/cpp/flow_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ target_compile_definitions(flow_control PRIVATE
$<$<AND:$<NOT:$<BOOL:${WIN32}>>,$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">>:__DEBUG>
$<$<BOOL:${INTERNAL_DEBUG}>:__INTERNALDEBUG> # Internal debug activated.
)
if(WIN32)
set_target_properties(flow_control PROPERTIES LINK_FLAGS /STACK:4194304)
endif()
target_link_libraries(flow_control fastdds fastcdr foonathan_memory)
install(TARGETS flow_control
RUNTIME DESTINATION ${DATA_INSTALL_DIR}/fastdds/examples/cpp/flow_control/${BIN_INSTALL_DIR})
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/flow_control/FlowControl.idl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@extensibility(APPENDABLE)
struct FlowControl
{
unsigned long index;
Expand Down
7 changes: 7 additions & 0 deletions examples/cpp/flow_control/FlowControlTypeObjectSupport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ void register_FlowControl_type_identifier(
QualifiedTypeName type_name_FlowControl = "FlowControl";
eprosima::fastcdr::optional<AppliedBuiltinTypeAnnotations> type_ann_builtin_FlowControl;
eprosima::fastcdr::optional<AppliedAnnotationSeq> ann_custom_FlowControl;
AppliedAnnotationSeq tmp_ann_custom_FlowControl;
eprosima::fastcdr::optional<AppliedVerbatimAnnotation> verbatim_FlowControl;
if (!tmp_ann_custom_FlowControl.empty())
{
ann_custom_FlowControl = tmp_ann_custom_FlowControl;
}

CompleteTypeDetail detail_FlowControl = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_FlowControl, ann_custom_FlowControl, type_name_FlowControl.to_string());
CompleteStructHeader header_FlowControl;
header_FlowControl = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_FlowControl);
Expand Down
12 changes: 9 additions & 3 deletions examples/cpp/flow_control/PublisherApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ void PublisherApp::run()
}
else
{
throw std::runtime_error("Slow Publisher failed sending a message");
if (!is_stopped())
{
std::cout << "Slow Publisher failed sending a message" << std::endl;
}
}

if (publish(fast_writer_, msg))
Expand All @@ -200,7 +203,10 @@ void PublisherApp::run()
}
else
{
throw std::runtime_error("Fast Publisher failed sending a message");
if (!is_stopped())
{
std::cout << "Fast Publisher failed sending a message" << std::endl;
}
}

// Wait for period or stop event
Expand All @@ -214,7 +220,7 @@ void PublisherApp::run()

bool PublisherApp::publish(
DataWriter* writer_,
FlowControl msg)
FlowControl& msg)
Mario-DL marked this conversation as resolved.
Show resolved Hide resolved
{
bool ret = false;
// Wait for the data endpoints discovery
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/flow_control/PublisherApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class PublisherApp : public Application, public DataWriterListener
//! Publish a sample
bool publish(
DataWriter* writer_,
FlowControl msg);
FlowControl& msg);

DomainParticipant* participant_;

Expand Down
1 change: 0 additions & 1 deletion examples/cpp/rtps/CLIParser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ class CLIParser
if (static_cast<uint16_t>(input) > std::numeric_limits<std::uint16_t>::max())
{
throw std::out_of_range("sample argument out of range");
print_help(EXIT_FAILURE);
}

config.samples = static_cast<uint16_t>(input);
Expand Down
Loading