susumu.yata
null+****@clear*****
Fri Sep 19 11:16:06 JST 2014
susumu.yata 2014-09-19 11:16:06 +0900 (Fri, 19 Sep 2014) New Revision: 7916ebd6f6f31c613a1142d958e0cd3dc7058bd9 https://github.com/groonga/grnxx/commit/7916ebd6f6f31c613a1142d958e0cd3dc7058bd9 Message: Add ColumnImpl<T>::read(). (#60) Modified files: lib/grnxx/column_impl.hpp Modified: lib/grnxx/column_impl.hpp (+50 -0) =================================================================== --- lib/grnxx/column_impl.hpp 2014-09-19 10:16:02 +0900 (8d52e3e) +++ lib/grnxx/column_impl.hpp 2014-09-19 11:16:06 +0900 (8eaf571) @@ -37,6 +37,13 @@ class ColumnImpl : public Column { return values_[row_id]; } + // Read values. + void read(ArrayCRef<Record> records, ArrayRef<T> values) const { + for (Int i = 0; i < records.size(); ++i) { + values.set(i, get(records.get_row_id(i))); + } + } + private: Array<T> values_; @@ -75,6 +82,13 @@ class ColumnImpl<Int> : public Column { return values_[row_id]; } + // Read values. + void read(ArrayCRef<Record> records, ArrayRef<Int> values) const { + for (Int i = 0; i < records.size(); ++i) { + values.set(i, get(records.get_row_id(i))); + } + } + private: Array<Int> values_; @@ -124,6 +138,13 @@ class ColumnImpl<Text> : public Column { } } + // Read values. + void read(ArrayCRef<Record> records, ArrayRef<Text> values) const { + for (Int i = 0; i < records.size(); ++i) { + values.set(i, get(records.get_row_id(i))); + } + } + private: Array<UInt> headers_; Array<char> bodies_; @@ -174,6 +195,13 @@ class ColumnImpl<Vector<Int>> : public Column { } } + // Read values. + void read(ArrayCRef<Record> records, ArrayRef<Vector<Int>> values) const { + for (Int i = 0; i < records.size(); ++i) { + values.set(i, get(records.get_row_id(i))); + } + } + private: Array<UInt> headers_; Array<Int> bodies_; @@ -224,6 +252,13 @@ class ColumnImpl<Vector<Float>> : public Column { } } + // Read values. + void read(ArrayCRef<Record> records, ArrayRef<Vector<Float>> values) const { + for (Int i = 0; i < records.size(); ++i) { + values.set(i, get(records.get_row_id(i))); + } + } + private: Array<UInt> headers_; Array<Float> bodies_; @@ -274,6 +309,14 @@ class ColumnImpl<Vector<GeoPoint>> : public Column { } } + // Read values. + void read(ArrayCRef<Record> records, + ArrayRef<Vector<GeoPoint>> values) const { + for (Int i = 0; i < records.size(); ++i) { + values.set(i, get(records.get_row_id(i))); + } + } + private: Array<UInt> headers_; Array<GeoPoint> bodies_; @@ -315,6 +358,13 @@ class ColumnImpl<Vector<Text>> : public Column { bodies_.data(), headers_[row_id].size); } + // Read values. + void read(ArrayCRef<Record> records, ArrayRef<Vector<Text>> values) const { + for (Int i = 0; i < records.size(); ++i) { + values.set(i, get(records.get_row_id(i))); + } + } + private: struct Header { Int offset; -------------- next part -------------- HTML����������������������������...Download