Changeset 176 in pacpusframework for trunk/examples
- Timestamp:
- Oct 11, 2013, 2:10:06 PM (11 years ago)
- Location:
- trunk/examples/ProducerConsumerExample
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/ProducerConsumerExample/ConsumerExample.cpp
r165 r176 20 20 LOG_INFO("Thread " << thread.currentThread()); 21 21 LOG_INFO("Current Thread " << QThread::currentThread()); 22 23 namespace po = boost::program_options; 24 25 addParameters() 26 ("output-path", po::value<std::string>(&mOutputFileName)->default_value("consumer.txt"), "set output file path") 27 ; 22 28 } 23 29 … … 40 46 ConsumerExample::configureComponent(XmlComponentConfig /*config*/) 41 47 { 42 LOG_TRACE(Q_FUNC_INFO);48 PACPUS_LOG_FUNCTION(); 43 49 44 // load XML parameters 50 // load XML parameters -- NOT NEEDED - loaded by boost::program_options (used addParameters()) 45 51 46 LOG_INFO("component '" << name() << "' configured");52 LOG_INFO("component '" << getName() << "' configured"); 47 53 return ComponentBase::CONFIGURED_OK; 48 54 } … … 54 60 m_counter = 0; 55 61 56 static const char * outputFileName = "consumer.txt"; 57 m_file.open(outputFileName, std::ios_base::out | std::ios_base::app); 62 m_file.open(mOutputFileName.c_str(), std::ios_base::out | std::ios_base::app); 58 63 if (!m_file.is_open()) { 59 LOG_ERROR("file '" << outputFileName << "'cannot be opened");64 LOG_ERROR("file '" << mOutputFileName << "' cannot be opened"); 60 65 } 61 66 62 67 thread.start(); 63 68 setState(MONITOR_OK); 64 LOG_INFO("started component '" << name() << "'");69 LOG_INFO("started component '" << getName() << "'"); 65 70 } 66 71 … … 72 77 m_file.close(); 73 78 setState(STOPPED); 74 LOG_INFO("stopped component '" << name() << "'");79 LOG_INFO("stopped component '" << getName() << "'"); 75 80 } 76 81 -
trunk/examples/ProducerConsumerExample/ConsumerExample.h
r163 r176 8 8 #include <QImage> 9 9 #include <QThread> 10 #include <string> 10 11 11 12 namespace pacpus { … … 35 36 int m_counter; 36 37 std::ofstream m_file; 38 39 std::string mOutputFileName; 37 40 }; 38 41 -
trunk/examples/ProducerConsumerExample/ProducerExample.cpp
r165 r176 22 22 { 23 23 LOG_TRACE("constructor(" << name << ")"); 24 25 namespace po = boost::program_options; 26 27 addParameters() 28 ("output-path", po::value<std::string>(&mOutputFileName)->default_value("producer.txt"), "set output file path") 29 ; 24 30 } 25 31 … … 32 38 ProducerExample::configureComponent(XmlComponentConfig /*config*/) 33 39 { 34 LOG_TRACE(Q_FUNC_INFO);40 PACPUS_LOG_FUNCTION(); 35 41 36 LOG_INFO("component '" << name() << "' configured");42 LOG_INFO("component '" << getName() << "' configured"); 37 43 return ComponentBase::CONFIGURED_OK; 38 44 } … … 57 63 setActive(true); 58 64 setState(MONITOR_OK); 59 LOG_INFO("started component '" << name() << "'");65 LOG_INFO("started component '" << getName() << "'"); 60 66 } 61 67 … … 66 72 setActive(false); 67 73 setState(STOPPED); 68 LOG_INFO("stopped component '" << name() << "'");74 LOG_INFO("stopped component '" << getName() << "'"); 69 75 } 70 76 -
trunk/examples/ProducerConsumerExample/ProducerExample.h
r163 r176 47 47 48 48 private: 49 std::string mOutputFileName; 49 50 //QThread thread; 50 51 };
Note:
See TracChangeset
for help on using the changeset viewer.