Changeset 179 in pacpusframework
- Timestamp:
- Oct 11, 2013, 5:40:46 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/ProducerConsumerExample/ConsumerExample.cpp
r176 r179 22 22 23 23 namespace po = boost::program_options; 24 25 24 addParameters() 26 25 ("output-path", po::value<std::string>(&mOutputFileName)->default_value("consumer.txt"), "set output file path") -
trunk/include/Pacpus/DbitePlayer/DbtPlyEngine.h
r152 r179 25 25 #include <QSemaphore> 26 26 #include <QThread> 27 #include <string> 27 28 28 29 namespace pacpus { … … 133 134 134 135 /// where the data are stored 135 QString dataDir_;136 std::string mDataDir; 136 137 137 138 /// mode 138 139 PlayMode replayMode_; 140 141 std::string mLoggerConfigFile; 139 142 140 143 Q_SIGNALS: -
trunk/src/DBITEPlayerLib/DbtPlyEngine.cpp
r176 r179 22 22 23 23 DECLARE_STATIC_LOGGER("pacpus.core.DbtPlyEngine"); 24 25 static const char * kPropertyDataDirectory = "datadir";26 27 static const char * kPropertyLoggerConfiguration = "log-config-file";28 29 static const char * kPropertyReplayMode = "replay_mode";30 static const char * kPropertyReplayModeLastData = "1";31 static const char * kPropertyReplayModeAllData = "2";32 24 33 25 typedef float SpeedType; … … 53 45 tDbtMin_ = numeric_limits<road_time_t>::max(); 54 46 tDbtMax_ = 0; 55 dataDir_ = QString::null; 47 48 namespace po = boost::program_options; 49 addParameters() 50 ("datadir", po::value<string>(&mDataDir)->required(), "set root data directory") 51 ("replay_mode", po::value<int>(&reinterpret_cast<int&>(replayMode_))->default_value(PlayModeLastData), "set data replay mode") 52 ("log-config-file", po::value<string>(&mLoggerConfigFile), "set logger configuration file path") 53 ; 56 54 } 57 55 … … 78 76 QString DbtPlyEngine::getDataDir() 79 77 { 80 return dataDir_;78 return mDataDir.c_str(); 81 79 } 82 80 … … 157 155 ComponentBase::COMPONENT_CONFIGURATION DbtPlyEngine::configureComponent(XmlComponentConfig config) 158 156 { 159 // datadir 160 dataDir_ = config.getProperty(kPropertyDataDirectory); 161 LOG_INFO("property " << kPropertyDataDirectory << "=\"" 162 << dataDir_ << "\""); 163 if (dataDir_.isNull()) { 164 LOG_FATAL("The data directory '" << getName() << "' is invalid or unavailable!"); 165 } 166 167 dataDir_ = QDir::toNativeSeparators(dataDir_); 168 if (!dataDir_.endsWith(QDir::separator())) { 169 dataDir_ += QDir::separator(); 157 { 158 // data directory: add path separator at end if needed 159 QString dataDir = mDataDir.c_str(); 160 dataDir = QDir::toNativeSeparators(dataDir); 161 if (!dataDir.endsWith(QDir::separator())) { 162 dataDir += QDir::separator(); 163 mDataDir = dataDir.toStdString(); 164 } 170 165 } 171 166 172 167 //////////////////////////////////////////////////////////////////////////////// 173 168 // logger configuration 174 QString loggerConfig = config.getProperty(kPropertyLoggerConfiguration); 175 LOG_INFO("property " << kPropertyLoggerConfiguration << "=\"" 176 << loggerConfig << "\""); 177 if (!loggerConfig.isNull()) { 178 LOG_INFO("configuring logger with file '" << loggerConfig << "'"); 179 LogConfigurator::configureLoggerWithFile(loggerConfig.toStdString().c_str()); 180 } 181 182 //////////////////////////////////////////////////////////////////////////////// 183 // Replay Mode 184 QString replayModeValue = config.getProperty(kPropertyReplayMode); 185 LOG_INFO("property " << kPropertyReplayMode << "=\"" 186 << replayModeValue << "\""); 187 if (replayModeValue.isNull()) { 188 LOG_INFO("property " << kPropertyReplayMode << " unset." 189 << " Set to default = 1."); 190 replayMode_ = PlayModeLastData; 191 } else { 192 if (kPropertyReplayModeLastData == replayModeValue.toStdString()) { 193 replayMode_ = PlayModeLastData; 194 } else if (kPropertyReplayModeAllData == replayModeValue.toStdString()) { 195 replayMode_ = PlayModeAllData; 196 } else { 197 LOG_WARN("unknown " << kPropertyReplayMode << " '" << replayModeValue << "'." 198 << " Set to default = 1."); 199 replayMode_ = PlayModeLastData; 200 } 169 if (!mLoggerConfigFile.empty()) { 170 LOG_INFO("configuring logger with file '" << mLoggerConfigFile << "'"); 171 LogConfigurator::configureLoggerWithFile(mLoggerConfigFile.c_str()); 201 172 } 202 173 -
trunk/src/PacpusLib/ComponentBase.cpp
r178 r179 197 197 po::command_line_parser(xargs) 198 198 .options(mOptionsDescription) 199 //.allow_unregistered() 199 //.allow_unregistered() // FIXME: temporary only, at term all the components specify all parameters 200 200 .run() 201 201 , vm);
Note:
See TracChangeset
for help on using the changeset viewer.