Skip to content

Commit e54a2d3

Browse files
add virtual/override, missed when I derived this class
1 parent 159059e commit e54a2d3

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

cpputest-for-qpcpp-lib/include/cmsDummyActiveObject.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ class DummyActiveObject : public QP::QActive {
9797
nullptr, 0);
9898
}
9999

100-
bool isRecorderEmpty() { return m_recordedEvents.isEmpty(); }
100+
bool isRecorderEmpty() const { return m_recordedEvents.isEmpty(); }
101101

102-
bool isAnyEventRecorded() { return !m_recordedEvents.isEmpty(); }
102+
virtual bool isAnyEventRecorded() const { return !m_recordedEvents.isEmpty(); }
103103

104-
bool isSignalRecorded(enum_t sig)
104+
virtual bool isSignalRecorded(enum_t sig)
105105
{
106106
if (!isAnyEventRecorded()) {
107107
return false;
@@ -123,7 +123,7 @@ class DummyActiveObject : public QP::QActive {
123123
}
124124

125125
protected:
126-
void RecorderEventHandler(QP::QEvt const * e)
126+
virtual void RecorderEventHandler(QP::QEvt const * e)
127127
{
128128
if (e->sig >= QP::Q_USER_SIG) {
129129
// record the event

cpputest-for-qpcpp-lib/include/cmsTestPublishedEventRecorder.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "cmsVectorBackedQEQueue.hpp"
3030
#include "qevtUniquePtr.hpp"
3131
#include "qpcpp.hpp"
32-
#include <vector>
3332

3433
namespace cms {
3534
namespace test {
@@ -60,7 +59,7 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
6059

6160
/// Upon construction and init/start, this active object will
6261
/// subscribe and record all events in the signal range:
63-
/// [startingValue .. endValue)
62+
/// [startingValue ... endValue)
6463
/// \param startingValue - starting sig value the recorder will record
6564
/// \param endValue - final value in sig range to record. This value is
6665
/// NOT recorded, rather "endValue - 1" is recorded.
@@ -69,9 +68,9 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
6968
/// recorder may store.
7069
explicit PublishedEventRecorder(enum_t startingValue, enum_t endValue,
7170
size_t maxRecordedEventCount = 100) :
72-
DummyActiveObject(),
73-
m_startingValue(startingValue), m_endValue(endValue),
74-
m_recordedEvents(maxRecordedEventCount), m_oneShotIgnoreSig(0)
71+
DummyActiveObject(), m_startingValue(startingValue),
72+
m_endValue(endValue), m_recordedEvents(maxRecordedEventCount),
73+
m_oneShotIgnoreSig(0)
7574
{
7675
}
7776

@@ -91,9 +90,7 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
9190
void recorderStart(uint_fast8_t priority)
9291
{
9392
SetPostedEventHandler(
94-
[=](QP::QEvt const* e) {
95-
this->RecorderEventHandler(e);
96-
});
93+
[=](QP::QEvt const* e) { this->RecorderEventHandler(e); });
9794

9895
dummyStart(priority);
9996

@@ -104,9 +101,12 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
104101

105102
bool isEmpty() const { return m_recordedEvents.isEmpty(); }
106103

107-
bool isAnyEventRecorded() const { return !m_recordedEvents.isEmpty(); }
104+
bool isAnyEventRecorded() const override
105+
{
106+
return !m_recordedEvents.isEmpty();
107+
}
108108

109-
bool isSignalRecorded(enum_t sig)
109+
bool isSignalRecorded(enum_t sig) override
110110
{
111111
if (!isAnyEventRecorded()) {
112112
return false;
@@ -133,7 +133,7 @@ class PublishedEventRecorder final : public DefaultDummyActiveObject {
133133
}
134134

135135
protected:
136-
void RecorderEventHandler(QP::QEvt const* e)
136+
void RecorderEventHandler(QP::QEvt const* e) override
137137
{
138138
if ((e->sig >= m_startingValue) && (e->sig < m_endValue)) {
139139
if (e->sig == m_oneShotIgnoreSig) {

0 commit comments

Comments
 (0)