MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / get_data

Method get_data

dds/DCPS/DataDurabilityCache.cpp:714–865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712}
713
714bool
715OpenDDS::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);

Callers

nothing calls this directly

Calls 15

moveFunction · 0.85
cleanup_directoryFunction · 0.85
get_sampleMethod · 0.80
advanceMethod · 0.80
getMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
doneMethod · 0.45
nextMethod · 0.45
mallocMethod · 0.45

Tested by

no test coverage detected