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