Skip to content

Commit

Permalink
Merge pull request #31 from ethz-asl/fix/virtual-dtors
Browse files Browse the repository at this point in the history
Fix missing virtual destructors
  • Loading branch information
4c3y authored Nov 12, 2024
2 parents 03c55f6 + 0bef296 commit 001883e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ $ git submodule add [email protected]:ethz-asl/lpp.git
```cmake
add_subdirectory(my_submodule_dir/lpp)
add_executable(my_executable main.cpp)
target_link_libraries(my_executable Log++)
target_link_libraries(my_executable lpp)
```

3. To update Log++ to the latest commit, execute the following commands:
Expand Down
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
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>lpp</name>
<version>0.1.0</version>
<description>Log++ Logging framework</description>
<maintainer email="[email protected]">4c3y</maintainer>
<maintainer email="[email protected]">4c3y</maintainer>
<license>BSD</license>
<buildtool_depend>catkin</buildtool_depend>
<depend>roscpp</depend>
Expand Down

0 comments on commit 001883e

Please sign in to comment.