00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "RtpsCustomizedElement.h" 00009 #include "RtpsSampleHeader.h" 00010 00011 #ifndef __ACE_INLINE__ 00012 #include "RtpsCustomizedElement.inl" 00013 #endif 00014 00015 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00016 00017 namespace OpenDDS { 00018 namespace DCPS { 00019 00020 RtpsCustomizedElement::~RtpsCustomizedElement() 00021 {} 00022 00023 ElementPair 00024 RtpsCustomizedElement::fragment(size_t size) 00025 { 00026 Message_Block_Ptr head; 00027 Message_Block_Ptr tail; 00028 const SequenceRange fragNumbers = 00029 RtpsSampleHeader::split(*msg(), size, head, tail); 00030 00031 RtpsCustomizedElement* frag = 00032 new RtpsCustomizedElement(0, move(head)); 00033 frag->set_publication_id(publication_id()); 00034 frag->seq_ = sequence(); 00035 frag->set_fragment(); 00036 frag->last_frag_ = fragNumbers.first; 00037 00038 RtpsCustomizedElement* rest = 00039 new RtpsCustomizedElement(this, move(tail)); 00040 rest->set_fragment(); 00041 rest->last_frag_ = fragNumbers.second; 00042 00043 return ElementPair(frag, rest); 00044 } 00045 00046 const ACE_Message_Block* 00047 RtpsCustomizedElement::msg_payload() const 00048 { 00049 return msg() ? msg()->cont() : 0; 00050 } 00051 00052 } 00053 } 00054 00055 OPENDDS_END_VERSIONED_NAMESPACE_DECL