20.10.2013 - Modified PIObject - virtual debugName() for macro piCoutObj, improved timer measurements and timers on Windows
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "piiodevice.h"
|
||||
#include "piconfig.h"
|
||||
|
||||
|
||||
/*! \class PIIODevice
|
||||
@@ -192,3 +193,29 @@ ullong PIIODevice::writeThreaded(const PIByteArray & data) {
|
||||
write_thread.unlock();
|
||||
return tri - 1;
|
||||
}
|
||||
|
||||
|
||||
bool PIIODevice::configure(const PIString & config_file, const PIString & section, bool parent_section) {
|
||||
PIConfig conf(config_file, PIIODevice::ReadOnly);
|
||||
if (!conf.isOpened()) return false;
|
||||
bool ex = true;
|
||||
PIConfig::Entry em;
|
||||
if (section.isEmpty()) em = conf.rootEntry();
|
||||
else em = conf.getValue(section, PIString(), &ex);
|
||||
if (!ex) return false;
|
||||
PIConfig::Entry * ep = 0;
|
||||
if (parent_section) ep = em.parent();
|
||||
if (ep != 0) {
|
||||
setReopenEnabled(ep->getValue("reopenEnabled", reopen_enabled_, &ex));
|
||||
if (!ex) setReopenEnabled(em.getValue("reopenEnabled", reopen_enabled_));
|
||||
setReopenTimeout(ep->getValue("reopenTimeout", reopen_timeout_, &ex));
|
||||
if (!ex) setReopenTimeout(em.getValue("reopenTimeout", reopen_timeout_));
|
||||
setThreadedReadBufferSize(ep->getValue("threadedReadBufferSize", buffer_tr.size_s(), &ex));
|
||||
if (!ex) setThreadedReadBufferSize(em.getValue("threadedReadBufferSize", buffer_tr.size_s()));
|
||||
} else {
|
||||
setReopenEnabled(em.getValue("reopenEnabled", reopen_enabled_));
|
||||
setReopenTimeout(em.getValue("reopenTimeout", reopen_timeout_));
|
||||
setThreadedReadBufferSize(em.getValue("threadedReadBufferSize", buffer_tr.size_s()));
|
||||
}
|
||||
return configureDevice(&em, ep);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user