Navigation Menu

Skip to content

Commit

Permalink
Update the new interface candidate.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yata committed Jun 11, 2014
1 parent 15298c3 commit 4581ee1
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
37 changes: 37 additions & 0 deletions new-interface/group-set.hpp
@@ -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
20 changes: 18 additions & 2 deletions new-interface/row-set.hpp
Expand Up @@ -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 を返す.
Expand All @@ -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
Expand Down

0 comments on commit 4581ee1

Please sign in to comment.