Skip to content

Commit 00f21bf

Browse files
committed
Add virtual destructors to polymorphic classes
1 parent fe0bcbd commit 00f21bf

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

include/CXXGraph/Partitioning/PartitionState.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ namespace Partitioning {
4040
template <typename T>
4141
class PartitionState {
4242
public:
43+
virtual ~PartitionState() = default;
44+
4345
virtual shared<Record<T>> getRecord(CXXGraph::id_t x) = 0;
4446
virtual int getMachineLoad(const int m) const = 0;
4547
virtual int getMachineWeight(const int m) const = 0;

include/CXXGraph/Partitioning/PartitionStrategy.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ namespace Partitioning {
3939
template <typename T>
4040
class PartitionStrategy {
4141
public:
42+
virtual ~PartitionStrategy() = default;
43+
4244
virtual void performStep(shared<const Edge<T>> t,
4345
shared<PartitionState<T>> Sstate) = 0;
4446
};

include/CXXGraph/Partitioning/Record.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ namespace Partitioning {
2929
template <typename T>
3030
class Record {
3131
public:
32+
virtual ~Record() = default;
33+
3234
virtual const std::set<int> &getPartitions() const = 0;
3335
virtual void addPartition(const int m) = 0;
3436
virtual bool hasReplicaInPartition(const int m) const = 0;
@@ -41,4 +43,4 @@ class Record {
4143
} // namespace Partitioning
4244
} // namespace CXXGraph
4345

44-
#endif // __CXXGRAPH_PARTITIONING_RECORD_H__
46+
#endif // __CXXGRAPH_PARTITIONING_RECORD_H__

include/CXXGraph/Utility/Runnable.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
namespace CXXGraph {
2626
class Runnable {
2727
public:
28+
virtual ~Runnable() = default;
29+
2830
virtual void run() = 0;
2931
};
3032
} // namespace CXXGraph

0 commit comments

Comments
 (0)