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

This commit is contained in:
2017-04-26 22:08:42 +00:00
parent 0e50a87317
commit 51f801c83b
4 changed files with 165 additions and 182 deletions

144
main.cpp
View File

@@ -32,141 +32,33 @@ const char pult_config[] =
";
*/
#include <typeinfo>
template<typename T>
struct Info {
enum {Defined = 0};
};
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;
};
#define TYPEINFO_SINGLE(PT, T) \
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 {
class A: public PIObject {
PIOBJECT(A)
public:
void f() {
piCout << "T";
}
EVENT1(ev1, float, f)
};
template <typename T>
class A<const T&> {
class B: public PIObject {
PIOBJECT(B)
public:
void f() {
piCout << "const T&";
}
EVENT_HANDLER0(void, eh0) {piCout << "eh0";}
EVENT_HANDLER1(void, eh1, float, f) {piCout << "eh1" << f;}
};
#include "pivector2d.h"
int main(int argc, char *argv[]) {
/*
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};
#pragma pack (push, 1)
struct VCO_Element {
VCO_Element() {}
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;
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;
A a;
B b;
CONNECTU_QUEUED(&a, ev1, &b, eh0, &b);
CONNECTU_QUEUED(&a, ev1, &b, eh1, &a);
piCout << "start";
a.ev1(1.5);
piSleep(1);
piCout << a.maybeCallQueuedEvents();
piSleep(1);
piCout << b.maybeCallQueuedEvents();
piCout << "end";
// PIFFTWf fft;
// fft.preparePlan(50, PIFFTWf::foReal);
// PIVector<complexf> out = fft.calcFFT(in);