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 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00019 00020 namespace OpenDDS { 00021 namespace DCPS { 00022 00023 class DataSampleElement; 00024 00025 00026 /** 00027 * A list of DataSampleElement pointers to be queued by the order the 00028 * samples are written to the instance (within 00029 * PRESENTAION.access_scope==INSTANCE). It is mainly used on the 00030 * send side to count the depth of instance data and to allow the 00031 * removal of elements by instance. 00032 * Manages DataSampleElement's next_instance_sample pointer 00033 */ 00034 class OpenDDS_Dcps_Export InstanceDataSampleList { 00035 00036 public: 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 static bool on_some_list(const DataSampleElement* iter); 00048 static DataSampleElement* next(const DataSampleElement* iter); 00049 static DataSampleElement* prev(const DataSampleElement* iter); 00050 00051 void enqueue_tail(const DataSampleElement* element); 00052 00053 bool dequeue_head(DataSampleElement*& stale); 00054 00055 bool dequeue(const DataSampleElement* stale); 00056 00057 protected: 00058 00059 /// The first element of the list. 00060 DataSampleElement* head_; 00061 00062 /// The last element of the list. 00063 DataSampleElement* tail_; 00064 00065 /// Number of elements in the list. 00066 ssize_t size_; 00067 //TBD size is never negative so should be size_t but this ripples through 00068 // the transport code so leave it for now. SHH 00069 00070 }; 00071 00072 00073 } // namespace DCPS 00074 } // namespace OpenDDS 00075 00076 00077 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00078 00079 #if defined(__ACE_INLINE__) 00080 #include "InstanceDataSampleList.inl" 00081 #endif /* __ACE_INLINE__ */ 00082 00083 #endif /* OPENDDS_DCPS_INSTANCEDATASAMPLELIST_H */