git-svn-id: svn://db.shs.com.ru/pip@274 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -82,7 +82,7 @@ public:
|
||||
public:
|
||||
iterator(): parent(0), pos(0) {}
|
||||
const Key & key() const {return const_cast<PIMap<Key, T> * >(parent)->_key(pos);}
|
||||
T & value() const {return const_cast<PIMap<Key, T> * >(parent)->_value(pos);}
|
||||
T & value() {return const_cast<PIMap<Key, T> * >(parent)->_value(pos);}
|
||||
void operator ++() {++pos;}
|
||||
void operator ++(int) {++pos;}
|
||||
void operator --() {--pos;}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user