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

This commit is contained in:
2017-04-28 08:45:16 +00:00
parent 54d40653cb
commit 284f3a5444

152
main.cpp
View File

@@ -32,141 +32,37 @@ const char pult_config[] =
"; ";
*/ */
#include <typeinfo> /*
class A: public PIObject {
template<typename T> PIOBJECT(A)
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 {
public: public:
void f() { EVENT1(ev1, float, f)
piCout << "T";
}
}; };
template <typename T> class B: public PIObject {
class A<const T&> { PIOBJECT(B)
public: public:
void f() { EVENT_HANDLER0(void, eh0) {piCout << "eh0";}
piCout << "const T&"; EVENT_HANDLER1(void, eh1, float, f) {piCout << "eh1" << f;}
}
}; };
*/
#include "pivector2d.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
/* if (argc < 2) return 0;
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}; bool r = PIString(argv[1]).toBool();
#pragma pack (push, 1) PISharedMemory shm;
struct VCO_Element { //shm.setSize(64);
VCO_Element() {} shm.open("test", r ? PIIODevice::ReadOnly : PIIODevice::WriteOnly);
VCO_Aim_Type type; piCout << "open" << shm.isOpened();
double elapsed; if (!r) {
float wls_a; // m/s int wr = shm.write(PIString("data").toByteArray());
float wls_b; // m piCout << "wrote" << wr;
float speed; return 0;
float acceleration; // m/s^2 }
float prediction_pos; // m piSleep(3.);
float variance; // m PIByteArray rb(4);
float power; int rd = shm.read(rb.data(), rb.size_s());
float angle; piCout << "readed" << rd << PIString(rb);
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);