本文整理汇总了C++中AisBitset::ToInt方法的典型用法代码示例。如果您正苦于以下问题:C++ AisBitset::ToInt方法的具体用法?C++ AisBitset::ToInt怎么用?C++ AisBitset::ToInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AisBitset
的用法示例。
在下文中一共展示了AisBitset::ToInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Ais8_1_26_Wx::Ais8_1_26_Wx(const AisBitset &bits,
const size_t offset) {
air_temp = bits.ToInt(offset, 11) / 10.;
air_temp_sensor_type = bits.ToUnsignedInt(offset + 11, 3);
precip = bits.ToUnsignedInt(offset + 14, 2);
horz_vis = bits.ToUnsignedInt(offset + 16, 8) / 10.;
dew_point = bits.ToInt(offset + 24, 10) / 10.;
dew_point_type = bits.ToUnsignedInt(offset + 34, 3);
air_pressure = (bits.ToUnsignedInt(offset + 37, 9) + 800) / 100.0; // Pa.
air_pressure_trend = bits.ToUnsignedInt(offset + 46, 2);
air_pressor_type = bits.ToUnsignedInt(offset + 48, 3);
salinity = bits.ToUnsignedInt(offset + 51, 9) / 10.;
spare = bits.ToUnsignedInt(offset + 60, 25);
}
示例2: assert
// IMO Circ 289 - Tidal Window
// See also Circ 236
Ais6_1_14::Ais6_1_14(const char *nmea_payload, const size_t pad)
: Ais6(nmea_payload, pad), utc_month(0), utc_day(0) {
// TODO(schwehr): untested - no sample of the correct length yet
assert(dac == 1);
assert(fi == 14);
if (num_bits != 376) {
status = AIS_ERR_BAD_BIT_COUNT;
return;
}
AisBitset bs;
const AIS_STATUS r = bs.ParseNmeaPayload(nmea_payload, pad);
if (r != AIS_OK) {
status = r;
return;
}
bs.SeekTo(88);
utc_month = bs.ToUnsignedInt(88, 4);
utc_day = bs.ToUnsignedInt(92, 5);
for (size_t window_num = 0; window_num < 3; window_num++) {
Ais6_1_14_Window w;
const size_t start = 97 + window_num * 93;
// Reversed order for lng/lat.
float y = bs.ToInt(start, 27) / 600000.;
float x = bs.ToInt(start + 27, 28) / 600000.;
w.position = AisPoint(x, y);
w.utc_hour_from = bs.ToUnsignedInt(start + 55, 5);
w.utc_min_from = bs.ToUnsignedInt(start + 60, 6);
w.utc_hour_to = bs.ToUnsignedInt(start + 66, 5);
w.utc_min_to = bs.ToUnsignedInt(start + 71, 6);
w.cur_dir = bs.ToUnsignedInt(start + 77, 9);
w.cur_speed = bs.ToUnsignedInt(start + 86, 7) / 10.;
windows.push_back(w);
}
assert(bs.GetRemaining() == 0);
status = AIS_OK;
}