git-svn-id: svn://db.shs.com.ru/pip@479 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
146
main.cpp
146
main.cpp
@@ -32,33 +32,141 @@ const char pult_config[] =
|
|||||||
";
|
";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
class A: public PIObject {
|
template<typename T>
|
||||||
PIOBJECT(A)
|
struct Info {
|
||||||
public:
|
enum {Defined = 0};
|
||||||
EVENT1(ev1, float, f)
|
};
|
||||||
|
template<typename T>
|
||||||
|
struct TypeInfo {
|
||||||
|
typedef T PureType;
|
||||||
|
typedef const T ConstPureType;
|
||||||
|
typedef T * PointerType;
|
||||||
|
typedef const T * ConstPointerType;
|
||||||
|
typedef T & ReferenceType;
|
||||||
|
typedef const T & ConstReferenceType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class B: public PIObject {
|
#define TYPEINFO_SINGLE(PT, T) \
|
||||||
PIOBJECT(B)
|
template<> struct TypeInfo<T> { \
|
||||||
|
typedef PT PureType; \
|
||||||
|
typedef const PT ConstPureType; \
|
||||||
|
typedef PT * PointerType; \
|
||||||
|
typedef const PT * ConstPointerType; \
|
||||||
|
typedef PT & ReferenceType; \
|
||||||
|
typedef const PT & ConstReferenceType; \
|
||||||
|
};
|
||||||
|
#define TYPEINFO(T) \
|
||||||
|
TYPEINFO_SINGLE(T, T &) \
|
||||||
|
TYPEINFO_SINGLE(T, const T) \
|
||||||
|
TYPEINFO_SINGLE(T, const T &) \
|
||||||
|
TYPEINFO_SINGLE(T, T *) \
|
||||||
|
TYPEINFO_SINGLE(T, const T *)
|
||||||
|
|
||||||
|
TYPEINFO(PIString)
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class A {
|
||||||
public:
|
public:
|
||||||
EVENT_HANDLER0(void, eh0) {piCout << "eh0";}
|
void f() {
|
||||||
EVENT_HANDLER1(void, eh1, float, f) {piCout << "eh1" << f;}
|
piCout << "T";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
class A<const T&> {
|
||||||
|
public:
|
||||||
|
void f() {
|
||||||
|
piCout << "const T&";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#include "pivector2d.h"
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
A a;
|
/*
|
||||||
B b;
|
enum VCO_Aim_Type {VCO_Aim_Type_None, VCO_Aim_Type_Detected, VCO_Aim_Type_New, VCO_Aim_Type_Confirmed, VCO_Aim_Type_Deleted = 127};
|
||||||
CONNECTU_QUEUED(&a, ev1, &b, eh0, &b);
|
#pragma pack (push, 1)
|
||||||
CONNECTU_QUEUED(&a, ev1, &b, eh1, &a);
|
struct VCO_Element {
|
||||||
piCout << "start";
|
VCO_Element() {}
|
||||||
a.ev1(1.5);
|
VCO_Aim_Type type;
|
||||||
piSleep(1);
|
double elapsed;
|
||||||
piCout << a.maybeCallQueuedEvents();
|
float wls_a; // m/s
|
||||||
piSleep(1);
|
float wls_b; // m
|
||||||
piCout << b.maybeCallQueuedEvents();
|
float speed;
|
||||||
piCout << "end";
|
float acceleration; // m/s^2
|
||||||
|
float prediction_pos; // m
|
||||||
|
float variance; // m
|
||||||
|
float power;
|
||||||
|
float angle;
|
||||||
|
int id;
|
||||||
|
int missed;
|
||||||
|
int missed_ml;
|
||||||
|
int confirmed;
|
||||||
|
int history_size;
|
||||||
|
bool tracing;
|
||||||
|
bool _found;
|
||||||
|
bool _checked;
|
||||||
|
bool _delete;
|
||||||
|
PIVector<PIVector<double> > history;
|
||||||
|
};
|
||||||
|
#pragma pack (pop)
|
||||||
|
struct VCO_ElementX {
|
||||||
|
VCO_Aim_Type type;
|
||||||
|
double elapsed;
|
||||||
|
float wls_a; // m/s
|
||||||
|
float wls_b; // m
|
||||||
|
float speed;
|
||||||
|
float acceleration; // m/s^2
|
||||||
|
float prediction_pos; // m
|
||||||
|
float variance; // m
|
||||||
|
float power;
|
||||||
|
float angle;
|
||||||
|
int id;
|
||||||
|
int missed;
|
||||||
|
int missed_ml;
|
||||||
|
int confirmed;
|
||||||
|
int history_size;
|
||||||
|
bool tracing;
|
||||||
|
bool _found;
|
||||||
|
bool _checked;
|
||||||
|
bool _delete;
|
||||||
|
};
|
||||||
|
struct VCO_ElementY : VCO_ElementX {
|
||||||
|
PIVector<PIVector<double> > history;
|
||||||
|
};
|
||||||
|
VCO_Element v;
|
||||||
|
VCO_ElementX x;
|
||||||
|
VCO_ElementY y;
|
||||||
|
piCout << sizeof(x);
|
||||||
|
piCout << sizeof(y) << sizeof(y.history) << sizeof(y) - sizeof(y.history) ;
|
||||||
|
piCout << sizeof(v) << sizeof(v.history) << sizeof(v) - sizeof(v.history) ;
|
||||||
|
return 0;*/
|
||||||
|
|
||||||
|
PIVector<PIVector<double> > in;
|
||||||
|
in.resize(5);
|
||||||
|
for (int i = 0; i < in.size_s(); ++i)
|
||||||
|
for (int j = 0; j < 20; ++j)
|
||||||
|
in[i] << j+i*100;
|
||||||
|
// piCout << in.size() << in[0].size();
|
||||||
|
PIVector2D<double> f0;
|
||||||
|
PIVector2D<double> f1(30, 40);
|
||||||
|
//in.resize(1);
|
||||||
|
PIVector2D<double> f2(in);
|
||||||
|
f0 = f2;
|
||||||
|
// piCout << f0;
|
||||||
|
// piCout << f1;
|
||||||
|
// piCout << f2;
|
||||||
|
// piCout << f2.rows() << f2.cols() << f2.size_all() << f2.rows()*f2.cols();
|
||||||
|
piCout << in;
|
||||||
|
piCout << f2;
|
||||||
|
piCout << f2.toVectors();
|
||||||
|
PIVector<double> t = f2.toPlainVector();
|
||||||
|
piCout << t;
|
||||||
|
piCout << PIVector2D<double>(f2.rows(), f2.cols(), t);
|
||||||
|
return 0;
|
||||||
// PIFFTWf fft;
|
// PIFFTWf fft;
|
||||||
// fft.preparePlan(50, PIFFTWf::foReal);
|
// fft.preparePlan(50, PIFFTWf::foReal);
|
||||||
// PIVector<complexf> out = fft.calcFFT(in);
|
// PIVector<complexf> out = fft.calcFFT(in);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/*! \file piscreen.h
|
/*! \file piscreen.h
|
||||||
* \brief Console output class
|
* \brief Console GUI class
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
Console output/input
|
Console GUI
|
||||||
Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru
|
Copyright (C) 2017 Ivan Pelipenko peri4ko@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
|
||||||
|
|||||||
@@ -1,8 +1,34 @@
|
|||||||
|
/*! \file piscreenconsole.h
|
||||||
|
* \brief Tile for PIScreen with PIConsole API
|
||||||
|
*
|
||||||
|
* This file declares TileVars
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
PIP - Platform Independent Primitives
|
||||||
|
Tile for PIScreen with PIConsole API
|
||||||
|
Copyright (C) 2017 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 PISCREENCONSOLE_H
|
#ifndef PISCREENCONSOLE_H
|
||||||
#define PISCREENCONSOLE_H
|
#define PISCREENCONSOLE_H
|
||||||
|
|
||||||
#include "piscreentiles.h"
|
#include "piscreentiles.h"
|
||||||
|
|
||||||
|
/// NOTE: incomplete class
|
||||||
|
/// TODO: write TileVars
|
||||||
|
|
||||||
class PIP_EXPORT TileVars: public PIScreenTile {
|
class PIP_EXPORT TileVars: public PIScreenTile {
|
||||||
public:
|
public:
|
||||||
TileVars(const PIString & n = PIString());
|
TileVars(const PIString & n = PIString());
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/*! \file picontainers.h
|
/*! \file picontainers.h
|
||||||
* \brief Generic containers
|
* \brief Base for generic containers
|
||||||
*
|
*
|
||||||
* This file declare all containers and useful macros
|
* This file declare all containers and useful macros
|
||||||
* to use them
|
* to use them
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
Generic containers
|
Base for generic containers
|
||||||
Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru
|
Copyright (C) 2017 Ivan Pelipenko peri4ko@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
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*! \file pilist.h
|
||||||
|
* \brief Linked list container, wrapper for std::list
|
||||||
|
*
|
||||||
|
* This file declares PIList
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
PIP - Platform Independent Primitives
|
||||||
|
Linked list container, wrapper for std::list
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
#ifndef PILIST_H
|
#ifndef PILIST_H
|
||||||
#define PILIST_H
|
#define PILIST_H
|
||||||
#include "pibase.h"
|
#include "pibase.h"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
Dynamic array of any type
|
Associative array with custom types of key and value
|
||||||
Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru
|
Copyright (C) 2017 Ivan Pelipenko peri4ko@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
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*! \file pipair.h
|
||||||
|
* \brief pair
|
||||||
|
*
|
||||||
|
* This file declare PIPair
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
PIP - Platform Independent Primitives
|
||||||
|
pair
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
#ifndef PIPAIR_H
|
#ifndef PIPAIR_H
|
||||||
#define PIPAIR_H
|
#define PIPAIR_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*! \file picontainers.h
|
/*! \file pideque.h
|
||||||
* \brief Queue container
|
* \brief Queue container
|
||||||
*
|
*
|
||||||
* This file declare PIQueue
|
* This file declare PIQueue
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/*! \file pivecto2Dr.h
|
/*! \file pivecto2d.h
|
||||||
* \brief 2D wrapper around PIVector
|
* \brief 2D wrapper around PIVector
|
||||||
*
|
*
|
||||||
* This file declares PIVector
|
* This file declares PIVector
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
/*! \file pibitarray.h
|
||||||
|
* \brief Bit array
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
Bit array
|
Bit array
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/*! \file pichunkstream.h
|
/*! \file pichunkstream.h
|
||||||
* \brief Binary serializator
|
* \brief Binary markup serializator
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
Binary serializator
|
Binary markup serializator
|
||||||
Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru
|
Copyright (C) 2017 Ivan Pelipenko peri4ko@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
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ PICout PICout::operator <<(const PICoutAction v) {
|
|||||||
case PICoutManipulators::ClearScreen:
|
case PICoutManipulators::ClearScreen:
|
||||||
if (!PICout::buffer_) {
|
if (!PICout::buffer_) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
/// TODO !!!
|
/// TODO : wondows ClearScreen !!!
|
||||||
/*GetConsoleCursorInfo(__Private__::hOut, &curinfo);
|
/*GetConsoleCursorInfo(__Private__::hOut, &curinfo);
|
||||||
curinfo.bVisible = false;
|
curinfo.bVisible = false;
|
||||||
SetConsoleCursorInfo(__Private__::hOut, &curinfo);
|
SetConsoleCursorInfo(__Private__::hOut, &curinfo);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace PICoutManipulators {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef PIFlags<PICoutControl> PICoutControls;
|
typedef PIFlags<PICoutControl> PICoutControls;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
PIP - Platform Independent Primitives
|
PIP - Platform Independent Primitives
|
||||||
Initialization
|
Private PIP includes
|
||||||
Copyright (C) 2017 Ivan Pelipenko peri4ko@yandex.ru
|
Copyright (C) 2017 Ivan Pelipenko peri4ko@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
|
||||||
|
|||||||
@@ -1,3 +1,27 @@
|
|||||||
|
/*! \file pipropertystorage.h
|
||||||
|
* \brief Storage of properties for GUI usage
|
||||||
|
*
|
||||||
|
* This file declare PIPropertyStorage
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
PIP - Platform Independent Primitives
|
||||||
|
Storage of properties for GUI usage
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef PIPROPERTYSTORAGE_H
|
#ifndef PIPROPERTYSTORAGE_H
|
||||||
#define PIPROPERTYSTORAGE_H
|
#define PIPROPERTYSTORAGE_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
/*! \file pistring.h
|
||||||
|
* \brief String
|
||||||
|
*
|
||||||
|
* This file declare std operators and string conversions
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
PIP - Platform Independent Primitives
|
||||||
|
STD for PIString
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
#ifndef PISTRING_STD_H
|
#ifndef PISTRING_STD_H
|
||||||
#define PISTRING_STD_H
|
#define PISTRING_STD_H
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -166,11 +166,6 @@ public:
|
|||||||
//! \returns \b true if sended bytes count = "size"
|
//! \returns \b true if sended bytes count = "size"
|
||||||
bool send(const void * data, int size) {return (write(data, size) == size);}
|
bool send(const void * data, int size) {return (write(data, size) == size);}
|
||||||
|
|
||||||
/// NOTE: no reason to use this function, use PIString::toUtf8() or PIString::dataAscii(),lengthAscii() instead
|
|
||||||
//! \brief Write to device string "data" and wait for data written if "wait" is \b true.
|
|
||||||
//! \returns \b true if sended bytes count = size of string
|
|
||||||
//bool send(const PIString & data, bool wait = false) {return (write(data.data(), data.lengthAscii(), wait) == data.size_s());}
|
|
||||||
|
|
||||||
//! \brief Write to device byte array "data" and wait for data written if "wait" is \b true.
|
//! \brief Write to device byte array "data" and wait for data written if "wait" is \b true.
|
||||||
//! \returns \b true if sended bytes count = size of string
|
//! \returns \b true if sended bytes count = size of string
|
||||||
bool send(const PIByteArray & data) {return (write(data.data(), data.size_s()) == data.size_s());}
|
bool send(const PIByteArray & data) {return (write(data.data(), data.size_s()) == data.size_s());}
|
||||||
|
|||||||
Reference in New Issue
Block a user