Turi Create
4.0
|
#include <core/storage/sframe_data/sframe_rows.hpp>
Classes | |
struct | const_iterator |
struct | iterator |
struct | row |
Public Types | |
typedef std::vector< flexible_type > | decoded_column_type |
The data type of decoded column (block_contents::DECODED_COLUMN) | |
Public Member Functions | |
sframe_rows ()=default | |
sframe_rows (const sframe_rows &other) | |
sframe_rows (sframe_rows &&)=default | |
sframe_rows & | operator= (const sframe_rows &other) |
sframe_rows & | operator= (sframe_rows &&)=default |
size_t | num_columns () const |
Returns the number of columns. | |
size_t | num_rows () const |
Returns the number of rows. | |
void | clear () |
void | resize (size_t num_cols, ssize_t num_rows=-1) |
void | add_decoded_column (const ptr_to_decoded_column_type &decoded_column) |
std::vector< ptr_to_decoded_column_type > & | get_columns () |
const std::vector< ptr_to_decoded_column_type > & | get_columns () const |
const std::vector< ptr_to_decoded_column_type > & | cget_columns () const |
void | save (oarchive &oarc) const |
void | load (iarchive &oarc) |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
iterator | begin () |
iterator | end () |
const row | operator[] (size_t i) const |
row | operator[] (size_t i) |
void | ensure_unique () |
void | type_check_inplace (const std::vector< flex_type_enum > &typelist) |
sframe_rows | type_check (const std::vector< flex_type_enum > &typelist) const |
sframe-rows is a semi-opaque wrapper around a collection of columns of flexible_type (i.e. from an SFrame / SArray). The objective is to allow the underlying representation to be column-wise, while maintaining a row-wise iterator interface.
sframe_rows are fast and cheap to copy, and also allow values to be modified. Internally, sframe_rows are built on a copy-on-write architecture thus allowing for safe mutation. Most accessor methods have a "constant" version which should be used if no value modifications are to be made. For instance:
The sframe_rows object is a relatively shallow wrapper over an
vector<shared_ptr<vector<flexible_type>>>
where each shared_ptr<vector<flexible_type>> represents a single column. The column set can be directly accessed and modified using sframe_rows::get_columns() (returns a reference to the underlying vector) or sframe_rows::cget_columns()
: We could templatize this around the column type, allowing this to be used for anything.
Definition at line 48 of file sframe_rows.hpp.
|
default |
Constructor
|
inline |
Copy constructor. The copy constructor is fast as only pointers are copied in a copy-on-write fashion.
Definition at line 63 of file sframe_rows.hpp.
|
default |
Move constructor.
void turi::sframe_rows::add_decoded_column | ( | const ptr_to_decoded_column_type & | decoded_column | ) |
Adds to the right of the sframe_rows, a collection of decoded columns
|
inline |
Gets a constant iterator to the first row of the sframe_rows.
Definition at line 474 of file sframe_rows.hpp.
|
inline |
Gets a mutable iterator to the first row of the sframe_rows.
Definition at line 505 of file sframe_rows.hpp.
|
inline |
Gets a constant iterator to the first row of the sframe_rows.
Definition at line 488 of file sframe_rows.hpp.
|
inline |
Gets a constant iterator to the end of the sframe_rows.
Definition at line 495 of file sframe_rows.hpp.
|
inline |
Returns a const reference to the set of column groups
Definition at line 145 of file sframe_rows.hpp.
void turi::sframe_rows::clear | ( | ) |
Clears the contents of the sframe_rows datastructure.
|
inline |
Gets a constant iterator to the end of the sframe_rows.
Definition at line 481 of file sframe_rows.hpp.
|
inline |
Gets a mutable iterator to the first row of the sframe_rows.
Definition at line 516 of file sframe_rows.hpp.
void turi::sframe_rows::ensure_unique | ( | ) |
Ensures that this is a unique copy
|
inline |
Returns a modifiable reference to the set of column groups
Definition at line 130 of file sframe_rows.hpp.
|
inline |
Returns a const reference to the set of column groups
Definition at line 138 of file sframe_rows.hpp.
void turi::sframe_rows::load | ( | iarchive & | oarc | ) |
Deserializer
|
inline |
Assignment operator. The assignment operator is fast as only pointers are copied in a copy on write fashion.
Definition at line 77 of file sframe_rows.hpp.
|
default |
Move assignment
|
inline |
Reads a particular row of the sframe_rows object.
Definition at line 524 of file sframe_rows.hpp.
|
inline |
gets a mutable reference to a particular row of the sframe_rows object
Definition at line 531 of file sframe_rows.hpp.
void turi::sframe_rows::resize | ( | size_t | num_cols, |
ssize_t | num_rows = -1 |
||
) |
Sets the size of sframe_rows. If num_rows == -1, columns are not resized.
void turi::sframe_rows::save | ( | oarchive & | oarc | ) | const |
Serializer
sframe_rows turi::sframe_rows::type_check | ( | const std::vector< flex_type_enum > & | typelist | ) | const |
Returns a new sframe rows where each column has the set of types enforced
void turi::sframe_rows::type_check_inplace | ( | const std::vector< flex_type_enum > & | typelist | ) |
Modifies the SFrame Rows inplace to enforce typing.