add option to add bits to setDataHandlerState()
This commit is contained in:
@@ -1027,11 +1027,11 @@ void Message::decodeJson(bool leadingSeparator, bool appendDirectionCondition, b
|
|||||||
*output << "\n }";
|
*output << "\n }";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Message::setDataHandlerState(int state) {
|
bool Message::setDataHandlerState(int state, bool addBits) {
|
||||||
if (state == m_dataHandlerState) {
|
if (addBits ? state == (m_dataHandlerState&state) : state == m_dataHandlerState) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_dataHandlerState = state;
|
m_dataHandlerState = addBits ? m_dataHandlerState|state : state;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -534,9 +534,10 @@ class Message : public AttributedItem {
|
|||||||
/**
|
/**
|
||||||
* Set the arbitrary state value for data handlers.
|
* Set the arbitrary state value for data handlers.
|
||||||
* @param state the new state value.
|
* @param state the new state value.
|
||||||
|
* @param addBits true to add the new state value bits to the existing state.
|
||||||
* @return true when the state was changed.
|
* @return true when the state was changed.
|
||||||
*/
|
*/
|
||||||
bool setDataHandlerState(int state);
|
bool setDataHandlerState(int state, bool addBits = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the time when this message was last seen with reasonable data.
|
* Get the time when this message was last seen with reasonable data.
|
||||||
|
|||||||
Reference in New Issue
Block a user