本文整理汇总了C++中AisBitset::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ AisBitset::ToString方法的具体用法?C++ AisBitset::ToString怎么用?C++ AisBitset::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AisBitset
的用法示例。
在下文中一共展示了AisBitset::ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
// IMO Circ 289 - Clearance time to enter port
Ais6_1_18::Ais6_1_18(const char *nmea_payload, const size_t pad)
: Ais6(nmea_payload, pad), link_id(0), utc_month(0), utc_day(0),
utc_hour(0), utc_min(0), spare2() {
assert(dac == 1);
assert(fi == 18);
if (num_bits != 360) {
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;
}
link_id = bs.ToUnsignedInt(88, 10);
utc_month = bs.ToUnsignedInt(98, 4);
utc_day = bs.ToUnsignedInt(102, 5);
utc_hour = bs.ToUnsignedInt(107, 5);
utc_min = bs.ToUnsignedInt(112, 6);
port_berth = bs.ToString(118, 120);
dest = bs.ToString(238, 30);
position = bs.ToAisPoint(268, 49);
spare2[0] = bs.ToUnsignedInt(317, 32);
spare2[1] = bs.ToUnsignedInt(349, 11);
assert(bs.GetRemaining() == 0);
status = AIS_OK;
}
示例2: un
// IMO Circ 289 - Dangerous cargo
// See also Circ 236
Ais6_1_12::Ais6_1_12(const char *nmea_payload, const size_t pad)
: Ais6(nmea_payload, pad), utc_month_dep(0), utc_day_dep(0),
utc_hour_dep(0), utc_min_dep(0), utc_month_next(0),
utc_day_next(0), utc_hour_next(0), utc_min_next(0),
un(0), value(0), value_unit(0), spare2(0) {
assert(dac == 1);
assert(fi == 12);
if (num_bits != 360) {
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;
}
// TODO(schwehr): add in the offset of the dest mmsi
#if 0
bs.SeekTo(56);
last_port = bs.ToString(56, 30);
utc_month_dep = bs.ToUnsignedInt(86, 4);
utc_day_dep = bs.ToUnsignedInt(90, 5);
utc_hour_dep = bs.ToUnsignedInt(95, 5);
utc_min_dep = bs.ToUnsignedInt(100, 6);
next_port = bs.ToString(106, 30);
utc_month_next = bs.ToUnsignedInt(136, 4); // estimated arrival
utc_day_next = bs.ToUnsignedInt(140, 5);
utc_hour_next = bs.ToUnsignedInt(145, 5);
utc_min_next = bs.ToUnsignedInt(150, 6);
main_danger = bs.ToString(156, 120);
imo_cat = bs.ToString(276, 24);
un = bs.ToUnsignedInt(300, 13);
value = bs.ToUnsignedInt(313, 10); // TODO(schwehr): units
value_unit = bs.ToUnsignedInt(323, 2);
spare = bs.ToUnsignedInt(325, 3);
// 360
#endif
// TODO(schwehr): Add assert(bs.GetRemaining() == 0);
status = AIS_OK;
}
示例3: length
// IMO Circ 289 - Berthing data
Ais6_1_20::Ais6_1_20(const char *nmea_payload, const size_t pad)
: Ais6(nmea_payload, pad), link_id(0), length(0), depth(0.0),
mooring_position(0), utc_month(0), utc_day(0), utc_hour(0), utc_min(0),
services_known(false), services() {
assert(dac == 1);
assert(fi == 20);
if (num_bits != 360) {
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);
link_id = bs.ToUnsignedInt(88, 10);
length = bs.ToUnsignedInt(98, 9);
depth = bs.ToUnsignedInt(107, 8);
mooring_position = bs.ToUnsignedInt(115, 3);
utc_month = bs.ToUnsignedInt(118, 4);
utc_day = bs.ToUnsignedInt(122, 5);
utc_hour = bs.ToUnsignedInt(127, 5);
utc_min = bs.ToUnsignedInt(132, 6);
services_known = bs[138];
for (size_t serv_num = 0; serv_num < 26; serv_num++) {
// TODO(schwehr): const int val = bs.ToUnsignedInt(139 + 2*serv_num, 2);
services[serv_num]
= static_cast<int>(bs.ToUnsignedInt(139 + 2*serv_num, 2));
}
name = bs.ToString(191, 120);
position = bs.ToAisPoint(311, 49);
assert(bs.GetRemaining() == 0);
status = AIS_OK;
}
示例4: string
Ais8_366_22_Text::Ais8_366_22_Text(const AisBitset &bits,
const size_t offset) {
text = string(bits.ToString(offset + 3, 84));
spare = bits.ToUnsignedInt(offset + 87, 3);
}
示例5:
Ais8_1_26_Station::Ais8_1_26_Station(const AisBitset &bits,
const size_t offset) {
name = bits.ToString(offset, 84);
spare = bits.ToUnsignedInt(offset + 84, 1);
}