OpenTREP Logo  0.07.18
C++ Open Travel Request Parsing Library
Loading...
Searching...
No Matches
LocationExchange.cpp
Go to the documentation of this file.
1// //////////////////////////////////////////////////////////////////////
2// Import section
3// //////////////////////////////////////////////////////////////////////
4// STL
5#include <cassert>
6#include <sstream>
7#include <string>
8// OpenTrep Protobuf
9#include <opentrep/Travel.pb.h>
10// OpenTrep
11#include <opentrep/Location.hpp>
14
15namespace OPENTREP {
16
17 // //////////////////////////////////////////////////////////////////////
19 exportLocationList (const LocationList_T& iLocationList,
20 const WordList_T& iNonMatchedWordList) {
21 std::string oStr ("");
22
23 // Protobuf structure
24 treppb::QueryAnswer lQueryAnswer;
25
26 // //// 1. Status ////
27 const bool kOKStatus = true;
28 lQueryAnswer.set_ok_status (kOKStatus);
29
30 // //// 2. Error message ////
37
38 // //// 3. List of places ////
39 treppb::PlaceList* lPlaceListPtr = lQueryAnswer.mutable_place_list();
40 assert (lPlaceListPtr != NULL);
41
42 // Browse the list of Location structures, and fill the Protobuf structure
43 for (LocationList_T::const_iterator itLocation = iLocationList.begin();
44 itLocation != iLocationList.end(); ++itLocation) {
45 const Location& lLocation = *itLocation;
46
47 // Create an instance of a Protobuf Place structure
48 treppb::Place* lPlacePtr = lPlaceListPtr->add_place();
49 assert (lPlacePtr != NULL);
50
51 // Fill the Protobuf Place structure with the content of
52 // the Location structure
53 exportLocation (*lPlacePtr, lLocation);
54 }
55
56 // //// 4. List of un-matched keywords ////
57 // Create an instance of a Protobuf UnknownKeywordList structure
58 treppb::UnknownKeywordList* lUnknownKeywordListPtr =
59 lQueryAnswer.mutable_unmatched_keyword_list();
60 assert (lUnknownKeywordListPtr != NULL);
61
62 // Browse the list of un-matched keywords, and fill the Protobuf structure
63 for (WordList_T::const_iterator itWord = iNonMatchedWordList.begin();
64 itWord != iNonMatchedWordList.end(); ++itWord) {
65 const Word_T& lWord = *itWord;
66 lUnknownKeywordListPtr->add_word (lWord);
67 }
68
69 // Serialize the Protobuf
70 const bool pbSerialStatus = lQueryAnswer.SerializeToString (&oStr);
71 if (pbSerialStatus == false) {
72 std::ostringstream errStr;
73 errStr << "Error - The OPTD Travel protocol buffer object cannot be "
74 << "serialized into a C++ string";
75 throw SerDeException (errStr.str());
76 }
77
78 return oStr;
79 }
80
81 // //////////////////////////////////////////////////////////////////////
82 void LocationExchange::exportLocation (treppb::Place& ioPlace,
83 const Location& iLocation) {
92
93 // Retrieve the primary key
94 const LocationKey& lLocationKey = iLocation.getKey();
95
99
100 // Retrieve and set the travel-related IATA code (part of the primary key)
101 const IATACode_T& lIataCode = lLocationKey.getIataCode();
102 treppb::IATACode* lIataAirportPtr = ioPlace.mutable_tvl_code();
103 assert (lIataAirportPtr != NULL);
104 lIataAirportPtr->set_code (lIataCode);
105
106 // Retrieve and set the ICAO code
107 const ICAOCode_T& lIcaoCode = iLocation.getIcaoCode();
108 treppb::ICAOCode* lIcaoCodePtr = ioPlace.mutable_icao_code();
109 assert (lIcaoCodePtr != NULL);
110 lIcaoCodePtr->set_code (lIcaoCode);
111
112 // Retrieve and set the FAA code
113 const FAACode_T& lFaaCode = iLocation.getFaaCode();
114 treppb::FAACode* lFaaCodePtr = ioPlace.mutable_faa_code();
115 assert (lFaaCodePtr != NULL);
116 lFaaCodePtr->set_code (lFaaCode);
117
118 // Retrieve and set the UN/LOCODE code list
119 const UNLOCodeList_T& lUNLOCodeList = iLocation.getUNLOCodeList();
120 treppb::UNLOCodeList* lUNLOCodeListPtr = ioPlace.mutable_unlocode_list();
121 assert (lUNLOCodeListPtr != NULL);
122 //
123 for (UNLOCodeList_T::const_iterator itUNLOCode = lUNLOCodeList.begin();
124 itUNLOCode != lUNLOCodeList.end(); ++itUNLOCode) {
125 const UNLOCode_T& lUNLOCode = *itUNLOCode;
126 treppb::UNLOCode* lUNLOCodePtr = lUNLOCodeListPtr->add_unlocode();
127 assert (lUNLOCodePtr != NULL);
128 lUNLOCodePtr->set_code (lUNLOCode);
129 }
130
131 // Retrieve and set the UIC code list
132 const UICCodeList_T& lUICCodeList = iLocation.getUICCodeList();
133 treppb::UICCodeList* lUICCodeListPtr = ioPlace.mutable_uiccode_list();
134 assert (lUICCodeListPtr != NULL);
135 //
136 for (UICCodeList_T::const_iterator itUICCode = lUICCodeList.begin();
137 itUICCode != lUICCodeList.end(); ++itUICCode) {
138 const UICCode_T& lUICCode = *itUICCode;
139 treppb::UICCode* lUICCodePtr = lUICCodeListPtr->add_uiccode();
140 assert (lUICCodePtr != NULL);
141 lUICCodePtr->set_code (lUICCode);
142 }
143
147
148 // Retrieve and set whether the Geonames ID is known
149 const IsGeonames_T& lIsGeonames = iLocation.isGeonames();
150 ioPlace.set_is_geonames (lIsGeonames);
151
152 // Retrieve and set the Geonames ID
153 const GeonamesID_T& lGeonamesID = lLocationKey.getGeonamesID();
154 treppb::GeonamesID* lGeonamesIDPtr = ioPlace.mutable_geonames_id();
155 assert (lGeonamesIDPtr != NULL);
156 lGeonamesIDPtr->set_id (lGeonamesID);
157
158 // Retrieve and set the feature class and code
159 const FeatureClass_T& lFeatClass = iLocation.getFeatureClass();
160 const FeatureCode_T& lFeatCode = iLocation.getFeatureCode();
161 treppb::FeatureType* lFeatTypePtr = ioPlace.mutable_feat_type();
162 assert (lFeatTypePtr != NULL);
163 treppb::FeatureClass* lFeatClassPtr = lFeatTypePtr->mutable_fclass();
164 assert (lFeatClassPtr != NULL);
165 treppb::FeatureCode* lFeatCodePtr = lFeatTypePtr->mutable_fcode();
166 assert (lFeatCodePtr != NULL);
167 lFeatClassPtr->set_code (lFeatClass);
168 lFeatCodePtr->set_code (lFeatCode);
169
170 // Retrieve and set the modification date (within Geonames)
171 const Date_T& lGeonameModDate = iLocation.getModificationDate();
172 treppb::Date* lGeonameModDatePtr = ioPlace.mutable_mod_date();
173 assert (lGeonameModDatePtr != NULL);
174 const std::string& lGeonameModDateStr =
175 boost::gregorian::to_iso_extended_string(lGeonameModDate);
176 lGeonameModDatePtr->set_date (lGeonameModDateStr);
177
178 // Retrieve and set the envelope ID
179 const EnvelopeID_T& lEnvID = iLocation.getEnvelopeID();
180 treppb::EnvelopeID* lEnvIDPtr = ioPlace.mutable_env_id();
181 assert (lEnvIDPtr != NULL);
182 lEnvIDPtr->set_id (lEnvID);
183
184 // Retrieve and set the beginning date of the validity period
185 const Date_T& lDateFrom = iLocation.getDateFrom();
186 treppb::Date* lDateFromPtr = ioPlace.mutable_date_from();
187 assert (lDateFromPtr != NULL);
188 const std::string& lDateFromStr =
189 boost::gregorian::to_iso_extended_string(lDateFrom);
190 lDateFromPtr->set_date (lDateFromStr);
191
192 // Retrieve and set the end date of the validity period
193 const Date_T& lDateEnd = iLocation.getDateEnd();
194 treppb::Date* lDateEndPtr = ioPlace.mutable_date_end();
195 assert (lDateEndPtr != NULL);
196 const std::string& lDateEndStr =
197 boost::gregorian::to_iso_extended_string(lDateEnd);
198 lDateEndPtr->set_date (lDateEndStr);
199
200 // Retrieve and set the location type
201 const IATAType& lLocationType = lLocationKey.getIataType();
202 const treppb::PlaceType& lPlaceType = lLocationType.getTypeAsPB();
203 const treppb::PlaceType_LocationType& lPlaceTypeEnum = lPlaceType.type();
204 treppb::PlaceType* lPlaceTypePtr = ioPlace.mutable_loc_type();
205 assert (lPlaceTypePtr != NULL);
206 lPlaceTypePtr->set_type (lPlaceTypeEnum);
207
211
212 // Retrieve and set the name in UTF-8 and ASCII formats
213 const CommonName_T& lUtfName = iLocation.getCommonName();
214 ioPlace.set_name_utf (lUtfName);
215 const ASCIIName_T& lAsciiName = iLocation.getAsciiName();
216 ioPlace.set_name_ascii (lAsciiName);
217
218 // Retrieve and set the list of alternate names
219 const NameMatrix& lNameMatrixRef = iLocation.getNameMatrix();
220 treppb::AltNameList* lAltNameListPtr = ioPlace.mutable_alt_name_list();
221 assert (lAltNameListPtr != NULL);
222 //
223 const NameMatrix_T lNameMatrix = lNameMatrixRef.getNameMatrix();
224 for (NameMatrix_T::const_iterator itNameList = lNameMatrix.begin();
225 itNameList != lNameMatrix.end(); ++itNameList) {
226 const Names& lNameListRef = itNameList->second;
227 const LanguageCode_T& lLangCode = lNameListRef.getLanguageCode();
228 const NameList_T& lNameList = lNameListRef.getNameList();
229 for (NameList_T::const_iterator itName = lNameList.begin();
230 itName != lNameList.end(); ++itName) {
231 const std::string& lName = *itName;
232 //
233 treppb::AltName* lAltNamePtr = lAltNameListPtr->add_name();
234 assert (lAltNamePtr != NULL);
235 //
236 treppb::LanguageCode* lLangCodePtr = lAltNamePtr->mutable_lang();
237 assert (lLangCodePtr != NULL);
238 lLangCodePtr->set_code (lLangCode);
239 lAltNamePtr->set_name (lName);
240 }
241 }
242
246
247 // Retrieve and set the geographical coordinates, as known by OPTD
248 const Latitude_T& lLatitude = iLocation.getLatitude();
249 const Longitude_T& lLongitude = iLocation.getLongitude();
250 treppb::GeoPoint* lPointPtr = ioPlace.mutable_coord();
251 assert (lPointPtr != NULL);
252 lPointPtr->set_latitude (lLatitude);
253 lPointPtr->set_longitude (lLongitude);
254
255 // Retrieve and set the geographical coordinates, as known by Geonames
256 const Latitude_T& lGeonameLatitude = iLocation.getGeonameLatitude();
257 const Longitude_T& lGeonameLongitude = iLocation.getGeonameLongitude();
258 treppb::GeoPoint* lGeonamePointPtr = ioPlace.mutable_coord_geonames();
259 assert (lGeonamePointPtr != NULL);
260 lGeonamePointPtr->set_latitude (lGeonameLatitude);
261 lGeonamePointPtr->set_longitude (lGeonameLongitude);
262
263 // Retrieve and set the elevation
264 const Elevation_T& lElevation = iLocation.getElevation();
265 treppb::Elevation* lElevationPtr = ioPlace.mutable_elevation();
266 assert (lElevationPtr != NULL);
267 lElevationPtr->set_value (lElevation);
268
269 // Retrieve and set the geo topology 30
270 const GTopo30_T& lGTopo30 = iLocation.getGTopo30();
271 treppb::GTopo30* lGTopo30Ptr = ioPlace.mutable_gtopo30();
272 assert (lGTopo30Ptr != NULL);
273 lGTopo30Ptr->set_value (lGTopo30);
274
278 // Retrieve and set the country code
279 const CountryCode_T& lCountryCode = iLocation.getCountryCode();
280 treppb::CountryCode* lCountryCodePtr = ioPlace.mutable_country_code();
281 assert (lCountryCodePtr != NULL);
282 lCountryCodePtr->set_code (lCountryCode);
283
284 // Retrieve and set the alternative country code
285 const AltCountryCode_T& lAltCountryCode = iLocation.getAltCountryCode();
286 treppb::AltCountryCode* lAltCountryCodePtr =
287 ioPlace.mutable_alt_country_code();
288 assert (lAltCountryCodePtr != NULL);
289 lAltCountryCodePtr->set_code (lAltCountryCode);
290
291 // Retrieve and set the country name
292 const CountryName_T& lCountryName = iLocation.getCountryName();
293 ioPlace.set_country_name (lCountryName);
294
295 // Retrieve and set the continent code
296 const ContinentCode_T& lContinentCode = iLocation.getContinentCode();
297 treppb::ContinentCode* lContinentCodePtr = ioPlace.mutable_continent_code();
298 assert (lContinentCodePtr != NULL);
299 lContinentCodePtr->set_code (lContinentCode);
300
301 // Retrieve and set the continent name
302 const ContinentName_T& lContinentName = iLocation.getContinentName();
303 ioPlace.set_continent_name (lContinentName);
304
305 // Retrieve and set the admin level 1 code
306 const Admin1Code_T& lAdm1Code = iLocation.getAdmin1Code();
307 treppb::Admin1Code* lAdm1CodePtr = ioPlace.mutable_adm1_code();
308 assert (lAdm1CodePtr != NULL);
309 lAdm1CodePtr->set_code (lAdm1Code);
310
311 // Retrieve and set the admin level 1 names
312 const Admin1UTFName_T& lAdm1UtfName = iLocation.getAdmin1UtfName();
313 ioPlace.set_adm1_name_utf (lAdm1UtfName);
314 const Admin1ASCIIName_T& lAdm1AsciiName = iLocation.getAdmin1AsciiName();
315 ioPlace.set_adm1_name_ascii (lAdm1AsciiName);
316
317 // Retrieve and set the admin level 2 code
318 const Admin2Code_T& lAdm2Code = iLocation.getAdmin2Code();
319 treppb::Admin2Code* lAdm2CodePtr = ioPlace.mutable_adm2_code();
320 assert (lAdm2CodePtr != NULL);
321 lAdm2CodePtr->set_code (lAdm2Code);
322
323 // Retrieve and set the admin level 2 names
324 const Admin2UTFName_T& lAdm2UtfName = iLocation.getAdmin2UtfName();
325 ioPlace.set_adm2_name_utf (lAdm2UtfName);
326 const Admin2ASCIIName_T& lAdm2AsciiName = iLocation.getAdmin2AsciiName();
327 ioPlace.set_adm2_name_ascii (lAdm2AsciiName);
328
329 // Retrieve and set the admin level 3 code
330 const Admin3Code_T& lAdm3Code = iLocation.getAdmin3Code();
331 treppb::Admin3Code* lAdm3CodePtr = ioPlace.mutable_adm3_code();
332 assert (lAdm3CodePtr != NULL);
333 lAdm3CodePtr->set_code (lAdm3Code);
334
335 // Retrieve and set the admin level 4 code
336 const Admin4Code_T& lAdm4Code = iLocation.getAdmin4Code();
337 treppb::Admin4Code* lAdm4CodePtr = ioPlace.mutable_adm4_code();
338 assert (lAdm4CodePtr != NULL);
339 lAdm4CodePtr->set_code (lAdm4Code);
340
341 // Retrieve and set the state code
342 const StateCode_T& lStateCode = iLocation.getStateCode();
343 treppb::StateCode* lStateCodePtr = ioPlace.mutable_state_code();
344 assert (lStateCodePtr != NULL);
345 lStateCodePtr->set_code (lStateCode);
346
347 // Retrieve and set the US DOT World Area Code (WAC)
348 const WAC_T& lWAC = iLocation.getWAC();
349 treppb::WorldAreaCode* lWorldAreaCodePtr = ioPlace.mutable_wac_code();
350 assert (lWorldAreaCodePtr != NULL);
351 lWorldAreaCodePtr->set_code (lWAC);
352
353 // Retrieve and set the US DOT World Area Code (WAC) name
354 const WACName_T& lWACName = iLocation.getWACName();
355 ioPlace.set_wac_name (lWACName);
356
360
361 // Retrieve and set the PageRank value
362 const PageRank_T& lPageRank = iLocation.getPageRank();
363 treppb::PageRank* lPageRankPtr = ioPlace.mutable_page_rank();
364 assert (lPageRankPtr != NULL);
365 lPageRankPtr->set_rank (lPageRank);
366
367 // Retrieve and set the commentaries
368 const Comment_T& lComment = iLocation.getComment();
369 treppb::Comment* lCommentPtr = ioPlace.mutable_comment();
370 assert (lCommentPtr != NULL);
371 lCommentPtr->set_text (lComment);
372
373 // Retrieve and set the population
374 const Population_T& lPopulation = iLocation.getPopulation();
375 treppb::Population* lPopulationPtr = ioPlace.mutable_population();
376 assert (lPopulationPtr != NULL);
377 lPopulationPtr->set_value (lPopulation);
378
379 // Retrieve and set the currency code
380 const CurrencyCode_T& lCurrencyCode = iLocation.getCurrencyCode();
381 treppb::CurrencyCode* lCurrencyCodePtr = ioPlace.mutable_currency_code();
382 assert (lCurrencyCodePtr != NULL);
383 lCurrencyCodePtr->set_code (lCurrencyCode);
384
388
389 // Retrieve and set the time-zone
390 const TimeZone_T& lTimeZone = iLocation.getTimeZone();
391 treppb::TimeZone* lTimeZonePtr = ioPlace.mutable_tz();
392 assert (lTimeZonePtr != NULL);
393 lTimeZonePtr->set_tz (lTimeZone);
394
395 // Retrieve and set the GMT offset
396 const GMTOffset_T& lGMTOffset = iLocation.getGMTOffset();
397 treppb::TZOffSet* lGMTOffsetPtr = ioPlace.mutable_gmt_offset();
398 assert (lGMTOffsetPtr != NULL);
399 lGMTOffsetPtr->set_offset (lGMTOffset);
400
401 // Retrieve and set the DST offset
402 const DSTOffset_T& lDSTOffset = iLocation.getDSTOffset();
403 treppb::TZOffSet* lDSTOffsetPtr = ioPlace.mutable_dst_offset();
404 assert (lDSTOffsetPtr != NULL);
405 lDSTOffsetPtr->set_offset (lDSTOffset);
406
407 // Retrieve and set the RAW offset
408 const RawOffset_T& lRAWOffset = iLocation.getRawOffset();
409 treppb::TZOffSet* lRAWOffsetPtr = ioPlace.mutable_raw_offset();
410 assert (lRAWOffsetPtr != NULL);
411 lRAWOffsetPtr->set_offset (lRAWOffset);
412
416
417 // Retrieve and set the list of served city details
418 const CityDetailsList_T& lCityList = iLocation.getCityList();
419 treppb::CityList* lCityListPtr = ioPlace.mutable_city_list();
420 assert (lCityListPtr != NULL);
421 //
422 for (CityDetailsList_T::const_iterator itCity = lCityList.begin();
423 itCity != lCityList.end(); ++itCity) {
424 const CityDetails& lCity = *itCity;
425 treppb::City* lCityPtr = lCityListPtr->add_city();
426 assert (lCityPtr != NULL);
427
428 // IATA code of the served city
429 const IATACode_T& lIataCode = lCity.getIataCode();
430 treppb::IATACode* lIataCodePtr = lCityPtr->mutable_code();
431 assert (lIataCodePtr != NULL);
432 lIataCodePtr->set_code (lIataCode);
433
434 // Geonames ID of the served city
435 const GeonamesID_T& lGeonamesID = lCity.getGeonamesID();
436 treppb::GeonamesID* lGeonamesIDPtr = lCityPtr->mutable_geonames_id();
437 assert (lGeonamesIDPtr != NULL);
438 lGeonamesIDPtr->set_id (lGeonamesID);
439
440 // City UTF8 name
441 const CityUTFName_T& lCityUtfName = lCity.getUtfName();
442 lCityPtr->set_name_utf (lCityUtfName);
443
444 // City ASCII name
445 const CityASCIIName_T& lCityAsciiName = lCity.getAsciiName();
446 lCityPtr->set_name_ascii (lCityAsciiName);
447 }
448
452
453 // Retrieve and set the list of the travel-related POR IATA codes
454 const TvlPORListString_T& lTvlPORList = iLocation.getTvlPORListString();
455 treppb::TravelRelatedList* lTvlPORListPtr = ioPlace.mutable_tvl_por_list();
456 assert (lTvlPORListPtr != NULL);
457 lTvlPORListPtr->add_tvl_code (lTvlPORList);
458
462
463 // Retrieve and set the list of the Wikipedia links (URLs)
464 const WikiLink_T& lWikiLink = iLocation.getWikiLink();
465 treppb::WikiLinkList* lWikiLinkListPtr = ioPlace.mutable_link_list();
466 assert (lWikiLinkListPtr != NULL);
467 treppb::WikiLink* lWikiLinkPtr = lWikiLinkListPtr->add_link();
468 assert (lWikiLinkPtr != NULL);
469 treppb::LanguageCode* lLangCodePtr = lWikiLinkPtr->mutable_lang();
470 assert (lLangCodePtr != NULL);
471 lLangCodePtr->set_code ("en");
472 lWikiLinkPtr->set_link (lWikiLink);
473
478
479 // Retrieve and set the matching percentage value
480 const MatchingPercentage_T& lPercentage = iLocation.getPercentage();
481 treppb::MatchingPercentage* lPercentagePtr =
482 ioPlace.mutable_matching_percentage();
483 assert (lPercentagePtr != NULL);
484 lPercentagePtr->set_percentage (lPercentage);
485
486 // Retrieve and set the list of the original keywords
491 const std::string& lOriginalKeywords = iLocation.getOriginalKeywords();
492 treppb::KeywordList* lOriginalKeywordListPtr =
493 ioPlace.mutable_original_keyword_list();
494 assert (lOriginalKeywordListPtr != NULL);
495 lOriginalKeywordListPtr->add_word (lOriginalKeywords);
496
497 // Retrieve and set the list of the corrected keywords
502 const std::string& lCorrectedKeywords = iLocation.getCorrectedKeywords();
503 treppb::KeywordList* lCorrectedKeywordListPtr =
504 ioPlace.mutable_corrected_keyword_list();
505 assert (lCorrectedKeywordListPtr != NULL);
506 lCorrectedKeywordListPtr->add_word (lCorrectedKeywords);
507
508 // Retrieve and set the actual edit distance
509 const NbOfErrors_T& lEditDistanceActual = iLocation.getEditDistance();
510 treppb::EditDistance* lEditDistanceActualPtr =
511 ioPlace.mutable_edit_distance_actual();
512 assert (lEditDistanceActualPtr != NULL);
513 lEditDistanceActualPtr->set_dist (lEditDistanceActual);
514
515 // Retrieve and set the allowable edit distance
516 const NbOfErrors_T& lEditDistanceAllowable =
517 iLocation.getAllowableEditDistance();
518 treppb::EditDistance* lEditDistanceAllowablePtr =
519 ioPlace.mutable_edit_distance_actual();
520 assert (lEditDistanceAllowablePtr != NULL);
521 lEditDistanceAllowablePtr->set_dist (lEditDistanceAllowable);
522
523 // Iterate on the extra list of locations
524 const LocationList_T& lExtraLocationList = iLocation.getExtraLocationList();
525 treppb::PlaceList* lExtraPlaceListPtr = ioPlace.mutable_extra_place_list();
526 assert (lExtraPlaceListPtr != NULL);
527 for (LocationList_T::const_iterator itLoc = lExtraLocationList.begin();
528 itLoc != lExtraLocationList.end(); ++itLoc) {
529 const Location& lExtraLocation = *itLoc;
530 //
531 treppb::Place* lPlacePtr = lExtraPlaceListPtr->add_place();
532 assert (lPlacePtr != NULL);
533 //
534 exportLocation (*lPlacePtr, lExtraLocation);
535 }
536
537 // Iterate on the alternative list of locations
538 const LocationList_T& lAltLocationList= iLocation.getAlternateLocationList();
539 treppb::PlaceList* lAltPlaceListPtr = ioPlace.mutable_alt_place_list();
540 assert (lAltPlaceListPtr != NULL);
541 for (LocationList_T::const_iterator itLoc = lAltLocationList.begin();
542 itLoc != lAltLocationList.end(); ++itLoc) {
543 const Location& lAlternateLocation = *itLoc;
544 //
545 treppb::Place* lPlacePtr = lAltPlaceListPtr->add_place();
546 assert (lPlacePtr != NULL);
547 //
548 exportLocation (*lPlacePtr, lAlternateLocation);
549 }
550 }
551
552}
553
static void exportLocation(treppb::Place &, const Location &)
static std::string exportLocationList(const LocationList_T &, const WordList_T &iNonMatchedWordList)
std::list< Word_T > WordList_T
unsigned int UICCode_T
unsigned short NbOfErrors_T
std::map< LanguageCode_T, Names > NameMatrix_T
Definition Names.hpp:149
std::string Word_T
std::list< std::string > NameList_T
Definition Names.hpp:20
double MatchingPercentage_T
std::list< CityDetails > CityDetailsList_T
A list of cities, for instance the list of cities served by a travel-/transport-related POR (point of...
GeoCoord_T Latitude_T
boost::gregorian::date Date_T
double PageRank_T
unsigned int EnvelopeID_T
GeoCoord_T Longitude_T
unsigned int WAC_T
std::list< Location > LocationList_T
std::list< UICCode_T > UICCodeList_T
std::list< UNLOCode_T > UNLOCodeList_T
unsigned int Population_T
unsigned int GeonamesID_T
Class modelling the elementary details of a city.
const IATACode_T & getIataCode() const
const GeonamesID_T & getGeonamesID() const
const CityUTFName_T & getUtfName() const
const CityASCIIName_T & getAsciiName() const
Enumeration of place/location types with respect to their use for transportation purposes.
Definition IATAType.hpp:42
treppb::PlaceType getTypeAsPB() const
Definition IATAType.cpp:181
Class modelling the primary key of a location/POR (point of reference).
const IATAType & getIataType() const
const IATACode_T & getIataCode() const
const GeonamesID_T & getGeonamesID() const
Structure modelling a (geographical) location.
Definition Location.hpp:25
const Latitude_T & getGeonameLatitude() const
Definition Location.hpp:375
const FeatureCode_T & getFeatureCode() const
Definition Location.hpp:270
const LocationList_T & getExtraLocationList() const
Definition Location.hpp:446
const Longitude_T & getGeonameLongitude() const
Definition Location.hpp:382
const CurrencyCode_T & getCurrencyCode() const
Definition Location.hpp:200
const IsGeonames_T & isGeonames() const
Definition Location.hpp:59
const LocationKey & getKey() const
Definition Location.hpp:31
const TvlPORListString_T & getTvlPORListString() const
Definition Location.hpp:116
const CommonName_T & getCommonName() const
Definition Location.hpp:95
const Longitude_T & getLongitude() const
Definition Location.hpp:256
const RawOffset_T & getRawOffset() const
Definition Location.hpp:242
const std::string & getCorrectedKeywords() const
Definition Location.hpp:417
const ContinentName_T & getContinentName() const
Definition Location.hpp:214
const Date_T & getDateFrom() const
Definition Location.hpp:130
const MatchingPercentage_T & getPercentage() const
Definition Location.hpp:424
const Admin3Code_T & getAdmin3Code() const
Definition Location.hpp:319
const GMTOffset_T & getGMTOffset() const
Definition Location.hpp:228
const NbOfErrors_T & getAllowableEditDistance() const
Definition Location.hpp:439
const Admin2Code_T & getAdmin2Code() const
Definition Location.hpp:298
const Elevation_T & getElevation() const
Definition Location.hpp:340
const NameMatrix & getNameMatrix() const
Definition Location.hpp:389
const WAC_T & getWAC() const
Definition Location.hpp:186
const Admin4Code_T & getAdmin4Code() const
Definition Location.hpp:326
const Latitude_T & getLatitude() const
Definition Location.hpp:249
const FeatureClass_T & getFeatureClass() const
Definition Location.hpp:263
const EnvelopeID_T & getEnvelopeID() const
Definition Location.hpp:123
const WACName_T & getWACName() const
Definition Location.hpp:193
const CountryCode_T & getCountryCode() const
Definition Location.hpp:165
const Admin1Code_T & getAdmin1Code() const
Definition Location.hpp:277
const ASCIIName_T & getAsciiName() const
Definition Location.hpp:102
const CityDetailsList_T & getCityList() const
Definition Location.hpp:151
const Admin1ASCIIName_T & getAdmin1AsciiName() const
Definition Location.hpp:291
const std::string & getOriginalKeywords() const
Definition Location.hpp:410
const AltCountryCode_T & getAltCountryCode() const
Definition Location.hpp:172
const FAACode_T & getFaaCode() const
Definition Location.hpp:73
const ContinentCode_T & getContinentCode() const
Definition Location.hpp:207
const Admin1UTFName_T & getAdmin1UtfName() const
Definition Location.hpp:284
const PageRank_T & getPageRank() const
Definition Location.hpp:354
const Comment_T & getComment() const
Definition Location.hpp:144
const LocationList_T & getAlternateLocationList() const
Definition Location.hpp:453
const DSTOffset_T & getDSTOffset() const
Definition Location.hpp:235
const CountryName_T & getCountryName() const
Definition Location.hpp:179
const UNLOCodeList_T & getUNLOCodeList() const
Definition Location.hpp:80
const Date_T & getDateEnd() const
Definition Location.hpp:137
const Admin2UTFName_T & getAdmin2UtfName() const
Definition Location.hpp:305
const TimeZone_T & getTimeZone() const
Definition Location.hpp:221
const GTopo30_T & getGTopo30() const
Definition Location.hpp:347
const NbOfErrors_T & getEditDistance() const
Definition Location.hpp:431
const StateCode_T & getStateCode() const
Definition Location.hpp:158
const Population_T & getPopulation() const
Definition Location.hpp:333
const WikiLink_T & getWikiLink() const
Definition Location.hpp:368
const Date_T & getModificationDate() const
Definition Location.hpp:361
const Admin2ASCIIName_T & getAdmin2AsciiName() const
Definition Location.hpp:312
const ICAOCode_T & getIcaoCode() const
Definition Location.hpp:66
const UICCodeList_T & getUICCodeList() const
Definition Location.hpp:87
const NameMatrix_T & getNameMatrix() const
LanguageCode_T getLanguageCode() const
Definition Names.hpp:53
const NameList_T & getNameList() const
Definition Names.hpp:60