#ifndef UTILS_H #define UTILS_H #define CLASS_NAME metaObject()->className() #define INSTANCE(OBJ) OBJ::getInstance() #define EVENT_SENDER(OBJ) OBJ::getInstance()->getEventSender() #define EVENT_RECEIVER(OBJ) OBJ::getInstance()->getEventReceiver() #define CONNECT_REQ_PATH(SENDER, RECEIVER) \ connect(EVENT_SENDER(SENDER), &UsEventSender::commandRequest, \ EVENT_RECEIVER(RECEIVER), &UsEventReceiver::newCommandRequest); \ connect(EVENT_RECEIVER(RECEIVER), &UsEventReceiver::commandResponse, \ EVENT_SENDER(SENDER), &UsEventSender::newCommandResponse); #define CONNECT_RESPONSE_PATH(RECEIVER) \ connect(EVENT_RECEIVER(RECEIVER), &UsEventReceiver::commandResponse, \ _eventSender, &UsEventSender::newCommandResponse) #define CONNECT_RESULT_PATH(SENDER, RECEIVER) \ connect(EVENT_SENDER(SENDER), \ &UsEventSender::commandResult, \ _eventReceiver, &UsEventReceiver::newCommandResult) #define GET_COMMAND_TYPE(REQUEST) REQUEST.getCommandType() #define COMMAND_TYPE(COMMAND) ECommandType::COMMAND #define CHECK_COMMAND_TYPE(REQUEST, COMMAND) \ GET_COMMAND_TYPE(REQUEST) == COMMAND_TYPE(COMMAND) #define SND_REQ_NO_ARG(command, ...) \ _eventSender->sendRequest(ECommandType::command, \ QVector({__VA_ARGS__}), \ QVector()) //#define GET_VALUE(REQUEST, INDEX, TYPE) REQUEST.getValueList()[INDEX].value() #define PATH_CONCAT(P1, P2) P1 + "/" + P2 #endif // UTILS_H