You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.3 KiB

#ifndef USMMIMIC_H
#define USMMIMIC_H
#define INSTANCE(OBJ) OBJ::getInstance()
#define CONNECT_COMMAND_LINE(SENDER, RECEIVER) \
do { \
connect(EVENT_SENDER(SENDER), &UsEventSender::commandRequest, \
EVENT_RECEIVER(RECEIVER), &UsEventReceiver::newCommandRequest); \
connect(EVENT_RECEIVER(RECEIVER), &UsEventReceiver::commandResponse, \
EVENT_SENDER(SENDER), &UsEventSender::newCommandResponse); \
} while(0)
#define SEND_FORGET_ASYNC(COMMAND, RECEIVER, ARGS) \
_eventSender->sendAsyncRequest(ECommandType::COMMAND, RECEIVER, ARGS)
#define SEND_FORGET_ASYNC_NO_ARG(COMMAND, RECEIVER) \
_eventSender->sendAsyncRequest(ECommandType::COMMAND, RECEIVER, {})
#define SEND_ASYNC(COMMAND, RECEIVER, ARGS, SUCCESS, FAILURE) \
_eventSender->sendAsyncRequest(ECommandType::COMMAND, RECEIVER, ARGS, SUCCESS, FAILURE)
#define SEND_ASYNC_NO_ARG(COMMAND, RECEIVER, SUCCESS, FAILURE) \
_eventSender->sendAsyncRequest(ECommandType::COMMAND, RECEIVER, {}, SUCCESS, FAILURE)
#define SEND_SYNC(COMMAND, RECEIVER, ARGS) \
_eventSender->sendSyncRequest(ECommandType::COMMAND, RECEIVER, ARGS)
#define SEND_SYNC_NO_ARG(COMMAND, RECEIVER) \
_eventSender->sendSyncRequest(ECommandType::COMMAND, RECEIVER, {})
#define GET_VALUE(REQUEST, INDEX, TYPE) REQUEST.getValueList()[INDEX].value<TYPE>()
#endif // USMMIMIC_H