@@ -210,7 +210,7 @@ class IntraProcessManager
210
210
std::shared_ptr<PublishedType> msg = std::move (message);
211
211
212
212
this ->template add_shared_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
213
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
213
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
214
214
msg,
215
215
sub_ids.take_shared_subscriptions ,
216
216
ros_message_type_allocator);
@@ -231,8 +231,8 @@ class IntraProcessManager
231
231
sub_ids.take_ownership_subscriptions .end ());
232
232
233
233
this ->template add_owned_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
234
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
235
- PublishedTypeAllocator>(
234
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
235
+ PublishedTypeAllocator>(
236
236
std::move (message),
237
237
concatenated_vector,
238
238
published_type_allocator,
@@ -241,16 +241,18 @@ class IntraProcessManager
241
241
} else {
242
242
// Construct a new shared pointer from the message
243
243
// for the buffers that do not require ownership
244
- auto shared_msg = std::allocate_shared<PublishedType, PublishedTypeAllocator>(published_type_allocator, *message);
244
+ auto shared_msg = std::allocate_shared<PublishedType, PublishedTypeAllocator>(
245
+ published_type_allocator,
246
+ *message);
245
247
246
248
this ->template add_shared_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
247
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
249
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
248
250
shared_msg,
249
251
sub_ids.take_shared_subscriptions ,
250
252
ros_message_type_allocator);
251
- this ->template add_owned_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc, Deleter,
252
- ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
253
- PublishedTypeAllocator>(
253
+ this ->template add_owned_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
254
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
255
+ PublishedTypeAllocator>(
254
256
std::move (message),
255
257
sub_ids.take_ownership_subscriptions ,
256
258
published_type_allocator,
@@ -301,7 +303,7 @@ class IntraProcessManager
301
303
std::shared_ptr<PublishedType> shared_msg = std::move (message);
302
304
if (!sub_ids.take_shared_subscriptions .empty ()) {
303
305
this ->template add_shared_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
304
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
306
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
305
307
shared_msg,
306
308
sub_ids.take_shared_subscriptions ,
307
309
ros_message_type_allocator);
@@ -310,19 +312,21 @@ class IntraProcessManager
310
312
} else {
311
313
// Construct a new shared pointer from the message for the buffers that
312
314
// do not require ownership and to return.
313
- auto shared_msg = std::allocate_shared<PublishedType, PublishedTypeAllocator>(published_type_allocator, *message);
315
+ auto shared_msg = std::allocate_shared<PublishedType, PublishedTypeAllocator>(
316
+ published_type_allocator,
317
+ *message);
314
318
315
319
if (!sub_ids.take_shared_subscriptions .empty ()) {
316
320
this ->template add_shared_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
317
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
321
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
318
322
shared_msg,
319
323
sub_ids.take_shared_subscriptions ,
320
324
ros_message_type_allocator);
321
325
}
322
326
323
327
this ->template add_owned_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
324
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
325
- PublishedTypeAllocator>(
328
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
329
+ PublishedTypeAllocator>(
326
330
std::move (message),
327
331
sub_ids.take_ownership_subscriptions ,
328
332
published_type_allocator,
@@ -359,7 +363,9 @@ class IntraProcessManager
359
363
{
360
364
auto ptr = ROSMessageTypeAllocatorTraits::allocate (ros_message_type_allocator, 1 );
361
365
ROSMessageTypeAllocatorTraits::construct (ros_message_type_allocator, ptr);
362
- auto unique_ros_msg = std::unique_ptr<ROSMessageType, ROSMessageTypeDeleter>(ptr, ros_message_type_deleter);
366
+ auto unique_ros_msg = std::unique_ptr<ROSMessageType, ROSMessageTypeDeleter>(
367
+ ptr,
368
+ ros_message_type_deleter);
363
369
rclcpp::TypeAdapter<MessageT>::convert_to_ros_message (*message, *unique_ros_msg);
364
370
365
371
std::shared_lock<std::shared_timed_mutex> lock (mutex_);
@@ -379,27 +385,29 @@ class IntraProcessManager
379
385
std::shared_ptr<PublishedType> shared_msg = std::move (message);
380
386
if (!sub_ids.take_shared_subscriptions .empty ()) {
381
387
this ->template add_shared_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
382
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
388
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
383
389
shared_msg,
384
390
sub_ids.take_shared_subscriptions ,
385
391
ros_message_type_allocator);
386
392
}
387
393
} else {
388
394
// Construct a new shared pointer from the message for the buffers that
389
395
// do not require ownership and to return.
390
- auto shared_msg = std::allocate_shared<PublishedType, PublishedTypeAllocator>(published_type_allocator, *message);
396
+ auto shared_msg = std::allocate_shared<PublishedType, PublishedTypeAllocator>(
397
+ published_type_allocator,
398
+ *message);
391
399
392
400
if (!sub_ids.take_shared_subscriptions .empty ()) {
393
401
this ->template add_shared_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
394
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
402
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator>(
395
403
shared_msg,
396
404
sub_ids.take_shared_subscriptions ,
397
405
ros_message_type_allocator);
398
406
}
399
407
400
408
this ->template add_owned_msg_to_buffers <MessageT, PublishedType, ROSMessageType, Alloc,
401
- Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
402
- PublishedTypeAllocator>(
409
+ Deleter, ROSMessageTypeAllocatorTraits, ROSMessageTypeAllocator, ROSMessageTypeDeleter,
410
+ PublishedTypeAllocator>(
403
411
std::move (message),
404
412
sub_ids.take_ownership_subscriptions ,
405
413
published_type_allocator,
@@ -482,18 +490,17 @@ class IntraProcessManager
482
490
auto subscription_base = subscription_it->second .lock ();
483
491
if (subscription_base) {
484
492
auto subscription = std::dynamic_pointer_cast<
485
- rclcpp::experimental::SubscriptionIntraProcessBuffer<MessageT, PublishedType, Alloc, Deleter>
486
- >(subscription_base);
493
+ rclcpp::experimental::SubscriptionIntraProcessBuffer<MessageT, PublishedType, Alloc,
494
+ Deleter> >(subscription_base);
487
495
if (nullptr == subscription) {
488
-
489
496
auto ros_message_subscription = std::dynamic_pointer_cast<
490
497
rclcpp::experimental::ROSMessageIntraProcessBuffer<ROSMessageType, Alloc, Deleter>
491
498
>(subscription_base);
492
499
493
500
if (nullptr == ros_message_subscription) {
494
501
throw std::runtime_error (
495
502
" failed to dynamic cast SubscriptionIntraProcessBase to "
496
- " SubscriptionIntraProcessBuffer<MessageT, PublishedType, Alloc, Deleter> , which "
503
+ " SubscriptionIntraProcessBuffer, which "
497
504
" can happen when the publisher and subscription use different "
498
505
" allocator types, which is not supported" );
499
506
} else {
@@ -506,13 +513,10 @@ class IntraProcessManager
506
513
} else {
507
514
ros_message_subscription->provide_intra_process_message (message);
508
515
}
509
-
510
516
}
511
517
} else {
512
518
subscription->provide_intra_process_data (message);
513
519
}
514
-
515
-
516
520
} else {
517
521
subscriptions_.erase (id);
518
522
}
@@ -538,7 +542,6 @@ class IntraProcessManager
538
542
ROSMessageTypeAllocator & ros_message_type_allocator,
539
543
ROSMessageTypeDeleter & ros_message_type_deleter)
540
544
{
541
-
542
545
std::cout << " add owned msg to buffers" << std::endl;
543
546
544
547
std::cout << " message has type : " << typeid (message).name () << std::endl;
@@ -554,15 +557,13 @@ class IntraProcessManager
554
557
auto subscription_base = subscription_it->second .lock ();
555
558
std::cout << " Subscription Base?" << std::endl;
556
559
if (subscription_base) {
557
-
558
560
std::cout << " Typed Subscription" << std::endl;
559
561
560
562
auto subscription = std::dynamic_pointer_cast<
561
- rclcpp::experimental::SubscriptionIntraProcessBuffer<MessageT, PublishedType, Alloc, Deleter>
562
- >(subscription_base);
563
+ rclcpp::experimental::SubscriptionIntraProcessBuffer<MessageT, PublishedType, Alloc,
564
+ Deleter> >(subscription_base);
563
565
if (nullptr == subscription) {
564
-
565
- std::cout << " ROSMessage Subscription" << std::endl;
566
+ std::cout << " ROSMessage Subscription" << std::endl;
566
567
567
568
auto ros_message_subscription = std::dynamic_pointer_cast<
568
569
rclcpp::experimental::ROSMessageIntraProcessBuffer<ROSMessageType, Alloc, Deleter>
@@ -571,17 +572,18 @@ class IntraProcessManager
571
572
if (nullptr == ros_message_subscription) {
572
573
throw std::runtime_error (
573
574
" failed to dynamic cast SubscriptionIntraProcessBase to "
574
- " SubscriptionIntraProcessBuffer<MessageT, PublishedType, Alloc, Deleter> , which "
575
+ " SubscriptionIntraProcessBuffer, which "
575
576
" can happen when the publisher and subscription use different "
576
577
" allocator types, which is not supported" );
577
578
} else {
578
-
579
579
std::cout << " ROSMessage TypeAdapted Subscription" << std::endl;
580
580
581
581
if constexpr (rclcpp::TypeAdapter<MessageT>::is_specialized::value) {
582
582
auto ptr = ROSMessageTypeAllocatorTraits::allocate (ros_message_type_allocator, 1 );
583
583
ROSMessageTypeAllocatorTraits::construct (ros_message_type_allocator, ptr);
584
- auto ros_msg = std::unique_ptr<ROSMessageType, ROSMessageTypeDeleter>(ptr, ros_message_type_deleter);
584
+ auto ros_msg = std::unique_ptr<ROSMessageType, ROSMessageTypeDeleter>(
585
+ ptr,
586
+ ros_message_type_deleter);
585
587
rclcpp::TypeAdapter<MessageT>::convert_to_ros_message (*message, *ros_msg);
586
588
ros_message_subscription->provide_intra_process_message (std::move (ros_msg));
587
589
} else {
@@ -600,7 +602,6 @@ class IntraProcessManager
600
602
ros_message_subscription->provide_intra_process_message (std::move (copy_message));
601
603
}
602
604
}
603
-
604
605
}
605
606
} else {
606
607
std::cout << " Typed Subscription" << std::endl;
@@ -618,7 +619,6 @@ class IntraProcessManager
618
619
subscription->provide_intra_process_data (std::move (copy_message));
619
620
}
620
621
}
621
-
622
622
} else {
623
623
std::cout << " Erasing subscription" << std::endl;
624
624
subscriptions_.erase (subscription_it);
0 commit comments