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

Method write

dds/DCPS/ReplayerImpl.cpp:862–934  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

860}
861
862DDS::ReturnCode_t
863ReplayerImpl::write (const RawDataSample* samples,
864 int num_samples,
865 DDS::InstanceHandle_t* reader_ih_ptr)
866{
867 DBG_ENTRY_LVL("ReplayerImpl","write",6);
868
869 OpenDDS::DCPS::GUID_t repo_id = GUID_UNKNOWN;
870 if (reader_ih_ptr) {
871 repo_id = this->participant_servant_->get_repoid(*reader_ih_ptr);
872 if (repo_id == GUID_UNKNOWN) {
873 ACE_ERROR_RETURN((LM_ERROR,
874 ACE_TEXT("(%P|%t) ERROR: ReplayerImpl::write: ")
875 ACE_TEXT("Invalid reader instance handle (%d)\n"), *reader_ih_ptr),
876 DDS::RETCODE_ERROR);
877 }
878 }
879
880 SendStateDataSampleList list;
881
882 for (int i = 0; i < num_samples; ++i) {
883 DataSampleElement* element = 0;
884
885 ACE_NEW_MALLOC_RETURN(
886 element,
887 static_cast<DataSampleElement*>(
888 sample_list_element_allocator_->malloc(
889 sizeof(DataSampleElement))),
890 DataSampleElement(publication_id_,
891 this,
892 PublicationInstance_rch()),
893 DDS::RETCODE_ERROR);
894
895 element->get_header().byte_order_ = samples[i].sample_byte_order_;
896 element->get_header().publication_id_ = this->publication_id_;
897 list.enqueue_tail(element);
898 Message_Block_Ptr temp;
899 Message_Block_Ptr sample(samples[i].sample_->duplicate());
900 DDS::ReturnCode_t ret = create_sample_data_message(OPENDDS_MOVE_NS::move(sample),
901 element->get_header(),
902 temp,
903 samples[i].source_timestamp_,
904 false);
905 element->set_sample(OPENDDS_MOVE_NS::move(temp));
906 if (reader_ih_ptr) {
907 element->set_num_subs(1);
908 element->set_sub_id(0, repo_id);
909 }
910
911 if (ret != DDS::RETCODE_OK) {
912 // we need to free the list
913 while (list.dequeue(element)) {
914 ACE_DES_FREE(element, sample_list_element_allocator_->free, DataSampleElement);
915 }
916
917 return ret;
918 }
919 }

Callers

nothing calls this directly

Calls 10

moveFunction · 0.85
get_repoidMethod · 0.80
enqueue_tailMethod · 0.80
DataSampleElementClass · 0.70
dequeueMethod · 0.65
mallocMethod · 0.45
duplicateMethod · 0.45
sendMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected