Skip to content

Commit

Permalink
Support strings in scenarios #354
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Ivar Hatledal committed Sep 12, 2019
1 parent beeba20 commit 804aeb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/cse/scenario.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct boolean_modifier
struct string_modifier
{
/// A function which may be called any number of times. Can be `nullptr`.
std::function<std::string(std::string_view)> f;
std::function<std::string(std::string)> f;
};

/// A struct specifying a variable and the modification of its value.
Expand Down
5 changes: 5 additions & 0 deletions src/cpp/scenario_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ cse::scenario::variable_action generate_action(
return cse::scenario::variable_action{
sim, var, cse::scenario::boolean_modifier{f}, isInput};
}
case cse::variable_type::string: {
auto f = generate_modifier<std::string>(mode, event);
return cse::scenario::variable_action{
sim, var, cse::scenario::string_modifier{f}, isInput};
}
default:
std::ostringstream oss;
oss << "No scenario action support for variable type: " << to_text(type);
Expand Down

0 comments on commit 804aeb0

Please sign in to comment.