From e2f6bd165508a04376af495e0d255a6fb03436af Mon Sep 17 00:00:00 2001 From: Joshua Scott Date: Wed, 4 Apr 2018 04:08:06 +0100 Subject: [PATCH] dml: Add method for getting FieldBase * from Record Needed for niceties in the Python binding --- include/ki/dml/Record.h | 2 ++ src/dml/Record.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/ki/dml/Record.h b/include/ki/dml/Record.h index cc70dd7..f1e1079 100644 --- a/include/ki/dml/Record.h +++ b/include/ki/dml/Record.h @@ -34,6 +34,8 @@ namespace dml return m_field_map.at(name)->is_type(); } + FieldBase *get_field(std::string name) const; + /** * Returns a previously added field with the specified name * and type. diff --git a/src/dml/Record.cpp b/src/dml/Record.cpp index 9389a48..2085ebf 100644 --- a/src/dml/Record.cpp +++ b/src/dml/Record.cpp @@ -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();