当前位置: 首页>>代码示例>>C++>>正文


C++ AisBitset::GetRemaining方法代码示例

本文整理汇总了C++中AisBitset::GetRemaining方法的典型用法代码示例。如果您正苦于以下问题:C++ AisBitset::GetRemaining方法的具体用法?C++ AisBitset::GetRemaining怎么用?C++ AisBitset::GetRemaining使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AisBitset的用法示例。


在下文中一共展示了AisBitset::GetRemaining方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: capabilities

// IFM 4: Capability reply - OLD ITU 1371-4
// TODO(schwehr): WTF?  10 + 128 + 6 == 80  Is this 168 or 232 bits?
Ais6_1_4::Ais6_1_4(const char *nmea_payload, const size_t pad)
    : Ais6(nmea_payload, pad), ack_dac(0), capabilities(),
      cap_reserved(), spare2(0) {
  assert(dac == 1);
  assert(fi == 4);

  // TODO(schwehr): num_bits for 6_1_4.  226 bits?
  if (num_bits != 232) {
    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);
  ack_dac = bs.ToUnsignedInt(88, 10);
  for (size_t cap_num = 0; cap_num < 128/2; cap_num++) {
    size_t start = 98 + cap_num * 2;
    capabilities[cap_num] = bs[start];
    cap_reserved[cap_num] = bs[start + 1];
  }
  // spare2 = bs.ToUnsignedInt(226, 6);  // OR NOT
  // TODO(schwehr): add in the offset of the dest mmsi

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:34,代码来源:ais6.cpp

示例2: assert

Ais6_1_0::Ais6_1_0(const char *nmea_payload, const size_t pad)
    : Ais6(nmea_payload, pad), ack_required(false), msg_seq(0),
      spare2(0) {

  assert(dac == 1);
  assert(fi == 0);

  if (num_bits < 88 || num_bits > 936) {
    status = AIS_ERR_BAD_BIT_COUNT;
    return;
  }

  AisBitset bs;  // TODO(schwehr): what is the real max size?
  const AIS_STATUS r = bs.ParseNmeaPayload(nmea_payload, pad);
  if (r != AIS_OK) {
    status = r;
    return;
  }

  bs.SeekTo(88);
  ack_required = bs[88];
  msg_seq = bs.ToUnsignedInt(89, 11);

  const size_t text_size = 6 * ((num_bits - 100) / 6);
  const size_t spare2_size = num_bits - 100 - text_size;
  text = bs.ToString(100, text_size);

  if (!spare2_size)
    spare2 = 0;
  else
    spare2 = bs.ToUnsignedInt(100 + text_size, spare2_size);

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:35,代码来源:ais6.cpp

示例3: spare

// IMO 1371-5 Ack
Ais6_1_5::Ais6_1_5(const char *nmea_payload, const size_t pad)
    : Ais6(nmea_payload, pad), ack_dac(0), ack_fi(0), seq_num(0),
      ai_available(false), ai_response(0), spare(0) {
  assert(dac == 1);
  assert(fi == 5);

  if (num_bits != 168) {
    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);
  ack_dac = bs.ToUnsignedInt(88, 10);
  ack_fi = bs.ToUnsignedInt(98, 6);
  seq_num = bs.ToUnsignedInt(104, 11);
  ai_available = static_cast<bool>(bs[115]);
  ai_response = bs.ToUnsignedInt(116, 3);
  spare = bs.ToUnsignedInt(119, 49);

  assert(bs.GetRemaining() == 0);

  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:31,代码来源:ais6.cpp

示例4: month

Ais8_366_22::Ais8_366_22(const char *nmea_payload, const size_t pad)
    : Ais8(nmea_payload, pad), link_id(0), notice_type(0), month(0), day(0),
      utc_hour(0), utc_minute(0), duration_minutes(0) {
  assert(dac == 366);
  assert(fi == 22);

  if (num_bits <= 208 || num_bits >= 1020) {
    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(56, 10);
  notice_type = bs.ToUnsignedInt(66, 7);
  month = bs.ToUnsignedInt(73, 4);
  day = bs.ToUnsignedInt(77, 5);
  utc_hour = bs.ToUnsignedInt(82, 5);
  utc_minute = bs.ToUnsignedInt(87, 6);

  duration_minutes = bs.ToUnsignedInt(93, 18);

  const int num_sub_areas = static_cast<int>(floor((num_bits - 111)/90.));
  for (int area_idx = 0; area_idx < num_sub_areas; area_idx++) {
    Ais8_366_22_SubArea *area =
        ais8_366_22_subarea_factory(bs, 111 + 90*area_idx);
    if (area) {
      sub_areas.push_back(area);
    } else {
      status = AIS_ERR_BAD_SUB_SUB_MSG;
      return;
    }
  }

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:42,代码来源:ais8_366_22.cpp

示例5: 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;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:41,代码来源:ais6.cpp

示例6: voltage

// http://www.e-navigation.nl/content/monitoring-aids-navigation
Ais6_0_0::Ais6_0_0(const char *nmea_payload, const size_t pad)
    : Ais6(nmea_payload, pad),
      sub_id(1),
      voltage(0.0),
      current(0.0),
      dc_power_supply(true),
      light_on(true),
      battery_low(false),
      off_position(false),
      spare2(0) {
  assert(dac == 0);
  assert(fi == 0);

  if (num_bits != 136) {
    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);
  sub_id = bs.ToUnsignedInt(88, 16);
  voltage = bs.ToUnsignedInt(104, 12) / 10.0;
  current = bs.ToUnsignedInt(116, 10) / 10.0;
  dc_power_supply = bs[126];
  light_on = bs[127];
  battery_low = bs[128];
  off_position = bs[129];

  spare2 = bs.ToUnsignedInt(130, 6);

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:40,代码来源:ais6.cpp

示例7: persons

// IFM 40: people on board - OLD ITU 1371-4
Ais6_1_40::Ais6_1_40(const char *nmea_payload, const size_t pad)
    : Ais6(nmea_payload, pad), persons(0), spare2(0) {
  assert(dac == 1);
  assert(fi == 40);

  if (num_bits != 104) {
    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);
  persons = bs.ToUnsignedInt(88, 13);
  spare2 = bs.ToUnsignedInt(101, 3);

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:25,代码来源:ais6.cpp

示例8: AisMsg

Ais23::Ais23(const char *nmea_payload, const size_t pad)
    : AisMsg(nmea_payload, pad), spare(0), station_type(0), type_and_cargo(0),
      spare2(3), txrx_mode(0), interval_raw(0), quiet(0), spare3(0) {

  assert(message_id == 23);

  if (pad != 2 || num_chars != 27) {
    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(38);
  spare = bs.ToUnsignedInt(38, 2);

  position1 = bs.ToAisPoint(40, 35);
  position2 = bs.ToAisPoint(75, 35);

  station_type = bs.ToUnsignedInt(110, 4);
  type_and_cargo = bs.ToUnsignedInt(114, 8);
  spare2 = bs.ToUnsignedInt(122, 22);

  txrx_mode = bs.ToUnsignedInt(144, 2);
  interval_raw = bs.ToUnsignedInt(146, 4);
  quiet = bs.ToUnsignedInt(150, 4);
  spare3 = bs.ToUnsignedInt(154, 6);

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:36,代码来源:ais23.cpp

示例9: amount

// IMO Circ 289 - Dangerous cargo indication 2
// See also Circ 236
Ais6_1_25::Ais6_1_25(const char *nmea_payload, const size_t pad)
    : Ais6(nmea_payload, pad), amount_unit(0), amount(0) {
  assert(dac == 1);
  assert(fi == 25);

  // TODO(schwehr): verify multiple of the size of cargos + header
  //   or padded to a slot boundary
  // Allowing a message with no payloads
  // TODO(schwehr): (num_bits - 100) % 17 != 0) is okay
  if (num_bits < 100 || num_bits > 576) {
    status = AIS_ERR_BAD_BIT_COUNT;
    return;
  }
  if ((num_bits - 100) % 17 != 0) {
    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);
  amount_unit = bs.ToUnsignedInt(88, 2);
  amount = bs.ToUnsignedInt(90, 10);
  const size_t total_cargos = static_cast<int>(floor((num_bits - 100) / 17.));
  for (size_t cargo_num = 0; cargo_num < total_cargos; cargo_num++) {
    Ais6_1_25_Cargo cargo;
    const size_t start = 100 + 17*cargo_num;
    cargo.code_type = bs.ToUnsignedInt(start, 4);

    // TODO(schwehr): Is this the correct behavior?
    switch (cargo.code_type) {
      // No 0
      case 1:  // IMDG Code in packed form
        cargo.imdg = bs.ToUnsignedInt(start + 4, 7);
        cargo.imdg_valid = true;
        cargo.spare = bs.ToUnsignedInt(start + 11, 6);
        cargo.spare_valid = true;
        break;
      case 2:  // IGC Code
        cargo.un = bs.ToUnsignedInt(start + 4, 13);
        cargo.un_valid = true;
        break;
      case 3:  // BC Code
        cargo.bc = bs.ToUnsignedInt(start + 4, 3);
        cargo.bc_valid = true;
        cargo.imdg = bs.ToUnsignedInt(start + 7, 7);
        cargo.imdg_valid = true;
        cargo.spare = bs.ToUnsignedInt(start + 14, 3);
        cargo.spare_valid = true;
        break;
      case 4:  // MARPOL Annex I
        cargo.marpol_oil = bs.ToUnsignedInt(start + 4, 4);
        cargo.marpol_oil_valid = true;
        cargo.spare = bs.ToUnsignedInt(start + 8, 9);
        cargo.spare_valid = true;
        break;
      case 5:  // MARPOL Annex II IBC
        cargo.marpol_cat = bs.ToUnsignedInt(start + 4, 3);
        cargo.marpol_cat_valid = true;
        cargo.spare = bs.ToUnsignedInt(start + 7, 10);
        cargo.spare_valid = true;
        break;
      // 6: Regional use
      // 7: 7-15 reserved for future
      default:
        break;  // Just push in an all blank record?
    }
    cargos.push_back(cargo);
  }

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:80,代码来源:ais6.cpp

示例10: AisMsg


//.........这里部分代码省略.........
      utc_min(0),
      utc_spare(0),
      slot_offset_valid(false),
      slot_offset(0),
      slot_increment_valid(false),
      slot_increment(0),
      slots_to_allocate_valid(false),
      slots_to_allocate(0),
      keep_flag_valid(false),
      keep_flag(0),
      commstate_cs_fill_valid(false),
      commstate_cs_fill(0) {
  assert(message_id == 18);

  if (pad != 0 || num_chars != 28) {
    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(38);
  spare = bs.ToUnsignedInt(38, 8);
  sog = bs.ToUnsignedInt(46, 10) / 10.;

  position_accuracy = bs[56];
  position = bs.ToAisPoint(57, 55);

  cog = bs.ToUnsignedInt(112, 12) / 10.;
  true_heading = bs.ToUnsignedInt(124, 9);
  timestamp = bs.ToUnsignedInt(133, 6);
  spare2 = bs.ToUnsignedInt(139, 2);
  unit_flag = bs[141];
  display_flag = bs[142];
  dsc_flag = bs[143];
  band_flag = bs[144];
  m22_flag = bs[145];
  mode_flag = bs[146];
  raim = bs[147];
  commstate_flag = bs[148];  // 0 SOTDMA, 1 ITDMA

  if (unit_flag == 0) {
    sync_state = bs.ToUnsignedInt(149, 2);
    if (commstate_flag == 0) {
      // SOTDMA
      slot_timeout = bs.ToUnsignedInt(151, 3);
      slot_timeout_valid = true;

      switch (slot_timeout) {
        case 0:
          slot_offset = bs.ToUnsignedInt(154, 14);
          slot_offset_valid = true;
          break;
        case 1:
          utc_hour = bs.ToUnsignedInt(154, 5);
          utc_min = bs.ToUnsignedInt(159, 7);
          utc_spare = bs.ToUnsignedInt(166, 2);
          utc_valid = true;
          break;
        case 2:  // FALLTHROUGH
        case 4:  // FALLTHROUGH
        case 6:
          slot_number = bs.ToUnsignedInt(154, 14);
          slot_number_valid = true;
          break;
        case 3:  // FALLTHROUGH
        case 5:  // FALLTHROUGH
        case 7:
          received_stations = bs.ToUnsignedInt(154, 14);
          received_stations_valid = true;
          break;
        default:
          assert(false);
      }

    } else {
      // ITDMA
      slot_increment = bs.ToUnsignedInt(151, 13);
      slot_increment_valid = true;

      slots_to_allocate = bs.ToUnsignedInt(164, 3);
      slots_to_allocate_valid = true;

      keep_flag = bs[167];
      keep_flag_valid = true;
    }
  } else {
    // Carrier Sense (CS) with unit_flag of 1.
    commstate_cs_fill = bs.ToUnsignedInt(149, 19);
    commstate_cs_fill_valid = true;
  }

  assert(bs.GetRemaining() == 0);
  status = AIS_OK;
}
开发者ID:AsbjornPettersen,项目名称:libais,代码行数:101,代码来源:ais18.cpp


注:本文中的AisBitset::GetRemaining方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。