git-svn-id: svn://db.shs.com.ru/pip@496 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -324,10 +324,11 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
# Test program
|
# Test program
|
||||||
#find_package(Qt4 REQUIRED)
|
find_package(Qt4 REQUIRED)
|
||||||
#include_directories(${QT_INCLUDES})
|
include_directories(${QT_INCLUDES})
|
||||||
add_executable(pip_test "main.cpp" "ccm_kbd.cpp")
|
qt4_wrap_cpp(CMOCS_TEST "main.h" OPTIONS -nw)
|
||||||
target_link_libraries(pip_test pip pip_fftw)# ${QT_QTCORE_LIBRARY})
|
add_executable(pip_test "main.cpp" "main.h" "ccm_kbd.cpp" ${CMOCS_TEST})
|
||||||
|
target_link_libraries(pip_test pip pip_fftw ${QT_QTCORE_LIBRARY})
|
||||||
|
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|||||||
27
main.cpp
27
main.cpp
@@ -1,25 +1,11 @@
|
|||||||
#include "pip.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
|
||||||
class A: public PIObject {
|
|
||||||
PIOBJECT(A)
|
|
||||||
public:
|
|
||||||
EVENT1(ev1, float, f)
|
|
||||||
};
|
|
||||||
|
|
||||||
class B: public PIObject {
|
|
||||||
PIOBJECT(B)
|
|
||||||
public:
|
|
||||||
EVENT_HANDLER0(void, eh0) {piCout << "eh0";}
|
|
||||||
EVENT_HANDLER1(void, eh1, float, f) {piCout << "eh1_1" << f;}
|
|
||||||
EVENT_HANDLER2(void, eh1, float, f, int, s) {piCout << "eh1_2" << f << s;}
|
|
||||||
};
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
A a;
|
A a;
|
||||||
B b;
|
B b;
|
||||||
|
a.setName("__a__");
|
||||||
|
b.setName("__b__");
|
||||||
/*CONNECTU_QUEUED(&a, ev1, &b, eh0, &b);
|
/*CONNECTU_QUEUED(&a, ev1, &b, eh0, &b);
|
||||||
CONNECTU_QUEUED(&a, ev1, &b, eh1, &a);
|
CONNECTU_QUEUED(&a, ev1, &b, eh1, &a);
|
||||||
piCout << "start";
|
piCout << "start";
|
||||||
@@ -29,9 +15,12 @@ int main(int argc, char *argv[]) {
|
|||||||
piSleep(1);
|
piSleep(1);
|
||||||
piCout << b.maybeCallQueuedEvents();*/
|
piCout << b.maybeCallQueuedEvents();*/
|
||||||
//piCout << "end";
|
//piCout << "end";
|
||||||
b.executeQueued(&a, "eh1", PIVariant(0.1), "0150", 10, 40);
|
/*b.executeQueued(&a, "eh1", PIVariant(0.1), "0150", 10, 40);
|
||||||
piSleep(1);
|
piSleep(1);
|
||||||
a.maybeCallQueuedEvents();
|
a.maybeCallQueuedEvents();*/
|
||||||
//dumpApplication();
|
//dumpApplication();
|
||||||
|
b.execute("eh1", PIVariant(0.1), "0150", 10, 40);
|
||||||
|
b.executeQueued(&a, "eh1", PIVariant(0.1), "0150", 10, 40);
|
||||||
|
a.callQueuedEvents();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
27
main.h
Normal file
27
main.h
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#ifndef MAIN_H
|
||||||
|
#define MAIN_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "pip.h"
|
||||||
|
|
||||||
|
struct _S {
|
||||||
|
uchar _c[164];
|
||||||
|
};
|
||||||
|
|
||||||
|
class A: public QObject, public PIObject {
|
||||||
|
PIOBJECT(A)
|
||||||
|
public:
|
||||||
|
A() {}
|
||||||
|
EVENT1(ev1, float, f)
|
||||||
|
};
|
||||||
|
|
||||||
|
class B: public QObject, public PIObject {
|
||||||
|
PIOBJECT(B)
|
||||||
|
public:
|
||||||
|
B() {}
|
||||||
|
EVENT_HANDLER0(void, eh0) {piCout << "eh0" << emitter();}
|
||||||
|
EVENT_HANDLER1(void, eh1, float, f) {piCout << "eh1_1" << f << emitter();}
|
||||||
|
EVENT_HANDLER2(void, eh1, float, f, int, s) {piCout << "eh1_2" << f << s << emitter();}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAIN_H
|
||||||
@@ -266,13 +266,6 @@ PIChar PIChar::toLower() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PIP_STD_IOSTREAM
|
|
||||||
std::ostream & operator <<(std::ostream & s, const PIChar & v) {
|
|
||||||
s << v.toCharPtr();
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
PICout operator <<(PICout s, const PIChar & v) {
|
PICout operator <<(PICout s, const PIChar & v) {
|
||||||
s.space();
|
s.space();
|
||||||
s.setControl(0, true);
|
s.setControl(0, true);
|
||||||
|
|||||||
@@ -157,11 +157,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef PIP_STD_IOSTREAM
|
|
||||||
//! Output operator to \c std::ostream
|
|
||||||
std::ostream & operator <<(std::ostream & s, const PIChar & v);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//! Output operator to \a PICout
|
//! Output operator to \a PICout
|
||||||
PICout operator <<(PICout s, const PIChar & v);
|
PICout operator <<(PICout s, const PIChar & v);
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ bool PIObject::execute(const PIString & method, const PIVector<PIVariant> & vl)
|
|||||||
bool ok = findSuitableMethodV(method, vl.size_s(), ac, func);
|
bool ok = findSuitableMethodV(method, vl.size_s(), ac, func);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return false;
|
return false;
|
||||||
callAddrV(func.addrV, this, ac, vl);
|
callAddrV(func.addrV, toThis(), ac, vl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ bool PIObject::executeQueued(PIObject * performer, const PIString & method, cons
|
|||||||
bool ok = findSuitableMethodV(method, vl.size_s(), ac, func);
|
bool ok = findSuitableMethodV(method, vl.size_s(), ac, func);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return false;
|
return false;
|
||||||
performer->postQueuedEvent(QueuedEvent(func.addrV, this, this, performer, vl));
|
performer->postQueuedEvent(QueuedEvent(func.addrV, toThis(), this, performer, vl));
|
||||||
performer->proc_event_queue = true;
|
performer->proc_event_queue = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -399,6 +399,12 @@ void PIObject::postQueuedEvent(const PIObject::QueuedEvent & e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void * PIObject::toThis() const {
|
||||||
|
//piCout << ptrOffset() << (void*)this << (void*)((char*)this - ptrOffset());
|
||||||
|
return (void*)((char*)this - ptrOffset());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PIMutex & PIObject::__meta_mutex() {
|
PIMutex & PIObject::__meta_mutex() {
|
||||||
static PIMutex ret;
|
static PIMutex ret;
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -195,7 +195,8 @@
|
|||||||
public: \
|
public: \
|
||||||
static const PIString __classNameS() {return PIStringAscii(#name);} \
|
static const PIString __classNameS() {return PIStringAscii(#name);} \
|
||||||
virtual const char * className() const {return #name;} \
|
virtual const char * className() const {return #name;} \
|
||||||
private:
|
private: \
|
||||||
|
virtual int ptrOffset() const {name * o = (name*)100; return int(llong((PIObject*)o) - llong(o));}
|
||||||
|
|
||||||
#define PIOBJECT_PARENT(name) \
|
#define PIOBJECT_PARENT(name) \
|
||||||
class __##name##_ParentInitializer__ { \
|
class __##name##_ParentInitializer__ { \
|
||||||
@@ -885,6 +886,8 @@ private:
|
|||||||
__MetaFunc methodEH(const void * addr) const;
|
__MetaFunc methodEH(const void * addr) const;
|
||||||
void updateConnectors();
|
void updateConnectors();
|
||||||
void postQueuedEvent(const QueuedEvent & e);
|
void postQueuedEvent(const QueuedEvent & e);
|
||||||
|
void * toThis() const;
|
||||||
|
virtual int ptrOffset() const {return 0;}
|
||||||
|
|
||||||
static PIVector<PIObject * > & objects();
|
static PIVector<PIObject * > & objects();
|
||||||
static void callAddrV(void * slot, void * obj, int args, const PIVector<PIVariant> & vl);
|
static void callAddrV(void * slot, void * obj, int args, const PIVector<PIVariant> & vl);
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ inline PIString StdWString2PIString(const std::wstring & v) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//! \relatesalso PIChar \brief Output operator to \c std::ostream
|
||||||
|
inline std::ostream & operator <<(std::ostream & s, const PIChar & v) {s << v.toCharPtr(); return s;}
|
||||||
|
|
||||||
//! \relatesalso PIString \brief Return concatenated string
|
//! \relatesalso PIString \brief Return concatenated string
|
||||||
inline PIString operator +(const PIString & f, const std::string & str) {PIString s(f); s += StdString2PIString(str); return s;}
|
inline PIString operator +(const PIString & f, const std::string & str) {PIString s(f); s += StdString2PIString(str); return s;}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "piprocess.h"
|
#include "piprocess.h"
|
||||||
|
|
||||||
class PIP_EXPORT PICodec: private PIProcess
|
class PIP_EXPORT PICodec: protected PIProcess
|
||||||
{
|
{
|
||||||
PIOBJECT(PICodec)
|
PIOBJECT(PICodec)
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
/// bool exec(const PIString & program, const PIStringList & args)
|
/// bool exec(const PIString & program, const PIStringList & args)
|
||||||
/// void terminate()
|
/// void terminate()
|
||||||
/// bool waitForFinish(int timeout_msecs = 60000)
|
/// bool waitForFinish(int timeout_msecs = 60000)
|
||||||
class PIP_EXPORT PIProcess: private PIThread
|
class PIP_EXPORT PIProcess: protected PIThread
|
||||||
{
|
{
|
||||||
PIOBJECT_SUBCLASS(PIProcess, PIThread)
|
PIOBJECT_SUBCLASS(PIProcess, PIThread)
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user