@@ -74,7 +74,7 @@ class TableAPI final : public BaseAPI
7474 auto number_of_destinations = parameters.destinations .size ();
7575
7676 auto data_timestamp = facade.GetTimestamp ();
77- boost::optional< flatbuffers::Offset<flatbuffers::String>> data_version_string = boost::none ;
77+ flatbuffers::Offset<flatbuffers::String> data_version_string;
7878 if (!data_timestamp.empty ())
7979 {
8080 data_version_string = fb_result.CreateString (data_timestamp);
@@ -116,21 +116,24 @@ class TableAPI final : public BaseAPI
116116 }
117117 }
118118
119- boost::optional<flatbuffers::Offset<flatbuffers::Vector<float >>> durations = boost::none;
120- if (parameters.annotations & TableParameters::AnnotationsType::Duration)
119+ bool use_durations = parameters.annotations & TableParameters::AnnotationsType::Duration;
120+ flatbuffers::Offset<flatbuffers::Vector<float >> durations;
121+ if (use_durations)
121122 {
122123 durations = MakeDurationTable (fb_result, tables.first );
123124 }
124125
125- boost::optional<flatbuffers::Offset<flatbuffers::Vector<float >>> distances = boost::none;
126- if (parameters.annotations & TableParameters::AnnotationsType::Distance)
126+ bool use_distances = parameters.annotations & TableParameters::AnnotationsType::Distance;
127+ flatbuffers::Offset<flatbuffers::Vector<float >> distances;
128+ if (use_distances)
127129 {
128130 distances = MakeDistanceTable (fb_result, tables.second );
129131 }
130132
131- boost::optional<flatbuffers::Offset<flatbuffers::Vector<uint32_t >>> speed_cells =
132- boost::none;
133- if (parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0 )
133+ bool have_speed_cells =
134+ parameters.fallback_speed != INVALID_FALLBACK_SPEED && parameters.fallback_speed > 0 ;
135+ flatbuffers::Offset<flatbuffers::Vector<uint32_t >> speed_cells;
136+ if (have_speed_cells)
134137 {
135138 speed_cells = MakeEstimatesTable (fb_result, fallback_speed_cells);
136139 }
@@ -139,24 +142,24 @@ class TableAPI final : public BaseAPI
139142 table.add_destinations (destinations);
140143 table.add_rows (number_of_sources);
141144 table.add_cols (number_of_destinations);
142- if (durations )
145+ if (use_durations )
143146 {
144- table.add_durations (* durations);
147+ table.add_durations (durations);
145148 }
146- if (distances )
149+ if (use_distances )
147150 {
148- table.add_distances (* distances);
151+ table.add_distances (distances);
149152 }
150- if (speed_cells )
153+ if (have_speed_cells )
151154 {
152- table.add_fallback_speed_cells (* speed_cells);
155+ table.add_fallback_speed_cells (speed_cells);
153156 }
154157 auto table_buffer = table.Finish ();
155158
156159 fbresult::FBResultBuilder response (fb_result);
157- if (data_version_string )
160+ if (!data_timestamp. empty () )
158161 {
159- response.add_data_version (* data_version_string);
162+ response.add_data_version (data_version_string);
160163 }
161164 response.add_table (table_buffer);
162165 response.add_waypoints (sources);
0 commit comments