diff --git a/ulog_cpp/subscription.hpp b/ulog_cpp/subscription.hpp index da4a936..b0b7e79 100644 --- a/ulog_cpp/subscription.hpp +++ b/ulog_cpp/subscription.hpp @@ -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 */