Mark one-parameter constructors as explicit & use override where possible

This commit marks (hopefully) ever one-parameter constructor as explicit.

It also uses override in (hopefully) all circumstances where a virtual
method is overridden.

There are a very few other minor changes - most of them were necessary
to get everything to compile (like one additional constructor). In one
case I changed an implicit operation to an explicit string conversion -
I think the automatically chosen conversion was much more convoluted.

This took longer than I want to admit but not as long as I feared :)
This commit is contained in:
Johanna Amann 2018-03-16 22:14:22 -07:00
parent 1f2bf50b49
commit 6d612ced3d
173 changed files with 1052 additions and 1046 deletions

View file

@ -56,7 +56,7 @@ class Timer : public SerialObj, public PQ_Element {
public:
Timer(double t, TimerType arg_type) : PQ_Element(t)
{ type = (char) arg_type; }
virtual ~Timer() { }
~Timer() override { }
TimerType Type() const { return (TimerType) type; }
@ -118,7 +118,7 @@ public:
static unsigned int* CurrentTimers() { return current_timers; }
protected:
TimerMgr(const Tag& arg_tag)
explicit TimerMgr(const Tag& arg_tag)
{
t = 0.0;
num_expired = 0;
@ -141,19 +141,19 @@ protected:
class PQ_TimerMgr : public TimerMgr {
public:
PQ_TimerMgr(const Tag& arg_tag);
~PQ_TimerMgr();
explicit PQ_TimerMgr(const Tag& arg_tag);
~PQ_TimerMgr() override;
void Add(Timer* timer);
void Expire();
void Add(Timer* timer) override;
void Expire() override;
int Size() const { return q->Size(); }
int PeakSize() const { return q->PeakSize(); }
uint64 CumulativeNum() const { return q->CumulativeNum(); }
int Size() const override { return q->Size(); }
int PeakSize() const override { return q->PeakSize(); }
uint64 CumulativeNum() const override { return q->CumulativeNum(); }
protected:
int DoAdvance(double t, int max_expire);
void Remove(Timer* timer);
int DoAdvance(double t, int max_expire) override;
void Remove(Timer* timer) override;
Timer* Remove() { return (Timer*) q->Remove(); }
Timer* Top() { return (Timer*) q->Top(); }
@ -163,20 +163,20 @@ protected:
class CQ_TimerMgr : public TimerMgr {
public:
CQ_TimerMgr(const Tag& arg_tag);
~CQ_TimerMgr();
explicit CQ_TimerMgr(const Tag& arg_tag);
~CQ_TimerMgr() override;
void Add(Timer* timer);
void Expire();
void Add(Timer* timer) override;
void Expire() override;
int Size() const { return cq_size(cq); }
int PeakSize() const { return cq_max_size(cq); }
uint64 CumulativeNum() const { return cq_cumulative_num(cq); }
int Size() const override { return cq_size(cq); }
int PeakSize() const override { return cq_max_size(cq); }
uint64 CumulativeNum() const override { return cq_cumulative_num(cq); }
unsigned int MemoryUsage() const;
protected:
int DoAdvance(double t, int max_expire);
void Remove(Timer* timer);
int DoAdvance(double t, int max_expire) override;
void Remove(Timer* timer) override;
struct cq_handle *cq;
};