scenario_simulator_v2 C++ API
parameter_assignment.hpp
Go to the documentation of this file.
1 // Copyright 2015 TIER IV, Inc. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef OPENSCENARIO_INTERPRETER__SYNTAX__PARAMETER_ASSIGNMENT_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__PARAMETER_ASSIGNMENT_HPP_
17 
20 #include <pugixml.hpp>
21 
23 {
24 inline namespace syntax
25 {
26 /*
27  ParameterAssignment (OpenSCENARIO XML 1.3.1)
28 
29  Assignment of a value to a named parameter. It is either used when importing
30  types of vehicles, controllers etc. from a catalog during startup of a simulator.
31  It is also used when generating concrete scenarios from logical scenarios
32  with ParameterValueSets during runtime of a scenario generator.
33 
34  <xsd:complexType name="ParameterAssignment">
35  <xsd:attribute name="parameterRef" type="String" use="required"/>
36  <xsd:attribute name="value" type="String" use="required"/>
37  </xsd:complexType>
38 */
40 {
41  explicit ParameterAssignment(const pugi::xml_node & node, Scope & scope)
42  : parameterRef(readAttribute<std::string>("parameterRef", node, scope)),
43  value(readAttribute<std::string>("value", node, scope))
44  {
45  scope.insert(parameterRef, make<std::string>(value));
46  }
47 
50 };
51 } // namespace syntax
52 } // namespace openscenario_interpreter
53 
54 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__PARAMETER_ASSIGNMENT_HPP_
Definition: scope.hpp:154
auto insert(const Name &, const Object &) -> void
Definition: scope.cpp:129
auto readAttribute(const std::string &name, const Node &node, const Scope &scope) -> T
Definition: attribute.hpp:104
Definition: hypot.hpp:22
Definition: lanelet_wrapper.hpp:39
std::string string
Definition: junit5.hpp:26
Definition: parameter_assignment.hpp:40
const std::string value
Definition: parameter_assignment.hpp:49
const std::string parameterRef
Definition: parameter_assignment.hpp:48
ParameterAssignment(const pugi::xml_node &node, Scope &scope)
Definition: parameter_assignment.hpp:41