susumu.yata
null+****@clear*****
Wed Jun 11 11:40:59 JST 2014
susumu.yata 2014-06-11 11:40:59 +0900 (Wed, 11 Jun 2014) New Revision: 4581ee1fcdb031a76c69cc98a7b4f6b2381c102b https://github.com/groonga/grnxx/commit/4581ee1fcdb031a76c69cc98a7b4f6b2381c102b Message: Update the new interface candidate. Added files: new-interface/group-set.hpp Modified files: new-interface/row-set.hpp Added: new-interface/group-set.hpp (+37 -0) 100644 =================================================================== --- /dev/null +++ new-interface/group-set.hpp 2014-06-11 11:40:59 +0900 (33acae2) @@ -0,0 +1,37 @@ +#ifndef GRNXX_GROUP_SET_HPP +#define GRNXX_GROUP_SET_HPP + +#include "grnxx/types.hpp" + +namespace grnxx { + +class GroupSet { + public: + GroupSet(); + ~GroupSet(); + + // 所属するテーブルを取得する. + Table *table() const; + // グループ数を取得する. + int64_t num_groups() const; + + // 行数を取得する. + int64_t get_num_rows(int64_t i) const; + // 保存してある行の一覧を取得する. + RowSet *get_row_set(int64_t i) const; + + // 整列する. + // 成功すれば true を返す. + // 失敗したときは *error にその内容を格納し, false を返す. + // + // TODO: 整列条件の指定方法を決める. + // + // 失敗する状況としては,以下のようなものが挙げられる. + // - リソースが足りない. + // - 演算において例外が発生する. + bool sort(Error *error, const GroupSortConditions &conditions); +}; + +} // namespace grnxx + +#endif // GRNXX_GROUP_SET_HPP Modified: new-interface/row-set.hpp (+18 -2) =================================================================== --- new-interface/row-set.hpp 2014-06-11 09:13:45 +0900 (6e2aa02) +++ new-interface/row-set.hpp 2014-06-11 11:40:59 +0900 (02d64c9) @@ -12,11 +12,13 @@ class RowSet { // 所属するテーブルを取得する. Table *table() const; + // 行数を取得する. + int64_t num_rows() const; // 行 ID を取得する. - RowID get_row_id(Int64 i) const; + RowID get_row_id(int64_t i) const; // スコアを取得する. - double get_score(Int64 i) const; + double get_score(int64_t i) const; // スコアを正規化する. // 成功すれば true を返す. @@ -43,6 +45,20 @@ class RowSet { // - リソースが足りない. // - 演算において例外が発生する. bool sort(Error *error, const SortConditions &conditions); + + // TODO: Grouper を使うより RowSet::group() の方が良い? + + // グループ化する. + // 成功すれば true を返す. + // 失敗したときは *error にその内容を格納し, false を返す. + // + // 失敗する状況としては,以下のようなものが挙げられる. + // - オプションが不正である. + // - リソースが確保できない. + bool group(Error *error, + GroupSet *group_set, + const Expression &expression, + GroupOptions &options) const; }; } // namespace grnxx -------------- next part -------------- HTML����������������������������...Download