8 #include <stdair/stdair_exceptions.hpp>
21 const std::string OptimizationType::_labels[LAST_VALUE] =
22 {
"OptimalByMC",
"OptimalByDP",
23 "HeuristicByEMSR",
"HeuristicByEMSRa",
"HeuristicByEMSRb",
24 "HeuristicByMCForQFF",
"HeuristicByEMSRbForQFF",
"HeuristicByMRTForQFF" };
27 const char OptimizationType::
28 _typeLabels[LAST_VALUE] = {
'M',
'D',
'E',
'A',
'B',
'Q',
'C',
'R' };
31 OptimizationType::OptimizationType()
32 : _type (LAST_VALUE) {
38 : _type (iOptimizationType._type) {
44 : _type (iOptimizationType) {
48 OptimizationType::OptimizationType (
const char iType) {
50 case 'M': _type =
OPT_MC;
break;
51 case 'D': _type =
OPT_DP;
break;
63 std::ostringstream oMessage;
64 oMessage <<
"The optimization type '" << iType
65 <<
"' is not known. Known optimization types: " << lLabels;
66 throw stdair::CodeConversionException (oMessage.str());
71 OptimizationType::OptimizationType (
const std::string& iTypeStr) {
72 for (
unsigned short idx = 0; idx !=
LAST_VALUE; ++idx) {
73 if (iTypeStr.compare(_labels[idx]) == 0) {
82 std::ostringstream oMessage;
83 oMessage <<
"The optimization type '" << iTypeStr
84 <<
"' is not known. Known optimization types: " << lLabels;
85 throw stdair::CodeConversionException (oMessage.str());
92 return _labels[iType];
97 return _typeLabels[iType];
103 std::ostringstream oStr;
104 oStr << _typeLabels[iType];
110 std::ostringstream ostr;
111 for (
unsigned short idx = 0; idx !=
LAST_VALUE; ++idx) {
115 ostr << _labels[idx];
127 std::ostringstream oStr;
128 oStr << _typeLabels[_type];
134 std::ostringstream ostr;
135 ostr << _labels[_type];
141 return (_type == iType);