Skip to content

Commit 6954211

Browse files
Merge branch 'master' into cleanup/deprecations
2 parents 9d9837f + 02bd7e4 commit 6954211

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

realtime_tools/include/realtime_tools/realtime_publisher.hpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,25 @@ class RealtimePublisher
156156

157157
const std::thread & get_thread() const { return thread_; }
158158

159-
const MessageT & get_msg() const { return msg_; }
159+
[[deprecated(
160+
"This getter method will be removed. It is recommended to use the try_publish() instead of "
161+
"accessing the msg_ variable.")]]
162+
const MessageT & get_msg() const
163+
{
164+
#ifdef _MSC_VER
165+
#pragma warning(push)
166+
#pragma warning(disable : 4996)
167+
#else
168+
#pragma GCC diagnostic push
169+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
170+
#endif
171+
return msg_;
172+
#ifdef _MSC_VER
173+
#pragma warning(pop)
174+
#else
175+
#pragma GCC diagnostic pop
176+
#endif
177+
}
160178

161179
std::mutex & get_mutex() { return msg_mutex_; }
162180

0 commit comments

Comments
 (0)