Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing virtual destructors #31

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading