git-svn-id: svn://db.shs.com.ru/pip@194 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-05-05 07:44:52 +00:00
parent ece66dc4c4
commit 7bea1b2cc0
6 changed files with 116 additions and 37 deletions

View File

@@ -6,23 +6,36 @@
#include "piethernet.h" #include "piethernet.h"
#include "piintrospection.h" #include "piintrospection.h"
struct MS { //struct MS {
//MS() {i = 0; f = 0.;} // //MS() {i = 0; f = 0.;}
int i; // int i;
float f; // float f;
PIString s; // 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 <uint N = 3u, typename T = double>
class VC {
public:
T v[N];
VC(T x) {for (uint i=0; i<N; i++) v[i] = x;}
T dot(VC<N, T> a) {T res = T(); for (uint i=0; i<N; i++) res += v[i] * a.v[N - i - 1]; return res;}
}; };
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;}
int main (int argc, char * argv[]) { 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; //PIByteArray ba;
/*PIKbdListener kbd; /*PIKbdListener kbd;
kbd.enableExitCapture(); kbd.enableExitCapture();
@@ -31,26 +44,26 @@ int main (int argc, char * argv[]) {
PIINTROSPECTION_START PIINTROSPECTION_START
//piCout << PIINTROSPECTION_CONTAINERS->count; //piCout << PIINTROSPECTION_CONTAINERS->count;
WAIT_FOR_EXIT*/ WAIT_FOR_EXIT*/
PIVector<PIVariant> vl; // PIVector<PIVariant> vl;
vl << PIVariant('2') << PIVariant(-5.5) << PIVariant(10) << PIVariant(complexd(2,3)) << PIVariant("text") << PIVariant(PIByteArray("bytearray", 9)) << PIVariant(PIDateTime::current()); // 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) // piForeachC (PIVariant v, vl)
piCout << v << v.value<PIString>(); // piCout << v << v.value<PIString>();
PIByteArray ba; ba << PIString("500"); // PIByteArray ba; ba << PIString("500");
piCout << PIVariant::fromValue(ba, "PIString"); // piCout << PIVariant::fromValue(ba, "PIString");
piCout << PIVariant("PIString"); // piCout << PIVariant("PIString");
piCout << __PIVariantFunctions__<int>::typeNameHelper(); // piCout << __PIVariantFunctions__<int>::typeNameHelper();
piCout << __PIVariantInfoStorage__::get()->map->size(); // piCout << __PIVariantInfoStorage__::get()->map->size();
for (PIMap<PIString, __PIVariantInfo__*>::iterator i = __PIVariantInfoStorage__::get()->map->begin(); i != __PIVariantInfoStorage__::get()->map->end(); ++i) // for (PIMap<PIString, __PIVariantInfo__*>::iterator i = __PIVariantInfoStorage__::get()->map->begin(); i != __PIVariantInfoStorage__::get()->map->end(); ++i)
piCout << i.key() << i.value()->cast.size(); // piCout << i.key() << i.value()->cast.size();
PIEthernet eth; // PIEthernet eth;
piCout << eth.properties(); // piCout << eth.properties();
MS ms = (MS){-1, 3.3, "str"}; // MS ms = (MS){-1, 3.3, "str"};
PIVariant mv = PIVariant::fromValue<MS>(ms); // PIVariant mv = PIVariant::fromValue<MS>(ms);
piCout << mv << mv.type(); // piCout << mv << mv.type();
piCout << mv.toInt(); // piCout << mv.toInt();
piCout << mv.toFloat(); // piCout << mv.toFloat();
piCout << mv.toString(); // piCout << mv.toString();
piCout << ms << mv.value<MS>() << vl[0].value<MS>(); // piCout << ms << mv.value<MS>() << vl[0].value<MS>();
/*PIScreen screen; /*PIScreen screen;
TileSimple window; TileSimple window;
window.back_format.color_back = PIScreenTypes::Red; window.back_format.color_back = PIScreenTypes::Red;

View File

@@ -4,7 +4,7 @@
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
Base class for reliable send and receive data in fixed packets with error correction, pause and resume 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 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 it under the terms of the GNU General Public License as published by

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef PIDATATRANSFER_H #ifndef PIDATATRANSFER_H
#define PIDATATRANSFER_H #define PIDATATRANSFER_H

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef PIFILETRANSFER_H #ifndef PIFILETRANSFER_H
#define PIFILETRANSFER_H #define PIFILETRANSFER_H

View File

@@ -4,7 +4,7 @@
#define PIP_VERSION_MAJOR 0 #define PIP_VERSION_MAJOR 0
#define PIP_VERSION_MINOR 5 #define PIP_VERSION_MINOR 5
#define PIP_VERSION_REVISION 1 #define PIP_VERSION_REVISION 4
#define PIP_VERSION_SUFFIX "_alpha" #define PIP_VERSION_SUFFIX ""
#endif // PIVERSION_H #endif // PIVERSION_H

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef PIPIPELINETHREAD_H #ifndef PIPIPELINETHREAD_H
#define PIPIPELINETHREAD_H #define PIPIPELINETHREAD_H