dml: Add method for getting FieldBase * from Record

Needed for niceties in the Python binding
This commit is contained in:
Joshua Scott 2018-04-04 04:08:06 +01:00
parent c08eb617bf
commit e2f6bd1655
2 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,8 @@ namespace dml
return m_field_map.at(name)->is_type<ValueT>();
}
FieldBase *get_field(std::string name) const;
/**
* Returns a previously added field with the specified name
* and type.

View File

@ -30,6 +30,13 @@ namespace dml
return m_field_map.count(name);
}
FieldBase *Record::get_field(std::string name) const
{
if (has_field(name))
return m_field_map.at(name);
return nullptr;
}
size_t Record::get_field_count() const
{
return m_fields.size();