Skip to content

Commit 02bd7e4

Browse files
Deprecate get_msg method of RT publisher (#422)
1 parent c4d415d commit 02bd7e4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

realtime_tools/include/realtime_tools/realtime_publisher.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,26 @@ class RealtimePublisher
264264
std::thread & get_thread() { return thread_; }
265265

266266
const std::thread & get_thread() const { return thread_; }
267+
268+
[[deprecated(
269+
"This getter method will be removed. It is recommended to use the try_publish() instead of "
270+
"accessing the msg_ variable.")]]
271+
const MessageT & get_msg() const
272+
{
267273
#ifdef _MSC_VER
268274
#pragma warning(push)
269275
#pragma warning(disable : 4996)
270276
#else
271277
#pragma GCC diagnostic push
272278
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
273279
#endif
274-
const MessageT & get_msg() const { return msg_; }
280+
return msg_;
275281
#ifdef _MSC_VER
276282
#pragma warning(pop)
277283
#else
278284
#pragma GCC diagnostic pop
279285
#endif
286+
}
280287

281288
std::mutex & get_mutex() { return msg_mutex_; }
282289

0 commit comments

Comments
 (0)