Skip to content

Commit

Permalink
virtual dtors
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanming-hu committed Mar 19, 2019
1 parent b0e5c76 commit def1615
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions include/taichi/common/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ class Unit {
TC_NOT_IMPLEMENTED;
return "";
}

virtual ~Unit() {
}
};

#define TC_IMPLEMENTATION_HOLDER_NAME(T) ImplementationHolder_##T
Expand Down
6 changes: 5 additions & 1 deletion include/taichi/common/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ class Task : public Unit {
assert_info(parameters.size() == 0, "No parameters supported.");
return this->run();
}

virtual std::string run() {
return this->run(std::vector<std::string>());
}

~Task() {
}
};

TC_INTERFACE(Task)
Expand Down Expand Up @@ -65,7 +69,7 @@ task_invoke(const T &func, const std::vector<std::string> &params) {
#define TC_REGISTER_TASK(task) \
class Task_##task : public taichi::Task { \
std::string run(const std::vector<std::string> &parameters) override { \
return taichi::task_invoke<decltype(task)>(task, parameters); \
return taichi::task_invoke<decltype(task)>(task, parameters); \
} \
}; \
TC_IMPLEMENTATION(Task, Task_##task, #task)
Expand Down
3 changes: 3 additions & 0 deletions include/taichi/dynamics/fluid2d/fluid.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ class Fluid {
return Array<real>(Vector2i(0, 0));
}

virtual ~Fluid() {
}

protected:
std::vector<Particle> particles;
};
Expand Down
5 changes: 4 additions & 1 deletion include/taichi/visual/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class Canvas {
Vector4 color) {
position = transform(position);
#if defined(TC_AMALGAMATED)
auto ttf_path = std::string(""); // use amalgamated font
auto ttf_path = std::string(""); // use amalgamated font
#else
char *root_dir = std::getenv("TAICHI_REPO_DIR");
TC_ASSERT(root_dir != nullptr);
Expand Down Expand Up @@ -497,6 +497,9 @@ class GUI : public GUIBase {
void set_hover(bool val) {
hover = val;
}

virtual ~Widget() {
}
};

std::vector<std::unique_ptr<Widget>> widgets;
Expand Down
2 changes: 2 additions & 0 deletions include/taichi/visualization/particle_visualization.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class ParticleRenderer {
virtual void render(Array2D<Vector3> &buffer,
const std::vector<RenderParticle> &particles) const {
}

virtual ~ParticleRenderer() {};
};

std::shared_ptr<Texture> rasterize_render_particles(
Expand Down

0 comments on commit def1615

Please sign in to comment.