20.10.2013 - Modified PIObject - virtual debugName() for macro piCoutObj, improved timer measurements and timers on Windows

This commit is contained in:
peri4
2013-10-20 17:41:55 +04:00
parent 0f1b528ac6
commit ec5530053a
32 changed files with 2196 additions and 1331 deletions

View File

@@ -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);
}