10 #include <boost/python.hpp>
12 #include <stdair/stdair_basic_types.hpp>
13 #include <stdair/stdair_exceptions.hpp>
14 #include <stdair/basic/BasFileMgr.hpp>
15 #include <stdair/basic/BasLogParams.hpp>
16 #include <stdair/basic/BasDBParams.hpp>
26 std::ostringstream oStream;
29 if (_logOutputStream == NULL) {
30 oStream <<
"The log filepath is not valid." << std::endl;
33 assert (_logOutputStream != NULL);
38 *_logOutputStream <<
"Default service" << std::endl;
40 if (_sevmgrService == NULL) {
41 oStream <<
"The Sevmgr service has not been initialised, "
42 <<
"i.e., the init() method has not been called "
43 <<
"correctly on the PYEventQueueManager object. Please "
44 <<
"check that all the parameters are not empty and "
45 <<
"point to actual files.";
46 *_logOutputStream << oStream.str();
49 assert (_sevmgrService != NULL);
52 _sevmgrService->buildSampleBom();
55 *_logOutputStream <<
"Default service returned" << std::endl;
58 *_logOutputStream <<
"Sevmgr output: " << oStream.str() << std::endl;
60 }
catch (
const stdair::RootException& eSevmgrError) {
61 *_logOutputStream <<
"Sevmgr error: " << eSevmgrError.what()
64 }
catch (
const std::exception& eStdError) {
65 *_logOutputStream <<
"Error: " << eStdError.what() << std::endl;
68 *_logOutputStream <<
"Unknown error" << std::endl;
81 : _sevmgrService (iPYEventQueueManager._sevmgrService),
82 _logOutputStream (iPYEventQueueManager._logOutputStream) {
87 _sevmgrService = NULL;
88 _logOutputStream = NULL;
92 bool init (
const std::string& iLogFilepath,
93 const std::string& iDBUser,
const std::string& iDBPasswd,
94 const std::string& iDBHost,
const std::string& iDBPort,
95 const std::string& iDBDBName) {
96 bool isEverythingOK =
true;
101 const bool isWriteable = (iLogFilepath.empty() ==
false);
103 if (isWriteable ==
false) {
104 isEverythingOK =
false;
105 return isEverythingOK;
109 _logOutputStream =
new std::ofstream;
110 assert (_logOutputStream != NULL);
113 _logOutputStream->open (iLogFilepath.c_str());
114 _logOutputStream->clear();
117 *_logOutputStream <<
"Python wrapper initialisation" << std::endl;
118 const stdair::BasLogParams lLogParams (stdair::LOG::DEBUG,
122 stdair::BasDBParams lDBParams (iDBUser, iDBPasswd, iDBHost, iDBPort,
127 *_logOutputStream <<
"Python wrapper initialised" << std::endl;
129 }
catch (
const stdair::RootException& eSevmgrError) {
130 *_logOutputStream <<
"Sevmgr error: " << eSevmgrError.what()
133 }
catch (
const std::exception& eStdError) {
134 *_logOutputStream <<
"Error: " << eStdError.what() << std::endl;
137 *_logOutputStream <<
"Unknown error" << std::endl;
140 return isEverythingOK;
146 std::ofstream* _logOutputStream;
153 boost::python::class_<SEVMGR::PYEventQueueManager> (
"PYEventQueueManager")