1.00.14
C++ Travel Customer Choice Model Library
Toggle main menu visibility
Loading...
Searching...
No Matches
CustomerChoiceModel.cpp
Go to the documentation of this file.
1
// //////////////////////////////////////////////////////////////////////
2
// Import section
3
// //////////////////////////////////////////////////////////////////////
4
// STL
5
#include <cassert>
6
#include <sstream>
7
#include <map>
8
// StdAir
9
#include <stdair/service/Logger.hpp>
10
// TravelCCM
11
#include <
travelccm/bom/CustomerChoiceModel.hpp
>
12
#include <
travelccm/TRAVELCCM_Types.hpp
>
13
14
namespace
TRAVELCCM
{
15
16
// ////////////////////////////////////////////////////////////////////
17
CustomerChoiceModel::CustomerChoiceModel
() {
18
}
19
20
// ////////////////////////////////////////////////////////////////////
21
CustomerChoiceModel::CustomerChoiceModel
22
(
const
stdair::PassengerChoiceModel::EN_PassengerChoiceModel& iPassengerChoiceModel) {
23
CustomerChoiceModelMap_T& lCustomerChoiceModelMap = getMap();
24
const
bool
hasInsertionBeenSuccessful =
25
lCustomerChoiceModelMap.insert (CustomerChoiceModelMap_T::value_type
26
(iPassengerChoiceModel,
this
)).second;
27
assert (hasInsertionBeenSuccessful ==
true
);
28
}
29
30
// ////////////////////////////////////////////////////////////////////
31
CustomerChoiceModel::~CustomerChoiceModel
() {
32
}
33
34
// ////////////////////////////////////////////////////////////////////
35
const
CustomerChoiceModel
*
CustomerChoiceModel::create
36
(
const
stdair::PassengerChoiceModel::EN_PassengerChoiceModel& iPassengerChoiceModel) {
37
38
const
CustomerChoiceModel
* lCustomerChoiceModel_ptr = NULL;
39
40
// Try to retrieve the object corresponding to the enum type in the
41
// dedicated map.
42
const
CustomerChoiceModelMap_T& lCustomerChoiceModelMap = getMap();
43
CustomerChoiceModelMap_T::const_iterator itModel =
44
lCustomerChoiceModelMap.find (iPassengerChoiceModel);
45
46
// If no object is retrieved, then the algorithm corresponding to the given
47
// enum type has not been implemented yet.
48
if
(itModel == lCustomerChoiceModelMap.end()) {
49
std::ostringstream oMessage;
50
oMessage <<
"The passenger choice model '"
51
<< stdair::PassengerChoiceModel::getLabel (iPassengerChoiceModel)
52
<<
"' has not been implemented yet."
<< std::endl;
53
STDAIR_LOG_ERROR(oMessage.str());
54
throw
MissingCustomerChoiceModelException
(oMessage.str());
55
}
else
{
56
lCustomerChoiceModel_ptr = itModel->second;
57
}
58
assert (lCustomerChoiceModel_ptr != NULL);
59
return
lCustomerChoiceModel_ptr;
60
}
61
62
}
CustomerChoiceModel.hpp
TRAVELCCM_Types.hpp
TRAVELCCM::CustomerChoiceModel::create
static const CustomerChoiceModel * create(const stdair::PassengerChoiceModel::EN_PassengerChoiceModel &)
Definition
CustomerChoiceModel.cpp:36
TRAVELCCM::CustomerChoiceModel::~CustomerChoiceModel
virtual ~CustomerChoiceModel()
Definition
CustomerChoiceModel.cpp:31
TRAVELCCM::CustomerChoiceModel::CustomerChoiceModel
CustomerChoiceModel()
Definition
CustomerChoiceModel.cpp:17
TRAVELCCM::MissingCustomerChoiceModelException
Definition
TRAVELCCM_Types.hpp:37
TRAVELCCM
Definition
BasConst.cpp:6
Generated on
for TravelCCM by
1.17.0