Skip to content

Commit

Permalink
Merge pull request #5 from basler/feature/fix_enum_name_handling
Browse files Browse the repository at this point in the history
featurewalker: selector name stripping breaks if name contains "_"
  • Loading branch information
thiesmoeller authored Aug 12, 2022
2 parents df8292c + d4463ba commit 8eea420
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ext/pylon/gstpylonfeaturewalker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,15 @@ static std::vector<GParamSpec*> gst_pylon_camera_handle_node(
/* Add selector enum values */
std::vector<std::string> enum_values;
GenApi::NodeList_t enum_entries;
/* calculate prefix length to strip */
const auto prefix_str = std::string("EnumEntry_") +
enum_node->GetNode()->GetName().c_str() +
std::string("_");
auto prefix_len = prefix_str.length();
enum_node->GetEntries(enum_entries);
for (auto const& e : enum_entries) {
auto enum_name = std::string(e->GetName());
enum_values.push_back(enum_name.substr(enum_name.find_last_of("_") + 1));
enum_values.push_back(enum_name.substr(prefix_len));
}

selector_node = selector->GetNode();
Expand Down

0 comments on commit 8eea420

Please sign in to comment.