scenario_simulator_v2 C++ API
user_defined_value_condition.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__USER_DEFINED_VALUE_CONDITION_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__USER_DEFINED_VALUE_CONDITION_HPP_
17 
22 #include <pugixml.hpp>
23 
25 {
26 inline namespace syntax
27 {
28 /* ---- UserDefinedValueCondition ----------------------------------------------
29  *
30  * This condition acts as a wrapper for external custom conditions which are
31  * implemented in the user software. This condition is considered true if the
32  * given value verifies the specified relation rule (bigger than, smaller than,
33  * or equal to) relatively to the provided reference.
34  *
35  * <xsd:complexType name="UserDefinedValueCondition">
36  * <xsd:attribute name="name" type="String" use="required"/>
37  * <xsd:attribute name="value" type="String" use="required"/>
38  * <xsd:attribute name="rule" type="Rule" use="required"/>
39  * </xsd:complexType>
40  *
41  * -------------------------------------------------------------------------- */
43 {
44  Object result;
45 
46  std::function<Object()> evaluate_value;
47 
48 public:
49  const String name;
50 
51  const String value;
52 
53  const Rule rule;
54 
55  explicit UserDefinedValueCondition(const pugi::xml_node &, Scope &);
56 
57  auto description() const -> String;
58 
59  auto evaluate() -> Object;
60 };
61 } // namespace syntax
62 } // namespace openscenario_interpreter
63 
64 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__USER_DEFINED_VALUE_CONDITION_HPP_
Definition: scope.hpp:154
Definition: user_defined_value_condition.hpp:43
auto evaluate() -> Object
Definition: user_defined_value_condition.cpp:223
const String value
Definition: user_defined_value_condition.hpp:51
const String name
Definition: user_defined_value_condition.hpp:49
const Rule rule
Definition: user_defined_value_condition.hpp:53
UserDefinedValueCondition(const pugi::xml_node &, Scope &)
Definition: user_defined_value_condition.cpp:108
auto description() const -> String
Definition: user_defined_value_condition.cpp:214
std::string String
Definition: string.hpp:24
Definition: escape_sequence.hpp:22
Pointer< Expression > Object
Definition: object.hpp:26