[Groonga-commit] groonga/grnxx at 2f2a951 [new_data_types] Make data types' type() static member functions.

Back to archive index

susumu.yata null+****@clear*****
Fri Nov 7 10:25:08 JST 2014


susumu.yata	2014-11-07 10:25:08 +0900 (Fri, 07 Nov 2014)

  New Revision: 2f2a951600fba60dc6aa5e6cbe7c03533cddc88e
  https://github.com/groonga/grnxx/commit/2f2a951600fba60dc6aa5e6cbe7c03533cddc88e

  Message:
    Make data types' type() static member functions.

  Modified files:
    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

  Modified: include/grnxx/data_types/scalar/bool.hpp (+4 -3)
===================================================================
--- include/grnxx/data_types/scalar/bool.hpp    2014-11-07 00:08:47 +0900 (383616c)
+++ include/grnxx/data_types/scalar/bool.hpp    2014-11-07 10:25:08 +0900 (8fde9be)
@@ -20,9 +20,6 @@ class Bool {
       : value_(value ? true_value() : false_value()) {}
   explicit constexpr Bool(NA) : value_(na_value()) {}
 
-  constexpr DataType type() const {
-    return BOOL_DATA;
-  }
   constexpr uint8_t value() const {
     return value_;
   }
@@ -89,6 +86,10 @@ class Bool {
            Bool(static_cast<uint8_t>(value_ ^ rhs.value_));
   }
 
+  static constexpr DataType type() {
+    return BOOL_DATA;
+  }
+
   static constexpr Bool na() {
     return Bool(NA());
   }

  Modified: include/grnxx/data_types/scalar/float.hpp (+4 -3)
===================================================================
--- include/grnxx/data_types/scalar/float.hpp    2014-11-07 00:08:47 +0900 (b856764)
+++ include/grnxx/data_types/scalar/float.hpp    2014-11-07 10:25:08 +0900 (3935ba9)
@@ -23,9 +23,6 @@ class Float {
   explicit constexpr Float(double value) : value_(value) {}
   explicit constexpr Float(NA) : value_(na_value()) {}
 
-  constexpr DataType type() const {
-    return FLOAT_DATA;
-  }
   constexpr double value() const {
     return value_;
   }
@@ -122,6 +119,10 @@ class Float {
     return Float(std::nextafter(value_, to.value_));
   }
 
+  static constexpr DataType type() {
+    return FLOAT_DATA;
+  }
+
   static constexpr Float min() {
     return Float(min_value());
   }

  Modified: include/grnxx/data_types/scalar/geo_point.hpp (+4 -3)
===================================================================
--- include/grnxx/data_types/scalar/geo_point.hpp    2014-11-07 00:08:47 +0900 (f114b90)
+++ include/grnxx/data_types/scalar/geo_point.hpp    2014-11-07 10:25:08 +0900 (d7f114d)
@@ -31,9 +31,6 @@ class GeoPoint {
       : latitude_(na_latitude()),
         longitude_(na_longitude()) {}
 
-  constexpr DataType type() const {
-    return GEO_POINT_DATA;
-  }
   constexpr int32_t latitude() const {
     return latitude_;
   }
@@ -56,6 +53,10 @@ class GeoPoint {
                 (longitude_ != rhs.longitude_));
   }
 
+  static constexpr DataType type() {
+    return GEO_POINT_DATA;
+  }
+
   static constexpr GeoPoint na() {
     return GeoPoint(NA());
   }

  Modified: include/grnxx/data_types/scalar/int.hpp (+4 -3)
===================================================================
--- include/grnxx/data_types/scalar/int.hpp    2014-11-07 00:08:47 +0900 (2230004)
+++ include/grnxx/data_types/scalar/int.hpp    2014-11-07 10:25:08 +0900 (3d86d7f)
@@ -22,9 +22,6 @@ class Int {
   explicit constexpr Int(int64_t value) : value_(value) {}
   explicit constexpr Int(NA) : value_(na_value()) {}
 
-  constexpr DataType type() const {
-    return INT_DATA;
-  }
   constexpr int64_t value() const {
     return value_;
   }
@@ -222,6 +219,10 @@ class Int {
     return (is_na() || rhs.is_na()) ? Bool::na() : Bool(value_ >= rhs.value_);
   }
 
+  static constexpr DataType type() {
+    return INT_DATA;
+  }
+
   static constexpr Int min() {
     return Int(min_value());
   }

  Modified: include/grnxx/data_types/scalar/text.hpp (+4 -3)
===================================================================
--- include/grnxx/data_types/scalar/text.hpp    2014-11-07 00:08:47 +0900 (dbb6667)
+++ include/grnxx/data_types/scalar/text.hpp    2014-11-07 10:25:08 +0900 (7e0edb2)
@@ -24,9 +24,6 @@ class Text {
   constexpr Text(const char *data, size_t size) : data_(data), size_(size) {}
   explicit constexpr Text(NA) : data_(na_data()), size_(na_size()) {}
 
-  constexpr DataType type() const {
-    return TEXT_DATA;
-  }
   const char &operator[](size_t i) const {
     return data_[i];
   }
@@ -105,6 +102,10 @@ class Text {
                             rhs.data_, rhs.size_) == 0);
   }
 
+  static constexpr DataType type() {
+    return TEXT_DATA;
+  }
+
   static constexpr Text empty() {
     return Text("", 0);
   }

  Modified: include/grnxx/data_types/vector/bool.hpp (+1 -1)
===================================================================
--- include/grnxx/data_types/vector/bool.hpp    2014-11-07 00:08:47 +0900 (d292f3e)
+++ include/grnxx/data_types/vector/bool.hpp    2014-11-07 10:25:08 +0900 (e863e0e)
@@ -13,7 +13,7 @@ template <>
 class Vector<Bool> {
  public:
   // TODO
-  constexpr DataType type() const {
+  static constexpr DataType type() {
     return BOOL_VECTOR_DATA;
   }
 };

  Modified: include/grnxx/data_types/vector/float.hpp (+1 -1)
===================================================================
--- include/grnxx/data_types/vector/float.hpp    2014-11-07 00:08:47 +0900 (f289e92)
+++ include/grnxx/data_types/vector/float.hpp    2014-11-07 10:25:08 +0900 (4966724)
@@ -13,7 +13,7 @@ template <>
 class Vector<Float> {
  public:
   // TODO
-  constexpr DataType type() const {
+  static constexpr DataType type() {
     return FLOAT_VECTOR_DATA;
   }
 };

  Modified: include/grnxx/data_types/vector/geo_point.hpp (+1 -1)
===================================================================
--- include/grnxx/data_types/vector/geo_point.hpp    2014-11-07 00:08:47 +0900 (2bb0fd4)
+++ include/grnxx/data_types/vector/geo_point.hpp    2014-11-07 10:25:08 +0900 (55251db)
@@ -13,7 +13,7 @@ template <>
 class Vector<GeoPoint> {
  public:
   // TODO
-  constexpr DataType type() const {
+  static constexpr DataType type() {
     return GEO_POINT_VECTOR_DATA;
   }
 };

  Modified: include/grnxx/data_types/vector/int.hpp (+1 -1)
===================================================================
--- include/grnxx/data_types/vector/int.hpp    2014-11-07 00:08:47 +0900 (a1569f9)
+++ include/grnxx/data_types/vector/int.hpp    2014-11-07 10:25:08 +0900 (57d61f6)
@@ -13,7 +13,7 @@ template <>
 class Vector<Int> {
  public:
   // TODO
-  constexpr DataType type() const {
+  static constexpr DataType type() {
     return INT_VECTOR_DATA;
   }
 };

  Modified: include/grnxx/data_types/vector/text.hpp (+1 -1)
===================================================================
--- include/grnxx/data_types/vector/text.hpp    2014-11-07 00:08:47 +0900 (cc4b5e4)
+++ include/grnxx/data_types/vector/text.hpp    2014-11-07 10:25:08 +0900 (f0dd678)
@@ -13,7 +13,7 @@ template <>
 class Vector<Text> {
  public:
   // TODO
-  constexpr DataType type() const {
+  static constexpr DataType type() {
     return TEXT_VECTOR_DATA;
   }
 };
-------------- next part --------------
HTML����������������������������...
下載 



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