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 namespace OpenDDS { 00016 namespace DCPS { 00017 00018 RtpsCustomizedElement::~RtpsCustomizedElement() 00019 {} 00020 00021 ElementPair 00022 RtpsCustomizedElement::fragment(size_t size) 00023 { 00024 ACE_Message_Block* head; 00025 ACE_Message_Block* tail; 00026 const SequenceRange fragNumbers = 00027 RtpsSampleHeader::split(*msg(), size, head, tail); 00028 00029 RtpsCustomizedElement* frag = 00030 RtpsCustomizedElement::alloc(0, head, allocator()); 00031 frag->set_publication_id(publication_id()); 00032 frag->seq_ = sequence(); 00033 frag->set_fragment(); 00034 frag->last_frag_ = fragNumbers.first; 00035 00036 RtpsCustomizedElement* rest = 00037 RtpsCustomizedElement::alloc(this, tail, allocator()); 00038 rest->set_fragment(); 00039 rest->last_frag_ = fragNumbers.second; 00040 00041 return ElementPair(frag, rest); 00042 } 00043 00044 const ACE_Message_Block* 00045 RtpsCustomizedElement::msg_payload() const 00046 { 00047 return msg() ? msg()->cont() : 0; 00048 } 00049 00050 } 00051 }