15 #ifndef OPENSCENARIO_INTERPRETER__SYNTAX__CONDITION_HPP_
16 #define OPENSCENARIO_INTERPRETER__SYNTAX__CONDITION_HPP_
19 #include <boost/json.hpp>
30 #include <pugixml.hpp>
35 inline namespace syntax
67 std::list<History> histories;
75 template <
typename... Booleans>
76 auto update_condition(std::function<
bool(Booleans...)> condition) ->
Object
79 if (
auto iterator = std::find_if(
80 std::begin(histories), std::end(histories),
81 [
this](
const auto & entry) {
return entry.time > histories.back().time -
delay; });
82 static_cast<std::ptrdiff_t
>(
sizeof...(Booleans)) <=
84 current_value = std::apply(condition, std::tuple{Booleans((--iterator)->result)...});
85 histories.erase(std::begin(histories), iterator);
93 auto operator<<(boost::json::object &,
const Condition &) -> boost::json::object &;
decltype(auto) evaluate(Ts &&... xs) const
Definition: pointer.hpp:120
Definition: scope.hpp:154
Definition: simulator_core.hpp:521
static auto evaluateSimulationTime(Ts &&... xs) -> double
Definition: simulator_core.hpp:554
auto asBoolean(bool) -> const Object &
Definition: boolean.cpp:62
auto operator<<(std::ostream &, const Boolean &) -> std::ostream &
Definition: boolean.cpp:46
std::string String
Definition: string.hpp:24
Definition: escape_sequence.hpp:22
Pointer< Expression > Object
Definition: object.hpp:26
auto distance(const geometry_msgs::Pose &pose1, const geometry_msgs::Pose &pose2)
Definition: detection_sensor.cpp:34
Definition: boolean.hpp:26
Definition: condition_edge.hpp:47
Definition: condition.hpp:51
bool current_value
Definition: condition.hpp:58
Condition(const pugi::xml_node &node, Scope &scope)
Definition: condition.cpp:34
auto evaluate() -> Object
Definition: condition.cpp:48
const ConditionEdge condition_edge
Definition: condition.hpp:56
const String name
Definition: condition.hpp:52
const Double delay
Definition: condition.hpp:54
Definition: double.hpp:25