00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_INSTANCEDATASAMPLELIST_H 00009 #define OPENDDS_DCPS_INSTANCEDATASAMPLELIST_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 instance (within 00027 * PRESENTAION.access_scope==INSTANCE). It is mainly used on the 00028 * send side to count the depth of instance data and to allow the 00029 * removal of elements by instance. 00030 * Manages DataSampleElement's next_instance_sample pointer 00031 */ 00032 class OpenDDS_Dcps_Export InstanceDataSampleList { 00033 00034 public: 00035 00036 /// Default constructor clears the list. 00037 InstanceDataSampleList(); 00038 ~InstanceDataSampleList(){}; 00039 00040 /// Reset to initial state. 00041 void reset(); 00042 00043 ssize_t size() const; 00044 DataSampleElement* head() const; 00045 DataSampleElement* tail() const; 00046 00047 void enqueue_tail(const DataSampleElement* element); 00048 00049 bool dequeue_head(DataSampleElement*& stale); 00050 00051 bool dequeue(const DataSampleElement* stale); 00052 00053 protected: 00054 00055 /// The first element of the list. 00056 DataSampleElement* head_; 00057 00058 /// The last element of the list. 00059 DataSampleElement* tail_; 00060 00061 /// Number of elements in the list. 00062 ssize_t size_; 00063 //TBD size is never negative so should be size_t but this ripples through 00064 // the transport code so leave it for now. SHH 00065 00066 }; 00067 00068 00069 } // namespace DCPS 00070 } // namespace OpenDDS 00071 00072 #if defined(__ACE_INLINE__) 00073 #include "InstanceDataSampleList.inl" 00074 #endif /* __ACE_INLINE__ */ 00075 00076 #endif /* OPENDDS_DCPS_INSTANCEDATASAMPLELIST_H */