Skip to content

Commit

Permalink
Change default value definition
Browse files Browse the repository at this point in the history
  • Loading branch information
f0reachARR committed Nov 28, 2024
1 parent 2c91138 commit b4ff043
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ struct Trigger : public std::list<ConditionGroup>

auto evaluate() -> Object;

// Utility variables for some default triggers that are always evaluated to be true
static const Trigger always_true;
// Utility function for some default triggers that are always evaluated to be true
static auto truthy() noexcept -> Trigger;
};

auto operator<<(boost::json::object &, const Trigger &) -> boost::json::object &;
Expand Down
2 changes: 1 addition & 1 deletion openscenario/openscenario_interpreter/src/syntax/act.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inline namespace syntax
Act::Act(const pugi::xml_node & node, Scope & scope)
: Scope(readAttribute<String>("name", node, scope), scope),
StoryboardElement(
readElement<Trigger>("StartTrigger", node, local(), Trigger::always_true),
readElement<Trigger>("StartTrigger", node, local(), Trigger::truthy()),
readElement<Trigger>("StopTrigger", node, local()))
{
traverse<1, unbounded>(node, "ManeuverGroup", [&](auto && node) {
Expand Down
2 changes: 1 addition & 1 deletion openscenario/openscenario_interpreter/src/syntax/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Event::Event(const pugi::xml_node & node, Scope & scope, Maneuver & maneuver)
StoryboardElement(
readAttribute<UnsignedInt>("maximumExecutionCount", node, local(), UnsignedInt(1)),
// If there is no "StartTrigger" in the "Event", the default StartTrigger that always returns true is used.
readElement<Trigger>("StartTrigger", node, local(), Trigger::always_true)),
readElement<Trigger>("StartTrigger", node, local(), Trigger::truthy())),
priority(readAttribute<Priority>("priority", node, local())),
parent_maneuver(maneuver)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Trigger::Trigger(const pugi::xml_node & node, Scope & scope)
traverse<0, unbounded>(node, "ConditionGroup", [&](auto && node) { emplace_back(node, scope); });
}

const Trigger Trigger::always_true = Trigger{{ConditionGroup()}};
auto Trigger::truthy() noexcept -> Trigger { return Trigger{{ConditionGroup()}}; }

auto Trigger::evaluate() -> Object
{
Expand Down

0 comments on commit b4ff043

Please sign in to comment.