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 namespace OpenDDS { 00022 namespace DCPS { 00023 00024 class OpenDDS_Dcps_Export PacketRemoveVisitor 00025 : public BasicQueueVisitor<TransportQueueElement> { 00026 public: 00027 00028 PacketRemoveVisitor(const TransportQueueElement::MatchCriteria& match, 00029 ACE_Message_Block*& unsent_head_block, 00030 ACE_Message_Block* header_block, 00031 TransportReplacedElementAllocator& allocator, 00032 MessageBlockAllocator& mb_allocator, 00033 DataBlockAllocator& db_allocator); 00034 00035 virtual ~PacketRemoveVisitor(); 00036 00037 /// The BasicQueue<T>::accept_remove_visitor() method will call 00038 /// this visit_element() method for each element in the queue. 00039 virtual int visit_element_ref(TransportQueueElement*& element); 00040 00041 RemoveResult status() const; 00042 00043 private: 00044 00045 /// The sample that needs to be removed. 00046 const TransportQueueElement::MatchCriteria& match_; 00047 00048 /// The head block of the chain of unsent blocks in the packet. 00049 ACE_Message_Block*& head_; 00050 00051 /// The packet header block that was duplicate()'d to form the 00052 /// first block in the packet. 00053 ACE_Message_Block* header_block_; 00054 00055 /// Holds the status of our visit. 00056 RemoveResult status_; 00057 00058 /// This is the message block in the chain that corresponds to the 00059 /// current (non-head) element being visited. 00060 ACE_Message_Block* current_block_; 00061 00062 /// This is the message block in the chain that has its cont() set 00063 /// to the current_block_. 00064 ACE_Message_Block* previous_block_; 00065 00066 /// Cached allocator for TransportReplaceElement. 00067 TransportReplacedElementAllocator& replaced_element_allocator_; 00068 /// Cached allocator for DataSampleHeader message block 00069 MessageBlockAllocator& replaced_element_mb_allocator_; 00070 /// Cached allocator for DataSampleHeader data block 00071 DataBlockAllocator& replaced_element_db_allocator_; 00072 }; 00073 00074 } // namespace DCPS 00075 } // namespace OpenDDS 00076 00077 #if defined (__ACE_INLINE__) 00078 #include "PacketRemoveVisitor.inl" 00079 #endif /* __ACE_INLINE__ */ 00080 00081 #endif /* OPENDDS_DCPS_PACKETREMOVEVISTOR_H */