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

This commit is contained in:
2017-05-23 08:53:36 +00:00
parent bd95bda39a
commit 444cc9ded3
599 changed files with 5231 additions and 5283 deletions

View File

@@ -611,10 +611,10 @@ public:
// / Raise events
static void raiseEvent(PIObject * sender, const PIString & event) {
for (int j = 0; j < sender->connections.size_s(); ++j) {
Connection & i(sender->connections[j]);
__Connection & i(sender->connections[j]);
if (i.event != event) continue;
if (i.performer) {
i.performer->postQueuedEvent(QueuedEvent(i.slot, i.dest, i.dest_o, sender));
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender));
} else {
if (sender->thread_safe_) i.dest_o->mutex_.lock();
i.dest_o->emitter_ = sender;
@@ -628,12 +628,12 @@ public:
template <typename T0>
static void raiseEvent(PIObject * sender, const PIString & event, const T0 & v0 = T0()) {
for (int j = 0; j < sender->connections.size_s(); ++j) {
Connection & i(sender->connections[j]);
__Connection & i(sender->connections[j]);
if (i.event != event) continue;
if (i.performer) {
PIVector<PIVariant> vl;
if (i.args_count > 0) vl << PIVariant::fromValue(v0);
i.performer->postQueuedEvent(QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
if (sender->thread_safe_) i.dest_o->mutex_.lock();
i.dest_o->emitter_ = sender;
@@ -647,13 +647,13 @@ public:
template <typename T0, typename T1>
static void raiseEvent(PIObject * sender, const PIString & event, const T0 & v0 = T0(), const T1 & v1 = T1()) {
for (int j = 0; j < sender->connections.size_s(); ++j) {
Connection & i(sender->connections[j]);
__Connection & i(sender->connections[j]);
if (i.event != event) continue;
if (i.performer) {
PIVector<PIVariant> vl;
if (i.args_count > 0) vl << PIVariant::fromValue(v0);
if (i.args_count > 1) vl << PIVariant::fromValue(v1);
i.performer->postQueuedEvent(QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
if (sender->thread_safe_) i.dest_o->mutex_.lock();
i.dest_o->emitter_ = sender;
@@ -670,14 +670,14 @@ public:
template <typename T0, typename T1, typename T2>
static void raiseEvent(PIObject * sender, const PIString & event, const T0 & v0 = T0(), const T1 & v1 = T1(), const T2 & v2 = T2()) {
for (int j = 0; j < sender->connections.size_s(); ++j) {
Connection & i(sender->connections[j]);
__Connection & i(sender->connections[j]);
if (i.event != event) continue;
if (i.performer) {
PIVector<PIVariant> vl;
if (i.args_count > 0) vl << PIVariant::fromValue(v0);
if (i.args_count > 1) vl << PIVariant::fromValue(v1);
if (i.args_count > 2) vl << PIVariant::fromValue(v2);
i.performer->postQueuedEvent(QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
if (sender->thread_safe_) i.dest_o->mutex_.lock();
i.dest_o->emitter_ = sender;
@@ -695,7 +695,7 @@ public:
template <typename T0, typename T1, typename T2, typename T3>
static void raiseEvent(PIObject * sender, const PIString & event, const T0 & v0 = T0(), const T1 & v1 = T1(), const T2 & v2 = T2(), const T3 & v3 = T3()) {
for (int j = 0; j < sender->connections.size_s(); ++j) {
Connection & i(sender->connections[j]);
__Connection & i(sender->connections[j]);
if (i.event != event) continue;
if (i.performer) {
PIVector<PIVariant> vl;
@@ -703,7 +703,7 @@ public:
if (i.args_count > 1) vl << PIVariant::fromValue(v1);
if (i.args_count > 2) vl << PIVariant::fromValue(v2);
if (i.args_count > 3) vl << PIVariant::fromValue(v3);
i.performer->postQueuedEvent(QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
i.performer->postQueuedEvent(__QueuedEvent(i.slot, i.dest, i.dest_o, sender, vl));
} else {
if (sender->thread_safe_) i.dest_o->mutex_.lock();
i.dest_o->emitter_ = sender;
@@ -847,8 +847,8 @@ protected:
//! \}
private:
struct Connection {
Connection(void * sl = 0, void * si = 0, const PIString & e = PIString(), PIObject * d_o = 0, void * d = 0, int ac = 0, PIObject * p = 0) {
struct __Connection {
__Connection(void * sl = 0, void * si = 0, const PIString & e = PIString(), PIObject * d_o = 0, void * d = 0, int ac = 0, PIObject * p = 0) {
slot = sl;
signal = si;
event = e;
@@ -865,8 +865,8 @@ private:
void * dest;
int args_count;
};
struct QueuedEvent {
QueuedEvent(void * sl = 0, void * d = 0, PIObject * d_o = 0, PIObject * s = 0, const PIVector<PIVariant> & v = PIVector<PIVariant>()) {
struct __QueuedEvent {
__QueuedEvent(void * sl = 0, void * d = 0, PIObject * d_o = 0, PIObject * s = 0, const PIVector<PIVariant> & v = PIVector<PIVariant>()) {
slot = sl;
dest = d;
dest_o = d_o;
@@ -885,17 +885,17 @@ private:
PIVector<__MetaFunc> findEH(const PIString & name) const;
__MetaFunc methodEH(const void * addr) const;
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 void callAddrV(void * slot, void * obj, int args, const PIVector<PIVariant> & vl);
PIVector<Connection> connections;
PIVector<__Connection> connections;
PIMap<PIString, PIVariant> properties_;
PISet<PIObject * > connectors;
PIVector<QueuedEvent> events_queue;
PIVector<__QueuedEvent> events_queue;
PIMutex mutex_, mutex_connect, mutex_queue;
PIObject * emitter_;
bool thread_safe_, proc_event_queue;