#15 убрать PIP_CXX11_SUPPORT

This commit is contained in:
2020-07-17 11:51:30 +03:00
parent 33a6382f4d
commit b772928dc1
11 changed files with 8 additions and 92 deletions

View File

@@ -459,9 +459,7 @@
#define CONNECTU(src, event, dest, handler) PIObject::piConnectU(src, PIStringAscii(#event), dest, dest, PIStringAscii(#handler), LOCATION);
#define CONNECTU_QUEUED(src, event, dest, handler, performer) PIObject::piConnectU(src, PIStringAscii(#event), dest, dest, PIStringAscii(#handler), LOCATION, performer);
#ifdef PIP_CXX11_SUPPORT
# define CONNECTL(src, event, functor) PIObject::piConnectLS(src, PIStringAscii(#event), PIObject::__newFunctor(&(src)->__stat_eh_##event##__, functor), LOCATION);
#endif
#define CONNECTL(src, event, functor) PIObject::piConnectLS(src, PIStringAscii(#event), PIObject::__newFunctor(&(src)->__stat_eh_##event##__, functor), LOCATION);
#define CONNECT0(ret, src, event, dest, handler) PIObject::piConnect(src, PIStringAscii(#event), dest, dest, (void*)(ret(*)(void*))(&(dest)->__stat_eh_##handler##__), (void*)(void(*)(void*))(&(src)->__stat_eh_##event##__), 0, LOCATION);
#define CONNECT1(ret, a0, src, event, dest, handler) PIObject::piConnect(src, PIStringAscii(#event), dest, dest, (void*)(ret(*)(void*, a0))(&(dest)->__stat_eh_##handler##__), (void*)(void(*)(void*, a0))(&(src)->__stat_eh_##event##__), 1, LOCATION);
@@ -499,21 +497,13 @@ class PIP_EXPORT PIObject {
typedef void __Parent__;
friend class PIIntrospection;
public:
NO_COPY_CLASS(PIObject)
//! Contructs PIObject with name "name"
explicit PIObject(const PIString & name = PIString());
virtual ~PIObject();
#ifdef PIP_CXX11_SUPPORT
explicit PIObject(const PIObject & ) = delete;
void operator =(const PIObject & ) = delete;
#else
private:
explicit PIObject(const PIObject & );
void operator =(const PIObject & );
#endif
private:
uint _signature_;
@@ -607,13 +597,11 @@ public:
// / Direct connect
static void piConnect(PIObject * src, const PIString & sig, PIObject * dest_o, void * dest, void * ev_h, void * e_h, int args, const char * loc);
static bool piConnectU(PIObject * src, const PIString & sig, PIObject * dest_o, void * dest, const PIString & hname, const char * loc, PIObject * performer = 0);
#ifdef PIP_CXX11_SUPPORT
static bool piConnectLS(PIObject * src, const PIString & sig, std::function<void()> * f, const char * loc);
template <typename INPUT, typename... TYPES>
static std::function<void()> * __newFunctor(void(*stat_handler)(void*,TYPES...), INPUT functor) {
return (std::function<void()>*)(new std::function<void(TYPES...)>(functor));
}
#endif
// / Through names and mixed
static void piConnect(const PIString & src, const PIString & sig, void * dest, void * ev_h);
@@ -635,11 +623,9 @@ public:
for (int j = 0; j < sender->connections.size_s(); ++j) {
__Connection i(sender->connections[j]);
if (i.eventID != eventID) continue;
#ifdef PIP_CXX11_SUPPORT
if (i.functor) {
(*(i.functor))();
} else {
#endif
if (i.performer) {
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender));
} else {
@@ -652,9 +638,7 @@ public:
if (ts) i.dest_o->mutex_.unlock();
}
}
#ifdef PIP_CXX11_SUPPORT
}
#endif
if (!sender->isPIObject()) break;
}
}
@@ -664,11 +648,9 @@ public:
for (int j = 0; j < sender->connections.size_s(); ++j) {
__Connection i(sender->connections[j]);
if (i.eventID != eventID) continue;
#ifdef PIP_CXX11_SUPPORT
if (i.functor) {
(*((std::function<void(T0)>*)i.functor))(v0);
} else {
#endif
if (i.performer) {
PIVector<PIVariant> vl;
if (i.args_count > 0) vl << PIVariant::fromValue(v0);
@@ -684,9 +666,7 @@ public:
if (ts) i.dest_o->mutex_.unlock();
}
}
#ifdef PIP_CXX11_SUPPORT
}
#endif
if (!sender->isPIObject()) break;
}
}
@@ -695,11 +675,9 @@ public:
for (int j = 0; j < sender->connections.size_s(); ++j) {
__Connection i(sender->connections[j]);
if (i.eventID != eventID) continue;
#ifdef PIP_CXX11_SUPPORT
if (i.functor) {
(*((std::function<void(T0, T1)>*)i.functor))(v0, v1);
} else {
#endif
if (i.performer) {
PIVector<PIVariant> vl;
if (i.args_count > 0) vl << PIVariant::fromValue(v0);
@@ -719,9 +697,7 @@ public:
if (ts) i.dest_o->mutex_.unlock();
}
}
#ifdef PIP_CXX11_SUPPORT
}
#endif
if (!sender->isPIObject()) break;
}
}
@@ -730,11 +706,9 @@ public:
for (int j = 0; j < sender->connections.size_s(); ++j) {
__Connection i(sender->connections[j]);
if (i.eventID != eventID) continue;
#ifdef PIP_CXX11_SUPPORT
if (i.functor) {
(*((std::function<void(T0, T1, T2)>*)i.functor))(v0, v1, v2);
} else {
#endif
if (i.performer) {
PIVector<PIVariant> vl;
if (i.args_count > 0) vl << PIVariant::fromValue(v0);
@@ -756,9 +730,7 @@ public:
if (ts) i.dest_o->mutex_.unlock();
}
}
#ifdef PIP_CXX11_SUPPORT
}
#endif
if (!sender->isPIObject()) break;
}
}
@@ -767,11 +739,9 @@ public:
for (int j = 0; j < sender->connections.size_s(); ++j) {
__Connection i(sender->connections[j]);
if (i.eventID != eventID) continue;
#ifdef PIP_CXX11_SUPPORT
if (i.functor) {
(*((std::function<void(T0, T1, T2, T3)>*)i.functor))(v0, v1, v2, v3);
} else {
#endif
if (i.performer) {
PIVector<PIVariant> vl;
if (i.args_count > 0) vl << PIVariant::fromValue(v0);
@@ -795,9 +765,7 @@ public:
if (ts) i.dest_o->mutex_.unlock();
}
}
#ifdef PIP_CXX11_SUPPORT
}
#endif
if (!sender->isPIObject()) break;
}
}
@@ -897,16 +865,12 @@ private:
dest = d;
args_count = ac;
performer = p;
#ifdef PIP_CXX11_SUPPORT
functor = 0;
#endif
}
void destroy();
void * slot;
void * signal;
#ifdef PIP_CXX11_SUPPORT
std::function<void()> * functor;
#endif
PIString event;
uint eventID;
PIObject * dest_o;