From a75fbf26b56cd5fdf072f7569474d1d4b0b8065b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD?= Date: Wed, 28 Sep 2016 12:25:03 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@274 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src/containers/pimap.h | 2 +- src/core/pistring.cpp | 8 ++++++++ src/core/pistring.h | 2 +- src/io/pipeer.cpp | 3 ++- src/thread/pithread.cpp | 2 ++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/containers/pimap.h b/src/containers/pimap.h index 99c8f394..87c8fb99 100644 --- a/src/containers/pimap.h +++ b/src/containers/pimap.h @@ -82,7 +82,7 @@ public: public: iterator(): parent(0), pos(0) {} const Key & key() const {return const_cast * >(parent)->_key(pos);} - T & value() const {return const_cast * >(parent)->_value(pos);} + T & value() {return const_cast * >(parent)->_value(pos);} void operator ++() {++pos;} void operator ++(int) {++pos;} void operator --() {--pos;} diff --git a/src/core/pistring.cpp b/src/core/pistring.cpp index 36a23eee..2f6ba602 100755 --- a/src/core/pistring.cpp +++ b/src/core/pistring.cpp @@ -613,6 +613,14 @@ bool PIString::endsWith(const PIString & str) const { } +bool PIString::toBool() const { + PIString s(*this); + s = s.trimmed().toLowerCase(); + if ( atof(s.toNativeDecimalPoints().data()) > 0. || s == "true" || s == "yes" || s == "on" || s == "ok") return true; + return false; +} + + PIString PIString::takeSymbol() { PIString ret; int sz = size_s(), ss = -1; diff --git a/src/core/pistring.h b/src/core/pistring.h index e19f6a32..5249b68d 100755 --- a/src/core/pistring.h +++ b/src/core/pistring.h @@ -578,7 +578,7 @@ public: //! \brief Return \c true if string equal "true", "yes", "on" or positive not null numeric value - bool toBool() const {PIString s(*this); if (atof(s.toNativeDecimalPoints().data()) > 0. || s.trimmed().toLowerCase() == "true" || s.trimmed().toLowerCase() == "yes" || s.trimmed().toLowerCase() == "on") return true; return false;} + bool toBool() const; //! \brief Return \c char numeric value of string char toChar() const; diff --git a/src/io/pipeer.cpp b/src/io/pipeer.cpp index 91b9dece..3824299c 100755 --- a/src/io/pipeer.cpp +++ b/src/io/pipeer.cpp @@ -136,6 +136,7 @@ REGISTER_DEVICE(PIPeer) PIPeer::PIPeer(const PIString & n): PIIODevice(), eth_tcp_srv(PIEthernet::TCP_Server), eth_tcp_cli(PIEthernet::TCP_Client), diag_s(false), diag_d(false) { destroyed = false; + setDebug(false); PIMutexLocker mbl(mc_mutex); PIMutexLocker ethl(eth_mutex); PIMutexLocker pl(peers_mutex); @@ -527,7 +528,7 @@ bool PIPeer::dataRead(uchar * readed, int size) { bool PIPeer::mbcastRead(uchar * data, int size) { if (destroyed) { - piCout << "[PIPeer] SegFault"; + //piCout << "[PIPeer] SegFault"; return true; } if (size < 8) return true; diff --git a/src/thread/pithread.cpp b/src/thread/pithread.cpp index 060fb861..5b5b6e54 100755 --- a/src/thread/pithread.cpp +++ b/src/thread/pithread.cpp @@ -239,7 +239,9 @@ __THREAD_FUNC__ PIThread::thread_function(void * t) { ct.started(); while (!ct.terminating) { if (ct.lockRun) ct.mutex_.lock(); + //piCout << "thread" << ct.name() << "..."; ct.run(); + //piCout << "thread" << ct.name() << "done"; //printf("thread %p tick\n", &ct); if (ct.ret_func != 0) ct.ret_func(ct.data_); if (ct.lockRun) ct.mutex_.unlock();