Vanetza
 
Loading...
Searching...
No Matches
vanetza::geonet::GbcMemory Class Reference

#include <gbc_memory.hpp>

Classes

struct  by_packet
 
struct  by_queue
 

Public Types

using PacketIdentifier = CbfPacketIdentifier
 

Public Member Functions

void capacity (std::size_t num)
 
std::size_t size () const
 
bool remember (const PacketIdentifier &id)
 
bool knows (const PacketIdentifier &id) const
 

Private Types

using packet_index = boost::multi_index::hashed_unique< boost::multi_index::tag< by_packet >, boost::multi_index::identity< PacketIdentifier >, std::hash< PacketIdentifier > >
 
using queue_index = boost::multi_index::sequenced< boost::multi_index::tag< by_queue > >
 
using container_type = boost::multi_index_container< PacketIdentifier, boost::multi_index::indexed_by< queue_index, packet_index > >
 

Private Attributes

std::size_t m_capacity = 1
 
container_type m_identifiers
 

Detailed Description

GbcMemory remembers previously seens GBC packets.

GBC packets are identified by their (GN addr, sequence number) tuple. The size of GbcMemory is bounded, i.e. it will forget old packets in favour of recent ones.

Definition at line 20 of file gbc_memory.hpp.

Member Typedef Documentation

◆ container_type

using vanetza::geonet::GbcMemory::container_type = boost::multi_index_container<PacketIdentifier, boost::multi_index::indexed_by<queue_index, packet_index> >
private

Definition at line 63 of file gbc_memory.hpp.

◆ packet_index

using vanetza::geonet::GbcMemory::packet_index = boost::multi_index::hashed_unique< boost::multi_index::tag<by_packet>, boost::multi_index::identity<PacketIdentifier>, std::hash<PacketIdentifier> >
private

Definition at line 55 of file gbc_memory.hpp.

◆ PacketIdentifier

using vanetza::geonet::GbcMemory::PacketIdentifier = CbfPacketIdentifier

Definition at line 23 of file gbc_memory.hpp.

◆ queue_index

using vanetza::geonet::GbcMemory::queue_index = boost::multi_index::sequenced<boost::multi_index::tag<by_queue> >
private

Definition at line 61 of file gbc_memory.hpp.

Member Function Documentation

◆ capacity()

void vanetza::geonet::GbcMemory::capacity ( std::size_t  num)

Forget a packet if memory exceeds upper limit of stored identifiers

Parameters
numupper limit of remembered packets

Definition at line 8 of file gbc_memory.cpp.

◆ knows()

bool vanetza::geonet::GbcMemory::knows ( const PacketIdentifier &  id) const

Check if a particular packet is known

Parameters
idpacket identifier
Returns
true if packet is known

Definition at line 46 of file gbc_memory.cpp.

◆ remember()

bool vanetza::geonet::GbcMemory::remember ( const PacketIdentifier &  id)

Remember a particular packet

Parameters
idpacket identifier
Returns
true if packet is already known

Definition at line 24 of file gbc_memory.cpp.

◆ size()

std::size_t vanetza::geonet::GbcMemory::size ( ) const

Number of currently known packets

Returns
number of packets

Definition at line 19 of file gbc_memory.cpp.

Member Data Documentation

◆ m_capacity

std::size_t vanetza::geonet::GbcMemory::m_capacity = 1
private

Definition at line 52 of file gbc_memory.hpp.

◆ m_identifiers

container_type vanetza::geonet::GbcMemory::m_identifiers
private

Definition at line 65 of file gbc_memory.hpp.


The documentation for this class was generated from the following files: