-
Notifications
You must be signed in to change notification settings - Fork 25
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
Refactor modeler code #2616
Refactor modeler code #2616
Conversation
pet-mit
commented
Feb 3, 2025
•
edited
Loading
edited
- move "expressions" code to src/expressions
- move optimisation sources to src/optimisatio,
- move yml importers to src/io
Signed-off-by: Peter Mitri <[email protected]>
Signed-off-by: Peter Mitri <[email protected]>
Signed-off-by: Peter Mitri <[email protected]>
this line must be updated in order to avoid sonar issues:
|
@@ -3,7 +3,7 @@ | |||
#include <stack> | |||
#include <vector> | |||
|
|||
namespace Antares::Solver::Nodes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this file named pre-order.h whereas it contains declaration of class AST ?
AST seems to be the main topic here, at least the feature we should highlight.
Class ASTPreOrderIterator is an implementation detail.
Rename into ast.h ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-zakir opinion ?
) | ||
|
||
|
||
add_library(expressions-iterators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This remark follows this one.
About expressions-iterators target : as it mainly defines class AST, and AST is central to expressions, these files should be part of expressions target.
@@ -22,11 +22,11 @@ | |||
#pragma once | |||
#include <stdexcept> | |||
|
|||
namespace Antares::Solver::Visitors | |||
namespace Antares::Expressions::Visitors | |||
{ | |||
class InvalidNode: public std::invalid_argument | |||
{ | |||
public: | |||
explicit InvalidNode(const std::string& node_name = ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dangerous to have a default argument here (node_name = ""
).
This means we allow :
throw InvalidNode();
without specifying any node name.
In this case, if exception is caught, associated error message will be cryptic, as we don't know which node is concerned.
{ | ||
|
||
InvalidNode::InvalidNode(const std::string& node_name): | ||
std::invalid_argument("Antares::Expressions::Nodes Visitor: invalid node type " + node_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Antares::Expressions::Nodes Visitor: ..."
Does user cares about hard coded namespace things when she reads the error message of an invalid node ?
"Invalid node type " + node_name
is enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made it more "human":
"Node visitor encountered an invalid node type: " + node_name
Attempted small changes on the current PR : see #2619 |
Signed-off-by: Peter Mitri <[email protected]>
|
will be merging other PR into develop