Vanetza
 
Loading...
Searching...
No Matches
header_type.cpp
1#include "header_type.hpp"
2#include "areas.hpp"
3#include <boost/variant/apply_visitor.hpp>
4#include <boost/variant/static_visitor.hpp>
5
6namespace vanetza
7{
8namespace geonet
9{
10
11struct gbc_header_type_visitor : public boost::static_visitor<HeaderType>
12{
13 HeaderType operator()(const Circle&) const
14 {
15 return HeaderType::GeoBroadcast_Circle;
16 }
17
18 HeaderType operator()(const Rectangle&) const
19 {
20 return HeaderType::GeoBroadcast_Rect;
21 }
22
23 HeaderType operator()(const Ellipse&) const
24 {
25 return HeaderType::GeoBroadcast_Elip;
26 }
27};
28
29HeaderType gbc_header_type(const Area& area)
30{
31 return boost::apply_visitor(gbc_header_type_visitor(), area.shape);
32}
33
34struct gac_header_type_visitor : public boost::static_visitor<HeaderType>
35{
36 HeaderType operator()(const Circle&) const
37 {
38 return HeaderType::GeoAnycast_Circle;
39 }
40
41 HeaderType operator()(const Rectangle&) const
42 {
43 return HeaderType::GeoAnycast_Rect;
44 }
45
46 HeaderType operator()(const Ellipse&) const
47 {
48 return HeaderType::GeoAnycast_Elip;
49 }
50};
51
52HeaderType gac_header_type(const Area& area)
53{
54 return boost::apply_visitor(gac_header_type_visitor(), area.shape);
55}
56
57} // namespace geonet
58} // namespace vanetza
59