Line data Source code
1 : /* 2 : * 3 : * 4 : * Distributed under the OpenDDS License. 5 : * See: http://www.opendds.org/license.html 6 : */ 7 : 8 : #include "ReceivedDataElementList.h" 9 : #include "InstanceState.h" 10 : 11 : ACE_INLINE 12 : void 13 0 : OpenDDS::DCPS::ReceivedDataElementList::add(ReceivedDataElement *data_sample) 14 : { 15 : // The default action is to simply add to the 16 : // tail - in the future we may want to add 17 : // to the middle of the list based on sequence 18 : // number and/or source timestamp 19 : 20 0 : data_sample->previous_data_sample_ = 0; 21 0 : data_sample->next_data_sample_ = 0; 22 : 23 0 : ++size_; 24 : 25 : #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 26 0 : if (!data_sample->coherent_change_) 27 : #endif 28 : { 29 0 : if (data_sample->sample_state_ == DDS::NOT_READ_SAMPLE_STATE) { 30 0 : increment_not_read_count(); 31 : } else { 32 0 : increment_read_count(); 33 : } 34 : } 35 : 36 0 : if (!head_) { 37 : // First sample in the list. 38 0 : head_ = tail_ = data_sample; 39 : 40 : } else { 41 : // Add to existing list. 42 0 : tail_->next_data_sample_ = data_sample; 43 0 : data_sample->previous_data_sample_ = tail_; 44 0 : tail_ = data_sample; 45 : } 46 : 47 0 : if (instance_state_) { 48 0 : instance_state_->empty(false); 49 : } 50 0 : } 51 : 52 : ACE_INLINE 53 : OpenDDS::DCPS::ReceivedDataElement* 54 0 : OpenDDS::DCPS::ReceivedDataElementList::remove_head() 55 : { 56 0 : if (!size_) { 57 0 : return 0; 58 : } 59 : 60 0 : OpenDDS::DCPS::ReceivedDataElement *ptr = head_; 61 0 : remove(head_); 62 0 : return ptr; 63 : } 64 : 65 : ACE_INLINE 66 : OpenDDS::DCPS::ReceivedDataElement* 67 : OpenDDS::DCPS::ReceivedDataElementList::remove_tail() 68 : { 69 : if (!size_) { 70 : return 0; 71 : } 72 : 73 : OpenDDS::DCPS::ReceivedDataElement* ptr = tail_; 74 : remove(tail_); 75 : return ptr; 76 : }