Skip to content

Commit

Permalink
add hasField method
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin authored and bkueng committed Jan 10, 2024
1 parent 93a9d3c commit 73cda62
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ulog_cpp/subscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,15 @@ class TypedDataView {
*/
const MessageFormat& format() const { return _message_format_ref; }

/**
* Checks if a field is present in the underlying MessageFormat
*/
bool hasField(const std::string& field_name) const
{
const auto iter = _message_format_ref.fieldMap().find(field_name);
return iter != _message_format_ref.fieldMap().end() && iter->second->definitionResolved();
}

/**
* @return The underlying raw data vector
*/
Expand Down

0 comments on commit 73cda62

Please sign in to comment.