From fc66f351dfd03983afa7925363c611adbf91923d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=8B=D1=87=D0=BA=D0=BE=D0=B2=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Fri, 28 Apr 2017 12:49:03 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@490 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- src_main/code/picodeparser.h | 1 - src_main/console/piscreenconsole.h | 1 + src_main/containers/pilist.h | 2 ++ src_main/containers/pipair.h | 1 + src_main/containers/pivector2d.h | 40 +++++++++++++++++++++++++++--- src_main/core/piinit.h | 2 -- src_main/core/pitime_win.h | 23 +++++++++++++++++ src_main/io/pidiagnostics.h | 2 +- src_main/io/pipacketextractor.h | 1 - src_main/io/piprotocol.cpp | 2 +- src_main/io/piprotocol.h | 2 +- src_main/io/piserial.cpp | 2 +- src_main/io/piserial.h | 2 +- src_main/math/pimathcomplex.h | 22 ++++++++++++++++ src_main/thread/pimutex.h | 2 +- 15 files changed, 92 insertions(+), 13 deletions(-) diff --git a/src_main/code/picodeparser.h b/src_main/code/picodeparser.h index bae37414..4eacc94f 100755 --- a/src_main/code/picodeparser.h +++ b/src_main/code/picodeparser.h @@ -20,7 +20,6 @@ along with this program. If not, see . */ - #ifndef PICODEPARSER_H #define PICODEPARSER_H diff --git a/src_main/console/piscreenconsole.h b/src_main/console/piscreenconsole.h index 636c60cc..1b424cac 100644 --- a/src_main/console/piscreenconsole.h +++ b/src_main/console/piscreenconsole.h @@ -21,6 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + #ifndef PISCREENCONSOLE_H #define PISCREENCONSOLE_H diff --git a/src_main/containers/pilist.h b/src_main/containers/pilist.h index cc95904e..2cab1127 100644 --- a/src_main/containers/pilist.h +++ b/src_main/containers/pilist.h @@ -21,8 +21,10 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + #ifndef PILIST_H #define PILIST_H + #include "pibase.h" #include diff --git a/src_main/containers/pipair.h b/src_main/containers/pipair.h index d42b4da5..ab991f76 100644 --- a/src_main/containers/pipair.h +++ b/src_main/containers/pipair.h @@ -21,6 +21,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ + #ifndef PIPAIR_H #define PIPAIR_H diff --git a/src_main/containers/pivector2d.h b/src_main/containers/pivector2d.h index 8d5a9cae..d51cb617 100644 --- a/src_main/containers/pivector2d.h +++ b/src_main/containers/pivector2d.h @@ -57,8 +57,10 @@ public: inline size_t rows() const {return rows_;} inline size_t cols() const {return cols_;} - inline size_t size_all() const {return mat.size();} - inline ssize_t size_s_all() const {return mat.size_s();} + inline size_t size() const {return mat.size();} + inline ssize_t size_s() const {return mat.size_s();} + inline size_t length() const {return mat.length();} + inline size_t capacity() const {return mat.capacity();} inline bool isEmpty() const {return mat.isEmpty();} class Row { @@ -71,6 +73,19 @@ public: inline size_t size() const {return p_->cols_;} inline T & operator [](size_t index) {return p_->mat[st_ + index];} inline const T & operator [](size_t index) const {return p_->mat[st_ + index];} + inline T * data(size_t index = 0) {return p_->mat.data(st_ + index);} + inline const T * data(size_t index = 0) const {return p_->mat.data(st_ + index);} + inline Row & operator =(const Row & other) { + if (p_ == other.p_ && st_ == other.st_) return *this; + size_t sz = piMin(p_->cols_, other.p_->cols_); + p_->copyRow(st_, other.data(), sz); + return *this; + } + inline Row & operator =(const PIVector & other) { + size_t sz = piMin(p_->cols_, other.size()); + p_->copyRow(st_, other.data(), sz); + return *this; + } }; class RowConst { @@ -82,11 +97,26 @@ public: public: inline size_t size() const {return p_->cols_;} inline const T & operator [](size_t index) const {return p_->mat[st_ + index];} + inline const T * data(size_t index = 0) const {return p_->mat.data(st_ + index);} }; inline Row operator[](size_t index) {return Row(this, index);} inline RowConst operator[](size_t index) const {return RowConst(this, index);} + inline T * data(size_t index = 0) {return mat.data(index);} + inline const T * data(size_t index = 0) const {return mat.data(index);} + + inline Row row(size_t index) {return Row(this, index);} + inline PIVector2D & setRow(size_t row, const Row & other) { + size_t sz = piMin(cols_, other.p_->cols_); + copyRow(cols_ * row, other.data(), sz); + return *this; + } + inline PIVector2D & setRow(size_t row, const PIVector & other) { + size_t sz = piMin(cols_, other.size()); + copyRow(cols_ * row, other.data(), sz); + return *this; + } PIVector > toVectors() const { PIVector > ret; @@ -97,9 +127,13 @@ public: PIVector toPlainVector() const {return mat;} private: + inline void copyRow(size_t start, const T * data, size_t size) { + for (size_t i = 0; i < size; i++) + mat[start + i] = data[i]; + } + size_t rows_, cols_; PIVector mat; - }; diff --git a/src_main/core/piinit.h b/src_main/core/piinit.h index b0ca5a18..2ce0c7c6 100644 --- a/src_main/core/piinit.h +++ b/src_main/core/piinit.h @@ -1,7 +1,5 @@ /*! \file piinit.h * \brief Initialization - * - * */ /* PIP - Platform Independent Primitives diff --git a/src_main/core/pitime_win.h b/src_main/core/pitime_win.h index 352e58bc..5df15ea5 100644 --- a/src_main/core/pitime_win.h +++ b/src_main/core/pitime_win.h @@ -1,3 +1,26 @@ +/*! \file pitime_win.h + * \brief PITime conversions for Windows + * + * This file declare time conversions for Windows +*/ +/* + PIP - Platform Independent Primitives + PITime conversions for Windows + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ #ifndef PITIME_WIN_H #define PITIME_WIN_H diff --git a/src_main/io/pidiagnostics.h b/src_main/io/pidiagnostics.h index 6ca4890d..8c96323f 100755 --- a/src_main/io/pidiagnostics.h +++ b/src_main/io/pidiagnostics.h @@ -4,7 +4,7 @@ /* PIP - Platform Independent Primitives Speed and quality in/out diagnostics - Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Bychkov Andrey wapmobil@gmail.com + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src_main/io/pipacketextractor.h b/src_main/io/pipacketextractor.h index 4061430b..3a82e280 100755 --- a/src_main/io/pipacketextractor.h +++ b/src_main/io/pipacketextractor.h @@ -20,7 +20,6 @@ along with this program. If not, see . */ - #ifndef PIPACKETEXTRACTOR_H #define PIPACKETEXTRACTOR_H diff --git a/src_main/io/piprotocol.cpp b/src_main/io/piprotocol.cpp index dea737d4..85648de5 100755 --- a/src_main/io/piprotocol.cpp +++ b/src_main/io/piprotocol.cpp @@ -1,7 +1,7 @@ /* PIP - Platform Independent Primitives Protocol, input/output channel (COM, UDP) - Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Bychkov Andrey wapmobil@gmail.com + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src_main/io/piprotocol.h b/src_main/io/piprotocol.h index 902251f4..2b51a02e 100755 --- a/src_main/io/piprotocol.h +++ b/src_main/io/piprotocol.h @@ -4,7 +4,7 @@ /* PIP - Platform Independent Primitives Protocol, input/output channel (COM, UDP) - Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Bychkov Andrey wapmobil@gmail.com + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src_main/io/piserial.cpp b/src_main/io/piserial.cpp index f20e2600..7fe3fb83 100755 --- a/src_main/io/piserial.cpp +++ b/src_main/io/piserial.cpp @@ -1,7 +1,7 @@ /* PIP - Platform Independent Primitives COM - Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Bychkov Andrey wapmobil@gmail.com + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src_main/io/piserial.h b/src_main/io/piserial.h index ebecd5b6..030811e7 100755 --- a/src_main/io/piserial.h +++ b/src_main/io/piserial.h @@ -4,7 +4,7 @@ /* PIP - Platform Independent Primitives COM - Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Bychkov Andrey wapmobil@gmail.com + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src_main/math/pimathcomplex.h b/src_main/math/pimathcomplex.h index 4fc33dc5..07fac936 100644 --- a/src_main/math/pimathcomplex.h +++ b/src_main/math/pimathcomplex.h @@ -1,3 +1,25 @@ +/*! \file pimathcomplex.h + * \brief PIP math complex +*/ +/* + PIP - Platform Independent Primitives + PIP math complex + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + #ifndef PIMATHCOMPLEX_H #define PIMATHCOMPLEX_H diff --git a/src_main/thread/pimutex.h b/src_main/thread/pimutex.h index c3a39852..a76e0293 100755 --- a/src_main/thread/pimutex.h +++ b/src_main/thread/pimutex.h @@ -4,7 +4,7 @@ /* PIP - Platform Independent Primitives Mutex - Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru + Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by