TransportCustomizedElement.cpp

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 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/
00009 #include "TransportCustomizedElement.h"
00010 #include "TransportSendListener.h"
00011 #include "TransportSendElement.h"
00012 
00013 #if !defined (__ACE_INLINE__)
00014 #include "TransportCustomizedElement.inl"
00015 #endif /* __ACE_INLINE__ */
00016 
00017 namespace OpenDDS {
00018 namespace DCPS {
00019 
00020 TransportCustomizedElement::~TransportCustomizedElement()
00021 {
00022   DBG_ENTRY_LVL("TransportCustomizedElement", "~TransportCustomizedElement", 6);
00023   if (msg_) {
00024     msg_->release();
00025   }
00026 }
00027 
00028 void
00029 TransportCustomizedElement::release_element(bool dropped_by_transport)
00030 {
00031   DBG_ENTRY_LVL("TransportCustomizedElement", "release_element", 6);
00032   TransportQueueElement* decided = 0;
00033   if (orig_) {
00034     decided = orig_;
00035   }
00036 
00037   if (allocator_) {
00038     ACE_DES_FREE(this, allocator_->free, TransportCustomizedElement);
00039   } else {
00040     delete this;
00041   }
00042   if (decided) {
00043     decided->decision_made(dropped_by_transport);
00044   }
00045 }
00046 
00047 RepoId
00048 TransportCustomizedElement::publication_id() const
00049 {
00050   DBG_ENTRY_LVL("TransportCustomizedElement", "publication_id", 6);
00051   return publication_id_;
00052 }
00053 
00054 RepoId
00055 TransportCustomizedElement::subscription_id() const
00056 {
00057   DBG_ENTRY_LVL("TransportCustomizedElement", "subscription_id", 6);
00058   const TransportSendElement* ose = original_send_element();
00059   return ose ? ose->subscription_id() : GUID_UNKNOWN;
00060 }
00061 
00062 void
00063 TransportCustomizedElement::set_publication_id(const RepoId& id)
00064 {
00065   DBG_ENTRY_LVL("TransportCustomizedElement", "set_msg", 6);
00066   publication_id_ = id;
00067 }
00068 
00069 const ACE_Message_Block*
00070 TransportCustomizedElement::msg() const
00071 {
00072   DBG_ENTRY_LVL("TransportCustomizedElement", "msg", 6);
00073   return msg_;
00074 }
00075 
00076 void
00077 TransportCustomizedElement::set_msg(ACE_Message_Block* m)
00078 {
00079   DBG_ENTRY_LVL("TransportCustomizedElement", "set_msg", 6);
00080   msg_ = m;
00081 }
00082 
00083 const ACE_Message_Block*
00084 TransportCustomizedElement::msg_payload() const
00085 {
00086   DBG_ENTRY_LVL("TransportCustomizedElement", "msg_payload", 6);
00087   return orig_ ? orig_->msg_payload() : 0;
00088 }
00089 
00090 const TransportSendElement*
00091 TransportCustomizedElement::original_send_element() const
00092 {
00093   const TransportSendElement* ose =
00094     dynamic_cast<const TransportSendElement*>(orig_);
00095   if (!ose) {
00096     const TransportCustomizedElement* tce =
00097       dynamic_cast<const TransportCustomizedElement*>(orig_);
00098     return tce ? tce->original_send_element() : 0;
00099   }
00100   return ose;
00101 }
00102 
00103 } // namespace DCPS
00104 } // namespace OpenDDS

Generated on Fri Feb 12 20:05:28 2016 for OpenDDS by  doxygen 1.4.7