12 #include <boost/program_options.hpp>
13 #include <boost/tokenizer.hpp>
14 #include <boost/regex.hpp>
15 #include <boost/swap.hpp>
16 #include <boost/algorithm/string/case_conv.hpp>
18 #include <stdair/ui/cmdline/SReadline.hpp>
20 #include <stdair/stdair_basic_types.hpp>
21 #include <stdair/stdair_json.hpp>
22 #include <stdair/stdair_exceptions.hpp>
23 #include <stdair/basic/BasConst_General.hpp>
24 #include <stdair/basic/BasLogParams.hpp>
25 #include <stdair/basic/BasDBParams.hpp>
26 #include <stdair/basic/DemandGenerationMethod.hpp>
27 #include <stdair/basic/BasConst_BomDisplay.hpp>
28 #include <stdair/bom/RMEventStruct.hpp>
29 #include <stdair/service/Logger.hpp>
34 #include <tvlsim/config/tvlsim-paths.hpp>
45 typedef std::list<stdair::Date_T> DateList_T;
58 "/rds01/schedule05.csv");
93 "/rds01/demand05.csv");
104 stdair::DEFAULT_RANDOM_SEED;
143 typedef std::vector<std::string> TokenList_T;
146 TokenList_T GlobalTokenListForDate;
168 JSON_LIST_FLIGHT_DATE,
169 JSON_DISPLAY_FLIGHT_DATE,
170 JSON_SET_BREAK_POINT,
186 typedef boost::tokenizer<boost::char_separator<char> > Tokeniser_T;
189 const boost::char_separator<char> lSepatorList(
" .,;:|+-*/_=!@#$%`~^&(){}[]?'<>\"");
192 Tokeniser_T lTokens (iPhrase, lSepatorList);
193 for (Tokeniser_T::const_iterator tok_iter = lTokens.begin();
194 tok_iter != lTokens.end(); ++tok_iter) {
195 const std::string& lTerm = *tok_iter;
196 ioWordList.push_back (lTerm);
201 std::ostringstream oStr;
203 unsigned short idx = iWordList.size();
204 for (WordList_T::const_iterator itWord = iWordList.begin();
205 itWord != iWordList.end(); ++itWord, --idx) {
206 const std::string& lWord = *itWord;
219 template<
class T> std::ostream&
operator<< (std::ostream& os,
220 const std::vector<T>& v) {
221 std::copy (v.begin(), v.end(), std::ostream_iterator<T> (std::cout,
" "));
229 bool& ioIsBuiltin, stdair::RandomSeed_T& ioRandomSeed,
231 stdair::Filename_T& ioScheduleInputFilename,
232 stdair::Filename_T& ioOnDInputFilename,
233 stdair::Filename_T& ioFRAT5Filename,
234 stdair::Filename_T& ioFFDisutilityFilename,
235 stdair::Filename_T& ioYieldInputFilename,
236 stdair::Filename_T& ioFareInputFilename,
237 stdair::Filename_T& ioDemandInputFilename,
238 std::string& ioLogFilename,
239 stdair::DemandGenerationMethod& ioDemandGenerationMethod,
240 std::string& ioDBUser, std::string& ioDBPasswd,
241 std::string& ioDBHost, std::string& ioDBPort,
242 std::string& ioDBDBName) {
245 char lDemandGenerationMethodChar;
251 if (ioQueryString.empty() ==
true) {
260 boost::program_options::options_description
generic (
"Generic options");
261 generic.add_options()
262 (
"prefix",
"print installation prefix")
263 (
"version,v",
"print version string")
264 (
"help,h",
"produce help message");
268 boost::program_options::options_description config (
"Configuration");
271 "The sample BOM tree can be either built-in or parsed from input files. In that latter case, the input files must be specified as well (e.g., -d/--demand, -s/--schedule, -o/--ond, -f/--fare, -y/--yield)")
274 "Seed for the random generation")
277 "Number of simulation runs")
280 "(CSV) input file for the schedules")
283 "(CSV) input file for the O&D definitions")
286 "(CSV) input file for the FRAT5 Curve")
289 "(CSV) input file for the FF disutility Curve")
292 "(CSV) input file for the yields")
295 "(CSV) input file for the fares")
298 "(CSV) input file for the demand distributions")
301 "Filepath for the logs")
302 (
"demandgeneration,G",
304 "Method used to generate the demand (i.e., booking requests): Poisson Process (e.g., P) or Statistics Order (e.g., S)")
307 "SQL database hostname (e.g., tvlsim)")
310 "SQL database hostname (e.g., tvlsim)")
313 "SQL database hostname (e.g., localhost)")
316 "SQL database port (e.g., 3306)")
319 "SQL database name (e.g., tvlsim)")
321 boost::program_options::value< WordList_T >(&lWordList)->multitoken(),
327 boost::program_options::options_description hidden (
"Hidden options");
330 boost::program_options::value< std::vector<std::string> >(),
331 "Show the copyright (license)");
333 boost::program_options::options_description cmdline_options;
334 cmdline_options.add(
generic).add(config).add(hidden);
336 boost::program_options::options_description config_file_options;
337 config_file_options.add(config).add(hidden);
339 boost::program_options::options_description visible (
"Allowed options");
340 visible.add(
generic).add(config);
342 boost::program_options::positional_options_description p;
343 p.add (
"copyright", -1);
345 boost::program_options::variables_map vm;
346 boost::program_options::
347 store (boost::program_options::command_line_parser (argc, argv).
348 options (cmdline_options).positional(p).run(), vm);
350 std::ifstream ifs (
"simulate.cfg");
351 boost::program_options::store (parse_config_file (ifs, config_file_options),
353 boost::program_options::notify (vm);
355 if (vm.count (
"help")) {
356 std::cout << visible << std::endl;
360 if (vm.count (
"version")) {
365 if (vm.count (
"prefix")) {
366 std::cout <<
"Installation prefix: " <<
PREFIXDIR << std::endl;
370 if (vm.count (
"builtin")) {
373 const std::string isBuiltinStr = (ioIsBuiltin ==
true)?
"yes":
"no";
374 std::cout <<
"The BOM should be built-in? " << isBuiltinStr << std::endl;
377 std::ostringstream oErrorMessageStr;
378 oErrorMessageStr <<
"Either the -b/--builtin option, or the combination of "
379 <<
"the -d/--demand, -s/--schedule, -o/--ond, -f/--fare "
380 <<
"and -y/--yield options must be specified";
382 if (ioIsBuiltin ==
false) {
383 if (vm.count (
"schedule")) {
384 ioScheduleInputFilename = vm[
"schedule"].as< std::string >();
385 std::cout <<
"Schedule input filename is: " << ioScheduleInputFilename
391 std::cerr << oErrorMessageStr.str() << std::endl;
394 if (vm.count (
"ond")) {
395 ioOnDInputFilename = vm[
"ond"].as< std::string >();
396 std::cout <<
"O&D input filename is: " << ioOnDInputFilename << std::endl;
401 std::cerr << oErrorMessageStr.str() << std::endl;
404 if (vm.count (
"frat5")) {
405 ioFRAT5Filename = vm[
"frat5"].as< std::string >();
406 std::cout <<
"FRAT5 input filename is: " << ioFRAT5Filename << std::endl;
411 std::cerr << oErrorMessageStr.str() << std::endl;
414 if (vm.count (
"ff_disutility")) {
415 ioFFDisutilityFilename = vm[
"ff_disutility"].as< std::string >();
416 std::cout <<
"FF disutility input filename is: "
417 << ioFFDisutilityFilename << std::endl;
422 std::cerr << oErrorMessageStr.str() << std::endl;
425 if (vm.count (
"yield")) {
426 ioYieldInputFilename = vm[
"yield"].as< std::string >();
427 std::cout <<
"Yield input filename is: " << ioYieldInputFilename << std::endl;
432 std::cerr << oErrorMessageStr.str() << std::endl;
435 if (vm.count (
"fare")) {
436 ioFareInputFilename = vm[
"fare"].as< std::string >();
437 std::cout <<
"Fare input filename is: " << ioFareInputFilename << std::endl;
442 std::cerr << oErrorMessageStr.str() << std::endl;
445 if (vm.count (
"demand")) {
446 ioDemandInputFilename = vm[
"demand"].as< std::string >();
447 std::cout <<
"Demand input filename is: " << ioDemandInputFilename
452 std::cerr << oErrorMessageStr.str() << std::endl;
456 if (vm.count (
"log")) {
457 ioLogFilename = vm[
"log"].as< std::string >();
458 std::cout <<
"Log filename is: " << ioLogFilename << std::endl;
462 if (vm.count (
"demandgeneration")) {
463 ioDemandGenerationMethod =
464 stdair::DemandGenerationMethod (lDemandGenerationMethodChar);
465 std::cout <<
"Demand generation method is: "
466 << ioDemandGenerationMethod.describe() << std::endl;
470 std::cout <<
"The random generation seed is: " << ioRandomSeed << std::endl;
473 std::cout <<
"The number of simulation runs is: " << ioRandomRuns
477 if (vm.count (
"user")) {
478 ioDBUser = vm[
"user"].as< std::string >();
482 if (vm.count (
"passwd")) {
483 ioDBPasswd = vm[
"passwd"].as< std::string >();
487 if (vm.count (
"host")) {
488 ioDBHost = vm[
"host"].as< std::string >();
492 if (vm.count (
"port")) {
493 ioDBPort = vm[
"port"].as< std::string >();
497 if (vm.count (
"dbname")) {
498 ioDBDBName = vm[
"dbname"].as< std::string >();
510 void initReadline (swift::SReadline& ioInputReader) {
513 std::vector<std::string> Completers;
518 Completers.push_back (
"help");
519 Completers.push_back (
"run");
520 Completers.push_back (
"reset");
521 Completers.push_back (
"optimise");
522 Completers.push_back (
"display_config");
523 Completers.push_back (
"display_status");
524 Completers.push_back (
"display_flight_date");
525 Completers.push_back (
"list_event");
526 Completers.push_back (
"list_event BookingRequest");
527 Completers.push_back (
"list_event Cancellation");
528 Completers.push_back (
"list_event OptimisationNotificationForFlightDate");
529 Completers.push_back (
"list_event OptimisationNotificationForNetwork");
530 Completers.push_back (
"list_event ScheduleChange");
531 Completers.push_back (
"list_event Snapshot");
532 Completers.push_back (
"list_event RevenueManagement");
533 Completers.push_back (
"list_event BreakPoint");
534 Completers.push_back (
"list_flight_date");
535 Completers.push_back (
"set_break_point");
536 Completers.push_back (
"sell");
537 Completers.push_back (
"json_list_event");
538 Completers.push_back (
"json_list_event BookingRequest");
539 Completers.push_back (
"json_list_event Cancellation");
540 Completers.push_back (
"json_list_event OptimisationNotificationForFlightDate");
541 Completers.push_back (
"json_list_event OptimisationNotificationForNetwork");
542 Completers.push_back (
"json_list_event ScheduleChange");
543 Completers.push_back (
"json_list_event Snapshot");
544 Completers.push_back (
"json_list_event RevenueManagement");
545 Completers.push_back (
"json_list_event BreakPoint");
546 Completers.push_back (
"json_list_flight_date");
547 Completers.push_back (
"json_display_flight_date");
548 Completers.push_back (
"json_display_status");
549 Completers.push_back (
"json_set_break_point");
550 Completers.push_back (
"json_run");
551 Completers.push_back (
"json_reset");
552 Completers.push_back (
"json_display_config");
553 Completers.push_back (
"quit");
557 ioInputReader.RegisterCompletions (Completers);
561 void parseFlightKey (
const TokenList_T& iTokenList,
562 stdair::AirlineCode_T& ioAirlineCode,
563 stdair::FlightNumber_T& ioFlightNumber) {
566 if (iTokenList.empty() ==
false) {
568 TokenList_T::const_iterator itTok = iTokenList.begin();
569 if (itTok->empty() ==
false) {
570 ioAirlineCode = *itTok;
571 boost::algorithm::to_upper (ioAirlineCode);
576 if (itTok != iTokenList.end()) {
578 if (itTok->empty() ==
false) {
581 ioFlightNumber = boost::lexical_cast<stdair::FlightNumber_T> (*itTok);
583 }
catch (boost::bad_lexical_cast& eCast) {
584 std::cerr <<
"The flight number ('" << *itTok
585 <<
"') cannot be understood. "
586 <<
"The default value (all) is kept."
599 void parseBookingClassKey (
const TokenList_T& iTokenList,
600 stdair::ClassCode_T& ioBookingClass,
601 stdair::PartySize_T& ioPartySize,
602 stdair::AirportCode_T& ioOrigin,
603 stdair::AirportCode_T& ioDestination) {
605 if (iTokenList.empty() ==
false) {
608 TokenList_T::const_iterator itTok = iTokenList.begin();
609 if (itTok->empty() ==
false) {
610 ioBookingClass = *itTok;
611 boost::algorithm::to_upper (ioBookingClass);
616 if (itTok != iTokenList.end()) {
618 if (itTok->empty() ==
false) {
621 ioPartySize = boost::lexical_cast<stdair::PartySize_T> (*itTok);
623 }
catch (boost::bad_lexical_cast& eCast) {
624 std::cerr <<
"The party size ('" << *itTok
625 <<
"') cannot be understood. The default value ("
626 << ioPartySize <<
") is kept." << std::endl;
637 if (itTok != iTokenList.end()) {
639 if (itTok->empty() ==
false) {
641 boost::algorithm::to_upper (ioOrigin);
650 if (itTok != iTokenList.end()) {
652 if (itTok->empty() ==
false) {
653 ioDestination = *itTok;
654 boost::algorithm::to_upper (ioDestination);
664 void parseDateKey (
const TokenList_T& iTokenList,
665 stdair::Date_T& ioDate) {
667 const std::string kMonthStr[12] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
668 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"};
670 unsigned short ioDateYear = ioDate.year();
671 unsigned short ioDateMonth = ioDate.month();
672 std::string ioDateMonthStr = kMonthStr[ioDateMonth-1];
673 unsigned short ioDateDay = ioDate.day();
676 if (iTokenList.empty() ==
false) {
679 TokenList_T::const_iterator itTok = iTokenList.begin();
680 if (itTok->empty() ==
false) {
683 ioDateYear = boost::lexical_cast<
unsigned short> (*itTok);
684 if (ioDateYear < 100) {
688 }
catch (boost::bad_lexical_cast& eCast) {
689 std::cerr <<
"The year of the date ('" << *itTok
690 <<
"') cannot be understood. The default value ("
691 << ioDate <<
") is kept. " << std::endl;
701 if (itTok != iTokenList.end()) {
703 if (itTok->empty() ==
false) {
706 const boost::regex lMonthRegex (
"^(\\d{1,2})$");
707 const bool isMonthANumber = regex_match (*itTok, lMonthRegex);
709 if (isMonthANumber ==
true) {
710 const unsigned short lMonth =
711 boost::lexical_cast<
unsigned short> (*itTok);
712 if (lMonth > 12 || lMonth < 1) {
713 throw boost::bad_lexical_cast();
715 ioDateMonthStr = kMonthStr[lMonth-1];
718 const std::string lMonthStr (*itTok);
719 if (lMonthStr.size() < 3) {
720 throw boost::bad_lexical_cast();
722 std::string lMonthStr1 (lMonthStr.substr (0, 1));
723 boost::algorithm::to_upper (lMonthStr1);
724 std::string lMonthStr23 (lMonthStr.substr (1, 2));
725 boost::algorithm::to_lower (lMonthStr23);
726 ioDateMonthStr = lMonthStr1 + lMonthStr23;
729 }
catch (boost::bad_lexical_cast& eCast) {
730 std::cerr <<
"The month of the date ('" << *itTok
731 <<
"') cannot be understood. The default value ("
732 << ioDate <<
") is kept. " << std::endl;
743 if (itTok != iTokenList.end()) {
745 if (itTok->empty() ==
false) {
748 ioDateDay = boost::lexical_cast<
unsigned short> (*itTok);
750 }
catch (boost::bad_lexical_cast& eCast) {
751 std::cerr <<
"The day of the date ('" << *itTok
752 <<
"') cannot be understood. The default value ("
753 << ioDate <<
") is kept. " << std::endl;
763 std::ostringstream lDateStr;
764 lDateStr << ioDateYear <<
"-" << ioDateMonthStr
770 boost::gregorian::from_simple_string (lDateStr.str());
772 }
catch (boost::gregorian::bad_day_of_month& eCast) {
773 std::cerr <<
"The date ('" << lDateStr.str()
774 <<
"') cannot be understood. The default value ("
775 << ioDate <<
") is kept. " << std::endl;
783 void parseDateListKey (stdair::Date_T& iDefaultDate,
784 DateList_T& ioDateList) {
787 if (GlobalTokenListForDate.size() < 3) {
788 ioDateList.push_back (iDefaultDate);
793 while (GlobalTokenListForDate.size() >= 3) {
795 parseDateKey (GlobalTokenListForDate, iDefaultDate);
796 ioDateList.push_back (iDefaultDate);
799 GlobalTokenListForDate.erase(GlobalTokenListForDate.begin(),
800 GlobalTokenListForDate.begin()+3);
806 void parseFlightDateKey (TokenList_T& iTokenList,
807 stdair::AirlineCode_T& ioAirlineCode,
808 stdair::FlightNumber_T& ioFlightNumber,
809 stdair::Date_T& ioDate) {
813 if (iTokenList.size() < 5) {
818 parseFlightKey (iTokenList, ioAirlineCode, ioFlightNumber);
821 assert (iTokenList.size() >= 2);
822 iTokenList.erase(iTokenList.begin(),iTokenList.begin()+2);
824 parseDateKey (iTokenList, ioDate);
825 assert (iTokenList.size() >= 3);
826 iTokenList.erase(iTokenList.begin(),iTokenList.begin()+3);
830 Command_T::Type_T extractCommand (TokenList_T& ioTokenList) {
831 Command_T::Type_T oCommandType = Command_T::LAST_VALUE;
834 if (ioTokenList.empty() ==
false) {
835 TokenList_T::iterator itTok = ioTokenList.begin();
836 std::string lCommand (*itTok);
837 boost::algorithm::to_lower (lCommand);
839 if (lCommand ==
"help") {
840 oCommandType = Command_T::HELP;
842 }
else if (lCommand ==
"run") {
843 oCommandType = Command_T::RUN;
845 }
else if (lCommand ==
"optimise") {
846 oCommandType = Command_T::OPTIMISE;
848 }
else if (lCommand ==
"reset") {
849 oCommandType = Command_T::RESET;
851 }
else if (lCommand ==
"list_event") {
852 oCommandType = Command_T::LIST_EVENT;
854 }
else if (lCommand ==
"list_flight_date") {
855 oCommandType = Command_T::LIST_FLIGHT_DATE;
857 }
else if (lCommand ==
"display_status") {
858 oCommandType = Command_T::DISPLAY_STATUS;
860 }
else if (lCommand ==
"display_config") {
861 oCommandType = Command_T::DISPLAY_CONFIG;
863 }
else if (lCommand ==
"display_flight_date") {
864 oCommandType = Command_T::DISPLAY_FLIGHT_DATE;
866 }
else if (lCommand ==
"set_break_point") {
867 oCommandType = Command_T::SET_BREAK_POINT;
869 }
else if (lCommand ==
"sell") {
870 oCommandType = Command_T::SELL;
872 }
else if (lCommand ==
"json_list_event") {
873 oCommandType = Command_T::JSON_LIST_EVENT;
875 }
else if (lCommand ==
"json_list_flight_date") {
876 oCommandType = Command_T::JSON_LIST_FLIGHT_DATE;
878 }
else if (lCommand ==
"json_display_flight_date") {
879 oCommandType = Command_T::JSON_DISPLAY_FLIGHT_DATE;
881 }
else if (lCommand ==
"json_set_break_point") {
882 oCommandType = Command_T::JSON_SET_BREAK_POINT;
884 }
else if (lCommand ==
"json_run") {
885 oCommandType = Command_T::JSON_RUN;
887 }
else if (lCommand ==
"json_reset") {
888 oCommandType = Command_T::JSON_RESET;
890 }
else if (lCommand ==
"json_display_status") {
891 oCommandType = Command_T::JSON_STATUS;
893 }
else if (lCommand ==
"json_display_config") {
894 oCommandType = Command_T::JSON_CONFIG;
896 }
else if (lCommand ==
"quit") {
897 oCommandType = Command_T::QUIT;
902 ioTokenList.erase (itTok);
905 oCommandType = Command_T::NOP;
912 std::string toString (
const TokenList_T& iTokenList) {
913 std::ostringstream oStr;
916 unsigned short idx = 0;
917 for (TokenList_T::const_iterator itTok = iTokenList.begin();
918 itTok != iTokenList.end(); ++itTok, ++idx) {
929 bool regex_callback(
const boost::match_results<std::string::const_iterator>& what)
936 const unsigned short lMatchSetSize = what.size();
937 for (
unsigned short matchIdx = 1; matchIdx != lMatchSetSize; ++matchIdx) {
938 const std::string lMatchedString (std::string (what[matchIdx].first,
939 what[matchIdx].second));
941 GlobalTokenListForDate.push_back (lMatchedString);
948 void extractTokenListDate (
const TokenList_T& iTokenList,
949 const std::string& iRegularExpression) {
950 TokenList_T oTokenList;
954 const std::string lFullLine = toString (iTokenList);
957 boost::regex expression (iRegularExpression);
959 std::string::const_iterator start = lFullLine.begin();
960 std::string::const_iterator end = lFullLine.end();
963 boost::sregex_iterator m1(start, end, expression);
964 boost::sregex_iterator m2;
965 std::for_each(m1, m2, ®ex_callback);
970 TokenList_T extractTokenList (
const TokenList_T& iTokenList,
971 const std::string& iRegularExpression) {
972 TokenList_T oTokenList;
976 const std::string lFullLine = toString (iTokenList);
979 boost::regex expression (iRegularExpression);
981 std::string::const_iterator start = lFullLine.begin();
982 std::string::const_iterator end = lFullLine.end();
984 boost::match_results<std::string::const_iterator> what;
985 boost::match_flag_type flags = boost::match_default;
986 regex_search (start, end, what, expression, flags);
990 const unsigned short lMatchSetSize = what.size();
991 for (
unsigned short matchIdx = 1; matchIdx != lMatchSetSize; ++matchIdx) {
992 const std::string lMatchedString (std::string (what[matchIdx].first,
993 what[matchIdx].second));
995 oTokenList.push_back (lMatchedString);
1006 TokenList_T extractTokenListForFlightDate (
const TokenList_T& iTokenList) {
1017 const std::string lRegEx(
"^([[:alpha:]]{2,3})?"
1018 "[[:space:]]*([[:digit:]]{1,4})?"
1020 "([[:digit:]]{2,4})?[/-]?[[:space:]]*"
1021 "([[:alpha:]]{3}|[[:digit:]]{1,2})?[/-]?[[:space:]]*"
1022 "([[:digit:]]{1,2})?$");
1025 const TokenList_T& oTokenList = extractTokenList (iTokenList, lRegEx);
1030 void extractTokenListForDate (
const TokenList_T& iTokenList) {
1038 const std::string lRegEx(
"([[:digit:]]{2,4})[/-]?"
1039 "([[:alpha:]]{3}|[[:digit:]]{1,2})[/-]?"
1040 "([[:digit:]]{1,2})");
1044 extractTokenListDate (iTokenList, lRegEx);
1049 TokenList_T extractTokenListForFlight (
const TokenList_T& iTokenList) {
1056 const std::string lRegEx (
"^([[:alpha:]]{2,3})?"
1057 "[[:space:]]*([[:digit:]]{1,4})?$");
1060 const TokenList_T& oTokenList = extractTokenList (iTokenList, lRegEx);
1065 TokenList_T extractTokenListForClass (
const TokenList_T& iTokenList) {
1081 const std::string lRegEx (
"^([[:alpha:]]{2,3})?"
1082 "[[:space:]]*([[:digit:]]{1,4})?"
1084 "([[:digit:]]{2,4})?[/-]?[[:space:]]*"
1085 "([[:alpha:]]{3}|[[:digit:]]{1,2})?[/-]?[[:space:]]*"
1086 "([[:digit:]]{1,2})?"
1087 "[[:space:]]*([[:alpha:]]{1})?"
1088 "[[:space:]]*([[:digit:]]{1,3})?"
1089 "[[:space:]]*([[:alpha:]]{3})?"
1090 "[[:space:]]*([[:alpha:]]{3})?$");
1093 const TokenList_T& oTokenList = extractTokenList (iTokenList, lRegEx);
1098 int main (
int argc,
char* argv[]) {
1101 const unsigned int lHistorySize (100);
1102 const std::string lHistoryFilename (
"tvlsim.hist");
1103 const std::string lHistoryBackupFilename (
"tvlsim.hist.bak");
1110 stdair::AirlineCode_T lDefaultAirlineCode;
1111 stdair::FlightNumber_T lDefaultFlightNumber;
1112 stdair::Date_T lDefaultDate;
1113 stdair::AirportCode_T lDefaultOrigin;
1114 stdair::AirportCode_T lDefaultDestination;
1115 stdair::ClassCode_T lDefaultBookingClass;
1116 stdair::PartySize_T lDefaultPartySize;
1119 stdair::RandomSeed_T lRandomSeed;
1128 stdair::Date_T lStartDate (2009, boost::gregorian::Feb, 01);
1131 stdair::Date_T lEndDate (2012, boost::gregorian::Sep, 01);
1134 stdair::Filename_T lScheduleInputFilename;
1137 std::string lOnDInputFilename;
1140 std::string lFRAT5InputFilename;
1143 std::string lFFDisutilityInputFilename;
1146 std::string lYieldInputFilename;
1149 std::string lFareInputFilename;
1152 stdair::Filename_T lDemandInputFilename;
1155 std::string lLogFilename;
1158 stdair::DemandGenerationMethod
1162 std::string lDBUser;
1163 std::string lDBPasswd;
1164 std::string lDBHost;
1165 std::string lDBPort;
1166 std::string lDBDBName;
1169 const int lOptionParserStatus =
1171 lScheduleInputFilename, lOnDInputFilename,
1172 lFRAT5InputFilename, lFFDisutilityInputFilename,
1173 lYieldInputFilename, lFareInputFilename,
1174 lDemandInputFilename, lLogFilename,
1175 lDemandGenerationMethod,
1176 lDBUser, lDBPasswd, lDBHost, lDBPort, lDBDBName);
1183 stdair::BasDBParams lDBParams (lDBUser, lDBPasswd, lDBHost, lDBPort,
1187 std::ofstream logOutputFile;
1189 logOutputFile.open (lLogFilename.c_str());
1190 logOutputFile.clear();
1194 if (isBuiltin ==
true) {
1197 lStartDate = stdair::Date_T (2011, 01, 01);
1198 lEndDate = stdair::Date_T (2011, 12, 01);
1199 lDefaultAirlineCode =
"BA";
1200 lDefaultFlightNumber = 9;
1201 lDefaultDate = stdair::Date_T (2011, 06, 10);
1202 lDefaultBookingClass =
"Q";
1203 lDefaultPartySize = 2;
1204 lDefaultOrigin =
"LHR";
1205 lDefaultDestination =
"SYD";
1210 lDefaultAirlineCode =
"SQ";
1211 lDefaultFlightNumber = 12;
1212 lDefaultDate = stdair::Date_T (2009, 02, 9);
1213 lDefaultBookingClass =
"Y";
1214 lDefaultPartySize = 2;
1215 lDefaultOrigin =
"SIN";
1216 lDefaultDestination =
"BKK";
1220 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG, logOutputFile);
1222 lRandomSeed, lDemandGenerationMethod,
1226 if (isBuiltin ==
true) {
1229 tvlsimService.buildSampleBom();
1234 stdair::ScheduleFilePath lScheduleFilePath (lScheduleInputFilename);
1235 stdair::ODFilePath lODFilePath (lOnDInputFilename);
1236 stdair::FRAT5FilePath lFRAT5FilePath (lFRAT5InputFilename);
1237 stdair::FFDisutilityFilePath lFFDisutilityFilePath (lFFDisutilityInputFilename);
1238 const SIMFQT::FareFilePath lFareFilePath (lFareInputFilename);
1239 const AIRRAC::YieldFilePath lYieldFilePath (lYieldInputFilename);
1240 const TRADEMGEN::DemandFilePath lDemandFilePath (lDemandInputFilename);
1241 tvlsimService.setInputFiles (lScheduleFilePath, lODFilePath,
1242 lFRAT5FilePath, lFFDisutilityFilePath,
1243 lYieldFilePath, lFareFilePath,
1245 tvlsimService.parseAndLoad ();
1249 tvlsimService.initSnapshotAndRMEvents();
1252 STDAIR_LOG_DEBUG (
"====================================================");
1253 STDAIR_LOG_DEBUG (
"= Beginning of the interactive session =");
1254 STDAIR_LOG_DEBUG (
"====================================================");
1257 swift::SReadline lReader (lHistoryFilename, lHistorySize);
1258 initReadline (lReader);
1261 std::string lUserInput;
1262 bool EndOfInput (
false);
1263 Command_T::Type_T lCommandType (Command_T::NOP);
1265 while (lCommandType != Command_T::QUIT && EndOfInput ==
false) {
1267 std::ostringstream oPromptStr;
1268 oPromptStr <<
"tvlsim "
1271 TokenList_T lTokenListByReadline;
1272 lUserInput = lReader.GetLine (oPromptStr.str(), lTokenListByReadline,
1276 lReader.SaveHistory (lHistoryBackupFilename);
1280 std::cout << std::endl;
1285 lCommandType = extractCommand (lTokenListByReadline);
1287 GlobalTokenListForDate.clear();
1289 switch (lCommandType) {
1292 case Command_T::HELP: {
1293 std::cout << std::endl;
1294 std::cout <<
"Commands:\n" << std::endl;
1295 std::cout <<
" help" <<
"\t\t\t\t" <<
"Display this help."
1297 std::cout <<
" quit" <<
"\t\t\t\t" <<
"Quit the application."
1299 std::cout <<
" display_config" <<
"\t\t\t" <<
"Display the configuration."
1301 std::cout <<
" display_status" <<
"\t\t\t"
1302 <<
"Display the simulation status."
1304 std::cout <<
" list_event" <<
"\t\t\t"
1305 <<
"List events in the queue."
1307 <<
"\t\t\t\tIt is possible to filter events according to their types:"
1309 <<
"\t\t\t\t 'list_event BookingRequest' "
1310 <<
"list all the booking requests."
1312 <<
"\t\t\t\t 'list_event Cancellation' "
1313 <<
"list all the cancellation events."
1315 <<
"\t\t\t\t 'list_event Snapshot' "
1316 <<
"list all the snap shots."
1318 <<
"\t\t\t\t 'list_event RevenueManagement' "
1319 <<
"list all the revenue management events."
1321 <<
"\t\t\t\t 'list_event BreakPoint' "
1322 <<
"list all the break points."
1324 std::cout <<
" list_flight_date" <<
"\t\t"
1325 <<
"List airlines, flights and departure dates."
1327 std::cout <<
" display_flight_date" <<
"\t\t"
1328 <<
"Display the given flight-date."
1330 <<
"\t\t\t\tIf the parameters list is empty or wrong, default values are used:"
1332 <<
"\t\t\t\t 'display_flight_date " << lDefaultAirlineCode
1333 << lDefaultFlightNumber <<
" " << lDefaultDate <<
"'"
1335 std::cout <<
" set_break_point" <<
"\t\t"
1336 <<
"Insert the given break points in the event list."
1338 <<
"\t\t\t\tIf the parameters list is empty or wrong, a default value is used:"
1340 <<
"\t\t\t\t 'set_break_point " << lDefaultDate <<
"'"
1342 std::cout <<
" run" <<
"\t\t\t\t"
1343 <<
"Perform the simulation until the next break-point, if any."
1345 std::cout <<
" reset" <<
"\t\t\t\t" <<
"Reset the service (including the "
1348 std::cout <<
" sell" <<
"\t\t\t\t" <<
"Make a booking on the given flight-date."
1350 <<
"\t\t\t\tIf the parameters list is empty or wrong, default values are used:"
1352 <<
"\t\t\t\t 'sell " << lDefaultAirlineCode
1353 << lDefaultFlightNumber <<
" " << lDefaultDate <<
" "
1354 << lDefaultBookingClass <<
" " << lDefaultPartySize <<
" "
1355 << lDefaultOrigin <<
" " << lDefaultDestination <<
"'"
1357 std::cout <<
" optimise" <<
"\t\t\t" <<
"Optimise the given flight-date."
1359 <<
"\t\t\t\tIf the parameters list is empty or wrong, default values are used:"
1361 <<
"\t\t\t\t 'optimise " << lDefaultAirlineCode
1362 << lDefaultFlightNumber <<
" " << lDefaultDate <<
"'"
1364 std::cout <<
" \n\nDebug Commands:\n"
1366 std::cout <<
" json_display_status" <<
"\t\t"
1367 <<
"Display the simulation status in a JSON format."
1369 std::cout <<
" json_display_config" <<
"\t\t"
1370 <<
"Display the simulation configuration in a JSON format."
1372 std::cout <<
" json_list_event" <<
"\t\t"
1373 <<
"List events in the queue in a JSON format."
1375 std::cout <<
" json_list_flight_date" <<
"\t\t"
1376 <<
"List airlines, flights and departure dates in a JSON format."
1378 std::cout <<
" json_display_flight_date" <<
"\t"
1379 <<
"Display the given flight-date in a JSON format."
1381 std::cout <<
" json_set_break_point" <<
"\t\t"
1382 <<
"Insert the given break points in the event list."
1384 std::cout <<
" json_run" <<
"\t\t\t"
1385 <<
"Perform the simulation until the next break-point, if any."
1387 std::cout <<
" json_reset" <<
"\t\t\t"
1388 <<
"Reset the service (including the event queue)."
1390 std::cout << std::endl;
1395 case Command_T::QUIT: {
1400 case Command_T::DISPLAY_CONFIG: {
1403 std::ostringstream oConfigStr;
1406 oConfigStr << tvlsimService.configDisplay () << std::endl;
1407 std::cout << oConfigStr.str();
1408 STDAIR_LOG_DEBUG (oConfigStr.str());
1413 case Command_T::RUN: {
1416 tvlsimService.simulate ();
1422 case Command_T::DISPLAY_STATUS: {
1424 std::cout <<
"Simulation Status" << std::endl;
1427 const std::string& lSimulationStatusStr =
1428 tvlsimService.simulationStatusDisplay();
1431 std::cout << lSimulationStatusStr << std::endl;
1432 STDAIR_LOG_DEBUG (lSimulationStatusStr);
1438 case Command_T::RESET: {
1440 std::cout <<
"Reset" << std::endl;
1441 tvlsimService.reset ();
1448 case Command_T::LIST_EVENT: {
1451 std::ostringstream oEventListStr;
1453 if (lTokenListByReadline.empty() ==
true) {
1456 oEventListStr << tvlsimService.listEvents ();
1458 }
else if (lTokenListByReadline.size() == 1) {
1460 assert (lTokenListByReadline.empty() ==
false);
1461 const std::string lEventTypeStr (lTokenListByReadline[0]);
1467 const stdair::EventType lEventType (lEventTypeStr);
1468 const stdair::EventType::EN_EventType& lActualEventType =
1469 lEventType.getType();
1470 oEventListStr << tvlsimService.listEvents (lActualEventType);
1472 }
catch (stdair::CodeConversionException e) {
1473 oEventListStr <<
"The event type '" << lEventTypeStr
1474 <<
"' is not known. Try 'help' for "
1475 <<
"more information on the 'list_event' command."
1481 oEventListStr <<
"The event type is not understood: try 'help' for "
1482 <<
"more information on the 'list_event' command."
1485 std::cout << oEventListStr.str() << std::endl;
1486 STDAIR_LOG_DEBUG (oEventListStr.str());
1494 case Command_T::SET_BREAK_POINT: {
1497 extractTokenListForDate (lTokenListByReadline);
1499 stdair::Date_T lDate (lDefaultDate);
1500 DateList_T lDateList;
1503 parseDateListKey (lDate, lDateList);
1505 assert (lDateList.size() >= 1);
1508 stdair::BreakPointList_T lBreakPointList;
1509 for (DateList_T::const_iterator itDate = lDateList.begin();
1510 itDate != lDateList.end(); itDate++) {
1511 const stdair::Date_T& lDate = *itDate;
1512 stdair::BreakPointStruct lBreakPoint (lDate);
1513 lBreakPointList.push_back(lBreakPoint);
1515 const stdair::Count_T lBPListSize = lBreakPointList.size();
1516 assert (lBPListSize >= 1);
1519 const stdair::Count_T lNumberOfBreakPointsAdded =
1520 tvlsimService.initBreakPointEvents (lBreakPointList);
1523 std::ostringstream oBreakPointStr;
1524 oBreakPointStr << lNumberOfBreakPointsAdded <<
" out of "
1525 << lBreakPointList.size() <<
" break point";
1526 if (lBPListSize > 1) {
1527 oBreakPointStr <<
"s have";
1529 oBreakPointStr <<
" has";
1531 oBreakPointStr <<
" been added to the queue.";
1532 std::cout << oBreakPointStr.str() << std::endl;
1533 STDAIR_LOG_DEBUG (oBreakPointStr.str());
1539 case Command_T::LIST_FLIGHT_DATE: {
1542 TokenList_T lTokenList = extractTokenListForFlight (lTokenListByReadline);
1544 stdair::AirlineCode_T lAirlineCode (
"all");
1545 stdair::FlightNumber_T lFlightNumber (0);
1548 parseFlightKey (lTokenList, lAirlineCode, lFlightNumber);
1551 const std::string lFlightNumberStr = (lFlightNumber ==0)?
" (all)":
"";
1552 std::cout <<
"List of flights for "
1553 << lAirlineCode <<
" " << lFlightNumber << lFlightNumberStr
1557 const std::string& lFlightDateListStr =
1558 tvlsimService.list (lAirlineCode, lFlightNumber);
1560 if (lFlightDateListStr.empty() ==
false) {
1561 std::cout << lFlightDateListStr << std::endl;
1562 STDAIR_LOG_DEBUG (lFlightDateListStr);
1565 std::cerr <<
"There is no result for "
1566 << lAirlineCode <<
" " << lFlightNumber << lFlightNumberStr
1567 <<
". Just type the 'list' command without any parameter "
1568 <<
"to see the flight-dates for all the airlines and for all "
1569 <<
"the flight numbers."
1578 case Command_T::DISPLAY_FLIGHT_DATE: {
1581 TokenList_T lTokenList = extractTokenListForFlightDate (lTokenListByReadline);
1583 stdair::AirlineCode_T lAirlineCode (lDefaultAirlineCode);
1584 stdair::FlightNumber_T lFlightNumber (lDefaultFlightNumber);
1585 stdair::Date_T lFlightDate (lDefaultDate);
1589 parseFlightDateKey (lTokenList, lAirlineCode, lFlightNumber, lFlightDate);
1592 const std::string& lCSVFlightDateDump =
1593 tvlsimService.csvDisplay (lAirlineCode, lFlightNumber, lFlightDate);
1595 std::cout << lCSVFlightDateDump << std::endl;
1596 STDAIR_LOG_DEBUG (lCSVFlightDateDump);
1602 case Command_T::SELL: {
1604 TokenList_T lTokenList = extractTokenListForClass (lTokenListByReadline);
1606 stdair::AirlineCode_T lAirlineCode (lDefaultAirlineCode);
1607 stdair::FlightNumber_T lFlightNumber (lDefaultFlightNumber);
1608 stdair::Date_T lFlightDate (lDefaultDate);
1609 stdair::AirportCode_T lOrigin (lDefaultOrigin);
1610 stdair::AirportCode_T lDestination (lDefaultDestination);
1611 stdair::ClassCode_T lBookingClass (lDefaultBookingClass);
1612 stdair::PartySize_T lPartySize (lDefaultPartySize);
1616 parseFlightDateKey (lTokenList, lAirlineCode,lFlightNumber, lFlightDate);
1617 parseBookingClassKey (lTokenList, lBookingClass,
1618 lPartySize, lOrigin, lDestination);
1620 std::ostringstream oSDKStr;
1621 oSDKStr << lAirlineCode <<
","
1622 << lFlightNumber <<
","
1623 << lFlightDate <<
","
1624 << lOrigin <<
"," << lDestination;
1625 const std::string lSegmentDateKey (oSDKStr.str());
1628 const bool isSellSuccessful =
1629 tvlsimService.sell (lSegmentDateKey, lBookingClass,
1633 const std::string isSellSuccessfulStr =
1634 (isSellSuccessful ==
true)?
"Yes":
"No";
1635 std::ostringstream oSaleStr;
1636 oSaleStr <<
"Sale ('" << lSegmentDateKey <<
"', "
1637 << lBookingClass <<
": " << lPartySize
1638 <<
") successful? " << isSellSuccessfulStr;
1639 std::cout << oSaleStr.str() << std::endl;
1642 STDAIR_LOG_DEBUG (oSaleStr.str());
1648 case Command_T::OPTIMISE: {
1651 TokenList_T lTokenList = extractTokenListForFlightDate (lTokenListByReadline);
1653 stdair::AirlineCode_T lAirlineCode (lDefaultAirlineCode);
1654 stdair::FlightNumber_T lFlightNumber (lDefaultFlightNumber);
1655 stdair::Date_T lFlightDate (lDefaultDate);
1659 parseFlightDateKey (lTokenList, lAirlineCode, lFlightNumber, lFlightDate);
1662 const std::string& lDepartureDateStr =
1663 boost::gregorian::to_iso_extended_string (lFlightDate);
1664 std::ostringstream oStr;
1665 oStr << lFlightNumber
1666 << stdair::DEFAULT_KEY_SUB_FLD_DELIMITER <<
" " << lDepartureDateStr;
1667 const stdair::KeyDescription_T lFDKeyDescription (oStr.str());
1671 tvlsimService.getSimulationStatus();
1672 const stdair::Date_T& lCurrentDate =
1674 const stdair::DateTime_T lRMDateTime (lCurrentDate,
1675 stdair::DEFAULT_NULL_DURATION);
1679 const stdair::RMEventStruct lRMEvent (lAirlineCode, lFDKeyDescription,
1683 std::ostringstream oOptimiseStr;
1684 oOptimiseStr <<
"Optimise " << lAirlineCode <<
" " << lFDKeyDescription;
1688 tvlsimService.optimise (lRMEvent);
1689 }
catch (stdair::ObjectNotFoundException lObjectNotFoundException) {
1690 oOptimiseStr <<
" FAILED: " << lObjectNotFoundException.what();
1694 oOptimiseStr << std::endl;
1695 std::cout << oOptimiseStr.str();
1696 STDAIR_LOG_DEBUG (oOptimiseStr.str());
1703 case Command_T::JSON_LIST_EVENT: {
1706 std::cout <<
"JSON List Events" << std::endl;
1709 std::ostringstream lJSONEventListStr;
1710 lJSONEventListStr <<
"{\"event_list\":";
1712 if (lTokenListByReadline.empty() ==
true) {
1715 lJSONEventListStr <<
"{ \"event_type\":\"" <<
"all";
1717 }
else if (lTokenListByReadline.size() == 1) {
1720 assert (lTokenListByReadline.empty() ==
false);
1721 const std::string lEventTypeStr (lTokenListByReadline[0]);
1722 lJSONEventListStr <<
"{ \"event_type\":\"" << lEventTypeStr;
1725 lJSONEventListStr <<
"\"}}";
1728 const stdair::JSONString lJSONEventTypeString (lJSONEventListStr.str());
1729 const std::string& lCSVEventListDump =
1730 tvlsimService.jsonHandler (lJSONEventTypeString);
1733 std::cout << lCSVEventListDump << std::endl;
1734 STDAIR_LOG_DEBUG (lCSVEventListDump);
1741 case Command_T::JSON_LIST_FLIGHT_DATE: {
1744 TokenList_T lTokenList = extractTokenListForFlight (lTokenListByReadline);
1746 stdair::AirlineCode_T lAirlineCode (
"all");
1747 stdair::FlightNumber_T lFlightNumber (0);
1750 parseFlightKey (lTokenList, lAirlineCode, lFlightNumber);
1753 const std::string lFlightNumberStr = (lFlightNumber ==0)?
" (all)":
"";
1754 std::cout <<
"JSON list of flights for "
1755 << lAirlineCode <<
" " << lFlightNumber << lFlightNumberStr
1758 std::ostringstream lMyCommandJSONstream;
1759 lMyCommandJSONstream <<
"{\"list\":"
1760 <<
"{ \"airline_code\":\"" << lAirlineCode
1761 <<
"\",\"flight_number\":\"" << lFlightNumber
1764 const stdair::JSONString lJSONCommandString (lMyCommandJSONstream.str());
1765 const std::string& lFlightDateListJSONStr =
1766 tvlsimService.jsonHandler (lJSONCommandString);
1769 std::cout << lFlightDateListJSONStr << std::endl;
1770 STDAIR_LOG_DEBUG (lFlightDateListJSONStr);
1777 case Command_T::JSON_DISPLAY_FLIGHT_DATE: {
1780 TokenList_T lTokenList = extractTokenListForFlightDate (lTokenListByReadline);
1782 stdair::AirlineCode_T lAirlineCode (lDefaultAirlineCode);
1783 stdair::FlightNumber_T lFlightNumber (lDefaultFlightNumber);
1784 stdair::Date_T lFlightDate (lDefaultDate);
1787 parseFlightDateKey (lTokenList, lAirlineCode, lFlightNumber, lFlightDate);
1791 std::ostringstream lMyCommandJSONstream;
1792 lMyCommandJSONstream <<
"{\"flight_date\":"
1793 <<
"{ \"departure_date\":\"" << lFlightDate
1794 <<
"\",\"airline_code\":\"" << lAirlineCode
1795 <<
"\",\"flight_number\":\"" << lFlightNumber
1799 const stdair::JSONString lJSONCommandString (lMyCommandJSONstream.str());
1800 const std::string& lCSVFlightDateDump =
1801 tvlsimService.jsonHandler (lJSONCommandString);
1804 std::cout << lCSVFlightDateDump << std::endl;
1805 STDAIR_LOG_DEBUG (lCSVFlightDateDump);
1812 case Command_T::JSON_SET_BREAK_POINT: {
1815 extractTokenListForDate (lTokenListByReadline);
1817 stdair::Date_T lDate (lDefaultDate);
1818 DateList_T lDateList;
1821 parseDateListKey (lDate, lDateList);
1823 assert (lDateList.size() >= 1);
1827 std::ostringstream lMyCommandJSONstream;
1828 lMyCommandJSONstream <<
"{\"break_point\":[";
1830 for (DateList_T::const_iterator itDate = lDateList.begin();
1831 itDate != lDateList.end(); itDate++) {
1832 const stdair::Date_T lDate = *itDate;
1833 if (itDate == lDateList.begin()) {
1834 lMyCommandJSONstream <<
"{\"bp\":\"" << lDate <<
"\"}";
1836 lMyCommandJSONstream <<
",{\"bp\":\"" << lDate <<
"\"}";
1839 lMyCommandJSONstream <<
"]}";
1842 const stdair::JSONString lJSONCommandString (lMyCommandJSONstream.str());
1843 const std::string& lCSVBPDump =
1844 tvlsimService.jsonHandler (lJSONCommandString);
1847 std::cout << lCSVBPDump << std::endl;
1848 STDAIR_LOG_DEBUG (lCSVBPDump);
1855 case Command_T::JSON_RESET: {
1857 std::cout <<
"JSON Reset" << std::endl;
1859 std::ostringstream lMyCommandJSONstream;
1860 lMyCommandJSONstream <<
"{\"reset\": \"1\"}";
1863 const stdair::JSONString lJSONCommandString (lMyCommandJSONstream.str());
1864 const std::string& lCSVEventListDump =
1865 tvlsimService.jsonHandler (lJSONCommandString);
1868 std::cout << lCSVEventListDump << std::endl;
1869 STDAIR_LOG_DEBUG (lCSVEventListDump);
1876 case Command_T::JSON_RUN: {
1878 std::cout <<
"JSON Run" << std::endl;
1880 std::ostringstream lMyCommandJSONstream;
1881 lMyCommandJSONstream <<
"{\"run\": \"1\"}";
1884 const stdair::JSONString lJSONCommandString (lMyCommandJSONstream.str());
1885 const std::string& lCSVEventListDump =
1886 tvlsimService.jsonHandler (lJSONCommandString);
1889 STDAIR_LOG_DEBUG (lCSVEventListDump);
1896 case Command_T::JSON_STATUS: {
1898 std::cout <<
"JSON Display status" << std::endl;
1900 std::ostringstream lMyCommandJSONstream;
1901 lMyCommandJSONstream <<
"{\"status\": \"1\"}";
1904 const stdair::JSONString lJSONCommandString (lMyCommandJSONstream.str());
1905 const std::string& lSimulationStatusJSonDump =
1906 tvlsimService.jsonHandler (lJSONCommandString);
1909 std::cout << lSimulationStatusJSonDump << std::endl;
1910 STDAIR_LOG_DEBUG (lSimulationStatusJSonDump);
1917 case Command_T::JSON_CONFIG: {
1919 std::cout <<
"JSON Configuration Display" << std::endl;
1921 std::ostringstream lMyCommandJSONstream;
1922 lMyCommandJSONstream <<
"{\"config\": \"1\"}";
1925 const stdair::JSONString lJSONCommandString (lMyCommandJSONstream.str());
1926 const std::string& lConfigurationStatusJSonDump =
1927 tvlsimService.jsonHandler (lJSONCommandString);
1930 std::cout << lConfigurationStatusJSonDump << std::endl;
1931 STDAIR_LOG_DEBUG (lConfigurationStatusJSonDump);
1938 case Command_T::NOP: {
1942 case Command_T::LAST_VALUE:
1945 std::ostringstream oStr;
1946 oStr <<
"That command is not yet understood: '" << lUserInput
1947 <<
"' => " << lTokenListByReadline;
1948 STDAIR_LOG_DEBUG (oStr.str());
1949 std::cout << oStr.str() << std::endl;
1955 STDAIR_LOG_DEBUG (
"End of the session. Exiting.");
1956 std::cout <<
"End of the session. Exiting." << std::endl;
1959 logOutputFile.close();