| 712 | } |
| 713 | |
| 714 | bool |
| 715 | OpenDDS::DCPS::DataDurabilityCache::get_data( |
| 716 | DDS::DomainId_t domain_id, |
| 717 | char const * topic_name, |
| 718 | char const * type_name, |
| 719 | DataWriterImpl * data_writer, |
| 720 | ACE_Allocator * mb_allocator, |
| 721 | ACE_Allocator * db_allocator, |
| 722 | DDS::LifespanQosPolicy const & /* lifespan */) |
| 723 | { |
| 724 | key_type const key(domain_id, |
| 725 | topic_name, |
| 726 | type_name, |
| 727 | this->allocator_.get()); |
| 728 | |
| 729 | ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, this->lock_, false); |
| 730 | |
| 731 | sample_list_type * p_sample_list = 0; |
| 732 | |
| 733 | if (this->samples_->find(key, |
| 734 | p_sample_list, |
| 735 | this->allocator_.get()) == -1) |
| 736 | return true; // No durable data for this domain/topic/type. |
| 737 | |
| 738 | else if (p_sample_list == 0) |
| 739 | return false; // Should never happen. |
| 740 | |
| 741 | sample_list_type & sample_list = *p_sample_list; |
| 742 | |
| 743 | // We will register an instance, and then write all of the cached |
| 744 | // data to the DataWriter using that instance. |
| 745 | |
| 746 | sample_data_type * registration_data = 0; |
| 747 | |
| 748 | if (sample_list[0]->get(registration_data, 0) == -1) |
| 749 | return false; |
| 750 | |
| 751 | char const * marshaled_sample = 0; |
| 752 | size_t marshaled_sample_length = 0; |
| 753 | DDS::Time_t registration_timestamp; |
| 754 | |
| 755 | registration_data->get_sample(marshaled_sample, |
| 756 | marshaled_sample_length, |
| 757 | registration_timestamp); |
| 758 | |
| 759 | // Don't use the cached allocator for the registered sample message |
| 760 | // block. |
| 761 | Message_Block_Ptr registration_sample( |
| 762 | new ACE_Message_Block(marshaled_sample_length, |
| 763 | ACE_Message_Block::MB_DATA, |
| 764 | 0, //cont |
| 765 | 0, //data |
| 766 | 0, //alloc_strategy |
| 767 | data_writer->get_db_lock())); |
| 768 | |
| 769 | ACE_OS::memcpy(registration_sample->wr_ptr(), |
| 770 | marshaled_sample, |
| 771 | marshaled_sample_length); |
nothing calls this directly
no test coverage detected