Skip to content

Commit

Permalink
[mrp] Inline ReliableMessageContext getters and setters (#13865)
Browse files Browse the repository at this point in the history
These are very simple methods, so inlining them reduces the
code size.
  • Loading branch information
Damian-Nordic authored Jan 24, 2022
1 parent 7f358b6 commit 4856390
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 55 deletions.
55 changes: 0 additions & 55 deletions src/messaging/ReliableMessageContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,56 +41,6 @@ namespace Messaging {

ReliableMessageContext::ReliableMessageContext() : mNextAckTime(0), mPendingPeerAckMessageCounter(0) {}

bool ReliableMessageContext::AutoRequestAck() const
{
return mFlags.Has(Flags::kFlagAutoRequestAck);
}

bool ReliableMessageContext::IsAckPending() const
{
return mFlags.Has(Flags::kFlagAckPending);
}

bool ReliableMessageContext::HasRcvdMsgFromPeer() const
{
return mFlags.Has(Flags::kFlagMsgRcvdFromPeer);
}

void ReliableMessageContext::SetAutoRequestAck(bool autoReqAck)
{
mFlags.Set(Flags::kFlagAutoRequestAck, autoReqAck);
}

void ReliableMessageContext::SetMsgRcvdFromPeer(bool inMsgRcvdFromPeer)
{
mFlags.Set(Flags::kFlagMsgRcvdFromPeer, inMsgRcvdFromPeer);
}

void ReliableMessageContext::SetAckPending(bool inAckPending)
{
mFlags.Set(Flags::kFlagAckPending, inAckPending);
}

void ReliableMessageContext::SetDropAckDebug(bool inDropAckDebug)
{
mFlags.Set(Flags::kFlagDropAckDebug, inDropAckDebug);
}

bool ReliableMessageContext::IsMessageNotAcked() const
{
return mFlags.Has(Flags::kFlagMesageNotAcked);
}

void ReliableMessageContext::SetMessageNotAcked(bool messageNotAcked)
{
mFlags.Set(Flags::kFlagMesageNotAcked, messageNotAcked);
}

bool ReliableMessageContext::ShouldDropAckDebug() const
{
return mFlags.Has(Flags::kFlagDropAckDebug);
}

ExchangeContext * ReliableMessageContext::GetExchangeContext()
{
return static_cast<ExchangeContext *>(this);
Expand Down Expand Up @@ -121,11 +71,6 @@ CHIP_ERROR ReliableMessageContext::FlushAcks()
return err;
}

bool ReliableMessageContext::HasPiggybackAckPending() const
{
return mFlags.Has(Flags::kFlagAckMessageCounterIsValid);
}

/**
* Process received Ack. Remove the corresponding message context from the RetransTable and execute the application
* callback
Expand Down
55 changes: 55 additions & 0 deletions src/messaging/ReliableMessageContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,60 @@ class ReliableMessageContext
uint32_t mPendingPeerAckMessageCounter;
};

inline bool ReliableMessageContext::AutoRequestAck() const
{
return mFlags.Has(Flags::kFlagAutoRequestAck);
}

inline bool ReliableMessageContext::IsAckPending() const
{
return mFlags.Has(Flags::kFlagAckPending);
}

inline bool ReliableMessageContext::HasRcvdMsgFromPeer() const
{
return mFlags.Has(Flags::kFlagMsgRcvdFromPeer);
}

inline bool ReliableMessageContext::IsMessageNotAcked() const
{
return mFlags.Has(Flags::kFlagMesageNotAcked);
}

inline bool ReliableMessageContext::ShouldDropAckDebug() const
{
return mFlags.Has(Flags::kFlagDropAckDebug);
}

inline bool ReliableMessageContext::HasPiggybackAckPending() const
{
return mFlags.Has(Flags::kFlagAckMessageCounterIsValid);
}

inline void ReliableMessageContext::SetAutoRequestAck(bool autoReqAck)
{
mFlags.Set(Flags::kFlagAutoRequestAck, autoReqAck);
}

inline void ReliableMessageContext::SetMsgRcvdFromPeer(bool inMsgRcvdFromPeer)
{
mFlags.Set(Flags::kFlagMsgRcvdFromPeer, inMsgRcvdFromPeer);
}

inline void ReliableMessageContext::SetAckPending(bool inAckPending)
{
mFlags.Set(Flags::kFlagAckPending, inAckPending);
}

inline void ReliableMessageContext::SetDropAckDebug(bool inDropAckDebug)
{
mFlags.Set(Flags::kFlagDropAckDebug, inDropAckDebug);
}

inline void ReliableMessageContext::SetMessageNotAcked(bool messageNotAcked)
{
mFlags.Set(Flags::kFlagMesageNotAcked, messageNotAcked);
}

} // namespace Messaging
} // namespace chip

0 comments on commit 4856390

Please sign in to comment.