2 #include <marnav/nmea/io.hpp>
8 MARNAV_NMEA_DEFINE_SENTENCE_PARSE_FUNC(r00
)
10 constexpr const char * r00::TAG
;
13 : sentence(ID
, TAG
, talker_id::global_positioning_system
)
17 r00::r00(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
18 : sentence(ID
, TAG
, talk
)
20 if (std::distance(first
, last
) != r00::max_waypoint_ids
)
21 throw std::invalid_argument
{"invalid number of fields in r00"};
23 for (auto i
= 0; i
< max_waypoint_ids
; ++i
) {
25 read(*(first
+ i
), id
);
26 set_waypoint_id(i
, id
);
30 std::vector
<std::string
> r00::get_data() const
32 std::vector
<std::string
> result
;
33 result
.reserve(max_waypoint_ids
);
35 for (auto i
= 0; i
< max_waypoint_ids
; ++i
) {
37 result
.push_back(waypoint_id
[i
].value());
46 void r00::check_index(int index
) const
48 if ((index
< 0) || (index
>= max_waypoint_ids
))
49 throw std::out_of_range
{"waypoint ID out of range"};
52 utils::optional
<waypoint
> r00::get_waypoint_id(int index
) const
55 return waypoint_id
[index
];
58 void r00::set_waypoint_id(int index
, const waypoint
& id
)
61 waypoint_id
[index
] = id
;