susumu.yata
null+****@clear*****
Mon May 6 10:22:57 JST 2013
susumu.yata 2013-05-06 10:22:57 +0900 (Mon, 06 May 2013) New Revision: 530ea63859d8dd9ab078cd72dc1215a4e1785f7b https://github.com/groonga/grnxx/commit/530ea63859d8dd9ab078cd72dc1215a4e1785f7b Message: Move grnxx::alpha::GeoPoint to grnxx::GeoPoint. Copied files: lib/grnxx/geo_point.hpp (from lib/grnxx/alpha/geo_point.hpp) Modified files: lib/grnxx/Makefile.am lib/grnxx/alpha/Makefile.am lib/grnxx/alpha/geo_point.hpp lib/grnxx/alpha/map.cpp lib/grnxx/alpha/map/array.cpp lib/grnxx/alpha/map/cursor.hpp lib/grnxx/alpha/map/double_array-slice.cpp lib/grnxx/alpha/map/double_array.cpp test/test_alpha_map.cpp Renamed files: lib/grnxx/geo_point.cpp (from lib/grnxx/alpha/geo_point.cpp) Modified: lib/grnxx/Makefile.am (+2 -0) =================================================================== --- lib/grnxx/Makefile.am 2013-05-06 09:22:17 +0900 (74c2c57) +++ lib/grnxx/Makefile.am 2013-05-06 10:22:57 +0900 (f7ee6ca) @@ -24,6 +24,7 @@ libgrnxx_la_SOURCES = \ backtrace.cpp \ charset.cpp \ error.cpp \ + geo_point.cpp \ grnxx.cpp \ logger.cpp \ map.cpp \ @@ -45,6 +46,7 @@ libgrnxx_include_HEADERS = \ exception.hpp \ features.hpp \ flags_impl.hpp \ + geo_point.hpp \ grnxx.hpp \ intrinsic.hpp \ lock.hpp \ Modified: lib/grnxx/alpha/Makefile.am (+1 -2) =================================================================== --- lib/grnxx/alpha/Makefile.am 2013-05-06 09:22:17 +0900 (fb4537f) +++ lib/grnxx/alpha/Makefile.am 2013-05-06 10:22:57 +0900 (2340390) @@ -2,14 +2,13 @@ SUBDIRS = map noinst_LTLIBRARIES = libgrnxx_alpha.la -libgrnxx_alpha_la_LIBADD = \ +libgrnxx_alpha_la_LIBADD = \ map/libgrnxx_alpha_map.la libgrnxx_alpha_la_LDFLAGS = @AM_LTLDFLAGS@ libgrnxx_alpha_la_SOURCES = \ double_array.cpp \ - geo_point.cpp \ map.cpp \ sample.cpp Modified: lib/grnxx/alpha/geo_point.hpp (+2 -67) =================================================================== --- lib/grnxx/alpha/geo_point.hpp 2013-05-06 09:22:17 +0900 (eabd7a7) +++ lib/grnxx/alpha/geo_point.hpp 2013-05-06 10:22:57 +0900 (d099323) @@ -18,77 +18,12 @@ #ifndef GRNXX_ALPHA_GEO_POINT_HPP #define GRNXX_ALPHA_GEO_POINT_HPP -#include "grnxx/basic.hpp" +#include "grnxx/geo_point.hpp" namespace grnxx { - -class StringBuilder; - namespace alpha { -// Latitude and longitude (lat/long). -union GeoPoint { - public: - // The default constructor does not initialize lat/long. - GeoPoint() = default; - // Copy lat/long as uint64_t to force atomic copy. - GeoPoint(const GeoPoint &x) : value_(x.value_) {} - // Copy lat/long. - GeoPoint(int32_t latitude, int32_t longitude) - : point_{ latitude, longitude } {} - - // Assign lat/long as uint64_t to force atomic assignment. - GeoPoint &operator=(const GeoPoint &x) { - value_ = x.value_; - return *this; - } - - // Get the latitude. - int32_t latitude() const { - return point_.latitude; - } - // Get the longitude. - int32_t longitude() const { - return point_.longitude; - } - // Get lat/long as uint64_t. - uint64_t value() const { - return value_; - } - - // Set the latitude. - void set_latitude(int32_t x) { - point_.latitude = x; - } - // Set the longitude. - void set_longitude(int32_t x) { - point_.longitude = x; - } - // Set lat/long as uint64_t. - void set_value(uint64_t x) { - value_ = x; - } - - StringBuilder &write_to(StringBuilder &builder) const; - - private: - struct Point { - int32_t latitude; - int32_t longitude; - } point_; - uint64_t value_; -}; - -inline bool operator==(const GeoPoint &lhs, const GeoPoint &rhs) { - return lhs.value() == rhs.value(); -} -inline bool operator!=(const GeoPoint &lhs, const GeoPoint &rhs) { - return lhs.value() != rhs.value(); -} - -inline StringBuilder &operator<<(StringBuilder &builder, const GeoPoint &x) { - return x.write_to(builder); -} +using grnxx::GeoPoint; } // namespace alpha } // namespace grnxx Modified: lib/grnxx/alpha/map.cpp (+1 -1) =================================================================== --- lib/grnxx/alpha/map.cpp 2013-05-06 09:22:17 +0900 (045ea4a) +++ lib/grnxx/alpha/map.cpp 2013-05-06 10:22:57 +0900 (ca3456f) @@ -17,13 +17,13 @@ */ #include "grnxx/alpha/map.hpp" -#include "grnxx/alpha/geo_point.hpp" #include "grnxx/alpha/map/array.hpp" #include "grnxx/alpha/map/cursor.hpp" #include "grnxx/alpha/map/double_array.hpp" #include "grnxx/alpha/map/header.hpp" #include "grnxx/alpha/map/scan.hpp" #include "grnxx/exception.hpp" +#include "grnxx/geo_point.hpp" #include "grnxx/slice.hpp" #include "grnxx/logger.hpp" Modified: lib/grnxx/alpha/map/array.cpp (+1 -1) =================================================================== --- lib/grnxx/alpha/map/array.cpp 2013-05-06 09:22:17 +0900 (b120cfd) +++ lib/grnxx/alpha/map/array.cpp 2013-05-06 10:22:57 +0900 (38f1db4) @@ -20,7 +20,7 @@ #include <cmath> #include <string> -#include "grnxx/alpha/geo_point.hpp" +#include "grnxx/geo_point.hpp" namespace grnxx { namespace alpha { Modified: lib/grnxx/alpha/map/cursor.hpp (+1 -1) =================================================================== --- lib/grnxx/alpha/map/cursor.hpp 2013-05-06 09:22:17 +0900 (bc601fd) +++ lib/grnxx/alpha/map/cursor.hpp 2013-05-06 10:22:57 +0900 (f92195f) @@ -22,7 +22,7 @@ #include <vector> -#include "grnxx/alpha/geo_point.hpp" +#include "grnxx/geo_point.hpp" namespace grnxx { namespace alpha { Modified: lib/grnxx/alpha/map/double_array-slice.cpp (+0 -1) =================================================================== --- lib/grnxx/alpha/map/double_array-slice.cpp 2013-05-06 09:22:17 +0900 (e6132f0) +++ lib/grnxx/alpha/map/double_array-slice.cpp 2013-05-06 10:22:57 +0900 (f18b539) @@ -20,7 +20,6 @@ #include <algorithm> #include <vector> -#include "grnxx/alpha/geo_point.hpp" #include "grnxx/lock.hpp" #include "grnxx/logger.hpp" Modified: lib/grnxx/alpha/map/double_array.cpp (+1 -1) =================================================================== --- lib/grnxx/alpha/map/double_array.cpp 2013-05-06 09:22:17 +0900 (1192eef) +++ lib/grnxx/alpha/map/double_array.cpp 2013-05-06 10:22:57 +0900 (29f6d3c) @@ -22,7 +22,7 @@ #include <vector> #include "../config.h" -#include "grnxx/alpha/geo_point.hpp" +#include "grnxx/geo_point.hpp" #include "grnxx/lock.hpp" #include "grnxx/logger.hpp" Renamed: lib/grnxx/geo_point.cpp (+1 -3) 93% =================================================================== --- lib/grnxx/alpha/geo_point.cpp 2013-05-06 09:22:17 +0900 (d5a6867) +++ lib/grnxx/geo_point.cpp 2013-05-06 10:22:57 +0900 (85b879f) @@ -15,17 +15,15 @@ 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 "grnxx/alpha/geo_point.hpp" +#include "grnxx/geo_point.hpp" #include "grnxx/string_builder.hpp" namespace grnxx { -namespace alpha { StringBuilder &GeoPoint::write_to(StringBuilder &builder) const { return builder << "{ latitude = " << point_.latitude << ", longitude = " << point_.longitude << " }"; } -} // namespace alpha } // namespace grnxx Copied: lib/grnxx/geo_point.hpp (+3 -6) 94% =================================================================== --- lib/grnxx/alpha/geo_point.hpp 2013-05-06 09:22:17 +0900 (eabd7a7) +++ lib/grnxx/geo_point.hpp 2013-05-06 10:22:57 +0900 (4344d20) @@ -15,8 +15,8 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef GRNXX_ALPHA_GEO_POINT_HPP -#define GRNXX_ALPHA_GEO_POINT_HPP +#ifndef GRNXX_GEO_POINT_HPP +#define GRNXX_GEO_POINT_HPP #include "grnxx/basic.hpp" @@ -24,8 +24,6 @@ namespace grnxx { class StringBuilder; -namespace alpha { - // Latitude and longitude (lat/long). union GeoPoint { public: @@ -90,7 +88,6 @@ inline StringBuilder &operator<<(StringBuilder &builder, const GeoPoint &x) { return x.write_to(builder); } -} // namespace alpha } // namespace grnxx -#endif // GRNXX_ALPHA_GEO_POINT_HPP +#endif // GRNXX_GEO_POINT_HPP Modified: test/test_alpha_map.cpp (+1 -1) =================================================================== --- test/test_alpha_map.cpp 2013-05-06 09:22:17 +0900 (4f709dc) +++ test/test_alpha_map.cpp 2013-05-06 10:22:57 +0900 (1633e33) @@ -22,8 +22,8 @@ #include <vector> #include <unordered_map> -#include "grnxx/alpha/geo_point.hpp" #include "grnxx/alpha/map.hpp" +#include "grnxx/geo_point.hpp" #include "grnxx/logger.hpp" #include "grnxx/time/time.hpp" -------------- next part -------------- HTML����������������������������...Download