From 7bea1b2cc0f3f69bd469e2742a98700af3a08d39 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: Thu, 5 May 2016 07:44:52 +0000 Subject: [PATCH] git-svn-id: svn://db.shs.com.ru/pip@194 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5 --- main.cpp | 81 ++++++++++++++++++++--------------- src/io/pibasetransfer.h | 2 +- src/io/pidatatransfer.h | 22 ++++++++++ src/io/pifiletransfer.h | 22 ++++++++++ src/piversion.h | 4 +- src/thread/pipipelinethread.h | 22 ++++++++++ 6 files changed, 116 insertions(+), 37 deletions(-) diff --git a/main.cpp b/main.cpp index e8a12ffd..72b68683 100644 --- a/main.cpp +++ b/main.cpp @@ -6,23 +6,36 @@ #include "piethernet.h" #include "piintrospection.h" -struct MS { - //MS() {i = 0; f = 0.;} - int i; - float f; - PIString s; +//struct MS { +// //MS() {i = 0; f = 0.;} +// int i; +// float f; +// PIString s; +//}; + +//PIByteArray & operator<<(PIByteArray & ba, const MS & v) {ba << v.i << v.f << v.s; return ba;} +//PIByteArray & operator>>(PIByteArray & ba, MS & v) {ba >> v.i >> v.f >> v.s; return ba;} +//PICout operator <<(PICout c, const MS & v) {c << "(" << v.i << v.f << v.s << ")"; return c;} + +//REGISTER_VARIANT(MS) +//REGISTER_VARIANT_CAST(MS, int) {return v.i;} +//REGISTER_VARIANT_CAST(MS, float) {return v.f;} +//REGISTER_VARIANT_CAST(MS, PIString) {return v.s;} +template +class VC { +public: + T v[N]; + VC(T x) {for (uint i=0; i a) {T res = T(); for (uint i=0; i>(PIByteArray & ba, MS & v) {ba >> v.i >> v.f >> v.s; return ba;} -PICout operator <<(PICout c, const MS & v) {c << "(" << v.i << v.f << v.s << ")"; return c;} - -REGISTER_VARIANT(MS) -REGISTER_VARIANT_CAST(MS, int) {return v.i;} -REGISTER_VARIANT_CAST(MS, float) {return v.f;} -REGISTER_VARIANT_CAST(MS, PIString) {return v.s;} - int main (int argc, char * argv[]) { + VC<30, double> x(1.5), y(3.3); + double r; + PITimeMeasurer tm; + for (int i=0; i<10000; i++) + r = x.dot(y); + piCout << r << tm.elapsed_m(); //PIByteArray ba; /*PIKbdListener kbd; kbd.enableExitCapture(); @@ -31,26 +44,26 @@ int main (int argc, char * argv[]) { PIINTROSPECTION_START //piCout << PIINTROSPECTION_CONTAINERS->count; WAIT_FOR_EXIT*/ - PIVector vl; - vl << PIVariant('2') << PIVariant(-5.5) << PIVariant(10) << PIVariant(complexd(2,3)) << PIVariant("text") << PIVariant(PIByteArray("bytearray", 9)) << PIVariant(PIDateTime::current()); - piForeachC (PIVariant v, vl) - piCout << v << v.value(); - PIByteArray ba; ba << PIString("500"); - piCout << PIVariant::fromValue(ba, "PIString"); - piCout << PIVariant("PIString"); - piCout << __PIVariantFunctions__::typeNameHelper(); - piCout << __PIVariantInfoStorage__::get()->map->size(); - for (PIMap::iterator i = __PIVariantInfoStorage__::get()->map->begin(); i != __PIVariantInfoStorage__::get()->map->end(); ++i) - piCout << i.key() << i.value()->cast.size(); - PIEthernet eth; - piCout << eth.properties(); - MS ms = (MS){-1, 3.3, "str"}; - PIVariant mv = PIVariant::fromValue(ms); - piCout << mv << mv.type(); - piCout << mv.toInt(); - piCout << mv.toFloat(); - piCout << mv.toString(); - piCout << ms << mv.value() << vl[0].value(); +// PIVector vl; +// vl << PIVariant('2') << PIVariant(-5.5) << PIVariant(10) << PIVariant(complexd(2,3)) << PIVariant("text") << PIVariant(PIByteArray("bytearray", 9)) << PIVariant(PIDateTime::current()); +// piForeachC (PIVariant v, vl) +// piCout << v << v.value(); +// PIByteArray ba; ba << PIString("500"); +// piCout << PIVariant::fromValue(ba, "PIString"); +// piCout << PIVariant("PIString"); +// piCout << __PIVariantFunctions__::typeNameHelper(); +// piCout << __PIVariantInfoStorage__::get()->map->size(); +// for (PIMap::iterator i = __PIVariantInfoStorage__::get()->map->begin(); i != __PIVariantInfoStorage__::get()->map->end(); ++i) +// piCout << i.key() << i.value()->cast.size(); +// PIEthernet eth; +// piCout << eth.properties(); +// MS ms = (MS){-1, 3.3, "str"}; +// PIVariant mv = PIVariant::fromValue(ms); +// piCout << mv << mv.type(); +// piCout << mv.toInt(); +// piCout << mv.toFloat(); +// piCout << mv.toString(); +// piCout << ms << mv.value() << vl[0].value(); /*PIScreen screen; TileSimple window; window.back_format.color_back = PIScreenTypes::Red; diff --git a/src/io/pibasetransfer.h b/src/io/pibasetransfer.h index 3208d768..e709f5d1 100644 --- a/src/io/pibasetransfer.h +++ b/src/io/pibasetransfer.h @@ -4,7 +4,7 @@ /* PIP - Platform Independent Primitives Base class for reliable send and receive data in fixed packets with error correction, pause and resume - Copyright (C) 2015 Andrey Bychkov work.a.b@yandex.ru + Copyright (C) 2016 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/io/pidatatransfer.h b/src/io/pidatatransfer.h index 2f8abd01..f4758c3e 100644 --- a/src/io/pidatatransfer.h +++ b/src/io/pidatatransfer.h @@ -1,3 +1,25 @@ +/*! \file pidatatransfer.h + * \brief Class for send and receive PIByteArray via \a PIBaseTransfer +*/ +/* + PIP - Platform Independent Primitives + Class for send and receive PIByteArray via PIBaseTransfer + Copyright (C) 2016 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 PIDATATRANSFER_H #define PIDATATRANSFER_H diff --git a/src/io/pifiletransfer.h b/src/io/pifiletransfer.h index f9959ec2..f2429588 100644 --- a/src/io/pifiletransfer.h +++ b/src/io/pifiletransfer.h @@ -1,3 +1,25 @@ +/*! \file pifiletransfer.h + * \brief Class for send and receive files and directories via \a PIBaseTransfer +*/ +/* + PIP - Platform Independent Primitives + Class for send and receive files and directories via PIBaseTransfer + Copyright (C) 2016 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 PIFILETRANSFER_H #define PIFILETRANSFER_H diff --git a/src/piversion.h b/src/piversion.h index 6cf4665a..22ecba1b 100644 --- a/src/piversion.h +++ b/src/piversion.h @@ -4,7 +4,7 @@ #define PIP_VERSION_MAJOR 0 #define PIP_VERSION_MINOR 5 -#define PIP_VERSION_REVISION 1 -#define PIP_VERSION_SUFFIX "_alpha" +#define PIP_VERSION_REVISION 4 +#define PIP_VERSION_SUFFIX "" #endif // PIVERSION_H diff --git a/src/thread/pipipelinethread.h b/src/thread/pipipelinethread.h index c655d5cb..b65ae54c 100644 --- a/src/thread/pipipelinethread.h +++ b/src/thread/pipipelinethread.h @@ -1,3 +1,25 @@ +/*! \file pipipelinethread.h + * \brief Class for create multihread pipeline +*/ +/* + PIP - Platform Independent Primitives + Class for create multihread pipeline + Copyright (C) 2015 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 PIPIPELINETHREAD_H #define PIPIPELINETHREAD_H