OpenTREP Logo  0.07.1
C++ Open Travel Request Parsing Library
OPENTREP_Service.hpp
Go to the documentation of this file.
1 #ifndef __OPENTREP_SVC_OPENTREP_SERVICE_HPP
2 #define __OPENTREP_SVC_OPENTREP_SERVICE_HPP
3 
4 // //////////////////////////////////////////////////////////////////////
5 // Import section
6 // //////////////////////////////////////////////////////////////////////
7 // STL
8 #include <iosfwd>
9 #include <string>
10 // OpenTREP
12 #include <opentrep/DBType.hpp>
15 
16 namespace OPENTREP {
17 
18  // Forward declaration
19  class OPENTREP_ServiceContext;
20 
21 
26  public:
27  // /////////// Business Methods /////////////
34 
46 
58  NbOfMatches_T interpretTravelRequest (const std::string& iTravelQuery,
60 
61 
73  typedef std::pair<const TravelDBFilePath_T,
75  typedef std::pair<const PORFilePath_T, const DBFilePathPair_T> FilePathSet_T;
77 
78  public:
79  // ////////// Interaction with the SQL database //////////
88  bool createSQLDBUser();
89 
103 
111  void createSQLDBTables();
112 
116  void createSQLDBIndexes();
117 
124 
131 
138 
145 
162 
170 
181 
192 
203 
214 
225 
236 
237 
238  public:
239  // ////////// Constructors and destructors //////////
249  OPENTREP_Service (std::ostream& ioLogStream, const TravelDBFilePath_T&,
250  const DBType&, const SQLDBConnectionString_T&,
251  const DeploymentNumber_T&);
252 
267  OPENTREP_Service (std::ostream& ioLogStream, const PORFilePath_T&,
268  const TravelDBFilePath_T&, const DBType&,
272  const shouldAddPORInSQLDB_T&);
273 
278 
279 
280  private:
281  // /////// Construction and Destruction helper methods ///////
290 
300  void init (std::ostream& ioLogStream, const TravelDBFilePath_T&,
301  const DBType&, const SQLDBConnectionString_T&,
302  const DeploymentNumber_T&);
303 
318  void init (std::ostream& ioLogStream, const PORFilePath_T&,
319  const TravelDBFilePath_T&,
320  const DBType&, const SQLDBConnectionString_T&,
323 
327  void finalise();
328 
329 
330  private:
331  // ///////// Service Context /////////
335  OPENTREP_ServiceContext* _opentrepServiceContext;
336  };
337 }
338 #endif // __OPENTREP_SVC_OPENTREP_SERVICE_HPP
void setSQLDBConnectString(const SQLDBConnectionString_T &)
unsigned int GeonamesID_T
unsigned short NbOfMatches_T
FilePathSet_T getFilePaths() const
Class holding the context of the OpenTrep services.
bool shouldIndexNonIATAPOR_T
OPENTREP::shouldIndexPORInXapian_T toggleShouldIndexPORInXapianFlag()
NbOfDBEntries_T insertIntoDBAndXapian()
unsigned int NbOfDBEntries_T
NbOfMatches_T listByIataCode(const IATACode_T &, LocationList_T &)
Interface for the OPENTREP Services.
std::list< Word_T > WordList_T
NbOfMatches_T listByFaaCode(const FAACode_T &, LocationList_T &)
NbOfDBEntries_T getNbOfPORFromDB()
NbOfMatches_T listByIcaoCode(const ICAOCode_T &, LocationList_T &)
NbOfMatches_T drawRandomLocations(const NbOfMatches_T &iNbOfDraws, LocationList_T &)
Enumeration of database types.
Definition: DBType.hpp:17
unsigned int UICCode_T
std::list< Location > LocationList_T
NbOfMatches_T listByUICCode(const UICCode_T &, LocationList_T &)
NbOfMatches_T interpretTravelRequest(const std::string &iTravelQuery, LocationList_T &, WordList_T &)
OPENTREP::shouldAddPORInSQLDB_T toggleShouldAddPORInSQLDBFlag()
bool shouldAddPORInSQLDB_T
bool shouldIndexPORInXapian_T
std::pair< const PORFilePath_T, const DBFilePathPair_T > FilePathSet_T
NbOfMatches_T listByGeonameID(const GeonamesID_T &, LocationList_T &)
OPENTREP::DeploymentNumber_T toggleDeploymentNumber()
OPENTREP::shouldIndexNonIATAPOR_T toggleShouldIncludeAllPORFlag()
unsigned short DeploymentNumber_T
NbOfMatches_T listByUNLOCode(const UNLOCode_T &, LocationList_T &)
std::pair< const TravelDBFilePath_T, const SQLDBConnectionString_T > DBFilePathPair_T