git-svn-id: svn://db.shs.com.ru/pip@194 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
81
main.cpp
81
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 <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[]) {
|
||||
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<PIVariant> 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<PIString>();
|
||||
PIByteArray ba; ba << PIString("500");
|
||||
piCout << PIVariant::fromValue(ba, "PIString");
|
||||
piCout << PIVariant("PIString");
|
||||
piCout << __PIVariantFunctions__<int>::typeNameHelper();
|
||||
piCout << __PIVariantInfoStorage__::get()->map->size();
|
||||
for (PIMap<PIString, __PIVariantInfo__*>::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>(ms);
|
||||
piCout << mv << mv.type();
|
||||
piCout << mv.toInt();
|
||||
piCout << mv.toFloat();
|
||||
piCout << mv.toString();
|
||||
piCout << ms << mv.value<MS>() << vl[0].value<MS>();
|
||||
// PIVector<PIVariant> 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<PIString>();
|
||||
// PIByteArray ba; ba << PIString("500");
|
||||
// piCout << PIVariant::fromValue(ba, "PIString");
|
||||
// piCout << PIVariant("PIString");
|
||||
// piCout << __PIVariantFunctions__<int>::typeNameHelper();
|
||||
// piCout << __PIVariantInfoStorage__::get()->map->size();
|
||||
// for (PIMap<PIString, __PIVariantInfo__*>::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>(ms);
|
||||
// piCout << mv << mv.type();
|
||||
// piCout << mv.toInt();
|
||||
// piCout << mv.toFloat();
|
||||
// piCout << mv.toString();
|
||||
// piCout << ms << mv.value<MS>() << vl[0].value<MS>();
|
||||
/*PIScreen screen;
|
||||
TileSimple window;
|
||||
window.back_format.color_back = PIScreenTypes::Red;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
#define PIDATATRANSFER_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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIFILETRANSFER_H
|
||||
#define PIFILETRANSFER_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
|
||||
|
||||
@@ -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
|
||||
#define PIPIPELINETHREAD_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user