Skip to content

Commit

Permalink
Rabbit allocator wip
Browse files Browse the repository at this point in the history
  • Loading branch information
f0reachARR committed Sep 26, 2024
1 parent 431df9b commit 301bd76
Show file tree
Hide file tree
Showing 8 changed files with 1,062 additions and 787 deletions.

Large diffs are not rendered by default.

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 @@ -55,7 +55,7 @@ auto operator<<(rabbit::object & json, const Act & datum) -> rabbit::object &
json.insert("ManeuverGroup", rabbit::array());

for (auto && maneuver_group : datum.elements) {
rabbit::object act;
rabbit::object act(json.get_allocator());
act << maneuver_group.as<ManeuverGroup>();
json["ManeuverGroup"].push_back(std::move(act));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ auto Condition::evaluate() -> Object

auto operator<<(rabbit::object & json, const Condition & datum) -> rabbit::object &
{
// json["currentEvaluation"] = std::movedatum.description();
json["currentEvaluation"] = datum.description();

json["currentValue"] = boost::lexical_cast<std::string>(Boolean(datum.current_value));

json["name"] = std::move(datum.name);
json["name"] = datum.name;

// clang-format off
static const std::unordered_map<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ auto operator<<(rabbit::object & json, const ConditionGroup & datum) -> rabbit::
json.insert("Condition", rabbit::array());

for (const auto & each : datum) {
rabbit::object condition;
rabbit::object condition(json.get_allocator());
condition << each;
json["Condition"].push_back(std::move(condition));
}
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 @@ -71,7 +71,7 @@ auto Event::evaluate() -> Object

auto operator<<(rabbit::object & json, const Event & datum) -> rabbit::object &
{
json["name"] = std::move(datum.name);
json["name"] = datum.name;

json["currentState"] = boost::lexical_cast<std::string>(datum.state());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ auto operator<<(rabbit::object & json, const OpenScenario & datum) -> rabbit::ob
if (datum.category.is<ScenarioDefinition>()) {
rabbit::object scenario_definition;
scenario_definition << datum.category.as<ScenarioDefinition>();
json["OpenSCENARIO"].swap(scenario_definition);
json.insert("OpenSCENARIO", scenario_definition);
}

return json;
Expand Down
4 changes: 2 additions & 2 deletions openscenario/openscenario_interpreter/src/syntax/private.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ auto operator<<(rabbit::object & json, const Private & datum) -> rabbit::object
json.insert("PrivateAction", rabbit::array());

for (const auto & private_action : datum.private_actions) {
rabbit::object action;
action["type"] = makeTypename(private_action.type());
rabbit::object action(json.get_allocator());
action["type"] = std::move(makeTypename(private_action.type()));
json["PrivateAction"].push_back(std::move(action));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ auto operator<<(rabbit::object & json, const Storyboard & datum) -> rabbit::obje
{
json["currentState"].set(boost::lexical_cast<std::string>(datum.state()));

rabbit::object json_init;
rabbit::object json_init = json["Init"];
json_init << datum.init;
json["Init"].swap(json_init);

json.insert("Story", rabbit::array());

Expand Down

0 comments on commit 301bd76

Please sign in to comment.