00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef OPENDDS_DCPS_TRANSPORTRETAINEDELEMENT_H 00009 #define OPENDDS_DCPS_TRANSPORTRETAINEDELEMENT_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 TransportRetainedElement; 00019 00020 typedef Cached_Allocator_With_Overflow<TransportRetainedElement, 00021 ACE_SYNCH_NULL_MUTEX> 00022 TransportRetainedElementAllocator; 00023 00024 class OpenDDS_Dcps_Export TransportRetainedElement 00025 : public TransportQueueElement { 00026 public: 00027 /// Construct with message block chain and Id values. 00028 TransportRetainedElement( 00029 const ACE_Message_Block* message, 00030 const RepoId& pubId, 00031 TransportRetainedElementAllocator* allocator = 0, 00032 MessageBlockAllocator* mb_allocator_ = 0, 00033 DataBlockAllocator* db_allocator_ = 0 00034 ); 00035 00036 /// Copy constructor. 00037 TransportRetainedElement(const TransportRetainedElement& source); 00038 00039 virtual ~TransportRetainedElement(); 00040 00041 ///{ @name TransportQueueElement methods 00042 00043 virtual RepoId publication_id() const; 00044 00045 virtual const ACE_Message_Block* msg() const; 00046 virtual const ACE_Message_Block* msg_payload() const; 00047 00048 virtual bool owned_by_transport(); 00049 00050 protected: 00051 virtual void release_element(bool dropped_by_transport); 00052 00053 ///} 00054 00055 private: 00056 /// Sample data, if any. 00057 ACE_Message_Block* msg_; 00058 00059 /// Originating publication Id, if any. 00060 RepoId publication_id_; 00061 00062 /// Reference to TransportRetainedElement allocator. 00063 TransportRetainedElementAllocator* allocator_; 00064 /// Cached allocator for DataSampleHeader message block 00065 MessageBlockAllocator* mb_allocator_; 00066 /// Cached allocator for DataSampleHeader data block 00067 DataBlockAllocator* db_allocator_; 00068 }; 00069 00070 } // namespace DCPS 00071 } // namespace OpenDDS 00072 00073 #if defined (__ACE_INLINE__) 00074 #include "TransportRetainedElement.inl" 00075 #endif /* __ACE_INLINE__ */ 00076 00077 #endif /* OPENDDS_DCPS_TRANSPORTRETAINEDELEMENT_H */ 00078