susumu.yata
null+****@clear*****
Thu Oct 30 10:35:02 JST 2014
susumu.yata 2014-10-30 10:35:02 +0900 (Thu, 30 Oct 2014) New Revision: dd798be70a316a2b3bdf0219f35bbd4443c4f005 https://github.com/groonga/grnxx/commit/dd798be70a316a2b3bdf0219f35bbd4443c4f005 Message: Put headers for data types. Added files: include/grnxx/data_types.hpp include/grnxx/data_types/Makefile.am include/grnxx/data_types/na.hpp include/grnxx/data_types/scalar.hpp include/grnxx/data_types/scalar/Makefile.am include/grnxx/data_types/vector.hpp include/grnxx/data_types/vector/Makefile.am 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/row_id.hpp include/grnxx/data_types/vector/text.hpp test/test_data_types.cpp Removed files: include/grnxx/new_types/na.hpp Modified files: configure.ac include/grnxx/Makefile.am test/Makefile.am Renamed files: include/grnxx/data_types/scalar/bool.hpp (from include/grnxx/new_types/bool.hpp) include/grnxx/data_types/scalar/float.hpp (from include/grnxx/new_types/float.hpp) include/grnxx/data_types/scalar/geo_point.hpp (from include/grnxx/new_types/geo_point.hpp) include/grnxx/data_types/scalar/int.hpp (from include/grnxx/new_types/int.hpp) include/grnxx/data_types/scalar/row_id.hpp (from include/grnxx/new_types/row_id.hpp) include/grnxx/data_types/scalar/text.hpp (from include/grnxx/new_types/text.hpp) Modified: configure.ac (+3 -0) =================================================================== --- configure.ac 2014-10-30 09:59:10 +0900 (2cacb70) +++ configure.ac 2014-10-30 10:35:02 +0900 (fe647ad) @@ -52,6 +52,9 @@ AC_CHECK_LIB([rt], [clock_gettime]) AC_CONFIG_FILES([Makefile include/Makefile include/grnxx/Makefile + include/grnxx/data_types/Makefile + include/grnxx/data_types/scalar/Makefile + include/grnxx/data_types/vector/Makefile lib/Makefile lib/grnxx/Makefile src/Makefile Modified: include/grnxx/Makefile.am (+2 -2) =================================================================== --- include/grnxx/Makefile.am 2014-10-30 09:59:10 +0900 (37c7dc7) +++ include/grnxx/Makefile.am 2014-10-30 10:35:02 +0900 (5764e08) @@ -1,5 +1,5 @@ -#SUBDIRS = \ -# types +SUBDIRS = \ + data_types pkginclude_HEADERS = \ library.hpp Added: include/grnxx/data_types.hpp (+7 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types.hpp 2014-10-30 10:35:02 +0900 (906d8fb) @@ -0,0 +1,7 @@ +#ifndef GRNXX_DATA_TYPES_HPP +#define GRNXX_DATA_TYPES_HPP + +#include "grnxx/data_types/scalar.hpp" +#include "grnxx/data_types/vector.hpp" + +#endif // GRNXX_DATA_TYPES_HPP Added: include/grnxx/data_types/Makefile.am (+9 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/Makefile.am 2014-10-30 10:35:02 +0900 (c055bfa) @@ -0,0 +1,9 @@ +SUBDIRS = \ + scalar \ + vector + +pkgincludedir = ${includedir}/${PACKAGE}/data_types +pkginclude_HEADERS = \ + na.hpp \ + scalar.hpp \ + vector.hpp Added: include/grnxx/data_types/na.hpp (+12 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/na.hpp 2014-10-30 10:35:02 +0900 (b1fe63b) @@ -0,0 +1,12 @@ +#ifndef GRNXX_DATA_TYPES_NA_HPP +#define GRNXX_DATA_TYPES_NA_HPP + +namespace grnxx { + +struct NA { + // TODO +}; + +} // namespace grnxx + +#endif // GRNXX_DATA_TYPES_NA_HPP Added: include/grnxx/data_types/scalar.hpp (+12 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/scalar.hpp 2014-10-30 10:35:02 +0900 (5aaf3ca) @@ -0,0 +1,12 @@ +#ifndef GRNXX_DATA_TYPES_SCALAR_HPP +#define GRNXX_DATA_TYPES_SCALAR_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/row_id.hpp" +#include "grnxx/data_types/scalar/text.hpp" + +#endif // GRNXX_DATA_TYPES_SCALAR_HPP Added: include/grnxx/data_types/scalar/Makefile.am (+8 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/scalar/Makefile.am 2014-10-30 10:35:02 +0900 (7f77c2d) @@ -0,0 +1,8 @@ +pkgincludedir = ${includedir}/${PACKAGE}/data_types/scalar +pkginclude_HEADERS = \ + bool.hpp \ + float.hpp \ + geo_point.hpp \ + int.hpp \ + row_id.hpp \ + text.hpp Renamed: include/grnxx/data_types/scalar/bool.hpp (+4 -4) 93% =================================================================== --- include/grnxx/new_types/bool.hpp 2014-10-30 09:59:10 +0900 (78aa745) +++ include/grnxx/data_types/scalar/bool.hpp 2014-10-30 10:35:02 +0900 (233b2c6) @@ -1,9 +1,9 @@ -#ifndef GRNXX_NEW_TYPES_BOOL_HPP -#define GRNXX_NEW_TYPES_BOOL_HPP +#ifndef GRNXX_DATA_TYPES_SCALAR_BOOL_HPP +#define GRNXX_DATA_TYPES_SCALAR_BOOL_HPP #include <cstdint> -#include "grnxx/new_types/na.hpp" +#include "grnxx/data_types/na.hpp" namespace grnxx { @@ -107,4 +107,4 @@ class Bool { } // namespace grnxx -#endif // GRNXX_NEW_TYPES_BOOL_HPP +#endif // GRNXX_DATA_TYPES_SCALAR_BOOL_HPP Renamed: include/grnxx/data_types/scalar/float.hpp (+4 -4) 95% =================================================================== --- include/grnxx/new_types/float.hpp 2014-10-30 09:59:10 +0900 (3da6522) +++ include/grnxx/data_types/scalar/float.hpp 2014-10-30 10:35:02 +0900 (0bc72e2) @@ -1,10 +1,10 @@ -#ifndef GRNXX_NEW_TYPES_FLOAT_HPP -#define GRNXX_NEW_TYPES_FLOAT_HPP +#ifndef GRNXX_DATA_TYPES_SCALAR_FLOAT_HPP +#define GRNXX_DATA_TYPES_SCALAR_FLOAT_HPP #include <cmath> #include <limits> -#include "grnxx/new_types/na.hpp" +#include "grnxx/data_types/na.hpp" namespace grnxx { @@ -142,4 +142,4 @@ class Float { } // namespace grnxx -#endif // GRNXX_NEW_TYPES_FLOAT_HPP +#endif // GRNXX_DATA_TYPES_SCALAR_FLOAT_HPP Renamed: include/grnxx/data_types/scalar/geo_point.hpp (+4 -12) 79% =================================================================== --- include/grnxx/new_types/geo_point.hpp 2014-10-30 09:59:10 +0900 (0cae020) +++ include/grnxx/data_types/scalar/geo_point.hpp 2014-10-30 10:35:02 +0900 (7242b52) @@ -1,10 +1,9 @@ -#ifndef GRNXX_NEW_TYPES_GEO_POINT_HPP -#define GRNXX_NEW_TYPES_GEO_POINT_HPP +#ifndef GRNXX_DATA_TYPES_SCALAR_GEO_POINT_HPP +#define GRNXX_DATA_TYPES_SCALAR_GEO_POINT_HPP #include <cstdint> -#include "grnxx/new_types/int.hpp" -#include "grnxx/new_types/na.hpp" +#include "grnxx/data_types/na.hpp" namespace grnxx { @@ -26,13 +25,6 @@ class GeoPoint { na_latitude() : latitude), longitude_((latitude_ == na_latitude()) ? na_longitude() : longitude) {} - // NOTE: This implementation assumes that Int::na_value() is less than - // GeoPoint::min_latitude() and GeoPoint::min_longitude. - // If this assumption is wrong, N/A must be excluded. - // NOTE: gcc-4.8 does not support use of the value being constructed in - // a constant exression. - GeoPoint(Int latitude, Int longitude) - : GeoPoint(latitude.value(), longitude.value()) {} explicit constexpr GeoPoint(NA) : latitude_(na_latitude()), longitude_(na_longitude()) {} @@ -89,4 +81,4 @@ class GeoPoint { } // namespace grnxx -#endif // GRNXX_NEW_TYPES_GEO_POINT_HPP +#endif // GRNXX_DATA_TYPES_SCALAR_GEO_POINT_HPP Renamed: include/grnxx/data_types/scalar/int.hpp (+4 -4) 98% =================================================================== --- include/grnxx/new_types/int.hpp 2014-10-30 09:59:10 +0900 (33e6f8c) +++ include/grnxx/data_types/scalar/int.hpp 2014-10-30 10:35:02 +0900 (391108a) @@ -1,10 +1,10 @@ -#ifndef GRNXX_NEW_TYPES_INT_HPP -#define GRNXX_NEW_TYPES_INT_HPP +#ifndef GRNXX_DATA_TYPES_SCALAR_INT_HPP +#define GRNXX_DATA_TYPES_SCALAR_INT_HPP #include <cstdint> #include <limits> -#include "grnxx/new_types/na.hpp" +#include "grnxx/data_types/na.hpp" namespace grnxx { @@ -390,4 +390,4 @@ class Int { } // namespace grnxx -#endif // GRNXX_NEW_TYPES_INT_HPP +#endif // GRNXX_DATA_TYPES_SCALAR_INT_HPP Renamed: include/grnxx/data_types/scalar/row_id.hpp (+4 -4) 86% =================================================================== --- include/grnxx/new_types/row_id.hpp 2014-10-30 09:59:10 +0900 (5c5c56c) +++ include/grnxx/data_types/scalar/row_id.hpp 2014-10-30 10:35:02 +0900 (c3f6f4d) @@ -1,10 +1,10 @@ -#ifndef GRNXX_NEW_TYPES_ROW_ID_HPP -#define GRNXX_NEW_TYPES_ROW_ID_HPP +#ifndef GRNXX_DATA_TYPES_SCALAR_ROW_ID_HPP +#define GRNXX_DATA_TYPES_SCALAR_ROW_ID_HPP #include <cstdint> #include <limits> -#include "grnxx/new_types/na.hpp" +#include "grnxx/data_types/na.hpp" namespace grnxx { @@ -59,4 +59,4 @@ class RowID { } // namespace grnxx -#endif // GRNXX_NEW_TYPES_ROW_ID_HPP +#endif // GRNXX_DATA_TYPES_SCALAR_ROW_ID_HPP Renamed: include/grnxx/data_types/scalar/text.hpp (+4 -4) 94% =================================================================== --- include/grnxx/new_types/text.hpp 2014-10-30 09:59:10 +0900 (3ebab25) +++ include/grnxx/data_types/scalar/text.hpp 2014-10-30 10:35:02 +0900 (2d18fde) @@ -1,10 +1,10 @@ -#ifndef GRNXX_NEW_TYPES_TEXT_HPP -#define GRNXX_NEW_TYPES_TEXT_HPP +#ifndef GRNXX_DATA_TYPES_SCALAR_TEXT_HPP +#define GRNXX_DATA_TYPES_SCALAR_TEXT_HPP #include <cstdint> #include <cstring> -#include "grnxx/new_types/na.hpp" +#include "grnxx/data_types/na.hpp" namespace grnxx { @@ -122,4 +122,4 @@ class Text { } // namespace grnxx -#endif // GRNXX_NEW_TYPES_TEXT_HPP +#endif // GRNXX_DATA_TYPES_SCALAR_TEXT_HPP Added: include/grnxx/data_types/vector.hpp (+12 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector.hpp 2014-10-30 10:35:02 +0900 (9084a5f) @@ -0,0 +1,12 @@ +#ifndef GRNXX_DATA_TYPES_VECTOR_HPP +#define GRNXX_DATA_TYPES_VECTOR_HPP + +#include "grnxx/data_types/na.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/row_id.hpp" +#include "grnxx/data_types/vector/text.hpp" + +#endif // GRNXX_DATA_TYPES_VECTOR_HPP Added: include/grnxx/data_types/vector/Makefile.am (+8 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector/Makefile.am 2014-10-30 10:35:02 +0900 (73c2290) @@ -0,0 +1,8 @@ +pkgincludedir = ${includedir}/${PACKAGE}/data_types/vector +pkginclude_HEADERS = \ + bool.hpp \ + float.hpp \ + geo_point.hpp \ + int.hpp \ + row_id.hpp \ + text.hpp Added: include/grnxx/data_types/vector/bool.hpp (+20 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector/bool.hpp 2014-10-30 10:35:02 +0900 (affd198) @@ -0,0 +1,20 @@ +#ifndef GRNXX_DATA_TYPES_VECTOR_BOOL_HPP +#define GRNXX_DATA_TYPES_VECTOR_BOOL_HPP + +#include "grnxx/data_types/na.hpp" +#include "grnxx/data_types/scalar/bool.hpp" + +namespace grnxx { + +template <typename T> class Vector; + +template <> +class Vector<Bool> { + // TODO +}; + +using BoolVector = Vector<Bool>; + +} // namespace grnxx + +#endif // GRNXX_DATA_TYPES_VECTOR_BOOL_HPP Added: include/grnxx/data_types/vector/float.hpp (+20 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector/float.hpp 2014-10-30 10:35:02 +0900 (687cd64) @@ -0,0 +1,20 @@ +#ifndef GRNXX_DATA_TYPES_VECTOR_FLOAT_HPP +#define GRNXX_DATA_TYPES_VECTOR_FLOAT_HPP + +#include "grnxx/data_types/na.hpp" +#include "grnxx/data_types/scalar/float.hpp" + +namespace grnxx { + +template <typename T> class Vector; + +template <> +class Vector<Float> { + // TODO +}; + +using FloatVector = Vector<Float>; + +} // namespace grnxx + +#endif // GRNXX_DATA_TYPES_VECTOR_FLOAT_HPP Added: include/grnxx/data_types/vector/geo_point.hpp (+20 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector/geo_point.hpp 2014-10-30 10:35:02 +0900 (aea0cd0) @@ -0,0 +1,20 @@ +#ifndef GRNXX_DATA_TYPES_VECTOR_GEO_POINT_HPP +#define GRNXX_DATA_TYPES_VECTOR_GEO_POINT_HPP + +#include "grnxx/data_types/na.hpp" +#include "grnxx/data_types/scalar/geo_point.hpp" + +namespace grnxx { + +template <typename T> class Vector; + +template <> +class Vector<GeoPoint> { + // TODO +}; + +using GeoPointVector = Vector<GeoPoint>; + +} // namespace grnxx + +#endif // GRNXX_DATA_TYPES_VECTOR_GEO_POINT_HPP Added: include/grnxx/data_types/vector/int.hpp (+20 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector/int.hpp 2014-10-30 10:35:02 +0900 (9457fd0) @@ -0,0 +1,20 @@ +#ifndef GRNXX_DATA_TYPES_VECTOR_INT_HPP +#define GRNXX_DATA_TYPES_VECTOR_INT_HPP + +#include "grnxx/data_types/na.hpp" +#include "grnxx/data_types/scalar/int.hpp" + +namespace grnxx { + +template <typename T> class Vector; + +template <> +class Vector<Int> { + // TODO +}; + +using IntVector = Vector<Int>; + +} // namespace grnxx + +#endif // GRNXX_DATA_TYPES_VECTOR_INT_HPP Added: include/grnxx/data_types/vector/row_id.hpp (+20 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector/row_id.hpp 2014-10-30 10:35:02 +0900 (8ccc280) @@ -0,0 +1,20 @@ +#ifndef GRNXX_DATA_TYPES_VECTOR_ROW_ID_HPP +#define GRNXX_DATA_TYPES_VECTOR_ROW_ID_HPP + +#include "grnxx/data_types/na.hpp" +#include "grnxx/data_types/scalar/row_id.hpp" + +namespace grnxx { + +template <typename T> class Vector; + +template <> +class Vector<RowID> { + // TODO +}; + +using RowIDVector = Vector<RowID>; + +} // namespace grnxx + +#endif // GRNXX_DATA_TYPES_VECTOR_ROW_ID_HPP Added: include/grnxx/data_types/vector/text.hpp (+20 -0) 100644 =================================================================== --- /dev/null +++ include/grnxx/data_types/vector/text.hpp 2014-10-30 10:35:02 +0900 (e965152) @@ -0,0 +1,20 @@ +#ifndef GRNXX_DATA_TYPES_VECTOR_TEXT_HPP +#define GRNXX_DATA_TYPES_VECTOR_TEXT_HPP + +#include "grnxx/data_types/na.hpp" +#include "grnxx/data_types/scalar/text.hpp" + +namespace grnxx { + +template <typename T> class Vector; + +template <> +class Vector<Text> { + // TODO +}; + +using TextVector = Vector<Text>; + +} // namespace grnxx + +#endif // GRNXX_DATA_TYPES_VECTOR_TEXT_HPP Deleted: include/grnxx/new_types/na.hpp (+0 -10) 100644 =================================================================== --- include/grnxx/new_types/na.hpp 2014-10-30 09:59:10 +0900 (bb324e8) +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GRNXX_NEW_TYPES_NA_HPP -#define GRNXX_NEW_TYPES_NA_HPP - -namespace grnxx { - -class NA {}; - -} // namespace grnxx - -#endif // GRNXX_NEW_TYPES_NA_HPP Modified: test/Makefile.am (+7 -2) =================================================================== --- test/Makefile.am 2014-10-30 09:59:10 +0900 (1a212ea) +++ test/Makefile.am 2014-10-30 10:35:02 +0900 (2e18757) @@ -1,4 +1,6 @@ -#TESTS = \ +TESTS = \ + test_data_types + # test_string \ # test_array \ # test_db \ @@ -11,7 +13,10 @@ # test_pipeline \ # test_issue_62 -#check_PROGRAMS = $(TESTS) +check_PROGRAMS = $(TESTS) + +test_data_types_SOURCES = test_data_types.cpp +test_data_types_LDADD = $(top_srcdir)/lib/grnxx/libgrnxx.la #test_string_SOURCES = test_string.cpp #test_string_LDADD = $(top_srcdir)/lib/grnxx/libgrnxx.la Added: test/test_data_types.cpp (+25 -0) 100644 =================================================================== --- /dev/null +++ test/test_data_types.cpp 2014-10-30 10:35:02 +0900 (b4af4c6) @@ -0,0 +1,25 @@ +/* + Copyright (C) 2012-2014 Brazil, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include <cassert> +#include <iostream> + +#include "grnxx/data_types.hpp" + +int main() { + return 0; +} -------------- next part -------------- HTML����������������������������...다운로드