Devirtualize NameAndLocation query on trackers

This commit is contained in:
Martin Hořeňovský 2020-06-13 19:26:17 +02:00
parent cbbebb65b6
commit 288416f501
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
2 changed files with 17 additions and 11 deletions

View File

@ -65,15 +65,12 @@ namespace TestCaseTracking {
}
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
: m_nameAndLocation( nameAndLocation ),
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
ITracker(nameAndLocation),
m_ctx( ctx ),
m_parent( parent )
{}
NameAndLocation const& TrackerBase::nameAndLocation() const {
return m_nameAndLocation;
}
bool TrackerBase::isComplete() const {
return m_runState == CompletedSuccessfully || m_runState == Failed;
}

View File

@ -29,15 +29,26 @@ namespace TestCaseTracking {
}
};
struct ITracker;
class ITracker;
using ITrackerPtr = std::shared_ptr<ITracker>;
struct ITracker {
virtual ~ITracker();
class ITracker {
NameAndLocation m_nameAndLocation;
public:
ITracker(NameAndLocation const& nameAndLoc) :
m_nameAndLocation(nameAndLoc)
{}
// static queries
virtual NameAndLocation const& nameAndLocation() const = 0;
NameAndLocation const& nameAndLocation() const {
return m_nameAndLocation;
}
virtual ~ITracker();
// dynamic queries
virtual bool isComplete() const = 0; // Successfully completed or failed
@ -98,7 +109,6 @@ namespace TestCaseTracking {
};
using Children = std::vector<ITrackerPtr>;
NameAndLocation m_nameAndLocation;
TrackerContext& m_ctx;
ITracker* m_parent;
Children m_children;
@ -107,7 +117,6 @@ namespace TestCaseTracking {
public:
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
NameAndLocation const& nameAndLocation() const override;
bool isComplete() const override;
bool isSuccessfullyCompleted() const override;
bool isOpen() const override;