This commit is contained in:
2022-03-18 01:28:07 +03:00
parent 7a26ae7292
commit 20e0771331
3 changed files with 284 additions and 64 deletions

View File

@@ -5,8 +5,8 @@ class ObjectA: public PIObject {
PIOBJECT(ObjectA)
public:
EVENT_HANDLER1(void, handlerA, const PIString & , str) {piCoutObj << "handler A:" << str;}
EVENT2(eventA2, int, i, float, f);
EVENT1(eventA1, const PIString & , str);
EVENT2(eventA2, int, i, float, f);
};
class ObjectB: public PIObject {
@@ -26,7 +26,11 @@ int main(int argc, char * argv[]) {
CONNECT1(void, PIString, &obj_b, eventB, &obj_a, handlerA);
obj_b.eventB("event to handler");
CONNECT1(void, PIString, &obj_a, eventA1, &obj_b, eventB);
CONNECTU(&obj_a, eventA1, &obj_b, eventB);
obj_a.eventA1("event to event");
obj_a.piDisconnect("eventA1");
CONNECTL(&obj_a, eventA1, ([](const PIString & str){piCout << str;}));
obj_a.eventA1("event to lambda");
};
//! [main]