16#ifndef MIRAI_MESSAGE_INTERFACE_HPP_
17#define MIRAI_MESSAGE_INTERFACE_HPP_
45 virtual std::unique_ptr<IMessage>
clone()
const = 0;
76template <
class Message>
91 Message& top_() {
return *
static_cast<Message*
>(
this); }
92 const Message& top_()
const {
return *
static_cast<const Message*
>(
this); }
99 std::unique_ptr<IMessage>
clone()
const override
101 return std::make_unique<Message>(top_());
std::unique_ptr< IMessage > clone() const override
static constexpr MessageTypes GetType()
static constexpr bool isSendSupported()
bool isSendSupported_() const override
MessageTypes GetType_() const override
Common interface for all message types
virtual ~IMessage()=default
virtual bool isSendSupported_() const =0
virtual bool isValid_() const =0
virtual std::unique_ptr< IMessage > clone() const =0
bool allowSend() const
检查消息是否可以用于发送
MessageTypes type() const
Return the type of the class
bool valid() const
检查消息是否有效
virtual MessageTypes GetType_() const =0