Skip to content

Commit

Permalink
Make some dtors virtual
Browse files Browse the repository at this point in the history
  • Loading branch information
4c3y committed Oct 16, 2024
1 parent 03c55f6 commit 672a9e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/log++.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ class InternalCondLog : public InternalLog {
: InternalLog(severity) {
should_print_ = cond;
}
~InternalCondLog() override = default;
};


Expand All @@ -679,12 +680,14 @@ class LogPolicyBase {
virtual void update() = 0;
[[nodiscard]] virtual bool shouldLog() const = 0;
virtual void onLog() {};
virtual ~LogPolicyBase() = default;
};

template<typename T>
class LogPolicy : public LogPolicyBase {
public:
explicit LogPolicy(T max) : max_(max) {}
~LogPolicy() override = default;
protected:
T max_{0};
};
Expand Down Expand Up @@ -716,7 +719,7 @@ class OccasionPolicy : public CountableLogPolicy {
return should_log_;
}

virtual ~OccasionPolicy() = default;
~OccasionPolicy() override = default;
private:
bool should_log_{false};
};
Expand All @@ -738,7 +741,7 @@ class FirstNOccurrencesPolicy : public CountableLogPolicy {
return !is_n_occurences_reached;
}

virtual ~FirstNOccurrencesPolicy() = default;
~FirstNOccurrencesPolicy() override = default;
private:
bool is_n_occurences_reached = false;
};
Expand All @@ -764,7 +767,7 @@ class TimePolicy : public LogPolicy<float> {
last_ = now_;
}

virtual ~TimePolicy() = default;
~TimePolicy() override = default;
private:
long now_{0};
long last_{0};
Expand Down

0 comments on commit 672a9e5

Please sign in to comment.