| 979 | |
| 980 | |
| 981 | DDS::ReturnCode_t |
| 982 | WriteDataContainer::remove_oldest_sample( |
| 983 | InstanceDataSampleList& instance_list, |
| 984 | bool& released) |
| 985 | { |
| 986 | DataSampleElement* stale = 0; |
| 987 | |
| 988 | // |
| 989 | // Remove the oldest sample from the instance list. |
| 990 | // |
| 991 | if (!instance_list.dequeue_head(stale)) { |
| 992 | ACE_ERROR_RETURN((LM_ERROR, |
| 993 | ACE_TEXT("(%P|%t) ERROR: ") |
| 994 | ACE_TEXT("WriteDataContainer::remove_oldest_sample, ") |
| 995 | ACE_TEXT("dequeue_head_next_sample failed\n")), |
| 996 | DDS::RETCODE_ERROR); |
| 997 | } |
| 998 | |
| 999 | // |
| 1000 | // Remove the stale data from the next_writer_sample_ list. The |
| 1001 | // sending_data_/next_send_sample_ list is not managed within the |
| 1002 | // container, it is only used external to the container and does |
| 1003 | // not need to be managed internally. |
| 1004 | // |
| 1005 | // The next_writer_sample_ link is being used in one of the sent_data_, |
| 1006 | // sending_data_, or unsent_data lists. Removal from the doubly |
| 1007 | // linked list needs to repair the list only when the stale sample |
| 1008 | // is either the head or tail of the list. |
| 1009 | // |
| 1010 | |
| 1011 | // |
| 1012 | // Locate the head of the list that the stale data is in. |
| 1013 | // |
| 1014 | SendStateDataSampleList* send_lists[] = { |
| 1015 | &sending_data_, |
| 1016 | &sent_data_, |
| 1017 | &unsent_data_, |
| 1018 | &orphaned_to_transport_}; |
| 1019 | const SendStateDataSampleList* containing_list = |
| 1020 | SendStateDataSampleList::send_list_containing_element(stale, send_lists); |
| 1021 | |
| 1022 | // |
| 1023 | // Identify the list that the stale data is in. |
| 1024 | // The stale data should be in one of the sent_data_, sending_data_ |
| 1025 | // or unsent_data_. It should not be in released_data_ list since |
| 1026 | // this function is the only place a sample is moved from |
| 1027 | // sending_data_ to released_data_ list. |
| 1028 | |
| 1029 | // Remove the element from the internal list. |
| 1030 | bool result = false; |
| 1031 | |
| 1032 | if (containing_list == &this->sending_data_) { |
| 1033 | if (DCPS_debug_level > 2) { |
| 1034 | ACE_ERROR((LM_WARNING, |
| 1035 | ACE_TEXT("(%P|%t) WARNING: ") |
| 1036 | ACE_TEXT("WriteDataContainer::remove_oldest_sample, ") |
| 1037 | ACE_TEXT("removing from sending_data_ so must notify transport to remove sample\n"))); |
| 1038 | } |
nothing calls this directly
no test coverage detected