[Groonga-commit] groonga/grnxx at 5638126 [new_data_types] Remove old files.

Back to archive index

susumu.yata null+****@clear*****
Fri Nov 28 17:26:13 JST 2014


susumu.yata	2014-11-28 17:26:13 +0900 (Fri, 28 Nov 2014)

  New Revision: 5638126b6be1300e0e447611518f2e3c0ae254c7
  https://github.com/groonga/grnxx/commit/5638126b6be1300e0e447611518f2e3c0ae254c7

  Message:
    Remove old files.

  Removed files:
    include/grnxx/types/Makefile.am
    include/grnxx/types/array.hpp
    include/grnxx/types/array/Makefile.am
    include/grnxx/types/array/bool.hpp
    include/grnxx/types/array/primary.hpp
    include/grnxx/types/array/record.hpp
    include/grnxx/types/base_types.hpp
    include/grnxx/types/constants.hpp
    include/grnxx/types/data_types.hpp
    include/grnxx/types/error.hpp
    include/grnxx/types/forward.hpp
    include/grnxx/types/options.hpp
    include/grnxx/types/vector.hpp
    lib/grnxx/types.cpp
  Modified files:
    include/grnxx/error.hpp

  Modified: include/grnxx/error.hpp (+1 -1)
===================================================================
--- include/grnxx/error.hpp    2014-11-28 16:00:19 +0900 (1227470)
+++ include/grnxx/error.hpp    2014-11-28 17:26:13 +0900 (de2b8cc)
@@ -101,4 +101,4 @@ class Error {
                             (error)->set_function(__PRETTY_FUNCTION__), \
                             (error)->set_message(format, ## __VA_ARGS__)))
 
-#endif  // GRNXX_TYPES_ERROR_HPP
+#endif  // GRNXX_ERROR_HPP

  Deleted: include/grnxx/types/Makefile.am (+0 -17) 100644
===================================================================
--- include/grnxx/types/Makefile.am    2014-11-28 16:00:19 +0900 (95be2bf)
+++ /dev/null
@@ -1,17 +0,0 @@
-SUBDIRS =		\
-	array
-
-pkgincludedir = ${includedir}/${PACKAGE}/types
-pkginclude_HEADERS =	\
-	array.hpp	\
-	base_types.hpp	\
-	constants.hpp	\
-	datum.hpp	\
-	data_types.hpp	\
-	error.hpp	\
-	forward.hpp	\
-	geo_point.hpp	\
-	options.hpp	\
-	string.hpp	\
-	traits.hpp	\
-	vector.hpp

  Deleted: include/grnxx/types/array.hpp (+0 -8) 100644
===================================================================
--- include/grnxx/types/array.hpp    2014-11-28 16:00:19 +0900 (1f46b81)
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef GRNXX_TYPES_ARRAY_HPP
-#define GRNXX_TYPES_ARRAY_HPP
-
-#include "grnxx/types/array/bool.hpp"
-#include "grnxx/types/array/primary.hpp"
-#include "grnxx/types/array/record.hpp"
-
-#endif  // GRNXX_TYPES_ARRAY_HPP

  Deleted: include/grnxx/types/array/Makefile.am (+0 -5) 100644
===================================================================
--- include/grnxx/types/array/Makefile.am    2014-11-28 16:00:19 +0900 (d8a1db5)
+++ /dev/null
@@ -1,5 +0,0 @@
-pkgincludedir = ${includedir}/${PACKAGE}/types/array
-pkginclude_HEADERS =	\
-	bool.hpp	\
-	primary.hpp	\
-	record.hpp

  Deleted: include/grnxx/types/array/bool.hpp (+0 -346) 100644
===================================================================
--- include/grnxx/types/array/bool.hpp    2014-11-28 16:00:19 +0900 (22f7993)
+++ /dev/null
@@ -1,346 +0,0 @@
-#ifndef GRNXX_TYPES_ARRAY_BOOL_HPP
-#define GRNXX_TYPES_ARRAY_BOOL_HPP
-
-#include "grnxx/types/base_types.hpp"
-#include "grnxx/types/error.hpp"
-
-namespace grnxx {
-
-template <typename T> class ArrayCRef;
-template <typename T> class ArrayRef;
-template <typename T> class Array;
-
-// ArrayCRef<Bool> is specialized because each Bool value does not have its own
-// unique address and thus a pointer type for Bool is not available.
-template <>
-class ArrayCRef<Bool> {
- public:
-  using Value = Bool;
-  using Block = UInt;
-
-  ArrayCRef() = default;
-  ArrayCRef(const ArrayCRef &) = default;
-
-  ArrayCRef &operator=(const ArrayCRef &) = default;
-
-  bool operator==(const ArrayCRef<Value> &rhs) const {
-    return (blocks_ == rhs.blocks_) &&
-           (offset_ == rhs.offset_) &&
-           (size_ == rhs.size_);
-  }
-  bool operator!=(const ArrayCRef<Value> &rhs) const {
-    return (blocks_ != rhs.blocks_) ||
-           (offset_ != rhs.offset_) ||
-           (size_ != rhs.size_);
-  }
-
-  ArrayCRef ref(Int offset = 0) const {
-    return ArrayCRef(blocks_, offset + offset_, size_ - offset);
-  }
-  ArrayCRef ref(Int offset, Int size) const {
-    return ArrayCRef(blocks_, offset + offset_, size);
-  }
-
-  Value get(Int i) const {
-    i += offset_;
-    return (blocks_[i / 64] & (Block(1) << (i % 64))) != 0;
-  }
-
-  Value operator[](Int i) const {
-    i += offset_;
-    return (blocks_[i / 64] & (Block(1) << (i % 64))) != 0;
-  }
-
-  Block get_block(Int i) const {
-    return blocks_[i];
-  }
-
-  Int offset() const {
-    return offset_;
-  }
-  Int size() const {
-    return size_;
-  }
-
- private:
-  const Block *blocks_;
-  Int offset_;
-  Int size_;
-
-  ArrayCRef(const Block *blocks, Int offset, Int size)
-      : blocks_(blocks + (offset / 64)),
-        offset_(offset % 64),
-        size_(size) {}
-
-  friend class ArrayRef<Value>;
-  friend class Array<Value>;
-};
-
-// ArrayRef<Bool> is specialized because each Bool value does not have its own
-// unique address and thus a pointer type for Bool is not available.
-template <>
-class ArrayRef<Bool> {
- public:
-  using Value = Bool;
-  using Block = UInt;
-
-  ArrayRef() = default;
-  ArrayRef(const ArrayRef &) = default;
-
-  ArrayRef &operator=(const ArrayRef &) = default;
-
-  bool operator==(const ArrayCRef<Value> &rhs) const {
-    return (blocks_ == rhs.blocks_) &&
-           (offset_ == rhs.offset_) &&
-           (size_ == rhs.size_);
-  }
-  bool operator==(const ArrayRef<Value> &rhs) const {
-    return (blocks_ == rhs.blocks_) &&
-           (offset_ == rhs.offset_) &&
-           (size_ == rhs.size_);
-  }
-
-  bool operator!=(const ArrayCRef<Value> &rhs) const {
-    return (blocks_ != rhs.blocks_) ||
-           (offset_ != rhs.offset_) ||
-           (size_ != rhs.size_);
-  }
-  bool operator!=(const ArrayRef<Value> &rhs) const {
-    return (blocks_ == rhs.blocks_) ||
-           (offset_ == rhs.offset_) ||
-           (size_ == rhs.size_);
-  }
-
-  operator ArrayCRef<Value>() const {
-    return ref();
-  }
-
-  ArrayCRef<Value> ref(Int offset = 0) const {
-    return ArrayCRef<Value>(blocks_, offset + offset_, size_ - offset);
-  }
-  ArrayCRef<Value> ref(Int offset, Int size) const {
-    return ArrayCRef<Value>(blocks_, offset + offset_, size);
-  }
-
-  ArrayRef ref(Int offset = 0) {
-    return ArrayRef(blocks_, offset + offset_, size_ - offset);
-  }
-  ArrayRef ref(Int offset, Int size) {
-    return ArrayRef(blocks_, offset + offset_, size);
-  }
-
-  Value get(Int i) const {
-    i += offset_;
-    return (blocks_[i / 64] & (Block(1) << (i % 64))) != 0;
-  }
-  void set(Int i, Value value) {
-    i += offset_;
-    if (value) {
-      blocks_[i / 64] |= Block(1) << (i % 64);
-    } else {
-      blocks_[i / 64] &= ~(Block(1) << (i % 64));
-    }
-  }
-
-  Value operator[](Int i) const {
-    i += offset_;
-    return (blocks_[i / 64] & (Block(1) << (i % 64))) != 0;
-  }
-
-  Block get_block(Int i) const {
-    return blocks_[i];
-  }
-  void set_block(Int i, Block block) {
-    blocks_[i] = block;
-  }
-
-  Int offset() const {
-    return offset_;
-  }
-  Int size() const {
-    return size_;
-  }
-
-  void swap(Int i, Int j) {
-    Value temp = get(i);
-    set(i, get(j));
-    set(j, temp);
-  }
-
- private:
-  Block *blocks_;
-  Int offset_;
-  Int size_;
-
-  ArrayRef(Block *blocks, Int offset, Int size)
-      : blocks_(blocks + (offset / 64)),
-        offset_(offset % 64),
-        size_(size) {}
-
-  friend class Array<Value>;
-};
-
-// Array<Bool> is specialized because each Bool value does not have its own
-// unique address and thus a pointer type for Bool is not available.
-template <>
-class Array<Bool> {
- public:
-  using Value = Bool;
-  using Block = UInt;
-
-  Array() : blocks_(), size_(0), capacity_(0) {}
-  ~Array() {}
-
-  Array(Array &&array)
-      : blocks_(std::move(array.blocks_)),
-        size_(array.size_),
-        capacity_(array.capacity_) {
-    array.size_ = 0;
-    array.capacity_ = 0;
-  }
-
-  Array &operator=(Array &&array) {
-    blocks_ = std::move(array.blocks_);
-    size_ = array.size_;
-    capacity_ = array.capacity_;
-    array.size_ = 0;
-    array.capacity_ = 0;
-    return *this;
-  }
-
-  operator ArrayCRef<Value>() const {
-    return ref();
-  }
-
-  ArrayCRef<Value> ref(Int offset = 0) const {
-    return ArrayCRef<Value>(blocks_.get(), offset, size_ - offset);
-  }
-  ArrayCRef<Value> ref(Int offset, Int size) const {
-    return ArrayCRef<Value>(blocks_.get(), offset, size);
-  }
-
-  ArrayRef<Value> ref(Int offset = 0) {
-    return ArrayRef<Value>(blocks_.get(), offset, size_ - offset);
-  }
-  ArrayRef<Value> ref(Int offset, Int size) {
-    return ArrayRef<Value>(blocks_.get(), offset, size);
-  }
-
-  Value get(Int i) const {
-    return (blocks_[i / 64] & (Block(1) << (i % 64))) != 0;
-  }
-  void set(Int i, Value value) {
-    if (value) {
-      blocks_[i / 64] |= Block(1) << (i % 64);
-    } else {
-      blocks_[i / 64] &= ~(Block(1) << (i % 64));
-    }
-  }
-
-  Value operator[](Int i) const {
-    return (blocks_[i / 64] & (Block(1) << (i % 64))) != 0;
-  }
-
-  Block get_block(Int i) const {
-    return blocks_[i];
-  }
-  void set_block(Int i, Block block) {
-    blocks_[i] = block;
-  }
-
-  Value front() const {
-    return (blocks_[0] & 1) != 0;
-  }
-  Value back() const {
-    return get(size_ - 1);
-  }
-
-  Int size() const {
-    return size_;
-  }
-  Int capacity() const {
-    return capacity_;
-  }
-
-  bool reserve(Error *error, Int new_size) {
-    if (new_size <= capacity_) {
-      return true;
-    }
-    return resize_blocks(error, new_size);
-  }
-
-  bool resize(Error *error, Int new_size) {
-    if (new_size <= capacity_) {
-      size_ = new_size;
-      return true;
-    }
-    if (!resize_blocks(error, new_size)) {
-      return false;
-    }
-    size_ = new_size;
-    return true;
-  }
-  bool resize(Error *error, Int new_size, Value value) {
-    if (new_size <= capacity_) {
-      size_ = new_size;
-      return true;
-    }
-    if (!resize_blocks(error, new_size)) {
-      return false;
-    }
-    if ((size_ % 64) != 0) {
-      if (value) {
-        blocks_[size_ / 64] |= ~Block(0) << (size_ % 64);
-      } else {
-        blocks_[size_ / 64] &= ~(~Block(0) << (size_ % 64));
-      }
-      size_ = (size_ + 63) & ~Int(63);
-    }
-    Block block = value ? ~Block(0) : Block(0);
-    for (Int i = size_; i < new_size; i += 64) {
-      blocks_[i / 64] = block;
-    }
-    size_ = new_size;
-    return true;
-  }
-
-  void clear() {
-    size_ = 0;
-  }
-
-  bool push_back(Error *error, Value value) {
-    if (size_ == capacity_) {
-      if (!resize_blocks(error, size_ + 1)) {
-        return false;
-      }
-    }
-    if (value) {
-      blocks_[size_ / 64] |= Block(1) << (size_ % 64);
-    } else {
-      blocks_[size_ / 64] &= ~(Block(1) << (size_ % 64));
-    }
-    ++size_;
-    return true;
-  }
-  void pop_back() {
-    --size_;
-  }
-
-  void swap(Int i, Int j) {
-    Value temp = get(i);
-    set(i, get(j));
-    set(j, temp);
-  }
-
- private:
-  unique_ptr<Block[]> blocks_;
-  Int size_;
-  Int capacity_;
-
-  // Assume new_size > capacity_.
-  bool resize_blocks(Error *error, Int new_size);
-};
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_ARRAY_BOOL_HPP

  Deleted: include/grnxx/types/array/primary.hpp (+0 -343) 100644
===================================================================
--- include/grnxx/types/array/primary.hpp    2014-11-28 16:00:19 +0900 (225ea7c)
+++ /dev/null
@@ -1,343 +0,0 @@
-#ifndef GRNXX_TYPES_ARRAY_PRIMARY_HPP
-#define GRNXX_TYPES_ARRAY_PRIMARY_HPP
-
-#include "grnxx/types/base_types.hpp"
-#include "grnxx/types/error.hpp"
-
-namespace grnxx {
-
-class ArrayErrorReporter {
- public:
-  static void report_memory_error(Error *error);
-};
-
-template <typename T> class ArrayCRef;
-template <typename T> class ArrayRef;
-template <typename T> class Array;
-
-template <typename T>
-class ArrayCRef {
- public:
-  using Value = T;
-
-  ArrayCRef() = default;
-  ArrayCRef(const ArrayCRef &) = default;
-
-  ArrayCRef &operator=(const ArrayCRef &) = default;
-
-  bool operator==(const ArrayCRef<Value> &rhs) const {
-    return (values_ == rhs.values_) && (size_ == rhs.size_);
-  }
-  bool operator!=(const ArrayCRef<Value> &rhs) const {
-    return (values_ != rhs.values_) || (size_ != rhs.size_);
-  }
-
-  ArrayCRef ref(Int offset = 0) const {
-    return ArrayCRef(values_ + offset, size_ - offset);
-  }
-  ArrayCRef ref(Int offset, Int size) const {
-    return ArrayCRef(values_ + offset, size);
-  }
-
-  const Value &get(Int i) const {
-    return values_[i];
-  }
-
-  const Value &operator[](Int i) const {
-    return values_[i];
-  }
-
-  Int size() const {
-    return size_;
-  }
-
- private:
-  const Value *values_;
-  Int size_;
-
-  ArrayCRef(const Value *values, Int size) : values_(values), size_(size) {}
-
-  friend class ArrayRef<Value>;
-  friend class Array<Value>;
-};
-
-template <typename T>
-class ArrayRef {
- public:
-  using Value = T;
-
-  ArrayRef() = default;
-  ArrayRef(const ArrayRef &) = default;
-
-  ArrayRef &operator=(const ArrayRef &) = default;
-
-  operator ArrayCRef<Value>() const {
-    return ref();
-  }
-
-  bool operator==(const ArrayCRef<Value> &rhs) const {
-    return (values_ == rhs.values_) && (size_ == rhs.size_);
-  }
-  bool operator==(const ArrayRef<Value> &rhs) const {
-    return (values_ == rhs.values_) && (size_ == rhs.size_);
-  }
-
-  bool operator!=(const ArrayCRef<Value> &rhs) const {
-    return (values_ != rhs.values_) || (size_ != rhs.size_);
-  }
-  bool operator!=(const ArrayRef<Value> &rhs) const {
-    return (values_ != rhs.values_) || (size_ != rhs.size_);
-  }
-
-  ArrayCRef<Value> ref(Int offset = 0) const {
-    return ArrayCRef<Value>(values_ + offset, size_ - offset);
-  }
-  ArrayCRef<Value> ref(Int offset, Int size) const {
-    return ArrayCRef<Value>(values_ + offset, size);
-  }
-
-  ArrayRef ref(Int offset = 0) {
-    return ArrayRef(values_ + offset, size_ - offset);
-  }
-  ArrayRef ref(Int offset, Int size) {
-    return ArrayRef(values_ + offset, size);
-  }
-
-  const Value &get(Int i) const {
-    return values_[i];
-  }
-  void set(Int i, const Value &value) {
-    values_[i] = value;
-  }
-  void set(Int i, Value &&value) {
-    values_[i] = std::move(value);
-  }
-
-  Value &operator[](Int i) {
-    return values_[i];
-  }
-  const Value &operator[](Int i) const {
-    return values_[i];
-  }
-
-  Int size() const {
-    return size_;
-  }
-
-  void swap(Int i, Int j) {
-    Value temp = std::move(values_[i]);
-    values_[i] = std::move(values_[j]);
-    values_[j] = std::move(temp);
-  }
-
- private:
-  Value *values_;
-  Int size_;
-
-  ArrayRef(Value *values, Int size) : values_(values), size_(size) {}
-
-  friend class Array<Value>;
-};
-
-template <typename T>
-class Array {
- public:
-  using Value = T;
-
-  Array() : buf_(), size_(0), capacity_(0) {}
-  ~Array() {}
-
-  Array(Array &&array)
-      : buf_(std::move(array.buf_)),
-        size_(array.size_),
-        capacity_(array.capacity_) {
-    array.size_ = 0;
-    array.capacity_ = 0;
-  }
-
-  Array &operator=(Array &&array) {
-    buf_ = std::move(array.buf_);
-    size_ = array.size_;
-    capacity_ = array.capacity_;
-    array.size_ = 0;
-    array.capacity_ = 0;
-    return *this;
-  }
-
-  operator ArrayCRef<Value>() const {
-    return ref();
-  }
-
-  ArrayCRef<Value> ref(Int offset = 0) const {
-    return ArrayCRef<Value>(data() + offset, size_ - offset);
-  }
-  ArrayCRef<Value> ref(Int offset, Int size) const {
-    return ArrayCRef<Value>(data() + offset, size);
-  }
-
-  ArrayRef<Value> ref(Int offset = 0) {
-    return ArrayRef<Value>(data() + offset, size_ - offset);
-  }
-  ArrayRef<Value> ref(Int offset, Int size) {
-    return ArrayRef<Value>(data() + offset, size);
-  }
-
-  const Value &get(Int i) const {
-    return data()[i];
-  }
-  void set(Int i, const Value &value) {
-    data()[i] = value;
-  }
-  void set(Int i, Value &&value) {
-    data()[i] = std::move(value);
-  }
-
-  Value &operator[](Int i) {
-    return data()[i];
-  }
-  const Value &operator[](Int i) const {
-    return data()[i];
-  }
-
-  Value &front() {
-    return *data();
-  }
-  const Value &front() const {
-    return *data();
-  }
-
-  Value &back() {
-    return data()[size_ - 1];
-  }
-  const Value &back() const {
-    return data()[size_ - 1];
-  }
-
-  Value *data() {
-    return reinterpret_cast<Value *>(buf_.get());
-  }
-  const Value *data() const {
-    return reinterpret_cast<const Value *>(buf_.get());
-  }
-
-  Int size() const {
-    return size_;
-  }
-  Int capacity() const {
-    return capacity_;
-  }
-
-  bool reserve(Error *error, Int new_size) {
-    if (new_size <= capacity_) {
-      return true;
-    }
-    return resize_buf(error, new_size);
-  }
-
-  bool resize(Error *error, Int new_size) {
-    if (new_size > capacity_) {
-      if (!resize_buf(error, new_size)) {
-        return false;
-      }
-    }
-    for (Int i = new_size; i < size_; ++i) {
-      data()[i].~Value();
-    }
-    for (Int i = size_; i < new_size; ++i) {
-      new (&data()[i]) Value;
-    }
-    size_ = new_size;
-    return true;
-  }
-  bool resize(Error *error, Int new_size, const Value &value) {
-    if (new_size > capacity_) {
-      if (!resize_buf(error, new_size)) {
-        return false;
-      }
-    }
-    for (Int i = new_size; i < size_; ++i) {
-      data()[i].~Value();
-    }
-    for (Int i = size_; i < new_size; ++i) {
-      new (&data()[i]) Value(value);
-    }
-    size_ = new_size;
-    return true;
-  }
-
-  void clear() {
-    for (Int i = 0; i < size_; ++i) {
-      data()[i].~Value();
-    }
-    size_ = 0;
-  }
-
-  void erase(Int i) {
-    for (Int j = i + 1; j < size_; ++j) {
-      data()[j - 1] = std::move(data()[j]);
-    }
-    data()[size_ - 1].~Value();
-    --size_;
-  }
-
-  bool push_back(Error *error, const Value &value) {
-    if (size_ == capacity_) {
-      if (!resize_buf(error, size_ + 1)) {
-        return false;
-      }
-    }
-    new (&data()[size_]) Value(value);
-    ++size_;
-    return true;
-  }
-  bool push_back(Error *error, Value &&value) {
-    if (size_ == capacity_) {
-      if (!resize_buf(error, size_ + 1)) {
-        return false;
-      }
-    }
-    new (&data()[size_]) Value(std::move(value));
-    ++size_;
-    return true;
-  }
-  void pop_back() {
-    data()[size_ - 1].~Value();
-    --size_;
-  }
-
-  void swap(Int i, Int j) {
-    Value temp = std::move(data()[i]);
-    data()[i] = std::move(data()[j]);
-    data()[j] = std::move(temp);
-  }
-
- private:
-  unique_ptr<char[]> buf_;
-  Int size_;
-  Int capacity_;
-
-  // Assume new_size > capacity_.
-  bool resize_buf(Error *error, Int new_size) {
-    Int new_capacity = capacity_ * 2;
-    if (new_size > new_capacity) {
-      new_capacity = new_size;
-    }
-    Int new_buf_size = sizeof(Value) * new_capacity;
-    unique_ptr<char[]> new_buf(new (nothrow) char[new_buf_size]);
-    if (!new_buf) {
-      ArrayErrorReporter::report_memory_error(error);
-      return false;
-    }
-    Value *new_values = reinterpret_cast<Value *>(new_buf.get());
-    for (Int i = 0; i < size_; ++i) {
-      new (&new_values[i]) Value(std::move(data()[i]));
-    }
-    buf_ = std::move(new_buf);
-    capacity_ = new_capacity;
-    return true;
-  }
-};
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_ARRAY_PRIMARY_HPP

  Deleted: include/grnxx/types/array/record.hpp (+0 -315) 100644
===================================================================
--- include/grnxx/types/array/record.hpp    2014-11-28 16:00:19 +0900 (97d88a2)
+++ /dev/null
@@ -1,315 +0,0 @@
-#ifndef GRNXX_TYPES_ARRAY_RECORD_HPP
-#define GRNXX_TYPES_ARRAY_RECORD_HPP
-
-#include "grnxx/types/base_types.hpp"
-#include "grnxx/types/data_types.hpp"
-#include "grnxx/types/error.hpp"
-
-namespace grnxx {
-
-template <typename T> class ArrayCRef;
-template <typename T> class ArrayRef;
-template <typename T> class Array;
-
-template <>
-class ArrayCRef<Record> {
- public:
-  using Value = Record;
-
-  ArrayCRef() = default;
-  ArrayCRef(const ArrayCRef &) = default;
-
-  ArrayCRef &operator=(const ArrayCRef &) = default;
-
-  bool operator==(const ArrayCRef<Value> &rhs) const {
-    return (values_ == rhs.values_) && (size_ == rhs.size_);
-  }
-  bool operator!=(const ArrayCRef<Value> &rhs) const {
-    return (values_ != rhs.values_) || (size_ != rhs.size_);
-  }
-
-  ArrayCRef ref(Int offset = 0) const {
-    return ArrayCRef(values_ + offset, size_ - offset);
-  }
-  ArrayCRef ref(Int offset, Int size) const {
-    return ArrayCRef(values_ + offset, size);
-  }
-
-  const Value &get(Int i) const {
-    return values_[i];
-  }
-  Int get_row_id(Int i) const {
-    return values_[i].row_id;
-  }
-  Float get_score(Int i) const {
-    return values_[i].score;
-  }
-
-  const Value &operator[](Int i) const {
-    return values_[i];
-  }
-
-  Int size() const {
-    return size_;
-  }
-
- private:
-  const Value *values_;
-  Int size_;
-
-  ArrayCRef(const Value *values, Int size) : values_(values), size_(size) {}
-
-  friend class ArrayRef<Value>;
-  friend class Array<Value>;
-};
-
-template <>
-class ArrayRef<Record> {
- public:
-  using Value = Record;
-
-  ArrayRef() = default;
-  ArrayRef(const ArrayRef &) = default;
-
-  ArrayRef &operator=(const ArrayRef &) = default;
-
-  operator ArrayCRef<Value>() const {
-    return ref();
-  }
-
-  bool operator==(const ArrayCRef<Value> &rhs) const {
-    return (values_ == rhs.values_) && (size_ == rhs.size_);
-  }
-  bool operator==(const ArrayRef<Value> &rhs) const {
-    return (values_ == rhs.values_) && (size_ == rhs.size_);
-  }
-
-  bool operator!=(const ArrayCRef<Value> &rhs) const {
-    return (values_ != rhs.values_) || (size_ != rhs.size_);
-  }
-  bool operator!=(const ArrayRef<Value> &rhs) const {
-    return (values_ != rhs.values_) || (size_ != rhs.size_);
-  }
-
-  ArrayCRef<Value> ref(Int offset = 0) const {
-    return ArrayCRef<Value>(values_ + offset, size_ - offset);
-  }
-  ArrayCRef<Value> ref(Int offset, Int size) const {
-    return ArrayCRef<Value>(values_ + offset, size);
-  }
-
-  ArrayRef ref(Int offset = 0) {
-    return ArrayRef(values_ + offset, size_ - offset);
-  }
-  ArrayRef ref(Int offset, Int size) {
-    return ArrayRef(values_ + offset, size);
-  }
-
-  const Value &get(Int i) const {
-    return values_[i];
-  }
-  Int get_row_id(Int i) const {
-    return values_[i].row_id;
-  }
-  Float get_score(Int i) const {
-    return values_[i].score;
-  }
-  void set(Int i, const Value &value) {
-    values_[i] = value;
-  }
-  void set_row_id(Int i, Int row_id) {
-    values_[i].row_id = row_id;
-  }
-  void set_score(Int i, Float score) {
-    values_[i].score = score;
-  }
-
-  const Value &operator[](Int i) const {
-    return values_[i];
-  }
-
-  Int size() const {
-    return size_;
-  }
-
-  void swap(Int i, Int j) {
-    Value temp = values_[i];
-    values_[i] = values_[j];
-    values_[j] = temp;
-  }
-
- private:
-  Value *values_;
-  Int size_;
-
-  ArrayRef(Value *values, Int size) : values_(values), size_(size) {}
-
-  friend class Array<Value>;
-};
-
-template <>
-class Array<Record> {
- public:
-  using Value = Record;
-
-  Array() : buf_(), size_(0), capacity_(0) {}
-  ~Array() {}
-
-  Array(Array &&array)
-      : buf_(std::move(array.buf_)),
-        size_(array.size_),
-        capacity_(array.capacity_) {
-    array.size_ = 0;
-    array.capacity_ = 0;
-  }
-
-  Array &operator=(Array &&array) {
-    buf_ = std::move(array.buf_);
-    size_ = array.size_;
-    capacity_ = array.capacity_;
-    array.size_ = 0;
-    array.capacity_ = 0;
-    return *this;
-  }
-
-  operator ArrayCRef<Value>() const {
-    return ref();
-  }
-
-  ArrayCRef<Value> ref(Int offset = 0) const {
-    return ArrayCRef<Value>(data() + offset, size_ - offset);
-  }
-  ArrayCRef<Value> ref(Int offset, Int size) const {
-    return ArrayCRef<Value>(data() + offset, size);
-  }
-
-  ArrayRef<Value> ref(Int offset = 0) {
-    return ArrayRef<Value>(data() + offset, size_ - offset);
-  }
-  ArrayRef<Value> ref(Int offset, Int size) {
-    return ArrayRef<Value>(data() + offset, size);
-  }
-
-  const Value &get(Int i) const {
-    return data()[i];
-  }
-  Int get_row_id(Int i) const {
-    return data()[i].row_id;
-  }
-  Float get_score(Int i) const {
-    return data()[i].score;
-  }
-  void set(Int i, const Value &value) {
-    data()[i] = value;
-  }
-  void set_row_id(Int i, Int row_id) {
-    data()[i].row_id = row_id;
-  }
-  void set_score(Int i, Float score) {
-    data()[i].score = score;
-  }
-
-  const Value &operator[](Int i) const {
-    return data()[i];
-  }
-
-  const Value &front() const {
-    return *data();
-  }
-
-  const Value &back() const {
-    return data()[size_ - 1];
-  }
-
-  Int size() const {
-    return size_;
-  }
-  Int capacity() const {
-    return capacity_;
-  }
-
-  bool reserve(Error *error, Int new_size) {
-    if (new_size <= capacity_) {
-      return true;
-    }
-    return resize_buf(error, new_size);
-  }
-
-  bool resize(Error *error, Int new_size) {
-    if (new_size > capacity_) {
-      if (!resize_buf(error, new_size)) {
-        return false;
-      }
-    }
-    for (Int i = new_size; i < size_; ++i) {
-      data()[i].~Value();
-    }
-    for (Int i = size_; i < new_size; ++i) {
-      new (&data()[i]) Value;
-    }
-    size_ = new_size;
-    return true;
-  }
-  bool resize(Error *error, Int new_size, const Value &value) {
-    if (new_size > capacity_) {
-      if (!resize_buf(error, new_size)) {
-        return false;
-      }
-    }
-    for (Int i = new_size; i < size_; ++i) {
-      data()[i].~Value();
-    }
-    for (Int i = size_; i < new_size; ++i) {
-      new (&data()[i]) Value(value);
-    }
-    size_ = new_size;
-    return true;
-  }
-
-  void clear() {
-    for (Int i = 0; i < size_; ++i) {
-      data()[i].~Value();
-    }
-    size_ = 0;
-  }
-
-  bool push_back(Error *error, const Value &value) {
-    if (size_ == capacity_) {
-      if (!resize_buf(error, size_ + 1)) {
-        return false;
-      }
-    }
-    new (&data()[size_]) Value(value);
-    ++size_;
-    return true;
-  }
-  void pop_back() {
-    data()[size_ - 1].~Value();
-    --size_;
-  }
-
-  void swap(Int i, Int j) {
-    Value temp = data()[i];
-    data()[i] = data()[j];
-    data()[j] = temp;
-  }
-
- private:
-  unique_ptr<char[]> buf_;
-  Int size_;
-  Int capacity_;
-
-  Value *data() {
-    return reinterpret_cast<Value *>(buf_.get());
-  }
-  const Value *data() const {
-    return reinterpret_cast<const Value *>(buf_.get());
-  }
-
-  // Assume new_size > capacity_.
-  bool resize_buf(Error *error, Int new_size);
-};
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_ARRAY_RECORD_HPP

  Deleted: include/grnxx/types/base_types.hpp (+0 -46) 100644
===================================================================
--- include/grnxx/types/base_types.hpp    2014-11-28 16:00:19 +0900 (3618c13)
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef GRNXX_TYPES_BASE_TYPES_HPP
-#define GRNXX_TYPES_BASE_TYPES_HPP
-
-#include <cinttypes>
-#include <limits>
-#include <memory>
-
-namespace grnxx {
-
-// Fixed-width signed integer types.
-using std::int8_t;
-using std::int16_t;
-using std::int32_t;
-using std::int64_t;
-
-// Fixed-width unsigned integer types.
-using std::uint8_t;
-using std::uint16_t;
-using std::uint32_t;
-using std::uint64_t;
-
-// Note that PRI*8/16/32/64 are available as format macro constants.
-// For example, "%" PRIi64 is used to print a 64-bit signed integer.
-// Also, "%" PRIu64 is used to print a 64-bit unsigned integer.
-
-// Integer type for representing offset and size.
-using std::size_t;
-
-// Limitations.
-using std::numeric_limits;
-
-// Smart pointer type.
-using std::unique_ptr;
-
-// An object to make a memory allocation (new) returns nullptr on failure.
-using std::nothrow;
-
-// Built-in data types.
-using Bool  = bool;
-using Int   = int64_t;
-using UInt  = uint64_t;
-using Float = double;
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_BASE_TYPES_HPP

  Deleted: include/grnxx/types/constants.hpp (+0 -98) 100644
===================================================================
--- include/grnxx/types/constants.hpp    2014-11-28 16:00:19 +0900 (a512876)
+++ /dev/null
@@ -1,98 +0,0 @@
-#ifndef GRNXX_TYPES_CONSTANTS_HPP
-#define GRNXX_TYPES_CONSTANTS_HPP
-
-#include "grnxx/types/base_types.hpp"
-
-namespace grnxx {
-
-// Zero is reserved for representing a null reference.
-constexpr Int NULL_ROW_ID = 0;
-constexpr Int MIN_ROW_ID  = 1;
-constexpr Int MAX_ROW_ID  = (Int(1) << 40) - 1;
-
-// Database data types.
-enum DataType {
-  // Content: True or false.
-  // Default: false.
-  BOOL_DATA,
-  // Content: 64-bit signed integer.
-  // Default: 0.
-  INT_DATA,
-  // Content: Double precision (64-bit) floating point number.
-  // Default: 0.0.
-  FLOAT_DATA,
-  // Content: Latitude-longitude in milliseconds.
-  // Default: (0, 0).
-  GEO_POINT_DATA,
-  // Content: Byte string.
-  // Default: "".
-  TEXT_DATA,
-  // Content: Vector of Bool.
-  // Default: {}.
-  BOOL_VECTOR_DATA,
-  // Content: Vector of Int.
-  // Default: {}.
-  INT_VECTOR_DATA,
-  // Content: Vector of Float.
-  // Default: {}.
-  FLOAT_VECTOR_DATA,
-  // Content: Vector of GeoPoint.
-  // Default: {}.
-  GEO_POINT_VECTOR_DATA,
-  // Content: Vector of Text.
-  // Default: {}.
-  TEXT_VECTOR_DATA
-};
-
-enum IndexType {
-  // Tree index supports range search.
-  TREE_INDEX,
-  // Hash index supports exact match search.
-  HASH_INDEX
-};
-
-enum OrderType {
-  // The natural order (the ascending order).
-  REGULAR_ORDER,
-  // The reverse order of REGULAR_ORDER (the descending order).
-  REVERSE_ORDER
-};
-
-// TODO: The following names should be improved.
-enum MergerType {
-  // Keep records included in both the first input stream and the second input
-  // stream.
-  AND_MERGER,
-  // Keep records included in the first input stream and/or the second input
-  // stream.
-  OR_MERGER,
-  // Keep records included in only one of the input streams.
-  XOR_MERGER,
-  // Keep records included in the first input stream and not included in the
-  // second input stream.
-  MINUS_MERGER,
-  // Keep records included in the first input stream.
-  LHS_MERGER,
-  // Keep records included in the second input stream.
-  RHS_MERGER
-};
-
-// TODO: The following names should be improved.
-enum MergerOperatorType {
-  // Add the first input score and the second input score.
-  PLUS_MERGER_OPERATOR,
-  // Subtract the second input score from the first input score.
-  MINUS_MERGER_OPERATOR,
-  // Multiply the first input score by the second input score.
-  MULTIPLICATION_MERGER_OPERATOR,
-  // Ignores the second input score.
-  LHS_MERGER_OPERATOR,
-  // Ignores the first input score.
-  RHS_MERGER_OPERATOR,
-  // All zeros.
-  ZERO_MERGER_OPERATOR
-};
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_CONSTANTS_HPP

  Deleted: include/grnxx/types/data_types.hpp (+0 -37) 100644
===================================================================
--- include/grnxx/types/data_types.hpp    2014-11-28 16:00:19 +0900 (24d93e9)
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef GRNXX_TYPES_DATA_TYPES_HPP
-#define GRNXX_TYPES_DATA_TYPES_HPP
-
-#include "grnxx/types/base_types.hpp"
-#include "grnxx/types/geo_point.hpp"
-#include "grnxx/types/string.hpp"
-#include "grnxx/types/vector.hpp"
-
-namespace grnxx {
-
-// Built-in data types (Bool, Int, and Float) are provided in
-// grnxx/types/base_types.hpp.
-
-// GeoPoint is provided in grnxx/types/geo_point.hpp.
-
-// Text is provided in grnxx/types/string.hpp.
-
-// Vector<T> are provided in grnxx/types/vector.hpp.
-using BoolVector     = Vector<Bool>;
-using IntVector      = Vector<Int>;
-using FloatVector    = Vector<Float>;
-using GeoPointVector = Vector<GeoPoint>;
-using TextVector     = Vector<Text>;
-
-struct Record {
-  Int row_id;
-  Float score;
-
-  Record() = default;
-  Record(Int row_id, Float score) : row_id(row_id), score(score) {}
-
-  Record &operator=(const Record &) & = default;
-};
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_DATA_TYPES_HPP

  Deleted: include/grnxx/types/error.hpp (+0 -104) 100644
===================================================================
--- include/grnxx/types/error.hpp    2014-11-28 16:00:19 +0900 (7fd145b)
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef GRNXX_TYPES_ERROR_HPP
-#define GRNXX_TYPES_ERROR_HPP
-
-#include "grnxx/types/base_types.hpp"
-
-namespace grnxx {
-
-enum ErrorCode {
-  NO_ERROR,           // No error occurred.
-  NOT_FOUND,          // The target does not found.
-  ALREADY_EXISTS,     // The target already exists.
-  NOT_REMOVABLE,      // The target is not removable.
-  BROKEN,             // The database is broken.
-  NO_MEMORY,          // Memory allocation failed.
-  INVALID_NAME,       // The string is invalid as an object name.
-  NO_KEY_COLUMN,      // The table has no key column.
-  INVALID_ARGUMENT,   // Invalid argument.
-  INVALID_OPERATION,  // Invalid operation.
-  INVALID_OPERAND,    // Invalid operand.
-  DIVISION_BY_ZERO,   // Integer division by zero.
-  DIVISION_OVERFLOW,  // Overflow in integer division.
-  NOT_SUPPORTED_YET   // The operation is not supported yet.
-};
-
-// Many functions take a pointer to an Error object as the first argument
-// (except an implicit this argument) for returning error information on
-// failure. On success, the Error object will not be modified. If the pointer
-// is nullptr, the error information will not be generated even on failure.
-class Error {
- public:
-  // The error code of an initialized Error object is NO_ERROR.
-  Error()
-      : code_(NO_ERROR),
-        line_(0),
-        file_(""),
-        function_(""),
-        message_() {
-    message_[0] = '\0';
-  }
-
-  // Error code.
-  ErrorCode code() const {
-    return code_;
-  }
-  // Line number (__LINE__).
-  int line() const {
-    return code_;
-  }
-  // File name (__FILE__).
-  const char *file() const {
-    return file_;
-  }
-  // Function name (__func__, __FUNCTION__, or __PRETTY_FUNCTION__).
-  const char *function() const {
-    return function_;
-  }
-  // Error message.
-  const char *message() const {
-    return message_;
-  }
-
-  // Set an error code.
-  void set_code(ErrorCode code) {
-    code_ = code;
-  }
-  // Set a line number.
-  void set_line(int line) {
-    line_ = line;
-  }
-  // Set a file name.
-  void set_file(const char *file) {
-    file_ = file;
-  }
-  // Set a function name.
-  void set_function(const char *function) {
-    function_ = function;
-  }
-  // Generate an error message with the printf syntax.
-  // If the expected message is too long, the result will be truncated.
-  // Return true on success.
-  bool set_message(const char *format, ...)
-      __attribute__ ((format (printf, 2, 3)));
-
- private:
-  static constexpr size_t MESSAGE_BUF_SIZE = 256;
-
-  ErrorCode code_;
-  int line_;
-  const char *file_;
-  const char *function_;
-  char message_[MESSAGE_BUF_SIZE];
-};
-
-}  // namespace grnxx
-
-// Set error information.
-#define GRNXX_ERROR_SET(error, code, format, ...) \
-  (((error) != nullptr) && ((error)->set_code(code), \
-                            (error)->set_line(__LINE__), \
-                            (error)->set_file(__FILE__), \
-                            (error)->set_function(__PRETTY_FUNCTION__), \
-                            (error)->set_message(format, ## __VA_ARGS__)))
-
-#endif  // GRNXX_TYPES_ERROR_HPP

  Deleted: include/grnxx/types/forward.hpp (+0 -21) 100644
===================================================================
--- include/grnxx/types/forward.hpp    2014-11-28 16:00:19 +0900 (0ca17c3)
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef GRNXX_TYPES_FORWARD_HPP
-#define GRNXX_TYPES_FORWARD_HPP
-
-namespace grnxx {
-
-// Database persistent object types.
-class DB;
-class Table;
-class Column;
-class Index;
-
-// Database temporary object types.
-class Datum;
-class Cursor;
-class Expression;
-class ExpressionBuilder;
-class Sorter;
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_FORWARD_HPP

  Deleted: include/grnxx/types/options.hpp (+0 -85) 100644
===================================================================
--- include/grnxx/types/options.hpp    2014-11-28 16:00:19 +0900 (4f85ab5)
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef GRNXX_TYPES_OPTIONS_HPP
-#define GRNXX_TYPES_OPTIONS_HPP
-
-#include "grnxx/types/base_types.hpp"
-#include "grnxx/types/constants.hpp"
-
-namespace grnxx {
-
-// Database persistent object option types.
-struct DBOptions {
-  DBOptions();
-};
-
-struct TableOptions {
-  TableOptions();
-};
-
-struct ColumnOptions {
-  // The referenced (parent) table.
-  StringCRef ref_table_name;
-
-  ColumnOptions();
-};
-
-struct IndexOptions {
-  IndexOptions();
-};
-
-struct CursorOptions {
-  // The first "offset" records are skipped (default: 0).
-  Int offset;
-
-  // At most "limit" records are read (default: numeric_limits<Int>::max()).
-  Int limit;
-
-  // The order of records (default: REGULAR_ORDER).
-  OrderType order_type;
-
-  CursorOptions();
-};
-
-struct ExpressionOptions {
-  // Records are evaluated per block.
-  Int block_size;
-
-  ExpressionOptions();
-};
-
-struct SorterOptions {
-  // The first "offset" records are skipped (default: 0).
-  Int offset;
-
-  // At most "limit" records are sorted (default: numeric_limits<Int>::max()).
-  Int limit;
-
-  SorterOptions();
-};
-
-struct MergerOptions {
-  // How to merge row IDs.
-  MergerType type;
-
-  // How to merge scores.
-  MergerOperatorType operator_type;
-
-  // This value is used when a corresponding record does not exist.
-  Float null_score;
-
-  // The first "offset" records are skipped (default: 0).
-  Int offset;
-
-  // At most "limit" records are returned
-  // (default: numeric_limits<Int>::max()).
-  Int limit;
-
-  MergerOptions();
-};
-
-struct PipelineOptions {
-  PipelineOptions();
-};
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_OPTIONS_HPP

  Deleted: include/grnxx/types/vector.hpp (+0 -336) 100644
===================================================================
--- include/grnxx/types/vector.hpp    2014-11-28 16:00:19 +0900 (39ecea0)
+++ /dev/null
@@ -1,336 +0,0 @@
-#ifndef GRNXX_TYPES_VECTOR_HPP
-#define GRNXX_TYPES_VECTOR_HPP
-
-#include <initializer_list>
-
-#include "grnxx/types/base_types.hpp"
-#include "grnxx/types/geo_point.hpp"
-#include "grnxx/types/string.hpp"
-
-namespace grnxx {
-
-template <typename T> class Vector;
-
-// A Vector<Bool> contains at most 58 Bool values.
-template <>
-class Vector<Bool> {
- public:
-  Vector() = default;
-  Vector(std::initializer_list<Bool> bits) : data_(0) {
-    UInt size = static_cast<UInt>(bits.size());
-    if (size > 58) {
-      size = 58;
-    }
-    UInt i = 0;
-    for (auto it = bits.begin(); it != bits.end(); ++it) {
-      if (*it) {
-        data_ |= UInt(1) << i;
-      }
-      ++i;
-    }
-    data_ |= size << 58;
-  }
-  Vector(UInt bits, Int size)
-      : data_((bits & mask(size)) |
-              (static_cast<UInt>(std::min(size, Int(58))) << 58)) {}
-  Vector(const Vector &) = default;
-
-  Vector &operator=(const Vector &) = default;
-
-  // Return the number of Bool values.
-  Int size() const {
-    return static_cast<Int>(data_ >> 58);
-  }
-  // Return the "i"-th Bool value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Bool get(Int i) const {
-    return (data_ & (UInt(1) << i)) != 0;
-  }
-  // Set the "i"-th Bool value.
-  //
-  // If "i" is invalid, the result is undefined.
-  void set(Int i, Bool value) {
-    if (value) {
-      data_ |= UInt(1) << i;
-    } else {
-      data_ &= ~(UInt(1) << i);
-    }
-  }
-
-  // Return the "i"-th Bool value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Bool operator[](Int i) const {
-    return get(i);
-  }
-
-  // Return the set of Bool values.
-  UInt bits() const {
-    return data_ & mask(58);
-  }
-
- private:
-  UInt data_;
-
-  static UInt mask(Int size) {
-    return (UInt(1) << size) - 1;
-  }
-};
-
-inline Bool operator==(Vector<Bool> lhs, Vector<Bool> rhs) {
-  return (lhs.size() == rhs.size()) &&
-         ((lhs.bits() ^ rhs.bits()) == 0);
-}
-inline Bool operator!=(Vector<Bool> lhs, Vector<Bool> rhs) {
-  return (lhs.size() == rhs.size()) ||
-         ((lhs.bits() ^ rhs.bits()) != 0);
-}
-
-template <>
-class Vector<Int> {
- public:
-  Vector() = default;
-  Vector(const Int *data, Int size) : data_(data), size_(size) {}
-  Vector(const Vector &) = default;
-
-  Vector &operator=(const Vector &) = default;
-
-  // Return the number of Int values.
-  Int size() const {
-    return size_;
-  }
-  // Return the "i"-th Int value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Int get(Int i) const {
-    return data_[i];
-  }
-
-  // Return the "i"-th Int value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Int operator[](Int i) const {
-    return get(i);
-  }
-
- private:
-  const Int *data_;
-  Int size_;
-};
-
-inline Bool operator==(Vector<Int> lhs, Vector<Int> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return false;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return false;
-    }
-  }
-  return true;
-}
-inline Bool operator!=(Vector<Int> lhs, Vector<Int> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return true;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return true;
-    }
-  }
-  return false;
-}
-
-template <>
-class Vector<Float> {
- public:
-  Vector() = default;
-  Vector(const Float *data, Int size) : data_(data), size_(size) {}
-  Vector(const Vector &) = default;
-
-  Vector &operator=(const Vector &) = default;
-
-  // Return the number of Float values.
-  Int size() const {
-    return size_;
-  }
-  // Return the "i"-th Float value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Float get(Int i) const {
-    return data_[i];
-  }
-
-  // Return the "i"-th Float value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Float operator[](Int i) const {
-    return get(i);
-  }
-
- private:
-  const Float *data_;
-  Int size_;
-};
-
-inline Bool operator==(Vector<Float> lhs, Vector<Float> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return false;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return false;
-    }
-  }
-  return true;
-}
-inline Bool operator!=(Vector<Float> lhs, Vector<Float> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return true;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return true;
-    }
-  }
-  return false;
-}
-
-template <>
-class Vector<GeoPoint> {
- public:
-  Vector() = default;
-  Vector(const GeoPoint *data, Int size) : data_(data), size_(size) {}
-  Vector(const Vector &) = default;
-
-  Vector &operator=(const Vector &) = default;
-
-  // Return the number of GeoPoint values.
-  Int size() const {
-    return size_;
-  }
-  // Return the "i"-th GeoPoint value.
-  //
-  // If "i" is invalid, the result is undefined.
-  GeoPoint get(Int i) const {
-    return data_[i];
-  }
-
-  // Return the "i"-th GeoPoint value.
-  //
-  // If "i" is invalid, the result is undefined.
-  GeoPoint operator[](Int i) const {
-    return get(i);
-  }
-
- private:
-  const GeoPoint *data_;
-  Int size_;
-};
-
-inline Bool operator==(Vector<GeoPoint> lhs, Vector<GeoPoint> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return false;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return false;
-    }
-  }
-  return true;
-}
-inline Bool operator!=(Vector<GeoPoint> lhs, Vector<GeoPoint> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return true;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return true;
-    }
-  }
-  return false;
-}
-
-// TODO: Improve the implementation of Vector<Text>.
-template <>
-class Vector<Text> {
- public:
-  Vector() = default;
-  Vector(const Text *data, Int size)
-      : is_direct_(1),
-        size_(size),
-        data_(data) {}
-  Vector(const void *headers, const char *bodies, Int size)
-      : is_direct_(0),
-        size_(size),
-        headers_(static_cast<const Header *>(headers)),
-        bodies_(bodies) {}
-  Vector(const Vector &) = default;
-
-  Vector &operator=(const Vector &) = default;
-
-  // Return the number of Text values.
-  Int size() const {
-    return static_cast<Int>(size_);
-  }
-  // Return the "i"-th Text value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Text get(Int i) const {
-    if (is_direct_) {
-      return data_[i];
-    } else {
-      return Text(&bodies_[headers_[i].offset], headers_[i].size);
-    }
-  }
-
-  // Return the "i"-th Text value.
-  //
-  // If "i" is invalid, the result is undefined.
-  Text operator[](Int i) const {
-    return get(i);
-  }
-
- private:
-  struct Header {
-    Int offset;
-    Int size;
-  };
-  bool is_direct_;
-  Int size_;
-  union {
-    const Text *data_;
-    struct {
-      const Header *headers_;
-      const char *bodies_;
-    };
-  };
-};
-
-inline Bool operator==(Vector<Text> lhs, Vector<Text> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return false;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return false;
-    }
-  }
-  return true;
-}
-inline Bool operator!=(Vector<Text> lhs, Vector<Text> rhs) {
-  if (lhs.size() != rhs.size()) {
-    return true;
-  }
-  for (Int i = 0; i < lhs.size(); ++i) {
-    if (lhs[i] != rhs[i]) {
-      return true;
-    }
-  }
-  return false;
-}
-
-}  // namespace grnxx
-
-#endif  // GRNXX_TYPES_VECTOR_HPP

  Deleted: lib/grnxx/types.cpp (+0 -119) 100644
