Turi Create
4.0
|
#include <model_server/lib/flex_dict_view.hpp>
Public Member Functions | |
flex_dict_view ()=delete | |
flex_dict_view (const flex_dict &value) | |
flex_dict_view (const flexible_type &value) | |
const flexible_type & | operator[] (const flexible_type &key) const |
bool | has_key (const flexible_type &key) const |
size_t | size () const |
const std::vector< flexible_type > & | keys () |
const std::vector< flexible_type > & | values () |
flex_dict::const_iterator | begin () const |
flex_dict::const_iterator | end () const |
A thin wrapper around flex_dict to facilitate access of the underneath sparse vector.
It can be used the following way, suppose sa_iter is an iterator on top of sarray: flex_dict_view value = (*sa_iter);
Internally, sparse vector points to a flex_dict structure. It will not make copy of the data to avoid memory allocation
Definition at line 25 of file flex_dict_view.hpp.
|
delete |
Default constructor.
turi::flex_dict_view::flex_dict_view | ( | const flex_dict & | value | ) |
Constructs a sparse vector from a flexible type that is DICT type
turi::flex_dict_view::flex_dict_view | ( | const flexible_type & | value | ) |
Constructs a sparse vector from a flexible type. This only works when the value is of type flex_type_enum::DICT, it will throw otherwise
flex_dict::const_iterator turi::flex_dict_view::begin | ( | ) | const |
Returns an iterator that gives out items from beginning
flex_dict::const_iterator turi::flex_dict_view::end | ( | ) | const |
Returns an iterator that points to end position
bool turi::flex_dict_view::has_key | ( | const flexible_type & | key | ) | const |
Returns whether or not a given key exists in the sparse vector
const std::vector<flexible_type>& turi::flex_dict_view::keys | ( | ) |
Returns all keys in a vector
const flexible_type& turi::flex_dict_view::operator[] | ( | const flexible_type & | key | ) | const |
Given a key retrieve the value, throws if the key doesn't exist
size_t turi::flex_dict_view::size | ( | ) | const |
Returns number of elements in the sparse vector
const std::vector<flexible_type>& turi::flex_dict_view::values | ( | ) |
Returns all values in a vector