git-svn-id: svn://db.shs.com.ru/pip@481 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
158
main.cpp
158
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 {
|
|
||||||
public:
|
|
||||||
void 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[]) {
|
|
||||||
/*
|
/*
|
||||||
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};
|
class A: public PIObject {
|
||||||
#pragma pack (push, 1)
|
PIOBJECT(A)
|
||||||
struct VCO_Element {
|
public:
|
||||||
VCO_Element() {}
|
EVENT1(ev1, float, f)
|
||||||
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;
|
class B: public PIObject {
|
||||||
in.resize(5);
|
PIOBJECT(B)
|
||||||
for (int i = 0; i < in.size_s(); ++i)
|
public:
|
||||||
for (int j = 0; j < 20; ++j)
|
EVENT_HANDLER0(void, eh0) {piCout << "eh0";}
|
||||||
in[i] << j+i*100;
|
EVENT_HANDLER1(void, eh1, float, f) {piCout << "eh1" << f;}
|
||||||
// piCout << in.size() << in[0].size();
|
};
|
||||||
PIVector2D<double> f0;
|
*/
|
||||||
PIVector2D<double> f1(30, 40);
|
|
||||||
//in.resize(1);
|
int main(int argc, char *argv[]) {
|
||||||
PIVector2D<double> f2(in);
|
if (argc < 2) return 0;
|
||||||
f0 = f2;
|
bool r = PIString(argv[1]).toBool();
|
||||||
// piCout << f0;
|
PISharedMemory shm;
|
||||||
// piCout << f1;
|
//shm.setSize(64);
|
||||||
// piCout << f2;
|
shm.open("test", r ? PIIODevice::ReadOnly : PIIODevice::WriteOnly);
|
||||||
// piCout << f2.rows() << f2.cols() << f2.size_all() << f2.rows()*f2.cols();
|
piCout << "open" << shm.isOpened();
|
||||||
piCout << in;
|
if (!r) {
|
||||||
piCout << f2;
|
int wr = shm.write(PIString("data").toByteArray());
|
||||||
piCout << f2.toVectors();
|
piCout << "wrote" << wr;
|
||||||
PIVector<double> t = f2.toPlainVector();
|
|
||||||
piCout << t;
|
|
||||||
piCout << PIVector2D<double>(f2.rows(), f2.cols(), t);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
piSleep(3.);
|
||||||
|
PIByteArray rb(4);
|
||||||
|
int rd = shm.read(rb.data(), rb.size_s());
|
||||||
|
piCout << "readed" << rd << PIString(rb);
|
||||||
// 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);
|
||||||
|
|||||||
Reference in New Issue
Block a user