Line data Source code
1 : /* 2 : * 3 : * 4 : * Distributed under the OpenDDS License. 5 : * See: http://www.opendds.org/license.html 6 : */ 7 : 8 : #ifndef OPENDDS_DCPS_WRITERDATASAMPLELIST_H 9 : #define OPENDDS_DCPS_WRITERDATASAMPLELIST_H 10 : 11 : #include "dcps_export.h" 12 : 13 : #include <cstring> 14 : 15 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 16 : 17 : namespace OpenDDS { 18 : namespace DCPS { 19 : 20 : class DataSampleElement; 21 : 22 : /** 23 : * A list of DataSampleElement pointers to be queued by the order the 24 : * samples are written to the DataWriter (within PRESENTATION.access_scope==TOPIC). 25 : * Cache the number of elements in the list so that list traversal is 26 : * not required to find this information. 27 : * Manages DataSampleElement's previous_writer_sample/next_writer_sample pointers 28 : */ 29 : class OpenDDS_Dcps_Export WriterDataSampleList { 30 : public: 31 : 32 : /// Default constructor clears the list. 33 : WriterDataSampleList(); 34 0 : ~WriterDataSampleList() {} 35 : 36 : /// Reset to initial state. 37 : void reset(); 38 : 39 : ssize_t size() const; 40 : DataSampleElement* head() const; 41 : DataSampleElement* tail() const; 42 : 43 : void enqueue_tail(const DataSampleElement* element); 44 : 45 : bool dequeue_head(DataSampleElement*& stale); 46 : 47 : bool dequeue(const DataSampleElement* stale); 48 : 49 : protected: 50 : 51 : /// The first element of the list. 52 : DataSampleElement* head_; 53 : 54 : /// The last element of the list. 55 : DataSampleElement* tail_; 56 : 57 : /// Number of elements in the list. 58 : ssize_t size_; 59 : //TBD size is never negative so should be size_t but this ripples through 60 : // the transport code so leave it for now. SHH 61 : }; 62 : 63 : 64 : } // namespace DCPS 65 : } // namespace OpenDDS 66 : 67 : OPENDDS_END_VERSIONED_NAMESPACE_DECL 68 : 69 : #if defined(__ACE_INLINE__) 70 : #include "WriterDataSampleList.inl" 71 : #endif /* __ACE_INLINE__ */ 72 : 73 : #endif /* OPENDDS_DCPS_WRITERDATASAMPLELIST_H */