===================================================================
--- lib/grnxx/types.cpp    2014-11-28 16:00:19 +0900 (a0e0295)
+++ /dev/null
@@ -1,119 +0,0 @@
-#include "grnxx/types.hpp"
-
-#include "grnxx/expression.hpp"
-
-namespace grnxx {
-
-void GeoPoint::fix(Int *latitude, Int *longitude) {
-  // Fix the latitude to [0, 360).
-  if ((*latitude <= DEGREES(-360)) || (*latitude >= DEGREES(360))) {
-    *latitude %= DEGREES(360);
-  }
-  if (*latitude < DEGREES(0)) {
-    *latitude += DEGREES(360);
-  }
-  // Fix the longitude to [0, 360).
-  if ((*longitude <= DEGREES(-360)) || (*longitude >= DEGREES(360))) {
-    *longitude %= DEGREES(360);
-  }
-  if (*longitude < DEGREES(0)) {
-    *longitude += DEGREES(360);
-  }
-  // Fix the latitude in (90, 270).
-  if ((*latitude > DEGREES(90)) && (*latitude < DEGREES(270))) {
-    *latitude = DEGREES(180) - *latitude;
-    if (*latitude < DEGREES(0)) {
-      *latitude += DEGREES(360);
-    }
-    *longitude += DEGREES(180);
-    if (*longitude >= DEGREES(360)) {
-      *longitude -= DEGREES(360);
-    }
-  }
-  // Fix the latitude to [-90, 90].
-  if (*latitude >= DEGREES(270)) {
-    *latitude -= DEGREES(360);
-  }
-  // Fix the longitude to [-180, 180).
-  if (*longitude >= DEGREES(180)) {
-    *longitude -= DEGREES(360);
-  }
-}
-
-bool String::resize_buf(Error *error, Int new_size) {
-  Int new_capacity = capacity_ * 2;
-  if (new_size > new_capacity) {
-    new_capacity = new_size;
-  }
-  unique_ptr<char[]> new_buf(new (nothrow) char[new_capacity]);
-  if (!new_buf) {
-    GRNXX_ERROR_SET(error, NO_MEMORY, "Memory allocation failed");
-    return false;
-  }
-  std::memcpy(new_buf.get(), buf_.get(), size_);
-  buf_ = std::move(new_buf);
-  capacity_ = new_capacity;
-  return true;
-}
-
-bool String::append_overlap(Error *error, const StringCRef &arg) {
-  Int new_capacity = capacity_ * 2;
-  Int new_size = size_ + arg.size();
-  if (new_size > new_capacity) {
-    new_capacity = new_size;
-  }
-  unique_ptr<char[]> new_buf(new (nothrow) char[new_capacity]);
-  if (!new_buf) {
-    GRNXX_ERROR_SET(error, NO_MEMORY, "Memory allocation failed");
-    return false;
-  }
-  std::memcpy(new_buf.get(), buf_.get(), size_);
-  std::memcpy(new_buf.get() + size_, arg.data(), arg.size());
-  buf_ = std::move(new_buf);
-  size_ = new_size;
-  capacity_ = new_capacity;
-  return true;
-}
-
-DBOptions::DBOptions() {}
-
-TableOptions::TableOptions() {}
-
-ColumnOptions::ColumnOptions() : ref_table_name("") {}
-
-IndexOptions::IndexOptions() {}
-
-CursorOptions::CursorOptions()
-    : offset(0),
-      limit(numeric_limits<Int>::max()),
-      order_type(REGULAR_ORDER) {}
-
-ExpressionOptions::ExpressionOptions()
-    : block_size(1024) {}
-
-SorterOptions::SorterOptions()
-    : offset(0),
-      limit(numeric_limits<Int>::max()) {}
-
-MergerOptions::MergerOptions()
-    : type(AND_MERGER),
-      operator_type(PLUS_MERGER_OPERATOR),
-      null_score(0.0),
-      offset(0),
-      limit(numeric_limits<Int>::max()) {}
-
-PipelineOptions::PipelineOptions() {}
-
-SortOrder::SortOrder() : expression(), type(REGULAR_ORDER) {}
-
-SortOrder::SortOrder(SortOrder &&order)
-    : expression(std::move(order.expression)),
-      type(order.type) {}
-
-SortOrder::SortOrder(unique_ptr<Expression> &&expression, OrderType type)
-    : expression(std::move(expression)),
-      type(type) {}
-
-SortOrder::~SortOrder() {}
-
-}  // namespace grnxx
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index