susumu.yata
null+****@clear*****
Mon Feb 9 13:29:20 JST 2015
susumu.yata 2015-02-09 13:29:20 +0900 (Mon, 09 Feb 2015) New Revision: 6714582286c918f26ca51f3d45b565ab44fd18bc https://github.com/groonga/grnxx/commit/6714582286c918f26ca51f3d45b565ab44fd18bc Message: Put data type constants in the C global namespace. (#144) Added files: include/grnxx/constants.h Modified files: benchmark/benchmark_filter_and.cpp benchmark/benchmark_filter_less.cpp benchmark/benchmark_filter_or.cpp benchmark/benchmark_filter_reference.cpp benchmark/benchmark_foreign_key.cpp benchmark/benchmark_sorter.cpp include/grnxx/Makefile.am include/grnxx/data_types/data_type.hpp include/grnxx/data_types/datum.hpp include/grnxx/data_types/na.hpp include/grnxx/data_types/scalar/bool.hpp include/grnxx/data_types/scalar/float.hpp include/grnxx/data_types/scalar/geo_point.hpp include/grnxx/data_types/scalar/int.hpp include/grnxx/data_types/scalar/text.hpp include/grnxx/data_types/vector/bool.hpp include/grnxx/data_types/vector/float.hpp include/grnxx/data_types/vector/geo_point.hpp include/grnxx/data_types/vector/int.hpp include/grnxx/data_types/vector/text.hpp lib/grnxx/impl/column/base.cpp lib/grnxx/impl/column/scalar/bool.cpp lib/grnxx/impl/column/scalar/float.cpp lib/grnxx/impl/column/scalar/geo_point.cpp lib/grnxx/impl/column/scalar/int.cpp lib/grnxx/impl/column/scalar/text.cpp lib/grnxx/impl/column/vector/bool.cpp lib/grnxx/impl/column/vector/float.cpp lib/grnxx/impl/column/vector/geo_point.cpp lib/grnxx/impl/column/vector/int.cpp lib/grnxx/impl/column/vector/text.cpp lib/grnxx/impl/expression.cpp lib/grnxx/impl/index.cpp lib/grnxx/impl/sorter.cpp lib/grnxx/impl/table.cpp test/test_column.cpp test/test_data_types.cpp test/test_expression.cpp test/test_index.cpp test/test_issue_62.cpp test/test_merger.cpp test/test_pipeline.cpp test/test_sorter.cpp test/test_table.cpp Modified: benchmark/benchmark_filter_and.cpp (+3 -3) =================================================================== --- benchmark/benchmark_filter_and.cpp 2015-01-07 13:45:58 +0900 (0703309) +++ benchmark/benchmark_filter_and.cpp 2015-02-09 13:29:20 +0900 (1b214ea) @@ -128,9 +128,9 @@ void benchmark_grnxx() { auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto col_a = table->create_column("A", grnxx::INT_DATA); - auto col_b = table->create_column("B", grnxx::INT_DATA); - auto col_c = table->create_column("C", grnxx::INT_DATA); + auto col_a = table->create_column("A", GRNXX_INT); + auto col_b = table->create_column("B", GRNXX_INT); + auto col_c = table->create_column("C", GRNXX_INT); for (size_t i = 0; i < SIZE; ++i) { grnxx::Int row_id = table->insert_row(); col_a->set(row_id, a[i]); Modified: benchmark/benchmark_filter_less.cpp (+1 -1) =================================================================== --- benchmark/benchmark_filter_less.cpp 2015-01-07 13:45:58 +0900 (1c3009c) +++ benchmark/benchmark_filter_less.cpp 2015-02-09 13:29:20 +0900 (64117fb) @@ -99,7 +99,7 @@ void benchmark_grnxx() { auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto col_a = table->create_column("A", grnxx::INT_DATA); + auto col_a = table->create_column("A", GRNXX_INT); for (size_t i = 0; i < SIZE; ++i) { grnxx::Int row_id = table->insert_row(); col_a->set(row_id, a[i]); Modified: benchmark/benchmark_filter_or.cpp (+3 -3) =================================================================== --- benchmark/benchmark_filter_or.cpp 2015-01-07 13:45:58 +0900 (96c55e9) +++ benchmark/benchmark_filter_or.cpp 2015-02-09 13:29:20 +0900 (e9b74c1) @@ -179,9 +179,9 @@ void benchmark_grnxx() { auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto col_a = table->create_column("A", grnxx::INT_DATA); - auto col_b = table->create_column("B", grnxx::INT_DATA); - auto col_c = table->create_column("C", grnxx::INT_DATA); + auto col_a = table->create_column("A", GRNXX_INT); + auto col_b = table->create_column("B", GRNXX_INT); + auto col_c = table->create_column("C", GRNXX_INT); for (size_t i = 0; i < SIZE; ++i) { grnxx::Int row_id = table->insert_row(); col_a->set(row_id, a[i]); Modified: benchmark/benchmark_filter_reference.cpp (+4 -4) =================================================================== --- benchmark/benchmark_filter_reference.cpp 2015-01-07 13:45:58 +0900 (8a8845b) +++ benchmark/benchmark_filter_reference.cpp 2015-02-09 13:29:20 +0900 (76d8d28) @@ -295,9 +295,9 @@ void benchmark_grnxx() { auto db = grnxx::open_db(""); auto table = db->create_table("To"); - auto col_a = table->create_column("A", grnxx::INT_DATA); - auto col_b = table->create_column("B", grnxx::INT_DATA); - auto col_c = table->create_column("C", grnxx::INT_DATA); + auto col_a = table->create_column("A", GRNXX_INT); + auto col_b = table->create_column("B", GRNXX_INT); + auto col_c = table->create_column("C", GRNXX_INT); for (size_t i = 0; i < TO_SIZE; ++i) { grnxx::Int row_id = table->insert_row(); col_a->set(row_id, a[i]); @@ -307,7 +307,7 @@ void benchmark_grnxx() { table = db->create_table("From"); grnxx::ColumnOptions options; options.reference_table_name = "To"; - auto col_ref = table->create_column("Ref", grnxx::INT_DATA, options); + auto col_ref = table->create_column("Ref", GRNXX_INT, options); for (size_t i = 0; i < FROM_SIZE; ++i) { grnxx::Int row_id = table->insert_row(); col_ref->set(row_id, ref[i]); Modified: benchmark/benchmark_foreign_key.cpp (+6 -6) =================================================================== --- benchmark/benchmark_foreign_key.cpp 2015-01-07 13:45:58 +0900 (4852ccd) +++ benchmark/benchmark_foreign_key.cpp 2015-02-09 13:29:20 +0900 (53468da) @@ -84,7 +84,7 @@ void benchmark_direct_build() try { auto db = grnxx::open_db(""); auto table = db->create_table("Values"); - auto column = table->create_column("Value", grnxx::TEXT_DATA); + auto column = table->create_column("Value", GRNXX_TEXT); for (size_t i = 0; i < VALUES_SIZE; ++i) { grnxx::Int row_id = table->insert_row(); column->set(row_id, values[i]); @@ -93,7 +93,7 @@ void benchmark_direct_build() try { table = db->create_table("Refs"); grnxx::ColumnOptions options; options.reference_table_name = "Values"; - column = table->create_column("Ref", grnxx::INT_DATA, options); + column = table->create_column("Ref", GRNXX_INT, options); for (size_t i = 0; i < REFS_SIZE; ++i) { grnxx::Int row_id = table->insert_row(); column->set(row_id, refs[i]); @@ -118,7 +118,7 @@ void benchmark_indirect_build() try { auto db = grnxx::open_db(""); auto to_table = db->create_table("Values"); - auto column = to_table->create_column("Value", grnxx::TEXT_DATA); + auto column = to_table->create_column("Value", GRNXX_TEXT); column->create_index("Index", grnxx::TREE_INDEX); to_table->set_key_column("Value"); for (size_t j = 0; j < VALUES_SIZE; ++j) { @@ -128,7 +128,7 @@ void benchmark_indirect_build() try { auto from_table = db->create_table("Refs"); grnxx::ColumnOptions options; options.reference_table_name = "Values"; - column = from_table->create_column("Ref", grnxx::INT_DATA, options); + column = from_table->create_column("Ref", GRNXX_INT, options); for (size_t j = 0; j < REFS_SIZE; ++j) { grnxx::Int row_id = from_table->insert_row(); column->set(row_id, to_table->find_row(values[refs[j].raw()])); @@ -153,14 +153,14 @@ void benchmark_sequential_build() try { auto db = grnxx::open_db(""); auto to_table = db->create_table("Values"); - auto value_column = to_table->create_column("Value", grnxx::TEXT_DATA); + auto value_column = to_table->create_column("Value", GRNXX_TEXT); value_column->create_index("Index", grnxx::TREE_INDEX); to_table->set_key_column("Value"); auto from_table = db->create_table("Refs"); grnxx::ColumnOptions options; options.reference_table_name = "Values"; auto ref_column = - from_table->create_column("Ref", grnxx::INT_DATA, options); + from_table->create_column("Ref", GRNXX_INT, options); for (size_t j = 0; j < REFS_SIZE; ++j) { grnxx::Int row_id = from_table->insert_row(); grnxx::Int ref = to_table->find_or_insert_row(values[refs[j].raw()]); Modified: benchmark/benchmark_sorter.cpp (+12 -12) =================================================================== --- benchmark/benchmark_sorter.cpp 2015-01-07 13:45:58 +0900 (b69b88b) +++ benchmark/benchmark_sorter.cpp 2015-02-09 13:29:20 +0900 (1af27ee) @@ -50,9 +50,9 @@ class Timer { void create_bool_columns(grnxx::Table *table) { grnxx::Column *columns[3]; - columns[0] = table->create_column("Bool1", grnxx::BOOL_DATA); - columns[1] = table->create_column("Bool2", grnxx::BOOL_DATA); - columns[2] = table->create_column("Bool3", grnxx::BOOL_DATA); + columns[0] = table->create_column("Bool1", GRNXX_BOOL); + columns[1] = table->create_column("Bool2", GRNXX_BOOL); + columns[2] = table->create_column("Bool3", GRNXX_BOOL); std::mt19937_64 rng; for (size_t i = 0; i < SIZE; ++i) { @@ -67,9 +67,9 @@ void create_bool_columns(grnxx::Table *table) { void create_int_columns(grnxx::Table *table) { grnxx::Column *columns[3]; - columns[0] = table->create_column("Int1", grnxx::INT_DATA); - columns[1] = table->create_column("Int2", grnxx::INT_DATA); - columns[2] = table->create_column("Int3", grnxx::INT_DATA); + columns[0] = table->create_column("Int1", GRNXX_INT); + columns[1] = table->create_column("Int2", GRNXX_INT); + columns[2] = table->create_column("Int3", GRNXX_INT); std::mt19937_64 rng; for (size_t i = 0; i < SIZE; ++i) { @@ -86,9 +86,9 @@ void create_int_columns(grnxx::Table *table) { void create_float_columns(grnxx::Table *table) { grnxx::Column *columns[3]; - columns[0] = table->create_column("Float1", grnxx::FLOAT_DATA); - columns[1] = table->create_column("Float2", grnxx::FLOAT_DATA); - columns[2] = table->create_column("Float3", grnxx::FLOAT_DATA); + columns[0] = table->create_column("Float1", GRNXX_FLOAT); + columns[1] = table->create_column("Float2", GRNXX_FLOAT); + columns[2] = table->create_column("Float3", GRNXX_FLOAT); std::mt19937_64 rng; for (size_t i = 0; i < SIZE; ++i) { @@ -105,9 +105,9 @@ void create_float_columns(grnxx::Table *table) { void create_text_columns(grnxx::Table *table) { grnxx::Column *columns[3]; - columns[0] = table->create_column("Text1", grnxx::TEXT_DATA); - columns[1] = table->create_column("Text2", grnxx::TEXT_DATA); - columns[2] = table->create_column("Text3", grnxx::TEXT_DATA); + columns[0] = table->create_column("Text1", GRNXX_TEXT); + columns[1] = table->create_column("Text2", GRNXX_TEXT); + columns[2] = table->create_column("Text3", GRNXX_TEXT); std::mt19937_64 rng; char buf[16]; Modified: include/grnxx/Makefile.am (+1 -0) =================================================================== --- include/grnxx/Makefile.am 2015-01-07 13:45:58 +0900 (c49404b) +++ include/grnxx/Makefile.am 2015-02-09 13:29:20 +0900 (bc9e34a) @@ -5,6 +5,7 @@ SUBDIRS = \ pkginclude_HEADERS = \ array.hpp \ column.hpp \ + constants.h \ cursor.hpp \ data_types.hpp \ db.hpp \ Added: include/grnxx/constants.h (+37 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/constants.h 2015-02-09 13:29:20 +0900 (3fd4f98) @@ -0,0 +1,37 @@ +#ifndef GRNXX_CONSTANTS_H +#define GRNXX_CONSTANTS_H + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +typedef enum { + // N/A. + GRNXX_NA, + // True or false. + GRNXX_BOOL, + // 64-bit signed integer. + GRNXX_INT, + // Double precision (64-bit) floating point number. + GRNXX_FLOAT, + // Latitude-longitude in milliseconds. + GRNXX_GEO_POINT, + // Byte string. + GRNXX_TEXT, + // Vector of Bool. + GRNXX_BOOL_VECTOR, + // Vector of Int. + GRNXX_INT_VECTOR, + // Vector of Float. + GRNXX_FLOAT_VECTOR, + // Vector of GeoPoint. + GRNXX_GEO_POINT_VECTOR, + // Vector of Text. + GRNXX_TEXT_VECTOR +} grnxx_data_type; + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#endif // GRNXX_GRNXX_H Modified: include/grnxx/data_types/data_type.hpp (+3 -24) =================================================================== --- include/grnxx/data_types/data_type.hpp 2015-01-07 13:45:58 +0900 (6858b8f) +++ include/grnxx/data_types/data_type.hpp 2015-02-09 13:29:20 +0900 (91aa5e8) @@ -1,32 +1,11 @@ #ifndef GRNXX_DATA_TYPES_DATA_TYPE_HPP #define GRNXX_DATA_TYPES_DATA_TYPE_HPP +#include "grnxx/constants.h" + namespace grnxx { -enum DataType { - // N/A. - NA_DATA, - // True or false. - BOOL_DATA, - // 64-bit signed integer. - INT_DATA, - // Double precision (64-bit) floating point number. - FLOAT_DATA, - // Latitude-longitude in milliseconds. - GEO_POINT_DATA, - // Byte string. - TEXT_DATA, - // Vector of Bool. - BOOL_VECTOR_DATA, - // Vector of Int. - INT_VECTOR_DATA, - // Vector of Float. - FLOAT_VECTOR_DATA, - // Vector of GeoPoint. - GEO_POINT_VECTOR_DATA, - // Vector of Text. - TEXT_VECTOR_DATA -}; +using DataType = grnxx_data_type; } // namespace grnxx Modified: include/grnxx/data_types/datum.hpp (+67 -67) =================================================================== --- include/grnxx/data_types/datum.hpp 2015-01-07 13:45:58 +0900 (16248e7) +++ include/grnxx/data_types/datum.hpp 2015-02-09 13:29:20 +0900 (a819ff3) @@ -13,7 +13,7 @@ namespace grnxx { class Datum { public: - Datum() : type_(NA_DATA), na_() {} + Datum() : type_(GRNXX_NA), na_() {} ~Datum() { destruct(); } @@ -28,47 +28,47 @@ class Datum { return *this; } switch (type_) { - case NA_DATA: { + case GRNXX_NA: { na_ = datum.na_; break; } - case BOOL_DATA: { + case GRNXX_BOOL: { bool_ = datum.bool_; break; } - case INT_DATA: { + case GRNXX_INT: { int_ = datum.int_; break; } - case FLOAT_DATA: { + case GRNXX_FLOAT: { float_ = datum.float_; break; } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { geo_point_ = datum.geo_point_; break; } - case TEXT_DATA: { + case GRNXX_TEXT: { text_ = datum.text_; break; } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { bool_vector_ = datum.bool_vector_; break; } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { int_vector_ = datum.int_vector_; break; } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { float_vector_ = datum.float_vector_; break; } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { geo_point_vector_ = datum.geo_point_vector_; break; } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { text_vector_ = datum.text_vector_; break; } @@ -86,47 +86,47 @@ class Datum { return *this; } switch (type_) { - case NA_DATA: { + case GRNXX_NA: { na_ = std::move(datum.na_); break; } - case BOOL_DATA: { + case GRNXX_BOOL: { bool_ = std::move(datum.bool_); break; } - case INT_DATA: { + case GRNXX_INT: { int_ = std::move(datum.int_); break; } - case FLOAT_DATA: { + case GRNXX_FLOAT: { float_ = std::move(datum.float_); break; } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { geo_point_ = std::move(datum.geo_point_); break; } - case TEXT_DATA: { + case GRNXX_TEXT: { text_ = std::move(datum.text_); break; } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { bool_vector_ = std::move(datum.bool_vector_); break; } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { int_vector_ = std::move(datum.int_vector_); break; } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { float_vector_ = std::move(datum.float_vector_); break; } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { geo_point_vector_ = std::move(datum.geo_point_vector_); break; } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { text_vector_ = std::move(datum.text_vector_); break; } @@ -135,36 +135,36 @@ class Datum { } // Create a N/A object. - Datum(NA) : type_(NA_DATA), na_() {} + Datum(NA) : type_(GRNXX_NA), na_() {} // Create a Bool object. - Datum(Bool value) : type_(BOOL_DATA), bool_(value) {} + Datum(Bool value) : type_(GRNXX_BOOL), bool_(value) {} // Create an Int object. - Datum(Int value) : type_(INT_DATA), int_(value) {} + Datum(Int value) : type_(GRNXX_INT), int_(value) {} // Create a Float object. - Datum(Float value) : type_(FLOAT_DATA), float_(value) {} + Datum(Float value) : type_(GRNXX_FLOAT), float_(value) {} // Create a GeoPoint object. - Datum(GeoPoint value) : type_(GEO_POINT_DATA), geo_point_(value) {} + Datum(GeoPoint value) : type_(GRNXX_GEO_POINT), geo_point_(value) {} // Create a Text object. - Datum(const Text &value) : type_(TEXT_DATA), text_(value) {} + Datum(const Text &value) : type_(GRNXX_TEXT), text_(value) {} // Create a Vector<Bool> object. Datum(const Vector<Bool> &value) - : type_(BOOL_VECTOR_DATA), + : type_(GRNXX_BOOL_VECTOR), bool_vector_(value) {} // Create a Vector<Int> object. Datum(const Vector<Int> &value) - : type_(INT_VECTOR_DATA), + : type_(GRNXX_INT_VECTOR), int_vector_(value) {} // Create a Vector<Float> object. Datum(const Vector<Float> &value) - : type_(FLOAT_VECTOR_DATA), + : type_(GRNXX_FLOAT_VECTOR), float_vector_(value) {} // Create a Vector<GeoPoint> object. Datum(const Vector<GeoPoint> &value) - : type_(GEO_POINT_VECTOR_DATA), + : type_(GRNXX_GEO_POINT_VECTOR), geo_point_vector_(value) {} // Create a Vector<Text> object. Datum(const Vector<Text> &value) - : type_(TEXT_VECTOR_DATA), + : type_(GRNXX_TEXT_VECTOR), text_vector_(value) {} // Return the data type. @@ -336,47 +336,47 @@ class Datum { void destruct() { switch (type_) { - case NA_DATA: { + case GRNXX_NA: { na_.~NA(); break; } - case BOOL_DATA: { + case GRNXX_BOOL: { bool_.~Bool(); break; } - case INT_DATA: { + case GRNXX_INT: { int_.~Int(); break; } - case FLOAT_DATA: { + case GRNXX_FLOAT: { float_.~Float(); break; } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { geo_point_.~GeoPoint(); break; } - case TEXT_DATA: { + case GRNXX_TEXT: { text_.~Text(); break; } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { bool_vector_.~BoolVector(); break; } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { int_vector_.~IntVector(); break; } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { float_vector_.~FloatVector(); break; } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { geo_point_vector_.~GeoPointVector(); break; } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { text_vector_.~TextVector(); break; } @@ -385,47 +385,47 @@ class Datum { void copy_from(const Datum &datum) { type_ = datum.type_; switch (type_) { - case NA_DATA: { + case GRNXX_NA: { new (&na_) NA(datum.na_); break; } - case BOOL_DATA: { + case GRNXX_BOOL: { new (&bool_) Bool(datum.bool_); break; } - case INT_DATA: { + case GRNXX_INT: { new (&int_) Int(datum.int_); break; } - case FLOAT_DATA: { + case GRNXX_FLOAT: { new (&float_) Float(datum.float_); break; } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { new (&geo_point_) GeoPoint(datum.geo_point_); break; } - case TEXT_DATA: { + case GRNXX_TEXT: { new (&text_) Text(datum.text_); break; } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { new (&bool_vector_) BoolVector(datum.bool_vector_); break; } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { new (&int_vector_) IntVector(datum.int_vector_); break; } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { new (&float_vector_) FloatVector(datum.float_vector_); break; } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { new (&geo_point_vector_) GeoPointVector(datum.geo_point_vector_); break; } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { new (&text_vector_) TextVector(datum.text_vector_); break; } @@ -434,48 +434,48 @@ class Datum { void move_from(Datum &&datum) { type_ = datum.type_; switch (type_) { - case NA_DATA: { + case GRNXX_NA: { new (&na_) NA(std::move(datum.na_)); break; } - case BOOL_DATA: { + case GRNXX_BOOL: { new (&bool_) Bool(std::move(datum.bool_)); break; } - case INT_DATA: { + case GRNXX_INT: { new (&int_) Int(std::move(datum.int_)); break; } - case FLOAT_DATA: { + case GRNXX_FLOAT: { new (&float_) Float(std::move(datum.float_)); break; } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { new (&geo_point_) GeoPoint(std::move(datum.geo_point_)); break; } - case TEXT_DATA: { + case GRNXX_TEXT: { new (&text_) Text(std::move(datum.text_)); break; } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { new (&bool_vector_) BoolVector(std::move(datum.bool_vector_)); break; } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { new (&int_vector_) IntVector(std::move(datum.int_vector_)); break; } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { new (&float_vector_) FloatVector(std::move(datum.float_vector_)); break; } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { new (&geo_point_vector_) GeoPointVector(std::move(datum.geo_point_vector_)); break; } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { new (&text_vector_) TextVector(std::move(datum.text_vector_)); break; } Modified: include/grnxx/data_types/na.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/na.hpp 2015-01-07 13:45:58 +0900 (50d7f3d) +++ include/grnxx/data_types/na.hpp 2015-02-09 13:29:20 +0900 (a72c2a7) @@ -7,7 +7,7 @@ namespace grnxx { struct NA { constexpr DataType type() const { - return NA_DATA; + return GRNXX_NA; } }; Modified: include/grnxx/data_types/scalar/bool.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/scalar/bool.hpp 2015-01-07 13:45:58 +0900 (9d1c81e) +++ include/grnxx/data_types/scalar/bool.hpp 2015-02-09 13:29:20 +0900 (dca00f9) @@ -90,7 +90,7 @@ class Bool { } static constexpr DataType type() { - return BOOL_DATA; + return GRNXX_BOOL; } static constexpr Bool na() { Modified: include/grnxx/data_types/scalar/float.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/scalar/float.hpp 2015-01-07 13:45:58 +0900 (d86fb1b) +++ include/grnxx/data_types/scalar/float.hpp 2015-02-09 13:29:20 +0900 (a6da27b) @@ -145,7 +145,7 @@ class Float { constexpr Int to_int() const; static constexpr DataType type() { - return FLOAT_DATA; + return GRNXX_FLOAT; } static constexpr Float min() { Modified: include/grnxx/data_types/scalar/geo_point.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/scalar/geo_point.hpp 2015-01-07 13:45:58 +0900 (71d9ff3) +++ include/grnxx/data_types/scalar/geo_point.hpp 2015-02-09 13:29:20 +0900 (d30462b) @@ -132,7 +132,7 @@ class GeoPoint { } static constexpr DataType type() { - return GEO_POINT_DATA; + return GRNXX_GEO_POINT; } static constexpr GeoPoint na() { Modified: include/grnxx/data_types/scalar/int.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/scalar/int.hpp 2015-01-07 13:45:58 +0900 (6cfe505) +++ include/grnxx/data_types/scalar/int.hpp 2015-02-09 13:29:20 +0900 (4799db1) @@ -241,7 +241,7 @@ class Int { constexpr Float to_float() const; static constexpr DataType type() { - return INT_DATA; + return GRNXX_INT; } static constexpr Int min() { Modified: include/grnxx/data_types/scalar/text.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/scalar/text.hpp 2015-01-07 13:45:58 +0900 (0f4645e) +++ include/grnxx/data_types/scalar/text.hpp 2015-02-09 13:29:20 +0900 (20e8695) @@ -141,7 +141,7 @@ class Text { } static constexpr DataType type() { - return TEXT_DATA; + return GRNXX_TEXT; } static constexpr Text empty() { Modified: include/grnxx/data_types/vector/bool.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/vector/bool.hpp 2015-01-07 13:45:58 +0900 (30453bc) +++ include/grnxx/data_types/vector/bool.hpp 2015-02-09 13:29:20 +0900 (b5ba1c1) @@ -85,7 +85,7 @@ class Vector<Bool> { } static constexpr DataType type() { - return BOOL_VECTOR_DATA; + return GRNXX_BOOL_VECTOR; } static constexpr Vector empty() { Modified: include/grnxx/data_types/vector/float.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/vector/float.hpp 2015-01-07 13:45:58 +0900 (88a1114) +++ include/grnxx/data_types/vector/float.hpp 2015-02-09 13:29:20 +0900 (2ee7e83) @@ -113,7 +113,7 @@ class Vector<Float> { } static constexpr DataType type() { - return FLOAT_VECTOR_DATA; + return GRNXX_FLOAT_VECTOR; } static constexpr Vector empty() { Modified: include/grnxx/data_types/vector/geo_point.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/vector/geo_point.hpp 2015-01-07 13:45:58 +0900 (fc55ae7) +++ include/grnxx/data_types/vector/geo_point.hpp 2015-02-09 13:29:20 +0900 (3060ee8) @@ -89,7 +89,7 @@ class Vector<GeoPoint> { } static constexpr DataType type() { - return GEO_POINT_VECTOR_DATA; + return GRNXX_GEO_POINT_VECTOR; } static constexpr Vector empty() { Modified: include/grnxx/data_types/vector/int.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/vector/int.hpp 2015-01-07 13:45:58 +0900 (164c191) +++ include/grnxx/data_types/vector/int.hpp 2015-02-09 13:29:20 +0900 (831df0f) @@ -87,7 +87,7 @@ class Vector<Int> { } static constexpr DataType type() { - return INT_VECTOR_DATA; + return GRNXX_INT_VECTOR; } static constexpr Vector empty() { Modified: include/grnxx/data_types/vector/text.hpp (+1 -1) =================================================================== --- include/grnxx/data_types/vector/text.hpp 2015-01-07 13:45:58 +0900 (6a08857) +++ include/grnxx/data_types/vector/text.hpp 2015-02-09 13:29:20 +0900 (5b98e64) @@ -132,7 +132,7 @@ class Vector<Text> { } static constexpr DataType type() { - return TEXT_VECTOR_DATA; + return GRNXX_TEXT_VECTOR; } static constexpr Vector empty() { Modified: lib/grnxx/impl/column/base.cpp (+10 -10) =================================================================== --- lib/grnxx/impl/column/base.cpp 2015-01-07 13:45:58 +0900 (0e8ff66) +++ lib/grnxx/impl/column/base.cpp 2015-02-09 13:29:20 +0900 (d0be61e) @@ -108,43 +108,43 @@ std::unique_ptr<ColumnBase> ColumnBase::create( const ColumnOptions &options) try { std::unique_ptr<ColumnBase> column; switch (data_type) { - case BOOL_DATA: { + case GRNXX_BOOL: { column.reset(new impl::Column<Bool>(table, name, options)); break; } - case INT_DATA: { + case GRNXX_INT: { column.reset(new impl::Column<Int>(table, name, options)); break; } - case FLOAT_DATA: { + case GRNXX_FLOAT: { column.reset(new impl::Column<Float>(table, name, options)); break; } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { column.reset(new impl::Column<GeoPoint>(table, name, options)); break; } - case TEXT_DATA: { + case GRNXX_TEXT: { column.reset(new impl::Column<Text>(table, name, options)); break; } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { column.reset(new impl::Column<Vector<Bool>>(table, name, options)); break; } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { column.reset(new impl::Column<Vector<Int>>(table, name, options)); break; } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { column.reset(new impl::Column<Vector<Float>>(table, name, options)); break; } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { column.reset(new impl::Column<Vector<GeoPoint>>(table, name, options)); break; } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { column.reset(new impl::Column<Vector<Text>>(table, name, options)); break; } Modified: lib/grnxx/impl/column/scalar/bool.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/bool.cpp 2015-01-07 13:45:58 +0900 (0e8155c) +++ lib/grnxx/impl/column/scalar/bool.cpp 2015-02-09 13:29:20 +0900 (a0cf739) @@ -8,7 +8,7 @@ namespace impl { Column<Bool>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, BOOL_DATA), + : ColumnBase(table, name, GRNXX_BOOL), values_() {} Column<Bool>::~Column() {} @@ -114,10 +114,10 @@ Int Column<Bool>::scan(Bool value) const { Bool Column<Bool>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Bool::na(); } - case BOOL_DATA: { + case GRNXX_BOOL: { return datum.as_bool(); } default: { Modified: lib/grnxx/impl/column/scalar/float.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/float.cpp 2015-01-07 13:45:58 +0900 (cb0a515) +++ lib/grnxx/impl/column/scalar/float.cpp 2015-02-09 13:29:20 +0900 (0597b9a) @@ -9,7 +9,7 @@ namespace impl { Column<Float>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, FLOAT_DATA), + : ColumnBase(table, name, GRNXX_FLOAT), values_() {} Column<Float>::~Column() {} @@ -129,10 +129,10 @@ Int Column<Float>::scan(Float value) const { Float Column<Float>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Float::na(); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return datum.as_float(); } default: { Modified: lib/grnxx/impl/column/scalar/geo_point.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/geo_point.cpp 2015-01-07 13:45:58 +0900 (c246711) +++ lib/grnxx/impl/column/scalar/geo_point.cpp 2015-02-09 13:29:20 +0900 (5414e22) @@ -9,7 +9,7 @@ namespace impl { Column<GeoPoint>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, GEO_POINT_DATA), + : ColumnBase(table, name, GRNXX_GEO_POINT), values_() {} Column<GeoPoint>::~Column() {} @@ -118,10 +118,10 @@ Int Column<GeoPoint>::scan(GeoPoint value) const { GeoPoint Column<GeoPoint>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return GeoPoint::na(); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { return datum.as_geo_point(); } default: { Modified: lib/grnxx/impl/column/scalar/int.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/int.cpp 2015-01-07 13:45:58 +0900 (485b113) +++ lib/grnxx/impl/column/scalar/int.cpp 2015-02-09 13:29:20 +0900 (e2b25fb) @@ -12,7 +12,7 @@ namespace impl { Column<Int>::Column(Table *table, const String &name, const ColumnOptions &options) - : ColumnBase(table, name, INT_DATA), + : ColumnBase(table, name, GRNXX_INT), value_size_(8), buffer_(nullptr), size_(0), @@ -605,10 +605,10 @@ void Column<Int>::reserve_with_different_value_size(size_t size, Int Column<Int>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Int::na(); } - case INT_DATA: { + case GRNXX_INT: { return datum.as_int(); } default: { Modified: lib/grnxx/impl/column/scalar/text.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/scalar/text.cpp 2015-01-07 13:45:58 +0900 (636015e) +++ lib/grnxx/impl/column/scalar/text.cpp 2015-02-09 13:29:20 +0900 (f586f19) @@ -12,7 +12,7 @@ namespace impl { Column<Text>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, TEXT_DATA), + : ColumnBase(table, name, GRNXX_TEXT), headers_(), bodies_() {} @@ -358,10 +358,10 @@ size_t Column<Text>::get_valid_size() const { Text Column<Text>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Text::na(); } - case TEXT_DATA: { + case GRNXX_TEXT: { return datum.as_text(); } default: { Modified: lib/grnxx/impl/column/vector/bool.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/bool.cpp 2015-01-07 13:45:58 +0900 (09eed45) +++ lib/grnxx/impl/column/vector/bool.cpp 2015-02-09 13:29:20 +0900 (f09da6f) @@ -12,7 +12,7 @@ namespace impl { Column<Vector<Bool>>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, BOOL_VECTOR_DATA), + : ColumnBase(table, name, GRNXX_BOOL_VECTOR), headers_(), bodies_() {} @@ -154,10 +154,10 @@ void Column<Vector<Bool>>::read(ArrayCRef<Record> records, Vector<Bool> Column<Vector<Bool>>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Vector<Bool>::na(); } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { return datum.as_bool_vector(); } default: { Modified: lib/grnxx/impl/column/vector/float.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/float.cpp 2015-01-07 13:45:58 +0900 (c9dded3) +++ lib/grnxx/impl/column/vector/float.cpp 2015-02-09 13:29:20 +0900 (8eb0cb7) @@ -12,7 +12,7 @@ namespace impl { Column<Vector<Float>>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, FLOAT_VECTOR_DATA), + : ColumnBase(table, name, GRNXX_FLOAT_VECTOR), headers_(), bodies_() {} @@ -154,10 +154,10 @@ size_t Column<Vector<Float>>::get_valid_size() const { Vector<Float> Column<Vector<Float>>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Vector<Float>::na(); } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { return datum.as_float_vector(); } default: { Modified: lib/grnxx/impl/column/vector/geo_point.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/geo_point.cpp 2015-01-07 13:45:58 +0900 (14cefef) +++ lib/grnxx/impl/column/vector/geo_point.cpp 2015-02-09 13:29:20 +0900 (5aba0f0) @@ -12,7 +12,7 @@ namespace impl { Column<Vector<GeoPoint>>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, GEO_POINT_VECTOR_DATA), + : ColumnBase(table, name, GRNXX_GEO_POINT_VECTOR), headers_(), bodies_() {} @@ -155,10 +155,10 @@ size_t Column<Vector<GeoPoint>>::get_valid_size() const { Vector<GeoPoint> Column<Vector<GeoPoint>>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Vector<GeoPoint>::na(); } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { return datum.as_geo_point_vector(); } default: { Modified: lib/grnxx/impl/column/vector/int.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/int.cpp 2015-01-07 13:45:58 +0900 (14b76c0) +++ lib/grnxx/impl/column/vector/int.cpp 2015-02-09 13:29:20 +0900 (9d84096) @@ -12,7 +12,7 @@ namespace impl { Column<Vector<Int>>::Column(Table *table, const String &name, const ColumnOptions &options) - : ColumnBase(table, name, INT_VECTOR_DATA), + : ColumnBase(table, name, GRNXX_INT_VECTOR), headers_(), bodies_() { if (!options.reference_table_name.is_empty()) { @@ -169,10 +169,10 @@ size_t Column<Vector<Int>>::get_valid_size() const { Vector<Int> Column<Vector<Int>>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Vector<Int>::na(); } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { return datum.as_int_vector(); } default: { Modified: lib/grnxx/impl/column/vector/text.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/column/vector/text.cpp 2015-01-07 13:45:58 +0900 (3f986cf) +++ lib/grnxx/impl/column/vector/text.cpp 2015-02-09 13:29:20 +0900 (2130d75) @@ -12,7 +12,7 @@ namespace impl { Column<Vector<Text>>::Column(Table *table, const String &name, const ColumnOptions &) - : ColumnBase(table, name, TEXT_VECTOR_DATA), + : ColumnBase(table, name, GRNXX_TEXT_VECTOR), headers_(), bodies_() {} @@ -156,10 +156,10 @@ size_t Column<Vector<Text>>::get_valid_size() const { Vector<Text> Column<Vector<Text>>::parse_datum(const Datum &datum) { switch (datum.type()) { - case NA_DATA: { + case GRNXX_NA: { return Vector<Text>::na(); } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { return datum.as_text_vector(); } default: { Modified: lib/grnxx/impl/expression.cpp (+74 -74) =================================================================== --- lib/grnxx/impl/expression.cpp 2015-01-07 13:45:58 +0900 (7aa9fb4) +++ lib/grnxx/impl/expression.cpp 2015-02-09 13:29:20 +0900 (60f933d) @@ -1931,34 +1931,34 @@ void ExpressionBuilder::push_dereference(const ExpressionOptions &options) { Node *ExpressionBuilder::create_constant_node( const Datum &datum) try { switch (datum.type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return new ConstantNode<Bool>(datum.as_bool()); } - case INT_DATA: { + case GRNXX_INT: { return new ConstantNode<Int>(datum.as_int()); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new ConstantNode<Float>(datum.as_float()); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { return new ConstantNode<GeoPoint>(datum.as_geo_point()); } - case TEXT_DATA: { + case GRNXX_TEXT: { return new ConstantNode<Text>(datum.as_text()); } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { return new ConstantNode<Vector<Bool>>(datum.as_bool_vector()); } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { return new ConstantNode<Vector<Int>>(datum.as_int_vector()); } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { return new ConstantNode<Vector<Float>>(datum.as_float_vector()); } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { return new ConstantNode<Vector<GeoPoint>>(datum.as_geo_point_vector()); } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { return new ConstantNode<Vector<Text>>(datum.as_text_vector()); } default: { @@ -1971,34 +1971,34 @@ Node *ExpressionBuilder::create_constant_node( Node *ExpressionBuilder::create_column_node(ColumnBase *column) try { switch (column->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return new ColumnNode<Bool>(column); } - case INT_DATA: { + case GRNXX_INT: { return new ColumnNode<Int>(column); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new ColumnNode<Float>(column); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { return new ColumnNode<GeoPoint>(column); } - case TEXT_DATA: { + case GRNXX_TEXT: { return new ColumnNode<Text>(column); } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { return new ColumnNode<Vector<Bool>>(column); } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { return new ColumnNode<Vector<Int>>(column); } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { return new ColumnNode<Vector<Float>>(column); } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { return new ColumnNode<Vector<GeoPoint>>(column); } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { return new ColumnNode<Vector<Text>>(column); } default: { @@ -2015,7 +2015,7 @@ Node *ExpressionBuilder::create_unary_node( switch (operator_type) { case LOGICAL_NOT_OPERATOR: { switch (arg->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return new LogicalNotNode(std::move(arg)); } default: { @@ -2025,10 +2025,10 @@ Node *ExpressionBuilder::create_unary_node( } case BITWISE_NOT_OPERATOR: { switch (arg->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return new BitwiseNotNode<Bool>(std::move(arg)); } - case INT_DATA: { + case GRNXX_INT: { return new BitwiseNotNode<Int>(std::move(arg)); } default: { @@ -2038,8 +2038,8 @@ Node *ExpressionBuilder::create_unary_node( } case POSITIVE_OPERATOR: { switch (arg->data_type()) { - case INT_DATA: - case FLOAT_DATA: { + case GRNXX_INT: + case GRNXX_FLOAT: { // A positive operator does nothing. return arg.release(); } @@ -2050,10 +2050,10 @@ Node *ExpressionBuilder::create_unary_node( } case NEGATIVE_OPERATOR: { switch (arg->data_type()) { - case INT_DATA: { + case GRNXX_INT: { return new NegativeNode<Int>(std::move(arg)); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new NegativeNode<Float>(std::move(arg)); } default: { @@ -2063,7 +2063,7 @@ Node *ExpressionBuilder::create_unary_node( } case TO_INT_OPERATOR: { switch (arg->data_type()) { - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new ToIntNode(std::move(arg)); } default: { @@ -2073,7 +2073,7 @@ Node *ExpressionBuilder::create_unary_node( } case TO_FLOAT_OPERATOR: { switch (arg->data_type()) { - case INT_DATA: { + case GRNXX_INT: { return new ToFloatNode(std::move(arg)); } default: { @@ -2095,15 +2095,15 @@ Node *ExpressionBuilder::create_binary_node( std::unique_ptr<Node> &&arg2) try { switch (operator_type) { case LOGICAL_AND_OPERATOR: { - if ((arg1->data_type() != BOOL_DATA) || - (arg2->data_type() != BOOL_DATA)) { + if ((arg1->data_type() != GRNXX_BOOL) || + (arg2->data_type() != GRNXX_BOOL)) { throw "Invalid data type"; // TODO } return new LogicalAndNode(std::move(arg1), std::move(arg2)); } case LOGICAL_OR_OPERATOR: { - if ((arg1->data_type() != BOOL_DATA) || - (arg2->data_type() != BOOL_DATA)) { + if ((arg1->data_type() != GRNXX_BOOL) || + (arg2->data_type() != GRNXX_BOOL)) { throw "Invalid data type"; // TODO } return new LogicalOrNode(std::move(arg1), std::move(arg2)); @@ -2111,43 +2111,43 @@ Node *ExpressionBuilder::create_binary_node( case EQUAL_OPERATOR: case NOT_EQUAL_OPERATOR: { switch (arg1->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return create_equality_test_node<Bool>( operator_type, std::move(arg1), std::move(arg2)); } - case INT_DATA: { + case GRNXX_INT: { return create_equality_test_node<Int>( operator_type, std::move(arg1), std::move(arg2)); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return create_equality_test_node<Float>( operator_type, std::move(arg1), std::move(arg2)); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { return create_equality_test_node<GeoPoint>( operator_type, std::move(arg1), std::move(arg2)); } - case TEXT_DATA: { + case GRNXX_TEXT: { return create_equality_test_node<Text>( operator_type, std::move(arg1), std::move(arg2)); } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { return create_equality_test_node<Vector<Bool>>( operator_type, std::move(arg1), std::move(arg2)); } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { return create_equality_test_node<Vector<Int>>( operator_type, std::move(arg1), std::move(arg2)); } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { return create_equality_test_node<Vector<Float>>( operator_type, std::move(arg1), std::move(arg2)); } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { return create_equality_test_node<Vector<GeoPoint>>( operator_type, std::move(arg1), std::move(arg2)); } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { return create_equality_test_node<Vector<Text>>( operator_type, std::move(arg1), std::move(arg2)); } @@ -2161,15 +2161,15 @@ Node *ExpressionBuilder::create_binary_node( case GREATER_OPERATOR: case GREATER_EQUAL_OPERATOR: { switch (arg1->data_type()) { - case INT_DATA: { + case GRNXX_INT: { return create_comparison_node<Int>( operator_type, std::move(arg1), std::move(arg2)); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return create_comparison_node<Float>( operator_type, std::move(arg1), std::move(arg2)); } - case TEXT_DATA: { + case GRNXX_TEXT: { return create_comparison_node<Text>( operator_type, std::move(arg1), std::move(arg2)); } @@ -2182,11 +2182,11 @@ Node *ExpressionBuilder::create_binary_node( case BITWISE_OR_OPERATOR: case BITWISE_XOR_OPERATOR: { switch (arg1->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return create_bitwise_binary_node<Bool>( operator_type, std::move(arg1), std::move(arg2)); } - case INT_DATA: { + case GRNXX_INT: { return create_bitwise_binary_node<Int>( operator_type, std::move(arg1), std::move(arg2)); } @@ -2201,11 +2201,11 @@ Node *ExpressionBuilder::create_binary_node( case DIVISION_OPERATOR: case MODULUS_OPERATOR: { switch (arg1->data_type()) { - case INT_DATA: { + case GRNXX_INT: { return create_arithmetic_node<Int>( operator_type, std::move(arg1), std::move(arg2)); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return create_arithmetic_node<Float>( operator_type, std::move(arg1), std::move(arg2)); } @@ -2218,7 +2218,7 @@ Node *ExpressionBuilder::create_binary_node( case ENDS_WITH_OPERATOR: case CONTAINS_OPERATOR: { switch (arg1->data_type()) { - case TEXT_DATA: { + case GRNXX_TEXT: { return create_search_node<Text>( operator_type, std::move(arg1), std::move(arg2)); } @@ -2367,23 +2367,23 @@ Node *ExpressionBuilder::create_search_node(OperatorType operator_type, Node *ExpressionBuilder::create_subscript_node(std::unique_ptr<Node> &&arg1, std::unique_ptr<Node> &&arg2) { - if (arg2->data_type() != INT_DATA) { + if (arg2->data_type() != GRNXX_INT) { throw "Invalid data type"; // TODO } switch (arg1->data_type()) { - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { return new SubscriptNode<Bool>(std::move(arg1), std::move(arg2)); } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { return new SubscriptNode<Int>(std::move(arg1), std::move(arg2)); } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { return new SubscriptNode<Float>(std::move(arg1), std::move(arg2)); } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { return new SubscriptNode<GeoPoint>(std::move(arg1), std::move(arg2)); } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { return new SubscriptNode<Text>(std::move(arg1), std::move(arg2)); } default: { @@ -2397,45 +2397,45 @@ Node *ExpressionBuilder::create_dereference_node( std::unique_ptr<Node> &&arg2, const ExpressionOptions &options) { switch (arg1->data_type()) { - case INT_DATA: { + case GRNXX_INT: { switch (arg2->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return new DereferenceNode<Bool>( std::move(arg1), std::move(arg2)); } - case INT_DATA: { + case GRNXX_INT: { return new DereferenceNode<Int>( std::move(arg1), std::move(arg2)); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new DereferenceNode<Float>( std::move(arg1), std::move(arg2)); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { return new DereferenceNode<GeoPoint>( std::move(arg1), std::move(arg2)); } - case TEXT_DATA: { + case GRNXX_TEXT: { return new DereferenceNode<Text>( std::move(arg1), std::move(arg2)); } - case BOOL_VECTOR_DATA: { + case GRNXX_BOOL_VECTOR: { return new DereferenceNode<Vector<Bool>>( std::move(arg1), std::move(arg2)); } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { return new DereferenceNode<Vector<Int>>( std::move(arg1), std::move(arg2)); } - case FLOAT_VECTOR_DATA: { + case GRNXX_FLOAT_VECTOR: { return new DereferenceNode<Vector<Float>>( std::move(arg1), std::move(arg2)); } - case GEO_POINT_VECTOR_DATA: { + case GRNXX_GEO_POINT_VECTOR: { return new DereferenceNode<Vector<GeoPoint>>( std::move(arg1), std::move(arg2)); } - case TEXT_VECTOR_DATA: { + case GRNXX_TEXT_VECTOR: { return new DereferenceNode<Vector<Text>>( std::move(arg1), std::move(arg2)); } @@ -2444,25 +2444,25 @@ Node *ExpressionBuilder::create_dereference_node( } } } - case INT_VECTOR_DATA: { + case GRNXX_INT_VECTOR: { switch (arg2->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return new VectorDereferenceNode<Bool>( std::move(arg1), std::move(arg2), options); } - case INT_DATA: { + case GRNXX_INT: { return new VectorDereferenceNode<Int>( std::move(arg1), std::move(arg2), options); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new VectorDereferenceNode<Float>( std::move(arg1), std::move(arg2), options); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { return new VectorDereferenceNode<GeoPoint>( std::move(arg1), std::move(arg2), options); } - case TEXT_DATA: { + case GRNXX_TEXT: { return new VectorDereferenceNode<Text>( std::move(arg1), std::move(arg2), options); } Modified: lib/grnxx/impl/index.cpp (+48 -48) =================================================================== --- lib/grnxx/impl/index.cpp 2015-01-07 13:45:58 +0900 (c0d7137) +++ lib/grnxx/impl/index.cpp 2015-02-09 13:29:20 +0900 (b9970ca) @@ -397,9 +397,9 @@ void TreeIndex<Int>::remove(Int row_id, const Datum &value) { std::unique_ptr<Cursor> TreeIndex<Int>::find( const Datum &value, const CursorOptions &options) const { - if (value.type() == NA_DATA) { + if (value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (value.type() != INT_DATA) { + } else if (value.type() != GRNXX_INT) { throw "Data type conflict"; // TODO } auto map_it = map_.find(value.as_int()); @@ -423,9 +423,9 @@ std::unique_ptr<Cursor> TreeIndex<Int>::find_in_range( const CursorOptions &options) const { Int lower_bound_value = Int::min(); // TODO: Datum should provide is_na()? - if (range.lower_bound().value.type() != NA_DATA) { + if (range.lower_bound().value.type() != GRNXX_NA) { // TODO: Typecast will be supported in future? - if (range.lower_bound().value.type() != INT_DATA) { + if (range.lower_bound().value.type() != GRNXX_INT) { throw "Data type conflict"; // TODO } if (!range.lower_bound().value.as_int().is_na()) { @@ -440,8 +440,8 @@ std::unique_ptr<Cursor> TreeIndex<Int>::find_in_range( } Int upper_bound_value = Int::max(); - if (range.upper_bound().value.type() != NA_DATA) { - if (range.upper_bound().value.type() != INT_DATA) { + if (range.upper_bound().value.type() != GRNXX_NA) { + if (range.upper_bound().value.type() != GRNXX_INT) { throw "Data type conflict"; // TODO } if (!range.upper_bound().value.as_int().is_na()) { @@ -577,9 +577,9 @@ void TreeIndex<Float>::remove(Int row_id, const Datum &value) { std::unique_ptr<Cursor> TreeIndex<Float>::find( const Datum &value, const CursorOptions &options) const { - if (value.type() == NA_DATA) { + if (value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (value.type() != FLOAT_DATA) { + } else if (value.type() != GRNXX_FLOAT) { throw "Data type conflict"; // TODO } auto map_it = map_.find(value.as_float()); @@ -603,9 +603,9 @@ std::unique_ptr<Cursor> TreeIndex<Float>::find_in_range( const CursorOptions &options) const { Float lower_bound_value = Float::min(); // TODO: Datum should provide is_na()? - if (range.lower_bound().value.type() != NA_DATA) { + if (range.lower_bound().value.type() != GRNXX_NA) { // TODO: Typecast will be supported in future? - if (range.lower_bound().value.type() != FLOAT_DATA) { + if (range.lower_bound().value.type() != GRNXX_FLOAT) { throw "Data type conflict"; // TODO } if (!range.lower_bound().value.as_float().is_na()) { @@ -625,8 +625,8 @@ std::unique_ptr<Cursor> TreeIndex<Float>::find_in_range( } Float upper_bound_value = Float::max(); - if (range.upper_bound().value.type() != NA_DATA) { - if (range.upper_bound().value.type() != FLOAT_DATA) { + if (range.upper_bound().value.type() != GRNXX_NA) { + if (range.upper_bound().value.type() != GRNXX_FLOAT) { throw "Data type conflict"; // TODO } if (!range.upper_bound().value.as_float().is_na()) { @@ -767,9 +767,9 @@ void TreeIndex<Text>::remove(Int row_id, const Datum &value) { std::unique_ptr<Cursor> TreeIndex<Text>::find( const Datum &value, const CursorOptions &options) const { - if (value.type() == NA_DATA) { + if (value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (value.type() != TEXT_DATA) { + } else if (value.type() != GRNXX_TEXT) { throw "Data type conflict"; // TODO } Text text = value.as_text(); @@ -795,9 +795,9 @@ std::unique_ptr<Cursor> TreeIndex<Text>::find_in_range( const CursorOptions &options) const { String lower_bound_value; // // TODO: Datum should provide is_na()? - if (range.lower_bound().value.type() != NA_DATA) { + if (range.lower_bound().value.type() != GRNXX_NA) { // // TODO: Typecast will be supported in future? - if (range.lower_bound().value.type() != TEXT_DATA) { + if (range.lower_bound().value.type() != GRNXX_TEXT) { throw "Data type conflict"; // TODO } Text text = range.lower_bound().value.as_text(); @@ -810,8 +810,8 @@ std::unique_ptr<Cursor> TreeIndex<Text>::find_in_range( } String upper_bound_value; - if (range.upper_bound().value.type() != NA_DATA) { - if (range.upper_bound().value.type() != TEXT_DATA) { + if (range.upper_bound().value.type() != GRNXX_NA) { + if (range.upper_bound().value.type() != GRNXX_TEXT) { throw "Data type conflict"; // TODO } Text text = range.upper_bound().value.as_text(); @@ -847,9 +847,9 @@ std::unique_ptr<Cursor> TreeIndex<Text>::find_starts_with( const EndPoint &prefix, const CursorOptions &options) const { // TODO: Typecast will be supported in future? - if (prefix.value.type() == NA_DATA) { + if (prefix.value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (prefix.value.type() != TEXT_DATA) { + } else if (prefix.value.type() != GRNXX_TEXT) { throw "Data type conflict"; // TODO } Text text = prefix.value.as_text(); @@ -887,9 +887,9 @@ std::unique_ptr<Cursor> TreeIndex<Text>::find_prefixes( const Datum &value, const CursorOptions &options) const { // TODO: Typecast will be supported in future? - if (value.type() == NA_DATA) { + if (value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (value.type() != TEXT_DATA) { + } else if (value.type() != GRNXX_TEXT) { throw "Data type conflict"; // TODO } Text text = value.as_text(); @@ -1028,9 +1028,9 @@ void HashIndex<Int>::remove(Int row_id, const Datum &value) { std::unique_ptr<Cursor> HashIndex<Int>::find( const Datum &value, const CursorOptions &options) const { - if (value.type() == NA_DATA) { + if (value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (value.type() != INT_DATA) { + } else if (value.type() != GRNXX_INT) { throw "Data type conflict"; // TODO } auto map_it = map_.find(value.as_int()); @@ -1161,9 +1161,9 @@ void HashIndex<Float>::remove(Int row_id, const Datum &value) { std::unique_ptr<Cursor> HashIndex<Float>::find( const Datum &value, const CursorOptions &options) const { - if (value.type() == NA_DATA) { + if (value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (value.type() != FLOAT_DATA) { + } else if (value.type() != GRNXX_FLOAT) { throw "Data type conflict"; // TODO } auto map_it = map_.find(value.as_float()); @@ -1289,9 +1289,9 @@ void HashIndex<Text>::remove(Int row_id, const Datum &value) { std::unique_ptr<Cursor> HashIndex<Text>::find( const Datum &value, const CursorOptions &options) const { - if (value.type() == NA_DATA) { + if (value.type() == GRNXX_NA) { return create_empty_cursor(); - } else if (value.type() != TEXT_DATA) { + } else if (value.type() != GRNXX_TEXT) { throw "Data type conflict"; // TODO } Text text = value.as_text(); @@ -1372,26 +1372,26 @@ Index *Index::create(ColumnBase *column, switch (type) { case TREE_INDEX: { switch (column->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { throw "Not supported yet"; // TODO } - case INT_DATA: { + case GRNXX_INT: { return new TreeIndex<Int>(column, name, options); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new TreeIndex<Float>(column, name, options); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { throw "Not supported yet"; // TODO } - case TEXT_DATA: { + case GRNXX_TEXT: { return new TreeIndex<Text>(column, name, options); } - case BOOL_VECTOR_DATA: - case INT_VECTOR_DATA: - case FLOAT_VECTOR_DATA: - case GEO_POINT_VECTOR_DATA: - case TEXT_VECTOR_DATA: + case GRNXX_BOOL_VECTOR: + case GRNXX_INT_VECTOR: + case GRNXX_FLOAT_VECTOR: + case GRNXX_GEO_POINT_VECTOR: + case GRNXX_TEXT_VECTOR: default: { throw "Not supported yet"; // TODO } @@ -1399,26 +1399,26 @@ Index *Index::create(ColumnBase *column, } case HASH_INDEX: { switch (column->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { throw "Not supported yet"; // TODO } - case INT_DATA: { + case GRNXX_INT: { return new HashIndex<Int>(column, name, options); } - case FLOAT_DATA: { + case GRNXX_FLOAT: { return new HashIndex<Float>(column, name, options); } - case GEO_POINT_DATA: { + case GRNXX_GEO_POINT: { throw "Not supported yet"; // TODO } - case TEXT_DATA: { + case GRNXX_TEXT: { return new HashIndex<Text>(column, name, options); } - case BOOL_VECTOR_DATA: - case INT_VECTOR_DATA: - case FLOAT_VECTOR_DATA: - case GEO_POINT_VECTOR_DATA: - case TEXT_VECTOR_DATA: + case GRNXX_BOOL_VECTOR: + case GRNXX_INT_VECTOR: + case GRNXX_FLOAT_VECTOR: + case GRNXX_GEO_POINT_VECTOR: + case GRNXX_TEXT_VECTOR: default: { throw "Not supported yet"; // TODO } Modified: lib/grnxx/impl/sorter.cpp (+4 -4) =================================================================== --- lib/grnxx/impl/sorter.cpp 2015-01-07 13:45:58 +0900 (0d1d9ee) +++ lib/grnxx/impl/sorter.cpp 2015-02-09 13:29:20 +0900 (220656f) @@ -1584,10 +1584,10 @@ Node *Sorter::create_node(SorterOrder &&order) try { } switch (order.expression->data_type()) { - case BOOL_DATA: { + case GRNXX_BOOL: { return new BoolNode(std::move(order)); } - case INT_DATA: { + case GRNXX_INT: { if (nodes_.is_empty() && ((offset_ + limit_) < 1000)) { if (order.type == SORTER_REGULAR_ORDER) { return new IntNodeS<RegularIntConverter>(std::move(order)); @@ -1602,7 +1602,7 @@ Node *Sorter::create_node(SorterOrder &&order) try { } } } - case FLOAT_DATA: { + case GRNXX_FLOAT: { if (nodes_.is_empty() && ((offset_ + limit_) < 1000)) { if (order.type == SORTER_REGULAR_ORDER) { return new FloatNodeS<RegularFloatConverter>(std::move(order)); @@ -1617,7 +1617,7 @@ Node *Sorter::create_node(SorterOrder &&order) try { } } } - case TEXT_DATA: { + case GRNXX_TEXT: { if (nodes_.is_empty() && ((offset_ + limit_) < 1000)) { if (order.type == SORTER_REGULAR_ORDER) { return new TextNodeS<RegularTextComparer>(std::move(order)); Modified: lib/grnxx/impl/table.cpp (+3 -3) =================================================================== --- lib/grnxx/impl/table.cpp 2015-01-07 13:45:58 +0900 (dd6e9fb) +++ lib/grnxx/impl/table.cpp 2015-02-09 13:29:20 +0900 (15e4d8d) @@ -330,13 +330,13 @@ void Table::unset_key_column() { Int Table::insert_row(const Datum &key) { if (key_column_) { - if (key.type() == NA_DATA) { + if (key.type() == GRNXX_NA) { throw "No key"; // TODO } if (!find_row(key).is_na()) { throw "Key already exists"; // TODO } - } else if (key.type() != NA_DATA) { + } else if (key.type() != GRNXX_NA) { throw "Wrong key"; // TODO } Int row_id = find_next_row_id(); @@ -357,7 +357,7 @@ Int Table::find_or_insert_row(const Datum &key, bool *inserted) { } return row_id; } - } else if (key.type() != NA_DATA) { + } else if (key.type() != GRNXX_NA) { throw "Wrong key"; // TODO } Int row_id = find_next_row_id(); Modified: test/test_column.cpp (+6 -6) =================================================================== --- test/test_column.cpp 2015-01-07 13:45:58 +0900 (2459174) +++ test/test_column.cpp 2015-02-09 13:29:20 +0900 (a7c4304) @@ -368,7 +368,7 @@ void test_internal_type_conversion() { table->insert_row(); table->insert_row(); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Set the first 8-bit integer. column->set(grnxx::Int(0), grnxx::Int(int64_t(1) << 0)); @@ -404,7 +404,7 @@ void test_internal_type_conversion() { assert(datum.as_int().raw() == (int64_t(1) << 32)); table->remove_column("Column"); - column = table->create_column("Column", grnxx::INT_DATA); + column = table->create_column("Column", GRNXX_INT); // Conversion from 8-bit to 32-bit. column->set(grnxx::Int(0), grnxx::Int(int64_t(1) << 0)); @@ -415,7 +415,7 @@ void test_internal_type_conversion() { assert(datum.as_int().raw() == (int64_t(1) << 16)); table->remove_column("Column"); - column = table->create_column("Column", grnxx::INT_DATA); + column = table->create_column("Column", GRNXX_INT); // Conversion from 8-bit to 64-bit. column->set(grnxx::Int(0), grnxx::Int(int64_t(1) << 0)); @@ -426,7 +426,7 @@ void test_internal_type_conversion() { assert(datum.as_int().raw() == (int64_t(1) << 32)); table->remove_column("Column"); - column = table->create_column("Column", grnxx::INT_DATA); + column = table->create_column("Column", GRNXX_INT); // Conversion from 16-bit to 64-bit. column->set(grnxx::Int(0), grnxx::Int(int64_t(1) << 8)); @@ -445,7 +445,7 @@ void test_contains() { table->insert_row(); table->insert_row(); - auto column = table->create_column("Int", grnxx::INT_DATA); + auto column = table->create_column("Int", GRNXX_INT); assert(!column->contains(grnxx::Int(123))); assert(!column->contains(grnxx::Int(456))); assert(!column->contains(grnxx::Int(789))); @@ -496,7 +496,7 @@ void test_find_one() { table->insert_row(); table->insert_row(); - auto column = table->create_column("Int", grnxx::INT_DATA); + auto column = table->create_column("Int", GRNXX_INT); assert(column->find_one(grnxx::Int(123)).is_na()); assert(column->find_one(grnxx::Int(456)).is_na()); assert(column->find_one(grnxx::Int(789)).is_na()); Modified: test/test_data_types.cpp (+45 -45) =================================================================== --- test/test_data_types.cpp 2015-01-07 13:45:58 +0900 (a80b5b5) +++ test/test_data_types.cpp 2015-02-09 13:29:20 +0900 (82198cb) @@ -27,9 +27,9 @@ void test_bool() { grnxx::Bool false_object(false); grnxx::Bool na_object((grnxx::NA())); - assert(true_object.type() == grnxx::BOOL_DATA); - assert(false_object.type() == grnxx::BOOL_DATA); - assert(na_object.type() == grnxx::BOOL_DATA); + assert(true_object.type() == GRNXX_BOOL); + assert(false_object.type() == GRNXX_BOOL); + assert(na_object.type() == GRNXX_BOOL); assert(true_object.raw() == grnxx::Bool::raw_true()); assert(false_object.raw() == grnxx::Bool::raw_false()); @@ -129,10 +129,10 @@ void test_bool() { } void test_int() { - assert(grnxx::Int(0).type() == grnxx::INT_DATA); - assert(grnxx::Int::min().type() == grnxx::INT_DATA); - assert(grnxx::Int::max().type() == grnxx::INT_DATA); - assert(grnxx::Int::na().type() == grnxx::INT_DATA); + assert(grnxx::Int(0).type() == GRNXX_INT); + assert(grnxx::Int::min().type() == GRNXX_INT); + assert(grnxx::Int::max().type() == GRNXX_INT); + assert(grnxx::Int::na().type() == GRNXX_INT); assert(grnxx::Int(0).raw() == 0); assert(grnxx::Int::min().raw() == grnxx::Int::raw_min()); @@ -493,14 +493,14 @@ void test_int() { } void test_float() { - assert(grnxx::Float(0.0).type() == grnxx::FLOAT_DATA); - assert(grnxx::Float::min().type() == grnxx::FLOAT_DATA); - assert(grnxx::Float::max().type() == grnxx::FLOAT_DATA); - assert(grnxx::Float::normal_min().type() == grnxx::FLOAT_DATA); - assert(grnxx::Float::subnormal_min().type() == grnxx::FLOAT_DATA); - assert(grnxx::Float::max().type() == grnxx::FLOAT_DATA); - assert(grnxx::Float::infinity().type() == grnxx::FLOAT_DATA); - assert(grnxx::Float::na().type() == grnxx::FLOAT_DATA); + assert(grnxx::Float(0.0).type() == GRNXX_FLOAT); + assert(grnxx::Float::min().type() == GRNXX_FLOAT); + assert(grnxx::Float::max().type() == GRNXX_FLOAT); + assert(grnxx::Float::normal_min().type() == GRNXX_FLOAT); + assert(grnxx::Float::subnormal_min().type() == GRNXX_FLOAT); + assert(grnxx::Float::max().type() == GRNXX_FLOAT); + assert(grnxx::Float::infinity().type() == GRNXX_FLOAT); + assert(grnxx::Float::na().type() == GRNXX_FLOAT); assert(grnxx::Float(0.0).raw() == 0.0); assert(grnxx::Float::min().is_min()); @@ -826,11 +826,11 @@ void test_geo_point() { grnxx::GeoPoint date_line(grnxx::Float(0.0), grnxx::Float(180.0)); grnxx::GeoPoint na(grnxx::Int::na(), grnxx::Int::na()); - assert(zero.type() == grnxx::GEO_POINT_DATA); - assert(north_pole.type() == grnxx::GEO_POINT_DATA); - assert(south_pole.type() == grnxx::GEO_POINT_DATA); - assert(date_line.type() == grnxx::GEO_POINT_DATA); - assert(na.type() == grnxx::GEO_POINT_DATA); + assert(zero.type() == GRNXX_GEO_POINT); + assert(north_pole.type() == GRNXX_GEO_POINT); + assert(south_pole.type() == GRNXX_GEO_POINT); + assert(date_line.type() == GRNXX_GEO_POINT); + assert(na.type() == GRNXX_GEO_POINT); assert(zero.raw_latitude() == 0); assert(date_line.raw_latitude() == 0); @@ -934,11 +934,11 @@ void test_text() { grnxx::Text empty = grnxx::Text::empty(); grnxx::Text na = grnxx::Text::na(); - assert(ab.type() == grnxx::TEXT_DATA); - assert(abc.type() == grnxx::TEXT_DATA); - assert(bc.type() == grnxx::TEXT_DATA); - assert(empty.type() == grnxx::TEXT_DATA); - assert(na.type() == grnxx::TEXT_DATA); + assert(ab.type() == GRNXX_TEXT); + assert(abc.type() == GRNXX_TEXT); + assert(bc.type() == GRNXX_TEXT); + assert(empty.type() == GRNXX_TEXT); + assert(na.type() == GRNXX_TEXT); assert(std::strcmp(ab.raw_data(), "ab") == 0); assert(std::strcmp(abc.raw_data(), "abc") == 0); @@ -1188,10 +1188,10 @@ void test_bool_vector() { grnxx::BoolVector empty = grnxx::BoolVector::empty(); grnxx::BoolVector na = grnxx::BoolVector::na(); - assert(tft.type() == grnxx::BOOL_VECTOR_DATA); - assert(ftn.type() == grnxx::BOOL_VECTOR_DATA); - assert(empty.type() == grnxx::BOOL_VECTOR_DATA); - assert(na.type() == grnxx::BOOL_VECTOR_DATA); + assert(tft.type() == GRNXX_BOOL_VECTOR); + assert(ftn.type() == GRNXX_BOOL_VECTOR); + assert(empty.type() == GRNXX_BOOL_VECTOR); + assert(na.type() == GRNXX_BOOL_VECTOR); assert(tft[0].is_true()); assert(tft[1].is_false()); @@ -1279,10 +1279,10 @@ void test_int_vector() { grnxx::IntVector empty = grnxx::IntVector::empty(); grnxx::IntVector na = grnxx::IntVector::na(); - assert(abc.type() == grnxx::INT_VECTOR_DATA); - assert(bcn.type() == grnxx::INT_VECTOR_DATA); - assert(empty.type() == grnxx::INT_VECTOR_DATA); - assert(na.type() == grnxx::INT_VECTOR_DATA); + assert(abc.type() == GRNXX_INT_VECTOR); + assert(bcn.type() == GRNXX_INT_VECTOR); + assert(empty.type() == GRNXX_INT_VECTOR); + assert(na.type() == GRNXX_INT_VECTOR); assert(abc[0].raw() == 1); assert(abc[1].raw() == 2); @@ -1370,10 +1370,10 @@ void test_float_vector() { grnxx::FloatVector empty = grnxx::FloatVector::empty(); grnxx::FloatVector na = grnxx::FloatVector::na(); - assert(abc.type() == grnxx::FLOAT_VECTOR_DATA); - assert(bcn.type() == grnxx::FLOAT_VECTOR_DATA); - assert(empty.type() == grnxx::FLOAT_VECTOR_DATA); - assert(na.type() == grnxx::FLOAT_VECTOR_DATA); + assert(abc.type() == GRNXX_FLOAT_VECTOR); + assert(bcn.type() == GRNXX_FLOAT_VECTOR); + assert(empty.type() == GRNXX_FLOAT_VECTOR); + assert(na.type() == GRNXX_FLOAT_VECTOR); assert(abc[0].raw() == 1.25); assert(abc[1].raw() == 2.50); @@ -1461,10 +1461,10 @@ void test_geo_point_vector() { grnxx::GeoPointVector empty = grnxx::GeoPointVector::empty(); grnxx::GeoPointVector na = grnxx::GeoPointVector::na(); - assert(sto.type() == grnxx::GEO_POINT_VECTOR_DATA); - assert(ton.type() == grnxx::GEO_POINT_VECTOR_DATA); - assert(empty.type() == grnxx::GEO_POINT_VECTOR_DATA); - assert(na.type() == grnxx::GEO_POINT_VECTOR_DATA); + assert(sto.type() == GRNXX_GEO_POINT_VECTOR); + assert(ton.type() == GRNXX_GEO_POINT_VECTOR); + assert(empty.type() == GRNXX_GEO_POINT_VECTOR); + assert(na.type() == GRNXX_GEO_POINT_VECTOR); assert(sto[0].raw_latitude() == data[0].raw_latitude()); assert(sto[1].raw_latitude() == data[1].raw_latitude()); @@ -1560,10 +1560,10 @@ void test_text_vector() { grnxx::TextVector empty = grnxx::TextVector::empty(); grnxx::TextVector na = grnxx::TextVector::na(); - assert(abc.type() == grnxx::TEXT_VECTOR_DATA); - assert(bcn.type() == grnxx::TEXT_VECTOR_DATA); - assert(empty.type() == grnxx::TEXT_VECTOR_DATA); - assert(na.type() == grnxx::TEXT_VECTOR_DATA); + assert(abc.type() == GRNXX_TEXT_VECTOR); + assert(bcn.type() == GRNXX_TEXT_VECTOR); + assert(empty.type() == GRNXX_TEXT_VECTOR); + assert(na.type() == GRNXX_TEXT_VECTOR); assert(abc[0].match(data[0])); assert(abc[1].match(data[1])); Modified: test/test_expression.cpp (+12 -12) =================================================================== --- test/test_expression.cpp 2015-01-07 13:45:58 +0900 (81c2959) +++ test/test_expression.cpp 2015-02-09 13:29:20 +0900 (456f652) @@ -88,63 +88,63 @@ void init_test() try { test.table = test.db->create_table("Table"); // Create columns for various data types. - grnxx::DataType data_type = grnxx::BOOL_DATA; + grnxx::DataType data_type = GRNXX_BOOL; auto bool_column = test.table->create_column("Bool", data_type); auto bool2_column = test.table->create_column("Bool2", data_type); - data_type = grnxx::INT_DATA; + data_type = GRNXX_INT; auto int_column = test.table->create_column("Int", data_type); auto int2_column = test.table->create_column("Int2", data_type); - data_type = grnxx::FLOAT_DATA; + data_type = GRNXX_FLOAT; auto float_column = test.table->create_column("Float", data_type); auto float2_column = test.table->create_column("Float2", data_type); - data_type = grnxx::GEO_POINT_DATA; + data_type = GRNXX_GEO_POINT; auto geo_point_column = test.table->create_column("GeoPoint", data_type); auto geo_point2_column = test.table->create_column("GeoPoint2", data_type); - data_type = grnxx::TEXT_DATA; + data_type = GRNXX_TEXT; auto text_column = test.table->create_column("Text", data_type); auto text2_column = test.table->create_column("Text2", data_type); - data_type = grnxx::BOOL_VECTOR_DATA; + data_type = GRNXX_BOOL_VECTOR; auto bool_vector_column = test.table->create_column("BoolVector", data_type); auto bool_vector2_column = test.table->create_column("BoolVector2", data_type); - data_type = grnxx::INT_VECTOR_DATA; + data_type = GRNXX_INT_VECTOR; auto int_vector_column = test.table->create_column("IntVector", data_type); auto int_vector2_column = test.table->create_column("IntVector2", data_type); - data_type = grnxx::FLOAT_VECTOR_DATA; + data_type = GRNXX_FLOAT_VECTOR; auto float_vector_column = test.table->create_column("FloatVector", data_type); auto float_vector2_column = test.table->create_column("FloatVector2", data_type); - data_type = grnxx::GEO_POINT_VECTOR_DATA; + data_type = GRNXX_GEO_POINT_VECTOR; auto geo_point_vector_column = test.table->create_column("GeoPointVector", data_type); auto geo_point_vector2_column = test.table->create_column("GeoPointVector2", data_type); - data_type = grnxx::TEXT_VECTOR_DATA; + data_type = GRNXX_TEXT_VECTOR; auto text_vector_column = test.table->create_column("TextVector", data_type); auto text_vector2_column = test.table->create_column("TextVector2", data_type); - data_type = grnxx::INT_DATA; + data_type = GRNXX_INT; grnxx::ColumnOptions options; options.reference_table_name = "Table"; auto ref_column = test.table->create_column("Ref", data_type, options); auto ref2_column = test.table->create_column("Ref2", data_type, options); - data_type = grnxx::INT_VECTOR_DATA; + data_type = GRNXX_INT_VECTOR; auto ref_vector_column = test.table->create_column("RefVector", data_type, options); auto ref_vector2_column = Modified: test/test_index.cpp (+15 -15) =================================================================== --- test/test_index.cpp 2015-01-07 13:45:58 +0900 (be7e7b1) +++ test/test_index.cpp 2015-02-09 13:29:20 +0900 (4cb0b86) @@ -33,7 +33,7 @@ void test_index() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Create an index named "Index". auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -50,7 +50,7 @@ void test_set_and_index() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Generate random values. // Int: [0, 100) or N/A. @@ -99,7 +99,7 @@ void test_index_and_set() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -148,7 +148,7 @@ void test_remove() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Generate random values. // Int: [0, 100) or N/A. @@ -210,7 +210,7 @@ void test_int_exact_match() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -261,7 +261,7 @@ void test_float_exact_match() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::FLOAT_DATA); + auto column = table->create_column("Column", GRNXX_FLOAT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -312,7 +312,7 @@ void test_text_exact_match() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::TEXT_DATA); + auto column = table->create_column("Column", GRNXX_TEXT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -367,7 +367,7 @@ void test_int_range() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -420,7 +420,7 @@ void test_float_range() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::FLOAT_DATA); + auto column = table->create_column("Column", GRNXX_FLOAT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -473,7 +473,7 @@ void test_text_range() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::TEXT_DATA); + auto column = table->create_column("Column", GRNXX_TEXT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -530,7 +530,7 @@ void test_text_find_starts_with() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::TEXT_DATA); + auto column = table->create_column("Column", GRNXX_TEXT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -614,7 +614,7 @@ void test_text_find_prefixes() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::TEXT_DATA); + auto column = table->create_column("Column", GRNXX_TEXT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -667,7 +667,7 @@ void test_reverse() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -727,7 +727,7 @@ void test_offset_and_limit() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); @@ -793,7 +793,7 @@ void test_uniqueness() { // Create a column. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Create an index. auto index = column->create_index("Index", grnxx::TREE_INDEX); Modified: test/test_issue_62.cpp (+2 -2) =================================================================== --- test/test_issue_62.cpp 2015-01-07 13:45:58 +0900 (ebeb18b) +++ test/test_issue_62.cpp 2015-02-09 13:29:20 +0900 (d8c0c88) @@ -48,10 +48,10 @@ void test_scored_subexpression() { } // Create columns for Float and Int values. - auto float_column = table->create_column("Float", grnxx::FLOAT_DATA); + auto float_column = table->create_column("Float", GRNXX_FLOAT); grnxx::ColumnOptions options; options.reference_table_name = "Table"; - auto ref_column = table->create_column("Ref", grnxx::INT_DATA, options); + auto ref_column = table->create_column("Ref", GRNXX_INT, options); // Store generated values into columns. for (size_t i = 0; i < NUM_ROWS; ++i) { Modified: test/test_merger.cpp (+2 -2) =================================================================== --- test/test_merger.cpp 2015-01-07 13:45:58 +0900 (fc1fbdf) +++ test/test_merger.cpp 2015-02-09 13:29:20 +0900 (5423726) @@ -49,11 +49,11 @@ void init_test() { test.table = test.db->create_table("Table"); // Create columns for Bool and Float values. - grnxx::DataType data_type = grnxx::BOOL_DATA; + grnxx::DataType data_type = GRNXX_BOOL; auto bool_column = test.table->create_column("Bool", data_type); auto bool2_column = test.table->create_column("Bool2", data_type); - data_type = grnxx::FLOAT_DATA; + data_type = GRNXX_FLOAT; auto float_column = test.table->create_column("Float", data_type); auto float2_column = test.table->create_column("Float2", data_type); Modified: test/test_pipeline.cpp (+3 -3) =================================================================== --- test/test_pipeline.cpp 2015-01-07 13:45:58 +0900 (1e1a381) +++ test/test_pipeline.cpp 2015-02-09 13:29:20 +0900 (94535a3) @@ -43,9 +43,9 @@ void init_test() { test.table = test.db->create_table("Table"); // Create columns for various data types. - auto bool_column = test.table->create_column("Bool", grnxx::BOOL_DATA); - auto int_column = test.table->create_column("Int", grnxx::INT_DATA); - auto float_column = test.table->create_column("Float", grnxx::FLOAT_DATA); + auto bool_column = test.table->create_column("Bool", GRNXX_BOOL); + auto int_column = test.table->create_column("Int", GRNXX_INT); + auto float_column = test.table->create_column("Float", GRNXX_FLOAT); // Generate random values. // Bool: true, false, or N/A. Modified: test/test_sorter.cpp (+4 -4) =================================================================== --- test/test_sorter.cpp 2015-01-07 13:45:58 +0900 (aa489dd) +++ test/test_sorter.cpp 2015-02-09 13:29:20 +0900 (65e8ae2) @@ -398,10 +398,10 @@ void test_composite() { // Create a table. auto db = grnxx::open_db(""); auto table = db->create_table("Table"); - auto bool_column = table->create_column("Bool", grnxx::BOOL_DATA); - auto int_column = table->create_column("Int", grnxx::INT_DATA); - auto float_column = table->create_column("Float", grnxx::FLOAT_DATA); - auto text_column = table->create_column("Text", grnxx::TEXT_DATA); + auto bool_column = table->create_column("Bool", GRNXX_BOOL); + auto int_column = table->create_column("Int", GRNXX_INT); + auto float_column = table->create_column("Float", GRNXX_FLOAT); + auto text_column = table->create_column("Text", GRNXX_TEXT); for (size_t i = 0; i < NUM_ROWS; ++i) { table->insert_row(); } Modified: test/test_table.cpp (+14 -14) =================================================================== --- test/test_table.cpp 2015-01-07 13:45:58 +0900 (6dff32d) +++ test/test_table.cpp 2015-02-09 13:29:20 +0900 (f3a21d2) @@ -41,7 +41,7 @@ void test_table() { assert(table->is_full()); // Create a column named "Column_1". - auto column = table->create_column("Column_1", grnxx::BOOL_DATA); + auto column = table->create_column("Column_1", GRNXX_BOOL); assert(column->name() == "Column_1"); assert(table->num_columns() == 1); @@ -50,14 +50,14 @@ void test_table() { // The following create_column() must fail because "Column_1" already exists. try { - table->create_column("Column_1", grnxx::BOOL_DATA); + table->create_column("Column_1", GRNXX_BOOL); assert(false); } catch (...) { } // Create columns named "Column_2" and Column_3". - table->create_column("Column_2", grnxx::BOOL_DATA); - table->create_column("Column_3", grnxx::BOOL_DATA); + table->create_column("Column_2", GRNXX_BOOL); + table->create_column("Column_3", GRNXX_BOOL); assert(table->num_columns() == 3); // Remove "Column_2". @@ -68,7 +68,7 @@ void test_table() { assert(table->get_column(1)->name() == "Column_3"); // Recreate "Column_2". - table->create_column("Column_2", grnxx::BOOL_DATA); + table->create_column("Column_2", GRNXX_BOOL); // Move "Column_3" to the next to "Column_2". table->reorder_column("Column_3", "Column_2"); @@ -211,7 +211,7 @@ void test_int_key() { auto table = db->create_table("Table"); // Create a column named "Column". - auto column = table->create_column("Column", grnxx::INT_DATA); + auto column = table->create_column("Column", GRNXX_INT); // Append three rows. grnxx::Int row_id = table->insert_row(); @@ -294,7 +294,7 @@ void test_text_key() { auto table = db->create_table("Table"); // Create a column named "Column". - auto column = table->create_column("Column", grnxx::TEXT_DATA); + auto column = table->create_column("Column", GRNXX_TEXT); // Append three rows. grnxx::Int row_id = table->insert_row(); @@ -424,7 +424,7 @@ void test_reference() { // Create a column named "Ref". grnxx::ColumnOptions options; options.reference_table_name = "To"; - auto ref_column = from_table->create_column("Ref", grnxx::INT_DATA, options); + auto ref_column = from_table->create_column("Ref", GRNXX_INT, options); // Append rows. to_table->insert_row(); @@ -444,25 +444,25 @@ void test_reference() { grnxx::Datum datum; ref_column->get(grnxx::Int(0), &datum); - assert(datum.type() == grnxx::INT_DATA); + assert(datum.type() == GRNXX_INT); assert(datum.as_int().raw() == 0); ref_column->get(grnxx::Int(1), &datum); - assert(datum.type() == grnxx::INT_DATA); + assert(datum.type() == GRNXX_INT); assert(datum.as_int().raw() == 1); ref_column->get(grnxx::Int(2), &datum); - assert(datum.type() == grnxx::INT_DATA); + assert(datum.type() == GRNXX_INT); assert(datum.as_int().raw() == 1); to_table->remove_row(grnxx::Int(1)); ref_column->get(grnxx::Int(0), &datum); - assert(datum.type() == grnxx::INT_DATA); + assert(datum.type() == GRNXX_INT); assert(datum.as_int().raw() == 0); ref_column->get(grnxx::Int(1), &datum); - assert(datum.type() == grnxx::INT_DATA); + assert(datum.type() == GRNXX_INT); assert(datum.as_int().raw() == 1); ref_column->get(grnxx::Int(2), &datum); - assert(datum.type() == grnxx::INT_DATA); + assert(datum.type() == GRNXX_INT); assert(datum.as_int().raw() == 1); }