Return updated AIS RecentEntry.

This commit is contained in:
Jared Boone 2016-01-15 11:38:09 -08:00
parent 19e3b273ad
commit c4f7d9bf54
2 changed files with 6 additions and 3 deletions

View File

@ -133,7 +133,7 @@ void AISRecentEntry::update(const ais::Packet& packet) {
}
}
void AISRecentEntries::on_packet(const ais::Packet& packet) {
const AISRecentEntry& AISRecentEntries::on_packet(const ais::Packet& packet) {
const auto source_id = packet.source_id();
auto matching_recent = find_by_mmsi(source_id);
if( matching_recent != std::end(entries) ) {
@ -145,7 +145,10 @@ void AISRecentEntries::on_packet(const ais::Packet& packet) {
truncate_entries();
}
entries.front().update(packet);
auto& entry = entries.front();
entry.update(packet);
return entry;
}
AISRecentEntries::ContainerType::const_iterator AISRecentEntries::find_by_mmsi(const ais::MMSI key) const {

View File

@ -75,7 +75,7 @@ public:
using ContainerType = std::list<AISRecentEntry>;
using RangeType = std::pair<ContainerType::const_iterator, ContainerType::const_iterator>;
void on_packet(const ais::Packet& packet);
const AISRecentEntry& on_packet(const ais::Packet& packet);
ContainerType::const_reference front() const {
return entries.front();