00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_PACKETREMOVEVISTOR_H 00009 #define OPENDDS_DCPS_PACKETREMOVEVISTOR_H 00010 00011 #include "dds/DCPS/dcps_export.h" 00012 #include "dds/DCPS/GuidUtils.h" 00013 #include "BasicQueueVisitor_T.h" 00014 #include "TransportDefs.h" 00015 #include "TransportReplacedElement.h" 00016 00017 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00018 class ACE_Message_Block; 00019 ACE_END_VERSIONED_NAMESPACE_DECL 00020 00021 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00022 00023 namespace OpenDDS { 00024 namespace DCPS { 00025 00026 class OpenDDS_Dcps_Export PacketRemoveVisitor 00027 : public BasicQueueVisitor<TransportQueueElement> { 00028 public: 00029 00030 PacketRemoveVisitor(const TransportQueueElement::MatchCriteria& match, 00031 ACE_Message_Block*& unsent_head_block, 00032 ACE_Message_Block* header_block, 00033 MessageBlockAllocator& mb_allocator, 00034 DataBlockAllocator& db_allocator); 00035 00036 virtual ~PacketRemoveVisitor(); 00037 00038 /// The BasicQueue<T>::accept_remove_visitor() method will call 00039 /// this visit_element() method for each element in the queue. 00040 virtual int visit_element_ref(TransportQueueElement*& element); 00041 00042 RemoveResult status() const; 00043 00044 private: 00045 00046 /// The sample that needs to be removed. 00047 const TransportQueueElement::MatchCriteria& match_; 00048 00049 /// The head block of the chain of unsent blocks in the packet. 00050 ACE_Message_Block*& head_; 00051 00052 /// The packet header block that was duplicate()'d to form the 00053 /// first block in the packet. 00054 ACE_Message_Block* header_block_; 00055 00056 /// Holds the status of our visit. 00057 RemoveResult status_; 00058 00059 /// This is the message block in the chain that corresponds to the 00060 /// current (non-head) element being visited. 00061 ACE_Message_Block* current_block_; 00062 00063 /// This is the message block in the chain that has its cont() set 00064 /// to the current_block_. 00065 ACE_Message_Block* previous_block_; 00066 00067 /// Cached allocator for DataSampleHeader message block 00068 MessageBlockAllocator& replaced_element_mb_allocator_; 00069 /// Cached allocator for DataSampleHeader data block 00070 DataBlockAllocator& replaced_element_db_allocator_; 00071 }; 00072 00073 } // namespace DCPS 00074 } // namespace OpenDDS 00075 00076 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00077 00078 #if defined (__ACE_INLINE__) 00079 #include "PacketRemoveVisitor.inl" 00080 #endif /* __ACE_INLINE__ */ 00081 00082 #endif /* OPENDDS_DCPS_PACKETREMOVEVISTOR_H */