Vanetza
Loading...
Searching...
No Matches
vanetza::geodesy::CountryDatabase Class Reference

Public Member Functions

bool load (const std::string &path, std::string *error=nullptr)
bool load (const uint8_t *data, std::size_t length, std::string *error=nullptr)
bool is_inside (M49Code country, const GeodeticPosition &position) const
bool empty () const

Static Public Member Functions

static CountryDatabase embedded (std::string *error=nullptr)

Private Attributes

std::unordered_map< M49Code, CountryPolygon > m_countries

Detailed Description

Definition at line 14 of file country_database.hpp.

Member Function Documentation

◆ embedded()

CountryDatabase vanetza::geodesy::CountryDatabase::embedded ( std::string * error = nullptr)
static

Create a CountryDatabase from embedded country data. Only available when built with VANETZA_WITH_EMBEDDED_COUNTRY_DATA.

Parameters
[out]erroroptional error message
Returns
loaded database, or empty database on failure

Definition at line 19 of file country_database.cpp.

◆ empty()

bool vanetza::geodesy::CountryDatabase::empty ( ) const

Check if the database contains any country data.

Returns
true if no countries are loaded

Definition at line 78 of file country_database.cpp.

◆ is_inside()

bool vanetza::geodesy::CountryDatabase::is_inside ( M49Code country,
const GeodeticPosition & position ) const

Check if a geodetic position lies within a country.

Parameters
countryM.49 country code
positiongeodetic position to check
Returns
true if position is inside the country's boundaries

Definition at line 67 of file country_database.cpp.

◆ load() [1/2]

bool vanetza::geodesy::CountryDatabase::load ( const std::string & path,
std::string * error = nullptr )

Load country data from a file.

Parameters
[in]pathpath to the binary country data file
[out]erroroptional error message
Returns
true on success

Definition at line 33 of file country_database.cpp.

◆ load() [2/2]

bool vanetza::geodesy::CountryDatabase::load ( const uint8_t * data,
std::size_t length,
std::string * error = nullptr )

Load country data from a memory buffer.

Parameters
[in]datapointer to binary data
[in]lengthsize of data in bytes
[out]erroroptional error message
Returns
true on success

Definition at line 47 of file country_database.cpp.

Member Data Documentation

◆ m_countries

std::unordered_map<M49Code, CountryPolygon> vanetza::geodesy::CountryDatabase::m_countries
private

Definition at line 57 of file country_database.hpp.


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