00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 namespace OpenDDS { 00009 namespace DCPS { 00010 00011 ACE_INLINE 00012 RtpsSampleHeader::RtpsSampleHeader() 00013 : valid_(false) 00014 , frag_(false) 00015 , marshaled_size_(0) 00016 , message_length_(0) 00017 { 00018 } 00019 00020 ACE_INLINE 00021 RtpsSampleHeader::RtpsSampleHeader(ACE_Message_Block& mb) 00022 : valid_(false) 00023 , frag_(false) 00024 , marshaled_size_(0) 00025 , message_length_(0) 00026 { 00027 init(mb); 00028 } 00029 00030 ACE_INLINE RtpsSampleHeader& 00031 RtpsSampleHeader::operator=(ACE_Message_Block& mb) 00032 { 00033 frag_ = false; 00034 valid_ = false; 00035 // message_length_ should not be reset here 00036 // marshaled_size_ doesn't need to be reset, init() will set it (if valid_) 00037 init(mb); 00038 return *this; 00039 } 00040 00041 ACE_INLINE bool 00042 RtpsSampleHeader::valid() const 00043 { 00044 return valid_; 00045 } 00046 00047 ACE_INLINE void 00048 RtpsSampleHeader::pdu_remaining(size_t size) 00049 { 00050 message_length_ = size; 00051 } 00052 00053 ACE_INLINE size_t 00054 RtpsSampleHeader::marshaled_size() 00055 { 00056 return marshaled_size_; 00057 } 00058 00059 ACE_INLINE ACE_UINT32 00060 RtpsSampleHeader::message_length() 00061 { 00062 return static_cast<ACE_UINT32>(message_length_); 00063 } 00064 00065 ACE_INLINE bool 00066 RtpsSampleHeader::more_fragments() const 00067 { 00068 return frag_; 00069 } 00070 00071 ACE_INLINE bool 00072 RtpsSampleHeader::control_message_supported(char message_id) 00073 { 00074 switch (message_id) { 00075 case INSTANCE_REGISTRATION: 00076 case UNREGISTER_INSTANCE: 00077 case DISPOSE_INSTANCE: 00078 case DISPOSE_UNREGISTER_INSTANCE: 00079 return true; 00080 default: 00081 return false; 00082 } 00083 } 00084 00085 } 00086 }