RecordedEvent: make members private
This commit is contained in:
parent
273452d8c6
commit
c863e52001
2 changed files with 42 additions and 10 deletions
|
@ -133,17 +133,17 @@ bool ChildSession::_handleInput(const char *buffer, int length)
|
|||
for (const auto& eventPair : viewPair.second)
|
||||
{
|
||||
const RecordedEvent& event = eventPair.second;
|
||||
LOG_TRC("Replaying missed view event: " << viewPair.first << " " << LOKitHelper::kitCallbackTypeToString(event._type)
|
||||
<< ": " << event._payload);
|
||||
loKitCallback(event._type, event._payload);
|
||||
LOG_TRC("Replaying missed view event: " << viewPair.first << " " << LOKitHelper::kitCallbackTypeToString(event.getType())
|
||||
<< ": " << event.getPayload());
|
||||
loKitCallback(event.getType(), event.getPayload());
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& eventPair : _stateRecorder.getRecordedEvents())
|
||||
{
|
||||
const RecordedEvent& event = eventPair.second;
|
||||
LOG_TRC("Replaying missed event: " << LOKitHelper::kitCallbackTypeToString(event._type) << ": " << event._payload);
|
||||
loKitCallback(event._type, event._payload);
|
||||
LOG_TRC("Replaying missed event: " << LOKitHelper::kitCallbackTypeToString(event.getType()) << ": " << event.getPayload());
|
||||
loKitCallback(event.getType(), event.getPayload());
|
||||
}
|
||||
|
||||
for (const auto& pair : _stateRecorder.getRecordedStates())
|
||||
|
@ -154,8 +154,8 @@ bool ChildSession::_handleInput(const char *buffer, int length)
|
|||
|
||||
for (const auto& event : _stateRecorder.getRecordedEventsVector())
|
||||
{
|
||||
LOG_TRC("Replaying missed event (part of sequence): " << LOKitHelper::kitCallbackTypeToString(event._type) << ": " << event._payload);
|
||||
loKitCallback(event._type, event._payload);
|
||||
LOG_TRC("Replaying missed event (part of sequence): " << LOKitHelper::kitCallbackTypeToString(event.getType()) << ": " << event.getPayload());
|
||||
loKitCallback(event.getType(), event.getPayload());
|
||||
}
|
||||
|
||||
_stateRecorder.clear();
|
||||
|
|
|
@ -78,8 +78,40 @@ public:
|
|||
|
||||
struct RecordedEvent
|
||||
{
|
||||
int _type;
|
||||
private:
|
||||
int _type = 0;
|
||||
std::string _payload;
|
||||
|
||||
public:
|
||||
RecordedEvent()
|
||||
{
|
||||
}
|
||||
|
||||
RecordedEvent(int type, const std::string& payload)
|
||||
: _type(type),
|
||||
_payload(payload)
|
||||
{
|
||||
}
|
||||
|
||||
void setType(int type)
|
||||
{
|
||||
_type = type;
|
||||
}
|
||||
|
||||
int getType() const
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
void setPayload(const std::string& payload)
|
||||
{
|
||||
_payload = payload;
|
||||
}
|
||||
|
||||
const std::string& getPayload() const
|
||||
{
|
||||
return _payload;
|
||||
}
|
||||
};
|
||||
|
||||
/// When the session is inactive, we need to record its state for a replay.
|
||||
|
@ -128,7 +160,7 @@ public:
|
|||
|
||||
void recordEvent(const int type, const std::string& payload)
|
||||
{
|
||||
_recordedEvents[type] = {type, payload};
|
||||
_recordedEvents[type] = RecordedEvent(type, payload);
|
||||
}
|
||||
|
||||
void recordViewEvent(const int viewId, const int type, const std::string& payload)
|
||||
|
@ -145,7 +177,7 @@ public:
|
|||
/// the final state.
|
||||
void recordEventSequence(const int type, const std::string& payload)
|
||||
{
|
||||
_recordedEventsVector.push_back({type, payload});
|
||||
_recordedEventsVector.emplace_back(type, payload);
|
||||
}
|
||||
|
||||
void clear()
|
||||
|
|
Loading…
Reference in a new issue