00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_WRITERDATASAMPLELIST_H 00009 #define OPENDDS_DCPS_WRITERDATASAMPLELIST_H 00010 00011 #include "dcps_export.h" 00012 #include <cstring> 00013 00014 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 namespace OpenDDS { 00017 namespace DCPS { 00018 00019 class DataSampleElement; 00020 00021 /** 00022 * A list of DataSampleElement pointers to be queued by the order the 00023 * samples are written to the DataWriter (within PRESENTATION.access_scope==TOPIC). 00024 * Cache the number of elements in the list so that list traversal is 00025 * not required to find this information. 00026 * Manages DataSampleElement's previous_writer_sample/next_writer_sample pointers 00027 */ 00028 class OpenDDS_Dcps_Export WriterDataSampleList { 00029 00030 public: 00031 00032 /// Default constructor clears the list. 00033 WriterDataSampleList(); 00034 ~WriterDataSampleList(){} 00035 00036 /// Reset to initial state. 00037 void reset(); 00038 00039 ssize_t size() const; 00040 DataSampleElement* head() const; 00041 DataSampleElement* tail() const; 00042 00043 void enqueue_tail(const DataSampleElement* element); 00044 00045 bool dequeue_head(DataSampleElement*& stale); 00046 00047 bool dequeue(const DataSampleElement* stale); 00048 00049 protected: 00050 00051 /// The first element of the list. 00052 DataSampleElement* head_; 00053 00054 /// The last element of the list. 00055 DataSampleElement* tail_; 00056 00057 /// Number of elements in the list. 00058 ssize_t size_; 00059 //TBD size is never negative so should be size_t but this ripples through 00060 // the transport code so leave it for now. SHH 00061 }; 00062 00063 00064 } // namespace DCPS 00065 } // namespace OpenDDS 00066 00067 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00068 00069 #if defined(__ACE_INLINE__) 00070 #include "WriterDataSampleList.inl" 00071 #endif /* __ACE_INLINE__ */ 00072 00073 #endif /* OPENDDS_DCPS_WRITERDATASAMPLELIST_H */