Vanetza
Loading...
Searching...
No Matches
country_database.hpp
1
#
pragma
once
2
#
include
<
vanetza
/
geodesy
/
country_polygon
.
hpp
>
3
#
include
<
vanetza
/
geodesy
/
m49_code
.
hpp
>
4
#
include
<
vanetza
/
geodesy
/
position
.
hpp
>
5
#
include
<
cstddef
>
6
#
include
<
string
>
7
#
include
<
unordered_map
>
8
9
namespace
vanetza
10
{
11
namespace
geodesy
12
{
13
14
class
CountryDatabase
15
{
16
public
:
17
/**
18
* Create a CountryDatabase from embedded country data.
19
* Only available when built with VANETZA_WITH_EMBEDDED_COUNTRY_DATA.
20
* \param[out] error optional error message
21
* \return loaded database, or empty database on failure
22
*/
23
static
CountryDatabase
embedded
(std::string* error =
nullptr
);
24
25
/**
26
* Load country data from a file.
27
* \param[in] path path to the binary country data file
28
* \param[out] error optional error message
29
* \return true on success
30
*/
31
bool
load
(
const
std::string& path, std::string* error =
nullptr
);
32
33
/**
34
* Load country data from a memory buffer.
35
* \param[in] data pointer to binary data
36
* \param[in] length size of data in bytes
37
* \param[out] error optional error message
38
* \return true on success
39
*/
40
bool
load
(
const
uint8_t* data, std::size_t length, std::string* error =
nullptr
);
41
42
/**
43
* Check if a geodetic position lies within a country.
44
* \param country M.49 country code
45
* \param position geodetic position to check
46
* \return true if position is inside the country's boundaries
47
*/
48
bool
is_inside
(
M49Code
country,
const
GeodeticPosition
& position)
const
;
49
50
/**
51
* Check if the database contains any country data.
52
* \return true if no countries are loaded
53
*/
54
bool
empty
()
const
;
55
56
private
:
57
std::unordered_map<M49Code, CountryPolygon> m_countries;
58
};
59
60
}
// namespace geodesy
61
}
// namespace vanetza
vanetza::byte_view_range
Definition
byte_view.hpp:135
vanetza::geodesy::CountryDatabase
Definition
country_database.hpp:15
vanetza::geodesy::CountryDatabase::is_inside
bool is_inside(M49Code country, const GeodeticPosition &position) const
Definition
country_database.cpp:67
vanetza::geodesy::CountryDatabase::load
bool load(const std::string &path, std::string *error=nullptr)
Definition
country_database.cpp:33
vanetza::geodesy::CountryDatabase::empty
bool empty() const
Definition
country_database.cpp:78
vanetza::geodesy::CountryDatabase::load
bool load(const uint8_t *data, std::size_t length, std::string *error=nullptr)
Definition
country_database.cpp:47
vanetza::geodesy::CountryDatabase::embedded
static CountryDatabase embedded(std::string *error=nullptr)
Definition
country_database.cpp:19
vanetza::geodesy::M49Code
Definition
m49_code.hpp:15
vanetza::geodesy::GeodeticPosition
Definition
position.hpp:26
vanetza
geodesy
country_database.hpp
Generated on
for Vanetza by
1.18.0