OpenTREP Logo  0.6.0
C++ Open Travel Request Parsing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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,
36  const SQLiteDBFilePath_T& iSQLiteDBFilePath) {
37  OPENTREP_ServiceContext* aOPENTREP_ServiceContext_ptr = NULL;
38 
39  aOPENTREP_ServiceContext_ptr =
40  new OPENTREP_ServiceContext (iTravelDBFilePath, iSQLiteDBFilePath);
41  assert (aOPENTREP_ServiceContext_ptr != NULL);
42 
43  // The new object is added to the Bom pool
44  _pool.push_back (aOPENTREP_ServiceContext_ptr);
45 
46  return *aOPENTREP_ServiceContext_ptr;
47  }
48 
49  // //////////////////////////////////////////////////////////////////////
51  create (const PORFilePath_T& iPORFilePath,
52  const TravelDBFilePath_T& iTravelDBFilePath,
53  const SQLiteDBFilePath_T& iSQLiteDBFilePath) {
54  OPENTREP_ServiceContext* aOPENTREP_ServiceContext_ptr = NULL;
55 
56  aOPENTREP_ServiceContext_ptr =
57  new OPENTREP_ServiceContext (iPORFilePath, iTravelDBFilePath, iSQLiteDBFilePath);
58  assert (aOPENTREP_ServiceContext_ptr != NULL);
59 
60  // The new object is added to the Bom pool
61  _pool.push_back (aOPENTREP_ServiceContext_ptr);
62 
63  return *aOPENTREP_ServiceContext_ptr;
64  }
65 
66 }
static FacSupervisor & instance()
void registerServiceFactory(FacServiceAbstract *)
Class holding the context of the OpenTrep services.
static FacOpenTrepServiceContext & instance()
OPENTREP_ServiceContext & create(const TravelDBFilePath_T &, const SQLiteDBFilePath_T &)