|< < 7 > >|

Iterators

Project


typedef void* (*RowExpression)(Row*); class Project: public Iterator { ... };
Project::Project(Iterator* input, const vector<RowExpression>& exprs) { this->input = input; this->exprs = exprs; } void Project::open() { input->open(); }
Row* Project::next() { Row* projected = NULL; Row* row = input->next(); if (row) { projected = new Row(); for (int field : fields) { projected->append(exprs.at(i)(row)); } } return projected; } void Project::close() { input->close(); }

|< < 7 > >|