2 #include <marnav/utils/mmsi.hpp>
8 std::string
to_string(char data
)
10 char buf
[sizeof(int)]; // sizeof(int) is for stack anlignment and protection
11 snprintf(buf
, sizeof(buf
), "%c", data
);
15 std::string
to_string(uint64_t data
)
17 return std::to_string(data
);
20 std::string
to_string(uint32_t data
)
22 return std::to_string(data
);
25 std::string
to_string(int32_t data
)
27 return std::to_string(data
);
30 std::string
to_string(double data
)
33 snprintf(buf
, sizeof(buf
), "%g", data
);
37 std::string
to_string(const std::string
& data
)
42 std::string
to_string(side t
)
50 return ""; // never reached, gcc does not get it, prevents compiler warning
53 std::string
to_string(route t
)
61 return ""; // never reached, gcc does not get it, prevents compiler warning
64 std::string
to_string(selection_mode t
)
67 case selection_mode::manual
:
69 case selection_mode::automatic
:
72 return ""; // never reached, gcc does not get it, prevents compiler warning
75 std::string
to_string(ais_channel t
)
83 return ""; // never reached, gcc does not get it, prevents compiler warning
86 std::string
to_string(type_of_point t
)
89 case type_of_point::collision
:
91 case type_of_point::turning_point
:
93 case type_of_point::reference
:
95 case type_of_point::wheelover
:
98 return ""; // never reached, gcc does not get it, prevents compiler warning
101 std::string
to_string(direction t
)
104 case direction::north
:
106 case direction::south
:
108 case direction::east
:
110 case direction::west
:
112 case direction::none
:
115 return ""; // never reached, gcc does not get it, prevents compiler warning
118 std::string
to_string(reference t
)
121 case reference::TRUE
:
123 case reference::MAGNETIC
:
125 case reference::RELATIVE
:
128 return ""; // never reached, gcc does not get it, prevents compiler warning
131 std::string
to_string(mode_indicator t
)
134 case mode_indicator::invalid
:
136 case mode_indicator::autonomous
:
138 case mode_indicator::differential
:
140 case mode_indicator::estimated
:
142 case mode_indicator::manual_input
:
144 case mode_indicator::simulated
:
146 case mode_indicator::data_not_valid
:
148 case mode_indicator::precise
:
151 return ""; // never reached, gcc does not get it, prevents compiler warning
154 std::string
to_string(status t
)
159 case status::warning
:
162 return ""; // never reached, gcc does not get it, prevents compiler warning
165 std::string
to_string(quality t
)
168 case quality::invalid
:
170 case quality::gps_fix
:
172 case quality::dgps_fix
:
176 case quality::simulation
:
179 return ""; // never reached, gcc does not get it, prevents compiler warning
182 std::string
to_string(target_status t
)
185 case target_status::lost
:
187 case target_status::query
:
189 case target_status::tracking
:
192 return ""; // never reached, gcc does not get it, prevents compiler warning
195 std::string
to_string(unit::distance t
)
198 case unit::distance::meter
:
200 case unit::distance::feet
:
202 case unit::distance::nm
:
204 case unit::distance::km
:
206 case unit::distance::fathom
:
209 return ""; // never reached, gcc does not get it, prevents compiler warning
212 std::string
to_string(unit::velocity t
)
215 case unit::velocity::knot
:
217 case unit::velocity::kmh
:
219 case unit::velocity::mps
:
222 return ""; // never reached, gcc does not get it, prevents compiler warning
225 std::string
to_string(unit::temperature t
)
228 case unit::temperature::celsius
:
231 return ""; // never reached, gcc does not get it, prevents compiler warning
234 std::string
to_string(unit::pressure t
)
237 case unit::pressure::bar
:
239 case unit::pressure::pascal:
242 return ""; // never reached, gcc does not get it, prevents compiler warning
245 std::string
to_string(const utils::mmsi
& t
)
248 snprintf(buf
, sizeof(buf
), "%09u", static_cast<uint32_t>(t
));