scenario_simulator_v2 C++ API
condition_group.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__CONDITION_GROUP_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__CONDITION_GROUP_HPP_
17 
18 #include <nlohmann/json.hpp>
21 #include <pugixml.hpp>
22 
24 {
25 inline namespace syntax
26 {
27 /* ---- ConditionGroup ---------------------------------------------------------
28  *
29  * A condition group is an association of conditions that is assessed during
30  * simulation time and signals true when all associated conditions are
31  * evaluated to true.
32  *
33  * <xsd:complexType name="ConditionGroup">
34  * <xsd:sequence>
35  * <xsd:element name="Condition" type="Condition" maxOccurs="unbounded"/>
36  * </xsd:sequence>
37  * </xsd:complexType>
38  *
39  * -------------------------------------------------------------------------- */
40 struct ConditionGroup : public std::list<Condition>
41 {
43 
44  // NOTE: Default constructed ConditionGroup must be return TRUE.
45  ConditionGroup() = default;
46 
47  explicit ConditionGroup(const pugi::xml_node &, Scope &);
48 
49  auto evaluate() -> Object;
50 };
51 
52 auto operator<<(nlohmann::json &, const ConditionGroup &) -> nlohmann::json &;
53 
54 template <typename T>
55 using isConditionGroup = typename std::is_same<typename std::decay<T>::type, ConditionGroup>;
56 
58 } // namespace syntax
59 } // namespace openscenario_interpreter
60 
61 #endif // OPENSCENARIO_INTERPRETER__SYNTAX__CONDITION_GROUP_HPP_
Definition: scope.hpp:154
auto operator<<(std::ostream &, const Boolean &) -> std::ostream &
Definition: boolean.cpp:46
typename std::is_same< typename std::decay< T >::type, ConditionGroup > isConditionGroup
Definition: condition_group.hpp:55
Definition: escape_sequence.hpp:22
Pointer< Expression > Object
Definition: object.hpp:26
Definition: condition_group.hpp:41
bool current_value
Definition: condition_group.hpp:42
auto evaluate() -> Object
Definition: condition_group.cpp:27