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 "dds/DCPS/Message_Block_Ptr.h" 00013 #include "TransportQueueElement.h" 00014 #include "ace/Synch_Traits.h" 00015 00016 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00017 00018 namespace OpenDDS { 00019 namespace DCPS { 00020 00021 class TransportRetainedElement; 00022 00023 class OpenDDS_Dcps_Export TransportRetainedElement 00024 : public TransportQueueElement { 00025 public: 00026 /// Construct with message block chain and Id values. 00027 TransportRetainedElement( 00028 const ACE_Message_Block* message, 00029 const RepoId& pubId, 00030 MessageBlockAllocator* mb_allocator_ = 0, 00031 DataBlockAllocator* db_allocator_ = 0 00032 ); 00033 00034 /// Copy constructor. 00035 TransportRetainedElement(const TransportRetainedElement& source); 00036 00037 virtual ~TransportRetainedElement(); 00038 00039 ///{ @name TransportQueueElement methods 00040 00041 virtual RepoId publication_id() const; 00042 00043 virtual const ACE_Message_Block* msg() const; 00044 virtual const ACE_Message_Block* msg_payload() const; 00045 00046 virtual bool owned_by_transport(); 00047 00048 protected: 00049 virtual void release_element(bool dropped_by_transport); 00050 00051 ///} 00052 00053 private: 00054 /// Sample data, if any. 00055 Message_Block_Ptr msg_; 00056 00057 /// Originating publication Id, if any. 00058 RepoId publication_id_; 00059 00060 /// Cached allocator for DataSampleHeader message block 00061 MessageBlockAllocator* mb_allocator_; 00062 /// Cached allocator for DataSampleHeader data block 00063 DataBlockAllocator* db_allocator_; 00064 }; 00065 00066 } // namespace DCPS 00067 } // namespace OpenDDS 00068 00069 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00070 00071 #if defined (__ACE_INLINE__) 00072 #include "TransportRetainedElement.inl" 00073 #endif /* __ACE_INLINE__ */ 00074 00075 #endif /* OPENDDS_DCPS_TRANSPORTRETAINEDELEMENT_H */ 00076