8 #include <stdair/stdair_exceptions.hpp>
15 const std::string SimulationMode::_labels[LAST_VALUE] =
16 {
"start",
"running",
"break",
"done" };
19 const char SimulationMode::_modeLabels[LAST_VALUE] = {
's',
'r',
'b',
'd'};
22 SimulationMode::SimulationMode()
23 : _mode (LAST_VALUE) {
30 : _mode (iSimulationMode._mode) {
39 case 's': oSimulationMode =
START;
break;
40 case 'r': oSimulationMode =
RUNNING;
break;
41 case 'b': oSimulationMode =
BREAK;
break;
42 case 'd': oSimulationMode =
DONE;
break;
48 std::ostringstream oMessage;
49 oMessage <<
"The simulation mode '" << iModeChar
50 <<
"' is not known. Known simulation modes: " << lLabels;
51 throw stdair::CodeConversionException (oMessage.str());
54 return oSimulationMode;
59 SimulationMode::SimulationMode (
const char iModeChar)
60 : _mode (getMode (iModeChar)) {
64 SimulationMode::SimulationMode (
const std::string& iModeStr) {
66 const size_t lSize = iModeStr.size();
68 const char lModeChar = iModeStr[0];
75 return _labels[iMode];
80 return _modeLabels[iMode];
86 std::ostringstream oStr;
87 oStr << _modeLabels[iMode];
93 std::ostringstream ostr;
94 for (
unsigned short idx = 0; idx !=
LAST_VALUE; ++idx) {
98 ostr << _labels[idx] <<
" '" << _modeLabels[idx] <<
"'";
110 std::ostringstream oStr;
111 oStr << _modeLabels[_mode];
117 const char oModeChar = _modeLabels[_mode];
123 std::ostringstream ostr;
124 ostr << _labels[_mode];
131 return (_mode == iMode);