OpenDDS::DCPS::ReceivedDataElementList Class Reference

#include <ReceivedDataElementList.h>

Collaboration diagram for OpenDDS::DCPS::ReceivedDataElementList:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ReceivedDataElementList (InstanceState *instance_state=0)
 ~ReceivedDataElementList ()
void apply_all (ReceivedDataFilter &match, ReceivedDataOperation &func)
void add (ReceivedDataElement *data_sample)
bool remove (ReceivedDataElement *data_sample)
bool remove (ReceivedDataFilter &match, bool eval_all)
ReceivedDataElementremove_head ()
ReceivedDataElementremove_tail ()

Public Attributes

ReceivedDataElementhead_
 The first element of the list.
ReceivedDataElementtail_
 The last element of the list.
ssize_t size_
 Number of elements in the list.

Private Attributes

InstanceStateinstance_state_

Detailed Description

Definition at line 173 of file ReceivedDataElementList.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::ReceivedDataElementList::ReceivedDataElementList ( InstanceState instance_state = 0  ) 

Definition at line 55 of file ReceivedDataElementList.cpp.

00056   : head_(0), tail_(0), size_(0), instance_state_(instance_state)
00057 {
00058 }

OpenDDS::DCPS::ReceivedDataElementList::~ReceivedDataElementList (  ) 

Definition at line 60 of file ReceivedDataElementList.cpp.

00061 {
00062   // The memory pointed to by instance_state_ is owned by
00063   // another object.
00064 }


Member Function Documentation

ACE_INLINE void OpenDDS::DCPS::ReceivedDataElementList::add ( ReceivedDataElement data_sample  ) 

Definition at line 13 of file ReceivedDataElementList.inl.

References OpenDDS::DCPS::InstanceState::empty(), head_, instance_state_, OpenDDS::DCPS::ReceivedDataElement::next_data_sample_, OpenDDS::DCPS::ReceivedDataElement::previous_data_sample_, size_, and tail_.

Referenced by OpenDDS::DCPS::SourceDataStrategy::add(), and OpenDDS::DCPS::ReceivedDataStrategy::add().

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

void OpenDDS::DCPS::ReceivedDataElementList::apply_all ( ReceivedDataFilter match,
ReceivedDataOperation func 
)

Definition at line 67 of file ReceivedDataElementList.cpp.

References head_, and OpenDDS::DCPS::ReceivedDataElement::next_data_sample_.

Referenced by OpenDDS::DCPS::ReceivedDataStrategy::accept_coherent().

00070 {
00071   for (ReceivedDataElement* it = head_;
00072        it != 0 ; it = it->next_data_sample_) {
00073     if (match(it)) {
00074       op(it);
00075     }
00076   }
00077 }

Here is the caller graph for this function:

bool OpenDDS::DCPS::ReceivedDataElementList::remove ( ReceivedDataFilter match,
bool  eval_all 
)

Definition at line 80 of file ReceivedDataElementList.cpp.

References OpenDDS::DCPS::InstanceState::empty(), head_, instance_state_, item(), OpenDDS::DCPS::ReceivedDataElement::next_data_sample_, OpenDDS::DCPS::ReceivedDataElement::previous_data_sample_, size_, and tail_.

00083 {
00084   if (!head_) {
00085     return false;
00086   }
00087 
00088   bool released = false;
00089 
00090   for (ReceivedDataElement* item = head_ ; item != 0 ;
00091        item = item->next_data_sample_) {
00092     if (match(item)) {
00093       size_-- ;
00094 
00095       if (item == head_) {
00096         if (head_ == tail_) {
00097           head_ = tail_ = 0;
00098 
00099         } else {
00100           head_ = item->next_data_sample_ ;
00101 
00102           if (head_) {
00103             head_->previous_data_sample_ = 0 ;
00104           }
00105         }
00106 
00107       } else if (item == tail_) {
00108         tail_ = item->previous_data_sample_ ;
00109 
00110         if (tail_) {
00111           tail_->next_data_sample_ = 0 ;
00112         }
00113 
00114       } else {
00115         item->previous_data_sample_->next_data_sample_ =
00116           item->next_data_sample_ ;
00117         item->next_data_sample_->previous_data_sample_ =
00118           item->previous_data_sample_ ;
00119       }
00120 
00121       if (instance_state_ && size_ == 0) {
00122         // let the instance know it is empty
00123         released = released || instance_state_->empty(true);
00124       }
00125 
00126       if (!eval_all) break;
00127     }
00128   }
00129 
00130   return released;
00131 }

Here is the call graph for this function:

bool OpenDDS::DCPS::ReceivedDataElementList::remove ( ReceivedDataElement data_sample  ) 

Definition at line 134 of file ReceivedDataElementList.cpp.

Referenced by OpenDDS::DCPS::RakeResults< SampleSeq >::copy_into(), and OpenDDS::DCPS::ReceivedDataStrategy::reject_coherent().

00135 {
00136   IdentityFilter match(data_sample);
00137   return remove(match, false); // short-circuit evaluation
00138 }

Here is the caller graph for this function:

ACE_INLINE OpenDDS::DCPS::ReceivedDataElement * OpenDDS::DCPS::ReceivedDataElementList::remove_head (  ) 

Definition at line 43 of file ReceivedDataElementList.inl.

References head_, and size_.

00044 {
00045   if (!size_) {
00046     return 0 ;
00047   }
00048 
00049   OpenDDS::DCPS::ReceivedDataElement *ptr = head_ ;
00050 
00051   remove(head_) ;
00052 
00053   return ptr ;
00054 }

ACE_INLINE OpenDDS::DCPS::ReceivedDataElement * OpenDDS::DCPS::ReceivedDataElementList::remove_tail (  ) 

Definition at line 58 of file ReceivedDataElementList.inl.

References size_, and 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 }


Member Data Documentation

Definition at line 203 of file ReceivedDataElementList.h.

Referenced by add(), and remove().

Number of elements in the list.

Definition at line 200 of file ReceivedDataElementList.h.

Referenced by OpenDDS::DCPS::SourceDataStrategy::add(), add(), remove(), remove_head(), and remove_tail().

The last element of the list.

Definition at line 197 of file ReceivedDataElementList.h.

Referenced by add(), OpenDDS::DCPS::RakeResults< SampleSeq >::copy_into(), remove(), and remove_tail().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1