@@ -63,10 +63,6 @@ class RealtimePublisher
6363
6464 RCLCPP_SMART_PTR_DEFINITIONS (RealtimePublisher<MessageT>)
6565
66- [[deprecated(
67- " This variable is deprecated, it is recommended to use the try_publish() method instead." )]]
68- MessageT msg_;
69-
7066 /* *
7167 * \brief Constructor for the realtime publisher
7268 *
@@ -76,13 +72,6 @@ class RealtimePublisher
7672 *
7773 * \param publisher the ROS publisher to wrap
7874 */
79- #ifdef _MSC_VER
80- #pragma warning(push)
81- #pragma warning(disable : 4996)
82- #else
83- #pragma GCC diagnostic push
84- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
85- #endif
8675 explicit RealtimePublisher (PublisherSharedPtr publisher)
8776 : publisher_(publisher), is_running_(false ), keep_running_(true ), turn_(State::LOOP_NOT_STARTED)
8877 {
@@ -111,11 +100,6 @@ class RealtimePublisher
111100 thread_.join ();
112101 }
113102 }
114- #ifdef _MSC_VER
115- #pragma warning(pop)
116- #else
117- #pragma GCC diagnostic pop
118- #endif
119103
120104 /* *
121105 * \brief Stop the realtime publisher
@@ -158,19 +142,7 @@ class RealtimePublisher
158142 if (can_publish (lock)) {
159143 {
160144 std::unique_lock<std::mutex> scoped_lock (std::move (lock));
161- #ifdef _MSC_VER
162- #pragma warning(push)
163- #pragma warning(disable : 4996)
164- #else
165- #pragma GCC diagnostic push
166- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
167- #endif
168145 msg_ = msg;
169- #ifdef _MSC_VER
170- #pragma warning(pop)
171- #else
172- #pragma GCC diagnostic pop
173- #endif
174146 turn_.store (State::NON_REALTIME, std::memory_order_release);
175147 }
176148 updated_cond_.notify_one (); // Notify the publishing thread
@@ -193,26 +165,6 @@ class RealtimePublisher
193165 */
194166 const std::thread & get_thread () const { return thread_; }
195167
196- [[deprecated(
197- " This getter method will be removed. It is recommended to use the try_publish() instead of "
198- " accessing the msg_ variable." )]]
199- const MessageT & get_msg () const
200- {
201- #ifdef _MSC_VER
202- #pragma warning(push)
203- #pragma warning(disable : 4996)
204- #else
205- #pragma GCC diagnostic push
206- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
207- #endif
208- return msg_;
209- #ifdef _MSC_VER
210- #pragma warning(pop)
211- #else
212- #pragma GCC diagnostic pop
213- #endif
214- }
215-
216168 /* *
217169 * \brief Get the mutex protecting the stored message.
218170 */
@@ -263,19 +215,7 @@ class RealtimePublisher
263215 // Locks msg_ and copies it to outgoing
264216 std::unique_lock<std::mutex> lock_ (msg_mutex_);
265217 updated_cond_.wait (lock_, [&] { return turn_ == State::NON_REALTIME || !keep_running_; });
266- #ifdef _MSC_VER
267- #pragma warning(push)
268- #pragma warning(disable : 4996)
269- #else
270- #pragma GCC diagnostic push
271- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
272- #endif
273218 outgoing = msg_;
274- #ifdef _MSC_VER
275- #pragma warning(pop)
276- #else
277- #pragma GCC diagnostic pop
278- #endif
279219 }
280220
281221 // Sends the outgoing message
@@ -292,6 +232,8 @@ class RealtimePublisher
292232
293233 std::thread thread_;
294234
235+ MessageT msg_;
236+
295237 mutable std::mutex msg_mutex_; // Protects msg_
296238 std::condition_variable updated_cond_;
297239
0 commit comments