Skip to content
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

Add EntitySelection #1059

Merged
merged 189 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
86b5b1d
`EntitySelection`の不完全な読み取り処理の追加
shouth Apr 18, 2023
bc4911b
Format include
shouth Apr 25, 2023
f7ae578
Fix wrong parsing of `SelectedEntities`
shouth Apr 25, 2023
4013aca
Ignore `EntitySelection` on engagement
shouth Apr 25, 2023
1163fb8
Make reference to `EntitySelection` error by default
shouth Apr 25, 2023
d922ac5
Use class member instead of inheritance
shouth Apr 25, 2023
8296a19
[WIP] implement tree flattening
shouth Apr 25, 2023
cd813a3
Remove unused functions
shouth May 9, 2023
a05f7db
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth May 9, 2023
0f00e23
Add `readNameRef`
shouth May 16, 2023
ce2fc54
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth May 23, 2023
338a07c
Make `EntityRef` more specific to parsing
shouth May 23, 2023
1f26185
エンティティの列挙処理の追加
shouth May 30, 2023
38e8db6
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth May 30, 2023
d035bee
`EntitySelection`の不完全な読み取り処理の追加
shouth Apr 18, 2023
4a4b875
Format include
shouth Apr 25, 2023
c330d2a
Fix wrong parsing of `SelectedEntities`
shouth Apr 25, 2023
b3e70e0
Ignore `EntitySelection` on engagement
shouth Apr 25, 2023
bf45fad
Make reference to `EntitySelection` error by default
shouth Apr 25, 2023
b3c6b2d
Use class member instead of inheritance
shouth Apr 25, 2023
e9f6d17
[WIP] implement tree flattening
shouth Apr 25, 2023
de627a1
Remove unused functions
shouth May 9, 2023
35e43c9
Add `readNameRef`
shouth May 16, 2023
4fa480e
Make `EntityRef` more specific to parsing
shouth May 23, 2023
9d2666b
Add entity enumeration
shouth May 30, 2023
36eeefb
Merge branch 'feature/interpreter/entity_selection' of https://github…
shouth May 30, 2023
4258e5e
Improve entity enumeration
shouth May 30, 2023
b140ca0
Add support for `EntitySelection` in `EntityAction`
shouth May 30, 2023
6e86571
Add `EntitySelection` support for `TriggeringEntities`
shouth May 30, 2023
b16c1b6
Update object enumeration
shouth Jun 13, 2023
79274e2
Update `Triggering_entities` to use new enumration
shouth Jun 13, 2023
8ad544f
Update `AcquirePositionAction` to handle `EntitySelection`
shouth Jun 13, 2023
07adcf8
Update `AssignRouteAction` to handle `EntitySelection`
shouth Jun 13, 2023
6ad2f29
Update `ControllerAction` to handle `EntitySelection`
shouth Jun 13, 2023
b197fc6
Update `CustomCommandAction` to handle `EntitySelection`
shouth Jun 13, 2023
a42d591
Update `EntityAction` to use new enumeration
shouth Jun 13, 2023
1751912
Update `LaneChangeAction` to handle `EntitySelection`
shouth Jun 13, 2023
01c040d
Use new enumeration in `SelectedEntities`
shouth Jun 13, 2023
8b49225
Update `SpeedAction` to handle `EntitySelection`
shouth Jun 13, 2023
c07e487
Update `SpeedProfileAction` to handle `EntitySelection`
shouth Jun 13, 2023
0b3c053
Update `TeleportAction` to handle `EntitySelection`
shouth Jun 13, 2023
376218f
Use switch for byType
shouth Jun 13, 2023
c30f787
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Jun 20, 2023
2aca9ea
Use `is_also` instead of `is`
shouth Jun 20, 2023
217523c
Format
shouth Jun 20, 2023
6cf08d8
Add constraints check for actions
shouth Jun 20, 2023
da777f1
Fix wrong message
shouth Jun 20, 2023
3c18341
Rename
shouth Jun 20, 2023
c42a6d6
Rename header
shouth Jun 20, 2023
f42ab9e
Make `entities` public
shouth Jun 20, 2023
b7247b5
Make construcotors explicit
shouth Jun 20, 2023
4f48d98
Remove redundant explicit
shouth Jun 20, 2023
6b8394a
Add simple impl of `ExternalObjectReference`
shouth Jun 20, 2023
e9cb8a3
Reorder
shouth Jun 20, 2023
20488fd
Update `ByType` to be like `EntityRef`
shouth Jun 20, 2023
e807ed6
Implement `objectTypes`
shouth Jun 20, 2023
2d01ee8
Implement constraints on entities of actions
shouth Jun 20, 2023
652aa9f
Mark constructor explicit
shouth Jun 27, 2023
627b8dd
Update `Entities::isAdded` to handle `EntitySelection`
shouth Jun 27, 2023
9853b36
Format
shouth Jun 27, 2023
43ba6ca
Simplify
shouth Jun 27, 2023
e0e9517
Remove redundant iteration
shouth Jun 27, 2023
00c1b40
Update `print_to` to print nested sequences
shouth Jun 27, 2023
376bac3
Update conditions to handle EntitySelection properly
shouth Jun 27, 2023
53ce9f1
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Jun 27, 2023
c114ced
Refactor
shouth Jun 27, 2023
92aaf78
Update to check ExternalObjectReference
shouth Jun 27, 2023
15b4ed6
Fix wrong condition
shouth Jun 27, 2023
3095c77
Refactor
shouth Jun 27, 2023
6edbc08
Fix wrong printing process
shouth Jun 27, 2023
fdd8b4f
Simplify
shouth Jun 27, 2023
864d058
Change to use inline variable instead of struct
shouth Jun 27, 2023
e8000b7
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Jul 10, 2023
ce77249
Use `set` instead of `list` to deduplicate entity
shouth Jul 11, 2023
6fbdc6b
Update not to use temporal
shouth Jul 11, 2023
92d6511
Update to fill `results` with NaN by default
shouth Jul 11, 2023
aa0152a
Add missing condition
shouth Jul 11, 2023
275f04f
Format
shouth Jul 11, 2023
6af551f
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Jul 18, 2023
f78bf48
Assign `this` first to avoid null dereference
shouth Jul 18, 2023
01a38ec
Use `Entities::isAdded`
shouth Jul 18, 2023
99e9260
Add test scenario for EntitySelection
shouth Jul 18, 2023
8ccb1e4
Add test for AccelerationCondition
shouth Jul 25, 2023
82e1ae8
Add test for StandStillCondition
shouth Jul 25, 2023
8472362
Add test for (Relative)DistanceCondition
shouth Jul 25, 2023
8ae904d
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Jul 25, 2023
df13a78
Add test for ReachPositionCondition
shouth Jul 25, 2023
5930ba2
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Aug 1, 2023
e47a848
Fix wrong argument order
shouth Aug 1, 2023
cffba69
Add test for TimeHeadwayCondition
shouth Aug 1, 2023
bb3ef7a
Refactor
shouth Aug 1, 2023
424c553
Remove wrong `return`
shouth Aug 1, 2023
4e87f15
Add test for LaneChangeAction
shouth Aug 1, 2023
9ffee3d
Fix typo
shouth Aug 1, 2023
4e9151d
Update ReleaseNotes.md
shouth Aug 1, 2023
75a5966
Fix wrong include guard
shouth Aug 1, 2023
cec490f
Fix typo
shouth Aug 1, 2023
6eb1450
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Aug 21, 2023
3a264ab
Remove unneccesary static_cast
shouth Aug 21, 2023
463a2fa
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Oct 17, 2023
c403b26
Fix weird format of ReleaseNote.md
shouth Oct 24, 2023
91e2381
Add type trait for iterator detection
shouth Oct 24, 2023
9542690
Update to use type trait
shouth Oct 24, 2023
ccc3644
Format
shouth Oct 24, 2023
d302269
Replace String entity_ref to original EntityRef
shouth Oct 24, 2023
3db16c7
Remove extra header include
shouth Oct 24, 2023
e1ecf9e
Format
shouth Oct 24, 2023
bdf2a6f
Use forward declration
shouth Oct 24, 2023
aab9137
Update to use EntityRef instead of String
shouth Oct 24, 2023
a123028
Rename HasIterator to Iterable
shouth Oct 24, 2023
b37218d
Update parameter name
shouth Oct 24, 2023
b429bd9
Reorder header
shouth Oct 24, 2023
9b289e6
Format
shouth Oct 24, 2023
3055d7b
Remove unnecessary empty check
shouth Oct 24, 2023
be0bd2b
Remove
shouth Oct 24, 2023
005ba20
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Nov 21, 2023
a579eb4
Add const version of `apply`
shouth Nov 21, 2023
803c836
Implement `Entity`
shouth Nov 21, 2023
ae691e5
Rename
shouth Nov 21, 2023
eaa0149
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Nov 28, 2023
e5e9bde
Remove extra header
shouth Nov 28, 2023
ca864bd
Add static field of object type
shouth Nov 28, 2023
688901d
Update entity exploration
shouth Nov 28, 2023
e2b5719
Remove extra include and declaration
shouth Nov 28, 2023
e486ab3
Make entity hashable
shouth Nov 28, 2023
4212385
Remove extra
shouth Nov 28, 2023
dc72d6a
[WIP] Replace Entities::objects with Entity::objects
shouth Nov 28, 2023
0d3554b
Format
shouth Nov 28, 2023
6556910
Update entity implementation to distinguish plurality
shouth Dec 19, 2023
e4a1b3d
Fix headers and declarations
shouth Dec 19, 2023
a673e1c
Format
shouth Dec 19, 2023
573e025
Fix wrong cast
shouth Dec 19, 2023
ec1a715
Revert changes on Entities
shouth Dec 19, 2023
b5090d4
Revert changes on Entities
shouth Dec 19, 2023
4253727
Revert changes on Entities
shouth Dec 19, 2023
17aa905
Revert changes on Entities
shouth Dec 19, 2023
026afba
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Dec 26, 2023
49208ec
Remove extra header
shouth Dec 26, 2023
08d6aaa
Add this to lambda capture
shouth Dec 26, 2023
6857e7b
Rename argument
shouth Dec 26, 2023
fb98db3
Use variadic function
shouth Dec 26, 2023
754add7
Rename variable
shouth Dec 26, 2023
8404917
Add `evaluate` to `GroupedEntity`
shouth Dec 26, 2023
2bd0c12
Update comparators to handle `std::valarray`
shouth Dec 26, 2023
12e0039
Format
shouth Dec 26, 2023
ed4dd8d
Simplify `AccelerationCondition::evaluate`
shouth Dec 26, 2023
6133f23
Rename
shouth Dec 26, 2023
1375b5e
Simplify for loop
shouth Dec 26, 2023
7a12816
Remove std::any_of
shouth Dec 26, 2023
a441824
Use universal reference
shouth Dec 26, 2023
5449bd8
Update entity lookup
shouth Dec 26, 2023
fb6ab31
Simplify entity inspection
shouth Dec 26, 2023
a6b9db6
Simplify entity inspection
shouth Dec 26, 2023
147feb4
Simplify entity inspection
shouth Dec 26, 2023
f8938dc
Simplify entity inspection
shouth Dec 26, 2023
e72627c
Simplify entity inspection
shouth Dec 26, 2023
b134708
Add missing `return`
shouth Dec 26, 2023
c21953d
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Dec 26, 2023
5abb119
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Feb 14, 2024
8e43902
Remove unneccessary argument name
shouth Feb 14, 2024
f547656
Remove unneccessary argument name
shouth Feb 14, 2024
16868b6
Remove unneccessary type argument
shouth Feb 14, 2024
6c6f464
Update constructor to pass args by reference
shouth Feb 14, 2024
18f4ab6
Remove extra this
shouth Feb 14, 2024
ca19efc
Update assign `this` after parsing ScenarioObject
shouth Feb 14, 2024
9a2d445
Fix constraint check
shouth Feb 14, 2024
e3d9dd2
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Feb 21, 2024
e6c58d5
Format
shouth Feb 21, 2024
8fdd483
Update example markdown to avoid link erros on CI
shouth Feb 21, 2024
141621f
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Feb 21, 2024
8ba9ef0
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Apr 22, 2024
b29826b
Update entity lookup to consider empty name
shouth Apr 22, 2024
1746ddd
Fix wrong branch
shouth Apr 22, 2024
074de5a
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth May 23, 2024
f61f2bf
Unite `GroupedEntity` and `SingleEntity` into `Entity`
shouth May 23, 2024
9d44e7d
Remove implementation-defined types
shouth May 23, 2024
983f304
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth May 23, 2024
38ebb9f
Merge branch 'feature/interpreter/entity_selection' into feature/inte…
shouth May 23, 2024
b10741f
Rename
shouth May 23, 2024
d64e7bd
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth May 30, 2024
9bd1b33
Merge branch 'feature/interpreter/entity_selection' into feature/inte…
shouth May 30, 2024
ccecfb5
Add operator overloading for ostream
shouth May 30, 2024
fde6fe2
Merge remote-tracking branch 'origin/master' into feature/interpreter…
shouth Jun 13, 2024
74a9b21
Merge branch 'master' into feature/interpreter/entity_selection
yamacir-kit Jul 11, 2024
02537e0
Merge branch 'master' into feature/interpreter/entity_selection
yamacir-kit Jul 12, 2024
6e26897
Merge branch 'master' into feature/interpreter/entity_selection
yamacir-kit Jul 18, 2024
026b024
Update ReleaseNotes.md
shouth Jul 18, 2024
d691580
Update workflow.txt
shouth Jul 18, 2024
33c1d4e
Merge branch 'master' into feature/interpreter/entity_selection
yamacir-kit Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make reference to EntitySelection error by default
  • Loading branch information
