00001
00002
00003
00004
00005
00006
00007
00008 ACE_INLINE
00009 OpenDDS::DCPS::DataSampleHeader::DataSampleHeader()
00010 : message_id_(0)
00011 , submessage_id_(0)
00012 , byte_order_(ACE_CDR_BYTE_ORDER)
00013 , coherent_change_(0)
00014 , historic_sample_(0)
00015 , lifespan_duration_(0)
00016 , group_coherent_(0)
00017 , content_filter_(0)
00018 , sequence_repair_(0)
00019 , more_fragments_(0)
00020 , cdr_encapsulation_(0)
00021 , key_fields_only_(0)
00022 , reserved_1(0)
00023 , reserved_2(0)
00024 , reserved_3(0)
00025 , reserved_4(0)
00026 , reserved_5(0)
00027 , reserved_6(0)
00028 , message_length_(0)
00029 , sequence_()
00030 , source_timestamp_sec_(0)
00031 , source_timestamp_nanosec_(0)
00032 , lifespan_duration_sec_(0)
00033 , lifespan_duration_nanosec_(0)
00034 , publication_id_(GUID_UNKNOWN)
00035 , publisher_id_(GUID_UNKNOWN)
00036 , marshaled_size_(0)
00037 {
00038 }
00039
00040 ACE_INLINE
00041 OpenDDS::DCPS::DataSampleHeader::DataSampleHeader(ACE_Message_Block& buffer)
00042 : message_id_(0)
00043 , submessage_id_(0)
00044 , byte_order_(ACE_CDR_BYTE_ORDER)
00045 , coherent_change_(0)
00046 , historic_sample_(0)
00047 , lifespan_duration_(0)
00048 , group_coherent_(0)
00049 , content_filter_(0)
00050 , sequence_repair_(0)
00051 , more_fragments_(0)
00052 , cdr_encapsulation_(0)
00053 , key_fields_only_(0)
00054 , reserved_1(0)
00055 , reserved_2(0)
00056 , reserved_3(0)
00057 , reserved_4(0)
00058 , reserved_5(0)
00059 , reserved_6(0)
00060 , message_length_(0)
00061 , sequence_()
00062 , source_timestamp_sec_(0)
00063 , source_timestamp_nanosec_(0)
00064 , lifespan_duration_sec_(0)
00065 , lifespan_duration_nanosec_(0)
00066 , publication_id_(GUID_UNKNOWN)
00067 , publisher_id_(GUID_UNKNOWN)
00068 {
00069 this->init(&buffer);
00070 }
00071
00072 ACE_INLINE
00073 OpenDDS::DCPS::DataSampleHeader&
00074 OpenDDS::DCPS::DataSampleHeader::operator=(ACE_Message_Block& buffer)
00075 {
00076 this->init(&buffer);
00077 return *this;
00078 }
00079
00080 ACE_INLINE
00081 size_t
00082 OpenDDS::DCPS::DataSampleHeader::marshaled_size() const
00083 {
00084 return marshaled_size_;
00085 }
00086
00087 ACE_INLINE
00088 size_t
00089 OpenDDS::DCPS::DataSampleHeader::max_marshaled_size()
00090 {
00091 return 1 +
00092 1 +
00093 2 +
00094 4 +
00095 8 +
00096 4 +
00097 4 +
00098 4 +
00099 4 +
00100 16 +
00101 16 ;
00102
00103
00104 }
00105
00106
00107
00108
00109
00110
00111 ACE_INLINE
00112 void
00113 OpenDDS::DCPS::DataSampleHeader::clear_flag(DataSampleHeaderFlag flag,
00114 ACE_Message_Block* buffer)
00115 {
00116 char* base = buffer->base();
00117
00118
00119 if (static_cast<size_t>(buffer->end() - base) < FLAGS_OFFSET + 1) {
00120 ACE_ERROR((LM_ERROR,
00121 ACE_TEXT("(%P|%t) ERROR: DataSampleHeader::clear_flag: ")
00122 ACE_TEXT("ACE_Message_Block too short (missing flags octet).\n")));
00123 return;
00124 }
00125
00126 base[FLAGS_OFFSET] &= ~mask_flag(flag);
00127 }
00128
00129 ACE_INLINE
00130 void
00131 OpenDDS::DCPS::DataSampleHeader::set_flag(DataSampleHeaderFlag flag,
00132 ACE_Message_Block* buffer)
00133 {
00134 char* base = buffer->base();
00135
00136
00137 if (static_cast<size_t>(buffer->end() - base) < FLAGS_OFFSET + 1) {
00138 ACE_ERROR((LM_ERROR,
00139 ACE_TEXT("(%P|%t) ERROR: DataSampleHeader::set_flag: ")
00140 ACE_TEXT("ACE_Message_Block too short (missing flags octet).\n")));
00141 return;
00142 }
00143
00144 base[FLAGS_OFFSET] |= mask_flag(flag);
00145 }
00146
00147 ACE_INLINE
00148 bool
00149 OpenDDS::DCPS::DataSampleHeader::test_flag(DataSampleHeaderFlag flag,
00150 const ACE_Message_Block* buffer)
00151 {
00152 char* base = buffer->base();
00153
00154
00155 if (static_cast<size_t>(buffer->end() - base) < FLAGS_OFFSET + 1) {
00156 ACE_ERROR_RETURN((LM_ERROR,
00157 ACE_TEXT("(%P|%t) ERROR: DataSampleHeader::set_flag: ")
00158 ACE_TEXT("ACE_Message_Block too short (missing flags octet).\n")), false);
00159 }
00160
00161
00162 return base[FLAGS_OFFSET] & mask_flag(flag);
00163 }