TransportSendControlElement.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef OPENDDS_DCPS_TRANSPORTSENDCONTROLELEMENT_H
00009 #define OPENDDS_DCPS_TRANSPORTSENDCONTROLELEMENT_H
00010 
00011 #include "dds/DCPS/dcps_export.h"
00012 #include "dds/DCPS/GuidUtils.h"
00013 #include "dds/DCPS/DataSampleHeader.h"
00014 #include "TransportDefs.h"
00015 #include "TransportQueueElement.h"
00016 #include "ace/Synch_Traits.h"
00017 
00018 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00019 class ACE_Message_Block;
00020 ACE_END_VERSIONED_NAMESPACE_DECL
00021 
00022 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 namespace OpenDDS {
00025 namespace DCPS {
00026 
00027 class TransportSendListener;
00028 
00029 class TransportSendControlElement;
00030 
00031 typedef Cached_Allocator_With_Overflow<TransportSendControlElement, ACE_SYNCH_NULL_MUTEX>
00032 TransportSendControlElementAllocator;
00033 
00034 class OpenDDS_Dcps_Export TransportSendControlElement : public TransportQueueElement {
00035 public:
00036 
00037   TransportSendControlElement(int initial_count,
00038                               const RepoId& publisher_id,
00039                               TransportSendListener* listener,
00040                               const DataSampleHeader& header,
00041                               Message_Block_Ptr msg_block);
00042 
00043   TransportSendControlElement(int initial_count,
00044                               const DataSampleElement* dcps_elem);
00045 
00046   virtual ~TransportSendControlElement();
00047 
00048   /// Overriden to always return true for Send Control elements.
00049   virtual bool requires_exclusive_packet() const;
00050 
00051   /// Accessor for the publisher id.
00052   virtual RepoId publication_id() const;
00053 
00054   /// Accessor for the ACE_Message_Block
00055   virtual const ACE_Message_Block* msg() const;
00056 
00057   const DataSampleHeader& header() const { return this->header_; }
00058   // Only allow const access to the header.  Modifying the header
00059   // would require remarshaling.
00060   //DataSampleHeader& header() { return this->header_; }
00061 
00062   const TransportSendListener* listener() const { return listener_; }
00063 
00064   virtual const ACE_Message_Block* msg_payload() const;
00065 
00066   virtual SequenceNumber sequence() const;
00067 
00068   /// Is the element a "control" sample from the specified pub_id?
00069   virtual bool is_control(RepoId pub_id) const;
00070   virtual bool owned_by_transport ();
00071 
00072   virtual bool is_request_ack() const { return header_.message_id_ == REQUEST_ACK; }
00073 
00074 protected:
00075 
00076   virtual void release_element(bool dropped_by_transport);
00077 
00078 private:
00079 
00080   /// The publisher of the control message
00081   RepoId publisher_id_;
00082 
00083   /// The TransportSendListener object to call back upon.
00084   TransportSendListener* listener_;
00085 
00086   /// The OpenDDS DCPS header for this control message
00087   DataSampleHeader header_;
00088 
00089   /// The control message.
00090   Message_Block_Ptr msg_;
00091 
00092   /// If constructed from a DataSampleElement, keep it around for release
00093   const DataSampleElement* const dcps_elem_;
00094 
00095   /// Reference to the TransportSendControlElement
00096   /// allocator.
00097   TransportSendControlElementAllocator* allocator_;
00098 };
00099 
00100 } // namespace DCPS
00101 } // namespace OpenDDS
00102 
00103 OPENDDS_END_VERSIONED_NAMESPACE_DECL
00104 
00105 #if defined (__ACE_INLINE__)
00106 #include "TransportSendControlElement.inl"
00107 #endif /* __ACE_INLINE__ */
00108 
00109 #endif  /* OPENDDS_DCPS_TRANSPORTSENDCONTROLELEMENT_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1