OpenTREP Logo  0.07.1
C++ Open Travel Request Parsing Library
FacOpenTrepServiceContext.cpp
Go to the documentation of this file.
1 // //////////////////////////////////////////////////////////////////////
2 // Import section
3 // //////////////////////////////////////////////////////////////////////
4 // STL
5 #include <cassert>
6 // OpenTrep
11 
12 namespace OPENTREP {
13 
14  FacOpenTrepServiceContext* FacOpenTrepServiceContext::_instance = NULL;
15 
16  // //////////////////////////////////////////////////////////////////////
18  _instance = NULL;
19  }
20 
21  // //////////////////////////////////////////////////////////////////////
23 
24  if (_instance == NULL) {
25  _instance = new FacOpenTrepServiceContext();
26  assert (_instance != NULL);
27 
29  }
30  return *_instance;
31  }
32 
33  // //////////////////////////////////////////////////////////////////////
35  create (const TravelDBFilePath_T& iTravelDBFilePath, const DBType& iSQLDBType,
36  const SQLDBConnectionString_T& iSQLDBConnStr,
37  const DeploymentNumber_T& iDeploymentNumber) {
38  OPENTREP_ServiceContext* aOPENTREP_ServiceContext_ptr = NULL;
39 
40  aOPENTREP_ServiceContext_ptr =
41  new OPENTREP_ServiceContext (iTravelDBFilePath, iSQLDBType, iSQLDBConnStr,
42  iDeploymentNumber);
43  assert (aOPENTREP_ServiceContext_ptr != NULL);
44 
45  // The new object is added to the Bom pool
46  _pool.push_back (aOPENTREP_ServiceContext_ptr);
47 
48  return *aOPENTREP_ServiceContext_ptr;
49  }
50 
51  // //////////////////////////////////////////////////////////////////////
53  create (const PORFilePath_T& iPORFilePath,
54  const TravelDBFilePath_T& iTravelDBFilePath, const DBType& iSQLDBType,
55  const SQLDBConnectionString_T& iSQLDBConnStr,
56  const DeploymentNumber_T& iDeploymentNumber,
57  const shouldIndexNonIATAPOR_T& iShouldIndexNonIATAPOR,
58  const shouldIndexPORInXapian_T& iShouldIndexPORInXapian,
59  const shouldAddPORInSQLDB_T& iShouldAddPORInSQLDB) {
60  OPENTREP_ServiceContext* aOPENTREP_ServiceContext_ptr = NULL;
61 
62  aOPENTREP_ServiceContext_ptr =
63  new OPENTREP_ServiceContext (iPORFilePath, iTravelDBFilePath, iSQLDBType,
64  iSQLDBConnStr, iDeploymentNumber,
65  iShouldIndexNonIATAPOR,
66  iShouldIndexPORInXapian,
67  iShouldAddPORInSQLDB);
68  assert (aOPENTREP_ServiceContext_ptr != NULL);
69 
70  // The new object is added to the Service pool
71  _pool.push_back (aOPENTREP_ServiceContext_ptr);
72 
73  return *aOPENTREP_ServiceContext_ptr;
74  }
75 
76 }
static FacSupervisor & instance()
void registerServiceFactory(FacServiceAbstract *)
Class holding the context of the OpenTrep services.
bool shouldIndexNonIATAPOR_T
static FacOpenTrepServiceContext & instance()
Enumeration of database types.
Definition: DBType.hpp:17
bool shouldAddPORInSQLDB_T
Factory for an OPENTREP_ServiceContext object.
bool shouldIndexPORInXapian_T
OPENTREP_ServiceContext & create(const TravelDBFilePath_T &, const DBType &, const SQLDBConnectionString_T &, const DeploymentNumber_T &)
unsigned short DeploymentNumber_T