00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_TRANSPORTREPLACEDELEMENT_H 00009 #define OPENDDS_DCPS_TRANSPORTREPLACEDELEMENT_H 00010 00011 #include "dds/DCPS/dcps_export.h" 00012 #include "TransportQueueElement.h" 00013 #include "ace/Synch.h" 00014 00015 namespace OpenDDS { 00016 namespace DCPS { 00017 00018 class TransportReplacedElement; 00019 00020 typedef Cached_Allocator_With_Overflow<TransportReplacedElement, 00021 ACE_SYNCH_NULL_MUTEX> 00022 TransportReplacedElementAllocator; 00023 00024 class OpenDDS_Dcps_Export TransportReplacedElement 00025 : public TransportQueueElement { 00026 public: 00027 00028 TransportReplacedElement(TransportQueueElement* orig_elem, 00029 TransportReplacedElementAllocator* allocator = 0, 00030 MessageBlockAllocator* mb_allocator = 0, 00031 DataBlockAllocator* db_allocator = 0); 00032 virtual ~TransportReplacedElement(); 00033 00034 /// Accessor for the publisher id. 00035 virtual RepoId publication_id() const; 00036 00037 /// Accessor for the ACE_Message_Block 00038 virtual const ACE_Message_Block* msg() const; 00039 00040 virtual const ACE_Message_Block* msg_payload() const; 00041 00042 virtual bool owned_by_transport(); 00043 00044 protected: 00045 00046 virtual void release_element(bool dropped_by_transport); 00047 00048 private: 00049 00050 /// Reference to TransportReplacedElement allocator. 00051 TransportReplacedElementAllocator* allocator_; 00052 /// Cached allocator for DataSampleHeader message block 00053 MessageBlockAllocator* mb_allocator_; 00054 /// Cached allocator for DataSampleHeader data block 00055 DataBlockAllocator* db_allocator_; 00056 00057 /// The publication_id() from the original TransportQueueElement 00058 RepoId publisher_id_; 00059 00060 /// A deep-copy of the msg() from the original TransportQueueElement. 00061 ACE_Message_Block* msg_; 00062 }; 00063 00064 } // namespace DCPS 00065 } // namespace OpenDDS 00066 00067 #if defined (__ACE_INLINE__) 00068 #include "TransportReplacedElement.inl" 00069 #endif /* __ACE_INLINE__ */ 00070 00071 #endif /* OPENDDS_DCPS_TRANSPORTREPLACEDELEMENT_H */