-
Notifications
You must be signed in to change notification settings - Fork 4
refactor(orderGraphValidator): Isolate OrderGraphValidator and use vda5050_types
#13
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
Open
shawnkchan
wants to merge
38
commits into
develop
Choose a base branch
from
feat/dev-orderGraphValidator
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+928
−2
Open
Changes from 24 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
1a3e15b
initial commit
shawnkchan 5abe26f
feat: add header file for order_graph_validator
shawnkchan 7ddb89c
feat: add unit tests for order_graph_validator
shawnkchan 803a323
fix: use vda5050_types
shawnkchan 12fd3a1
fix: use vda5050_types in tests
shawnkchan cae3c3b
chore: add package and tests to cmake
shawnkchan becce38
fix: fix linting errors
shawnkchan 2e9ca5b
refactor: place order_graph_validator in order directort
shawnkchan ef4bccc
refactor: place order_graph_validator in client directory
shawnkchan 135c0c3
refactor: move order_graph_manager into client/order directory
shawnkchan 6179f8c
refactor: move order_graph_validator into vda5050_core::client::order…
shawnkchan 0c8a8f0
refactor: update order_graph_validator to use VDA5050 logging macros …
shawnkchan a771210
feat: crete validation_result struct for more detailed error reporting
shawnkchan 6061e79
fix: reimplement is_in_traversal_order function
shawnkchan acb2a96
refactor: update tests according to new order_graph_validator
shawnkchan 2d69c21
feat: add equality and inequality operators for testing purposes
shawnkchan 5647d38
chore: update CMakeLists
shawnkchan 77aee79
style: apply clang-format
shawnkchan b8ac8d5
style: apply clang-format to order_graph_validator test
shawnkchan 29e1e43
chore: disable if else style check for cpplint during testing
shawnkchan fd04ac0
style: add space before comment
shawnkchan 58be0ae
refactor: remove equality and inequality checks as tests do not requi…
shawnkchan d5a6b38
test: make test cases more detailed
shawnkchan 42d6a64
refactor: change Error Level of graph validation errors to WARNING in…
shawnkchan ce90e6f
feat: add function checking for valid sequenceIds
shawnkchan fb2f40d
feat: create graph_element struct for easier management of nodes and …
shawnkchan 553ecdc
refactor: refactor order_graph_manager to do additional checks for gr…
shawnkchan bce7af2
chore: remove line to find gtest package in CMakeLists
shawnkchan 5cc4b70
chore: make classes explicit
shawnkchan 04c011f
chore: move fmt header to top of file
shawnkchan a451f90
chore: temporary change to use "" instead of <> for vda5050_types to …
shawnkchan 8eb611c
fix: change include back to use <> for vda5050_types
shawnkchan e009b26
feat: update test cases
shawnkchan 8e5f90f
chore: update description of in_traversal_order()
shawnkchan c7faa4b
refactor: revised graph validator and test cases
Johnarman1398 1b3d073
chore: lint
Johnarman1398 ee9200c
chore: lint
Johnarman1398 1f87a73
chore: merged changes from develop
Johnarman1398 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
vda5050_core/include/vda5050_core/client/order/order_graph_validator.hpp
shawnkchan marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /** | ||
| * Copyright (C) 2025 ROS-Industrial Consortium Asia Pacific | ||
| * Advanced Remanufacturing and Technology Centre | ||
| * A*STAR Research Entities (Co. Registration No. 199702110H) | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef VDA5050_CORE__CLIENT__ORDER__ORDER_GRAPH_VALIDATOR_HPP_ | ||
| #define VDA5050_CORE__CLIENT__ORDER__ORDER_GRAPH_VALIDATOR_HPP_ | ||
|
|
||
| #include <vector> | ||
|
|
||
| #include "vda5050_core/client/order/validation_result.hpp" | ||
| #include "vda5050_types/order.hpp" | ||
Johnarman1398 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| namespace vda5050_core { | ||
| namespace client { | ||
| namespace order { | ||
|
|
||
| /// \brief Utility class with functions to perform validity checks on the graph | ||
| /// contained in a VDA5050 Order message | ||
| class OrderGraphValidator | ||
| { | ||
| public: | ||
| /// \brief Checks that the nodes and edges in a VDA5050 Order form a valid | ||
| /// graph according to the VDA5050 specification sheet. | ||
| /// | ||
| /// \return True if nodes and edges create a valid graph, false otherwise | ||
shawnkchan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| static ValidationResult is_valid_graph(const vda5050_types::Order& order); | ||
|
|
||
| private: | ||
| /// \brief Checks that the nodes and edges contained in a VDA5050 Order are | ||
| /// arranged according to their sequenceId | ||
| /// | ||
| /// \return True if nodes and edges are arranged according to their | ||
| /// sequenceId, false otherwise | ||
| static ValidationResult is_in_traversal_order( | ||
| const vda5050_types::Order& order); | ||
|
|
||
| /// \brief Checks that startNodeId and endNodeId of all edges in a VDA5050 | ||
| /// Order match with its the start and end nodeIds | ||
| /// | ||
| /// \return True if all edges' startNodeId and endNodId match, false otherwise | ||
| static ValidationResult is_valid_edges(const vda5050_types::Order& order); | ||
| }; | ||
|
|
||
| } // namespace order | ||
| } // namespace client | ||
| } // namespace vda5050_core | ||
|
|
||
| #endif // VDA5050_CORE__CLIENT__ORDER__ORDER_GRAPH_VALIDATOR_HPP_ | ||
45 changes: 45 additions & 0 deletions
45
vda5050_core/include/vda5050_core/client/order/validation_result.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /** | ||
| * Copyright (C) 2025 ROS-Industrial Consortium Asia Pacific | ||
| * Advanced Remanufacturing and Technology Centre | ||
| * A*STAR Research Entities (Co. Registration No. 199702110H) | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #ifndef VDA5050_CORE__CLIENT__ORDER__VALIDATION_RESULT_HPP_ | ||
| #define VDA5050_CORE__CLIENT__ORDER__VALIDATION_RESULT_HPP_ | ||
|
|
||
| #include "vector" | ||
|
|
||
| #include <vda5050_types/error.hpp> | ||
|
|
||
| namespace vda5050_core { | ||
| namespace client { | ||
| namespace order { | ||
|
|
||
| /// \brief Struct that details the validity of an order | ||
| struct ValidationResult | ||
| { | ||
| /// \brief True if an order is valid, false otherwise | ||
| bool valid; | ||
|
|
||
| /// \brief A vector of error(s) that resulted in an invalid order. Empty if | ||
| /// order is valid. | ||
| std::vector<vda5050_types::Error> errors; | ||
| }; | ||
|
|
||
| } // namespace order | ||
| } // namespace client | ||
| } // namespace vda5050_core | ||
|
|
||
| #endif // VDA5050_CORE__CLIENT__ORDER__VALIDATION_RESULT_HPP_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't think you need to bring in
ament_cmake_gtestseparately. The previousament_cmake_gmockmost probably does that