shouth committed Apr 25, 2023
commit 1163fb8ed2be5401bb82a2e85ced03229e5d888e
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct Entities : public std::unordered_map<std::string, Object> // TODO to be

auto isAdded(const EntityRef &) const -> bool;

auto ref(const EntityRef &) const -> Object;
auto ref(const EntityRef &, bool = false) const -> Object;
};
} // namespace syntax
} // namespace openscenario_interpreter
Expand Down
12 changes: 8 additions & 4 deletions openscenario/openscenario_interpreter/src/syntax/entities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ auto Entities::isAdded(const EntityRef & entity_ref) const -> bool
return ref(entity_ref).template as<ScenarioObject>().is_added;
}

auto Entities::ref(const EntityRef & entity_ref) const -> Object
auto Entities::ref(const EntityRef & entity_ref, bool allow_entity_selection) const -> Object
{
try {
return at(entity_ref);
} catch (const std::out_of_range &) {
if (auto entry = find(entity_ref); entry == end()) {
throw Error("An undeclared entity ", std::quoted(entity_ref), " was specified in entityRef.");
} else if (not allow_entity_selection and entry->second.is<EntitySelection>()) {
THROW_SEMANTIC_ERROR(
"tried to reference the entity `", entity_ref,
"` of the type `EntitySelection`, which is not allowed in this context.");
} else {
return entry->second;
}
}
} // namespace syntax
Expand Down