diff options
| author | Léo Lam <leo@leolam.fr> | 2021-01-31 14:12:10 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2021-01-31 14:56:17 +0100 |
| commit | 176d68769881ba3a80548c89dc02f2ea4aff814a (patch) | |
| tree | 00b24c9755ab01256f33b0ae14b0adbb5a094fec /src/KingSystem/Utils/Thread/Message.cpp | |
| parent | d6ee0c9183ceb4ba19b59256b47a1a45ab50c3e7 (diff) | |
ksys: Add Message class
Diffstat (limited to 'src/KingSystem/Utils/Thread/Message.cpp')
| -rw-r--r-- | src/KingSystem/Utils/Thread/Message.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/KingSystem/Utils/Thread/Message.cpp b/src/KingSystem/Utils/Thread/Message.cpp new file mode 100644 index 00000000..96eada1d --- /dev/null +++ b/src/KingSystem/Utils/Thread/Message.cpp @@ -0,0 +1,61 @@ +#include "KingSystem/Utils/Thread/Message.h" + +namespace ksys { + +Message::Message() = default; + +Message::Message(const MesTransceiverId& source, const MesTransceiverId& destination, + const MessageType& type, void* user_data, const Message::DelayParams& delay_params, + bool x) + : mSource(source), mDestination(destination), mType(type), mUserData(user_data), + mDelayParams(delay_params), _60(x) {} + +Message::Message(const MesTransceiverId& source, const MessageType& type, void* user_data, + const Message::DelayParams& delay_params, bool x) + : mSource(source), mType(type), mUserData(user_data), mDelayParams(delay_params), _60(x) {} + +Message::~Message() = default; + +const MesTransceiverId& Message::getSource() const { + return mSource; +} + +const MesTransceiverId& Message::getDestination() const { + return mDestination; +} + +const MessageType& Message::getType() const { + return mType; +} + +void* Message::getUserData() const { + return mUserData; +} + +u32 Message::getField48() const { + return _48; +} + +bool Message::shouldBeProcessed() const { + if (mDelayParams.delay_ticks != 0) + return false; + + if (!mDelayParams.delayer) + return true; + + return mDelayParams.delayer->shouldProcessMessage(); +} + +bool Message::getField60() const { + return _60; +} + +void Message::setDestination(const MesTransceiverId& dest) { + mDestination = dest; +} + +void Message::setField48(const u32& v) { + _48 = v; +} + +} // namespace ksys |
