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_INSTANCEDATASAMPLELIST_H 9 : #define OPENDDS_DCPS_INSTANCEDATASAMPLELIST_H 10 : 11 : #include "Definitions.h" 12 : #include "Dynamic_Cached_Allocator_With_Overflow_T.h" 13 : 14 : #include "transport/framework/TransportDefs.h" 15 : #include "dds/DdsDcpsInfoUtilsC.h" 16 : 17 : #include <iterator> 18 : 19 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 20 : 21 : namespace OpenDDS { 22 : namespace DCPS { 23 : 24 : class DataSampleElement; 25 : 26 : 27 : /** 28 : * A list of DataSampleElement pointers to be queued by the order the 29 : * samples are written to the instance (within 30 : * PRESENTATION.access_scope==INSTANCE). It is mainly used on the 31 : * send side to count the depth of instance data and to allow the 32 : * removal of elements by instance. 33 : * Manages DataSampleElement's next_instance_sample pointer 34 : */ 35 : class OpenDDS_Dcps_Export InstanceDataSampleList { 36 : public: 37 : InstanceDataSampleList(); 38 0 : ~InstanceDataSampleList() {} 39 : 40 : /// Reset to initial state. 41 : void reset(); 42 : 43 : ssize_t size() const; 44 : DataSampleElement* head() const; 45 : DataSampleElement* tail() const; 46 : 47 : static bool on_some_list(const DataSampleElement* iter); 48 : static DataSampleElement* next(const DataSampleElement* iter); 49 : static DataSampleElement* prev(const DataSampleElement* iter); 50 : 51 : void enqueue_tail(const DataSampleElement* element); 52 : 53 : bool dequeue_head(DataSampleElement*& stale); 54 : 55 : bool dequeue(const DataSampleElement* stale); 56 : 57 : protected: 58 : 59 : /// The first element of the list. 60 : DataSampleElement* head_; 61 : 62 : /// The last element of the list. 63 : DataSampleElement* tail_; 64 : 65 : /// Number of elements in the list. 66 : ssize_t size_; 67 : //TBD size is never negative so should be size_t but this ripples through 68 : // the transport code so leave it for now. SHH 69 : 70 : }; 71 : 72 : 73 : } // namespace DCPS 74 : } // namespace OpenDDS 75 : 76 : 77 : OPENDDS_END_VERSIONED_NAMESPACE_DECL 78 : 79 : #if defined(__ACE_INLINE__) 80 : #include "InstanceDataSampleList.inl" 81 : #endif /* __ACE_INLINE__ */ 82 : 83 : #endif /* OPENDDS_DCPS_INSTANCEDATASAMPLELIST_H */