Skip to content

Commit afcc7cf

Browse files
committed
refactor : fix some badsmells
1 parent fea6d11 commit afcc7cf

15 files changed

Lines changed: 29 additions & 30 deletions

src/app/openemsh.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void OpenEMSH::write() const {
8383
}
8484

8585
//******************************************************************************
86-
void OpenEMSH::run(std::set<Step> const& steps) {
86+
void OpenEMSH::run(std::set<Step> const& steps) const {
8787
auto const annotate = [](Step step) {
8888
Caretaker::singleton().annotate_current_timepoint(make_unique<Annotation>(step));
8989
};
@@ -129,7 +129,7 @@ void OpenEMSH::run(std::set<Step> const& steps) {
129129
}
130130

131131
//******************************************************************************
132-
void OpenEMSH::run_all_steps() {
132+
void OpenEMSH::run_all_steps() const {
133133
Caretaker::singleton().remember_current_timepoint();
134134
run({
135135
Step::DETECT_CONFLICT_EIP,
@@ -139,13 +139,13 @@ void OpenEMSH::run_all_steps() {
139139
Step::SOLVE_ALL_EIP,
140140
Step::SOLVE_ALL_CE,
141141
Step::DETECT_AND_SOLVE_TCMLP,
142-
Step::DETECT_INTERVALS,
143-
Step::MESH
142+
Step::DETECT_INTERVALS
143+
// Step::MESH
144144
});
145145
}
146146

147147
//******************************************************************************
148-
void OpenEMSH::run_next_step() {
148+
void OpenEMSH::run_next_step() const {
149149
auto& c = Caretaker::singleton();
150150
auto* t = c.find_first_ancestor_with_annotation();
151151
if(auto* a = c.get_annotation(t); a)

src/app/openemsh.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ class OpenEMSH {
6161
// void check_x();
6262

6363
void parse();
64-
void run(std::set<Step> const& steps);
65-
void run_all_steps();
66-
void run_next_step();
64+
void run(std::set<Step> const& steps) const;
65+
void run_all_steps() const;
66+
void run_next_step() const;
6767
void go_before(Step step) const;
6868
void go_before_previous_step() const;
6969
void write() const;

src/domain/board.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct BoardState final {
3636
PlaneSpace<std::vector<std::shared_ptr<Polygon>>> polygons;
3737
PlaneSpace<std::vector<Edge*>> edges;
3838

39-
BoardState(PlaneSpace<std::vector<std::shared_ptr<Polygon>>>&& polygons);
39+
explicit BoardState(PlaneSpace<std::vector<std::shared_ptr<Polygon>>>&& polygons);
4040
};
4141

4242
//******************************************************************************

src/domain/conflict_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ ConflictManager::ConflictManager(Timepoint* t)
2121
{}
2222

2323
//******************************************************************************
24-
void ConflictManager::init(MeshlinePolicyManager* line_policy_manager) {
25-
this->line_policy_manager = line_policy_manager;
24+
void ConflictManager::init(MeshlinePolicyManager* _line_policy_manager) {
25+
line_policy_manager = _line_policy_manager;
2626
}
2727

2828
/// @warning Allows geometrically inconsistent datas.

src/domain/conflict_manager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ConflictManager
4646
public:
4747
explicit ConflictManager(Timepoint* t);
4848

49-
void init(MeshlinePolicyManager* line_policy_manager);
49+
void init(MeshlinePolicyManager* _line_policy_manager);
5050

5151
void add_colinear_edges(Edge* a, Edge* b);
5252

src/domain/mesh/interval.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace domain {
1818
using namespace std;
1919

2020
//******************************************************************************
21-
Interval::Side::Side(MeshlinePolicy* meshline_policy, size_t lmin, double lambda, Coord h, Timepoint* t, function<double (double)> d_init)
21+
Interval::Side::Side(MeshlinePolicy* meshline_policy, size_t lmin, double lambda, Coord h, function<double (double)> d_init)
2222
: meshline_policy(meshline_policy)
2323
, lmin(lmin)
2424
, lambda(lambda)
@@ -45,7 +45,7 @@ Coord calc_h(Coord const& a, Coord const& b) noexcept {
4545
Interval::Interval(MeshlinePolicy* before, MeshlinePolicy* after, Axis axis, GlobalParams* global_params, Timepoint* t)
4646
: Originator(t, {
4747
.dmax = global_params->get_current_state().dmax,
48-
.before = Side(before, global_params->get_current_state().lmin, global_params->get_current_state().lambda, calc_h(before->coord, after->coord), t, [before](double d) noexcept {
48+
.before = Side(before, global_params->get_current_state().lmin, global_params->get_current_state().lambda, calc_h(before->coord, after->coord), [before](double d) noexcept {
4949
switch(before->policy) {
5050
case MeshlinePolicy::Policy::ONELINE: return 0.0;
5151
case MeshlinePolicy::Policy::HALFS: return d / 2.0;
@@ -62,7 +62,7 @@ Interval::Interval(MeshlinePolicy* before, MeshlinePolicy* after, Axis axis, Glo
6262
default: unreachable();
6363
}
6464
}),
65-
.after = Side(after, global_params->get_current_state().lmin, global_params->get_current_state().lambda, calc_h(before->coord, after->coord), t, [after](double d) noexcept {
65+
.after = Side(after, global_params->get_current_state().lmin, global_params->get_current_state().lambda, calc_h(before->coord, after->coord), [after](double d) noexcept {
6666
switch(after->policy) {
6767
case MeshlinePolicy::Policy::ONELINE: return 0.0;
6868
case MeshlinePolicy::Policy::HALFS: return d / 2.0;

src/domain/mesh/interval.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Interval
5151
std::function<double (double)> const d_init_;
5252
std::vector<Coord> ls; // TODO avoid Coord::operator= -> double
5353

54-
Side(MeshlinePolicy* meshline_policy, size_t lmin, double lambda, Coord h, Timepoint* t, std::function<double (double)> d_init);
54+
Side(MeshlinePolicy* meshline_policy, size_t lmin, double lambda, Coord h, std::function<double (double)> d_init);
5555

5656
double d_init() const;
5757
};

src/domain/meshline_policy_manager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ MeshlinePolicyManager::MeshlinePolicyManager(
4040
}
4141

4242
//******************************************************************************
43-
void MeshlinePolicyManager::init(ConflictManager* conflict_manager) {
44-
this->conflict_manager = conflict_manager;
43+
void MeshlinePolicyManager::init(ConflictManager* _conflict_manager) {
44+
conflict_manager = _conflict_manager;
4545
}
4646

4747
//******************************************************************************

src/domain/meshline_policy_manager.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class MeshlinePolicyManager // TODO MeshlineManager
4646
AxisSpace<std::vector<std::shared_ptr<MeshlinePolicy>>>&& line_policies,
4747
Timepoint* t);
4848

49-
void init(ConflictManager* conflict_manager);
49+
void init(ConflictManager* _conflict_manager);
5050

5151
MeshlinePolicy* add_meshline_policy(
5252
std::vector<IMeshLineOrigin*> origins,

src/ui/qt/processing_view/processing_view.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ ProcessingView::ProcessingView(QWidget* parent)
3030
}
3131

3232
//******************************************************************************
33-
void ProcessingView::init(domain::Board const* board) {
34-
this->board = board;
33+
void ProcessingView::init(domain::Board const* _board) {
34+
board = _board;
3535
}
3636
//******************************************************************************
3737
void ProcessingView::wheelEvent(QWheelEvent* event) {

0 commit comments

Comments
 (0)