00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "ReceivedDataElementList.h" 00009 #include "InstanceState.h" 00010 00011 ACE_INLINE 00012 void 00013 OpenDDS::DCPS::ReceivedDataElementList::add(ReceivedDataElement *data_sample) 00014 { 00015 // The default action is to simply add to the 00016 // tail - in the future we may want to add 00017 // to the middle of the list based on sequence 00018 // number and/or source timestamp 00019 00020 data_sample->previous_data_sample_ = 0; 00021 data_sample->next_data_sample_ = 0; 00022 00023 ++size_ ; 00024 00025 if (!head_) { 00026 // First sample in the list. 00027 head_ = tail_ = data_sample ; 00028 00029 } else { 00030 // Add to existing list. 00031 tail_->next_data_sample_ = data_sample ; 00032 data_sample->previous_data_sample_ = tail_; 00033 tail_ = data_sample; 00034 } 00035 00036 if (instance_state_) { 00037 instance_state_->empty(false); 00038 } 00039 } 00040 00041 ACE_INLINE 00042 OpenDDS::DCPS::ReceivedDataElement * 00043 OpenDDS::DCPS::ReceivedDataElementList::remove_head() 00044 { 00045 if (!size_) { 00046 return 0 ; 00047 } 00048 00049 OpenDDS::DCPS::ReceivedDataElement *ptr = head_ ; 00050 00051 remove(head_) ; 00052 00053 return ptr ; 00054 } 00055 00056 ACE_INLINE 00057 OpenDDS::DCPS::ReceivedDataElement * 00058 OpenDDS::DCPS::ReceivedDataElementList::remove_tail() 00059 { 00060 if (!size_) { 00061 return 0 ; 00062 } 00063 00064 OpenDDS::DCPS::ReceivedDataElement *ptr = tail_ ; 00065 00066 remove(tail_) ; 00067 00068 return ptr ; 00069 }