Skip to content

Commit f337644

Browse files
authored
Add get_params method to the AsyncFunctionHandler (#419)
1 parent 716a517 commit f337644

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

realtime_tools/include/realtime_tools/async_function_handler.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,12 @@ class AsyncFunctionHandler
495495
*/
496496
const std::thread & get_thread() const { return thread_; }
497497

498+
/// Get the parameters used to configure the AsyncFunctionHandler
499+
/**
500+
* @return The parameters used to configure the AsyncFunctionHandler
501+
*/
502+
const AsyncFunctionHandlerParams & get_params() const { return params_; }
503+
498504
/// Check if the async callback method is in progress
499505
/**
500506
* @return True if the async callback method is in progress, false otherwise

realtime_tools/test/test_async_function_handler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,14 @@ TEST_F(AsyncFunctionHandlerTest, trigger_for_several_cycles_in_detached_scheduli
444444
params.clock = node->get_clock();
445445
params.initialize(node, "");
446446
async_class.initialize(params);
447+
ASSERT_EQ(
448+
async_class.get_handler().get_params().scheduling_policy,
449+
realtime_tools::AsyncSchedulingPolicy::DETACHED);
450+
ASSERT_FALSE(async_class.get_handler().get_params().wait_until_initial_trigger);
451+
ASSERT_EQ(async_class.get_handler().get_params().exec_rate, 500);
452+
ASSERT_EQ(async_class.get_handler().get_params().thread_priority, 60);
453+
ASSERT_EQ(async_class.get_handler().get_params().cpu_affinity_cores.size(), 1u);
454+
ASSERT_EQ(async_class.get_handler().get_params().cpu_affinity_cores[0], 0);
447455
ASSERT_TRUE(async_class.get_handler().is_initialized());
448456
ASSERT_FALSE(async_class.get_handler().is_running());
449457
ASSERT_FALSE(async_class.get_handler().is_stopped());

0 commit comments

Comments
 (0)