git-svn-id: svn://db.shs.com.ru/pip@481 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
150
main.cpp
150
main.cpp
@@ -32,141 +32,37 @@ 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);
|
||||
if (argc < 2) return 0;
|
||||
bool r = PIString(argv[1]).toBool();
|
||||
PISharedMemory shm;
|
||||
//shm.setSize(64);
|
||||
shm.open("test", r ? PIIODevice::ReadOnly : PIIODevice::WriteOnly);
|
||||
piCout << "open" << shm.isOpened();
|
||||
if (!r) {
|
||||
int wr = shm.write(PIString("data").toByteArray());
|
||||
piCout << "wrote" << wr;
|
||||
return 0;
|
||||
}
|
||||
piSleep(3.);
|
||||
PIByteArray rb(4);
|
||||
int rd = shm.read(rb.data(), rb.size_s());
|
||||
piCout << "readed" << rd << PIString(rb);
|
||||
// PIFFTWf fft;
|
||||
// fft.preparePlan(50, PIFFTWf::foReal);
|
||||
// PIVector<complexf> out = fft.calcFFT(in);
|
||||
|
||||
Reference in New Issue
Block a user