-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1486 from tier4/fix/speed-condition/backward-comp…
…atibility Fix/speed condition/backward compatibility
- Loading branch information
Showing
8 changed files
with
96 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
30 changes: 30 additions & 0 deletions
30
openscenario/openscenario_interpreter/include/openscenario_interpreter/compatibility.hpp
This file contains 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,30 @@ | ||
// Copyright 2015 TIER IV, Inc. All rights reserved. | ||
// | ||
// 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 OPENSCENARIO_INTERPRETER__COMPATIBILITY_HPP_ | ||
#define OPENSCENARIO_INTERPRETER__COMPATIBILITY_HPP_ | ||
|
||
#include <iostream> | ||
|
||
namespace openscenario_interpreter | ||
{ | ||
enum class Compatibility { | ||
legacy, | ||
standard, | ||
}; | ||
|
||
auto operator>>(std::istream &, Compatibility &) -> std::istream &; | ||
} // namespace openscenario_interpreter | ||
|
||
#endif // OPENSCENARIO_INTERPRETER__COMPATIBILITY_HPP_ |
This file contains 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
38 changes: 38 additions & 0 deletions
38
openscenario/openscenario_interpreter/src/compatibility.cpp
This file contains 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,38 @@ | ||
// Copyright 2015 TIER IV, Inc. All rights reserved. | ||
// | ||
// 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. | ||
|
||
#include <openscenario_interpreter/compatibility.hpp> | ||
|
||
namespace openscenario_interpreter | ||
{ | ||
auto operator>>(std::istream & input, Compatibility & compatiblity) -> std::istream & | ||
{ | ||
if (auto token = std::string(); input >> token) { | ||
if (token == "legacy") { | ||
compatiblity = Compatibility::legacy; | ||
return input; | ||
} else if (token == "standard") { | ||
compatiblity = Compatibility::standard; | ||
return input; | ||
} else { | ||
throw Error( | ||
"Unknown compatiblity ", std::quoted(token), | ||
" was specified. It must be \"legacy\" or \"standard\"."); | ||
} | ||
} else { | ||
compatiblity = Compatibility::legacy; | ||
return input; | ||
} | ||
} | ||
} // namespace openscenario_interpreter |
This file contains 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
This file contains 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
This file contains 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