diff --git a/include/xo/unit/Quantity2.hpp b/include/xo/unit/Quantity2.hpp index afebb074..b44bf0f0 100644 --- a/include/xo/unit/Quantity2.hpp +++ b/include/xo/unit/Quantity2.hpp @@ -10,7 +10,7 @@ #include "unit2.hpp" namespace xo { - namespace unit { + namespace qty { /** @class quantity * @brief represent a scalar quantity with attached units. enforce dimensional consistency. * @@ -87,7 +87,7 @@ namespace xo { { return Quantity::multiply(x, y); } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/Quantity2_iostream.hpp b/include/xo/unit/Quantity2_iostream.hpp index 0a1f2893..2c1aa55a 100644 --- a/include/xo/unit/Quantity2_iostream.hpp +++ b/include/xo/unit/Quantity2_iostream.hpp @@ -9,7 +9,7 @@ #include namespace xo { - namespace unit { + namespace qty { template inline std::ostream & @@ -23,7 +23,7 @@ namespace xo { return os; } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end Quantity2_iostream.hpp **/ diff --git a/include/xo/unit/basis_unit2.hpp b/include/xo/unit/basis_unit2.hpp index ae6d35d5..828e4fd5 100644 --- a/include/xo/unit/basis_unit2.hpp +++ b/include/xo/unit/basis_unit2.hpp @@ -8,7 +8,7 @@ #include namespace xo { - namespace unit { + namespace qty { using basis_unit2_abbrev_type = flatstring<16>; using scalefactor_ratio_type = xo::ratio::ratio; @@ -365,7 +365,7 @@ namespace xo { constexpr auto scaled_native_unit2_abbrev_v = scaled_native_unit2_abbrev::value; } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/bpu_store.hpp b/include/xo/unit/bpu_store.hpp index b66fcd51..196bd8ed 100644 --- a/include/xo/unit/bpu_store.hpp +++ b/include/xo/unit/bpu_store.hpp @@ -5,7 +5,7 @@ #include "native_bpu2.hpp" namespace xo { - namespace unit { + namespace qty { /** @class basis_unit2_store * @brief Store known basis units for runtime **/ @@ -156,7 +156,7 @@ namespace xo { /* bu_abbrev_v[dim] holds known units for native unit dim */ std::vector bu_abbrev_vv_; }; - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end bpu_store.hpp **/ diff --git a/include/xo/unit/dim_iostream.hpp b/include/xo/unit/dim_iostream.hpp index 24b31326..c420bca1 100644 --- a/include/xo/unit/dim_iostream.hpp +++ b/include/xo/unit/dim_iostream.hpp @@ -9,13 +9,13 @@ #include namespace xo { - namespace unit { + namespace qty { inline std::ostream & operator<<(std::ostream & os, dim x) { os << dim2str(x); return os; } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end dim_iostream.hpp **/ diff --git a/include/xo/unit/dim_util.hpp b/include/xo/unit/dim_util.hpp index 7d369bc2..b3b9a365 100644 --- a/include/xo/unit/dim_util.hpp +++ b/include/xo/unit/dim_util.hpp @@ -7,7 +7,7 @@ #include namespace xo { - namespace unit { + namespace qty { enum class dim { invalid = -1, @@ -76,7 +76,7 @@ namespace xo { template constexpr auto native_unit_for_v = native_unit_for::value; - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /* end dim_util.hpp */ diff --git a/include/xo/unit/dim_util2.hpp b/include/xo/unit/dim_util2.hpp index c49706fd..709056cd 100644 --- a/include/xo/unit/dim_util2.hpp +++ b/include/xo/unit/dim_util2.hpp @@ -9,7 +9,7 @@ #include "xo/flatstring/flatstring.hpp" namespace xo { - namespace unit { + namespace qty { using native_unit2_abbrev_type = flatstring<8>; /** @class native_unit2 @@ -43,7 +43,7 @@ namespace xo { native_unit2(dim::price, native_unit2_abbrev_type::from_chars("px")), }; - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/native_bpu2.hpp b/include/xo/unit/native_bpu2.hpp index 62786d44..cbd52bb2 100644 --- a/include/xo/unit/native_bpu2.hpp +++ b/include/xo/unit/native_bpu2.hpp @@ -10,7 +10,7 @@ #include "dim_iostream.hpp" namespace xo { - namespace unit { + namespace qty { using bpu2_abbrev_type = flatstring<24>; using power_ratio_type = xo::ratio::ratio; @@ -126,7 +126,7 @@ namespace xo { flatstring_from_exponent()))); }; #endif - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/native_bpu2_iostream.hpp b/include/xo/unit/native_bpu2_iostream.hpp index a748670c..e16cc65a 100644 --- a/include/xo/unit/native_bpu2_iostream.hpp +++ b/include/xo/unit/native_bpu2_iostream.hpp @@ -10,7 +10,7 @@ #include namespace xo { - namespace unit { + namespace qty { template inline std::ostream & operator<<(std::ostream & os, const bpu2 & x) { @@ -22,7 +22,7 @@ namespace xo { return os; } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/natural_unit.hpp b/include/xo/unit/natural_unit.hpp index ecfea289..d827cfca 100644 --- a/include/xo/unit/natural_unit.hpp +++ b/include/xo/unit/natural_unit.hpp @@ -10,7 +10,7 @@ #include namespace xo { - namespace unit { + namespace qty { /** @class natural_unit * @brief an array representing the cartesian product of distinct basis-power-units * @@ -223,7 +223,7 @@ namespace xo { constexpr auto nanogram = bpu_array_maker::make_bpu_array(make_unit_power(bu2::nanogram)); constexpr auto microgram = bpu_array_maker::make_bpu_array(make_unit_power(bu2::microgram)); } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end natural_unit.hpp **/ diff --git a/include/xo/unit/natural_unit_iostream.hpp b/include/xo/unit/natural_unit_iostream.hpp index 931d8f22..99d3dd4d 100644 --- a/include/xo/unit/natural_unit_iostream.hpp +++ b/include/xo/unit/natural_unit_iostream.hpp @@ -9,7 +9,7 @@ #include namespace xo { - namespace unit { + namespace qty { template inline std::ostream & operator<<(std::ostream & os, const natural_unit & x) { @@ -22,7 +22,7 @@ namespace xo { os << "]>"; return os; } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end natural_unit_iostream.hpp **/ diff --git a/include/xo/unit/numeric_concept.hpp b/include/xo/unit/numeric_concept.hpp index f1d32f58..b853e8f5 100644 --- a/include/xo/unit/numeric_concept.hpp +++ b/include/xo/unit/numeric_concept.hpp @@ -5,7 +5,7 @@ #include namespace xo { - namespace unit { + namespace qty { /** @concept numeric_concept * @brief Concept for values that participate in arithmetic operations (+,-,*,/) and comparisons * @@ -28,7 +28,7 @@ namespace xo { { x == y }; { x != y }; }; - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /* end numeric_concept.hpp */ diff --git a/include/xo/unit/quantity2.hpp b/include/xo/unit/quantity2.hpp index 9fb74ac2..efd2b75f 100644 --- a/include/xo/unit/quantity2.hpp +++ b/include/xo/unit/quantity2.hpp @@ -8,7 +8,7 @@ #include "bpu_array.hpp" namespace xo { - namespace unit { + namespace qty { /** @class quantity * @brief represent a scalar quantity with attached units. enforce dimensional consistency. * @@ -21,7 +21,7 @@ namespace xo { private: }; - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/quantity2_concept.hpp b/include/xo/unit/quantity2_concept.hpp index b401be7b..3fbde14e 100644 --- a/include/xo/unit/quantity2_concept.hpp +++ b/include/xo/unit/quantity2_concept.hpp @@ -6,7 +6,7 @@ #include "numeric_concept.hpp" namespace xo { - namespace unit { + namespace qty { template concept quantity2_concept = requires(Quantity qty, typename Quantity::repr_type repr) { @@ -19,5 +19,5 @@ namespace xo { //{ Quantity::promote(repr) } -> std::same_as; } && (true //unit_concept && numeric_concept); - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ diff --git a/include/xo/unit/scaled_unit2.hpp b/include/xo/unit/scaled_unit2.hpp index c6655a3e..d8c11bdd 100644 --- a/include/xo/unit/scaled_unit2.hpp +++ b/include/xo/unit/scaled_unit2.hpp @@ -9,7 +9,7 @@ //#include namespace xo { - namespace unit { + namespace qty { /** @class bpu2_array_rescale_result * @brief Represents the product sqrt(outer_scale_sq) * outer_scale_exact * nat_unit **/ @@ -120,7 +120,7 @@ namespace xo { rr.outer_scale_exact_ * x_unit.outer_scale_exact_ * y_unit.outer_scale_exact_, rr.outer_scale_sq_ * x_unit.outer_scale_sq_ * y_unit.outer_scale_sq_)); } - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end scaled_unit2.hpp **/ diff --git a/include/xo/unit/scaled_unit_iostream.hpp b/include/xo/unit/scaled_unit_iostream.hpp index 64525991..4d0ab1fe 100644 --- a/include/xo/unit/scaled_unit_iostream.hpp +++ b/include/xo/unit/scaled_unit_iostream.hpp @@ -9,7 +9,7 @@ #include namespace xo { - namespace unit { + namespace qty { template inline std::ostream & operator<<(std::ostream & os, const scaled_unit2 & x) { @@ -21,7 +21,7 @@ namespace xo { return os; }; - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end scaled_unit_iostream.hpp **/ diff --git a/include/xo/unit/unit2.hpp b/include/xo/unit/unit2.hpp index 3fe9b622..eab1bf8f 100644 --- a/include/xo/unit/unit2.hpp +++ b/include/xo/unit/unit2.hpp @@ -8,7 +8,7 @@ #include "natural_unit.hpp" namespace xo { - namespace unit { + namespace qty { /** @class unit2 * @brief represent an arbitrary unit along with dimension details * @@ -18,7 +18,7 @@ namespace xo { **/ template using unit2 = natural_unit; - } /*namespace unit*/ + } /*namespace qty*/ } /*namespace xo*/ /** end unit2.hpp **/ diff --git a/utest/mpl_unit.test.cpp b/utest/mpl_unit.test.cpp index 680fad65..0fc6e10f 100644 --- a/utest/mpl_unit.test.cpp +++ b/utest/mpl_unit.test.cpp @@ -39,7 +39,7 @@ namespace xo { //using xo::unit::bpu2_abbrev_type; //using xo::unit::abbrev::bpu2_abbrev; //using xo::unit::basis_unit2_store; - using xo::unit::power_ratio_type; + using xo::qty::power_ratio_type; //using xo::unit::abbrev::flatstring_from_exponent; //using xo::unit::bpu2; //using xo::unit::detail::bpu2_rescale; diff --git a/utest/unit.test.cpp b/utest/unit.test.cpp index 451fadcc..c957ce9c 100644 --- a/utest/unit.test.cpp +++ b/utest/unit.test.cpp @@ -23,57 +23,31 @@ namespace xo { using xo::reflect::Reflect; - namespace su2 = xo::unit::su2; + namespace su2 = xo::qty::su2; - using xo::unit::Quantity2; - using xo::unit::dim; - using xo::unit::basis_unit2_abbrev_type; - using xo::unit::native_unit2; - using xo::unit::native_unit2_v; - using xo::unit::scalefactor_ratio_type; - using xo::unit::units::scaled_native_unit2_abbrev; - using xo::unit::units::scaled_native_unit2_abbrev_v; - using xo::unit::basis_unit2; - using xo::unit::abbrev::basis_unit2_abbrev;; - using xo::unit::bpu2_abbrev_type; - using xo::unit::abbrev::bpu2_abbrev; - using xo::unit::basis_unit2_store; - using xo::unit::power_ratio_type; - using xo::unit::abbrev::flatstring_from_exponent; - using xo::unit::bpu2; - using xo::unit::detail::bpu2_rescale; - using xo::unit::detail::bpu2_product; - using xo::unit::natural_unit; - using xo::unit::bpu_array_maker; - using xo::unit::detail::nu_product; - using xo::unit::unit_qty; + using xo::qty::Quantity2; + using xo::qty::dim; + using xo::qty::basis_unit2_abbrev_type; + using xo::qty::native_unit2; + using xo::qty::native_unit2_v; + using xo::qty::scalefactor_ratio_type; + using xo::qty::units::scaled_native_unit2_abbrev; + using xo::qty::units::scaled_native_unit2_abbrev_v; + using xo::qty::basis_unit2; + using xo::qty::abbrev::basis_unit2_abbrev;; + using xo::qty::bpu2_abbrev_type; + using xo::qty::abbrev::bpu2_abbrev; + using xo::qty::basis_unit2_store; + using xo::qty::power_ratio_type; + using xo::qty::abbrev::flatstring_from_exponent; + using xo::qty::bpu2; + using xo::qty::detail::bpu2_rescale; + using xo::qty::detail::bpu2_product; + using xo::qty::natural_unit; + using xo::qty::bpu_array_maker; + using xo::qty::detail::nu_product; + using xo::qty::unit_qty; - //using xo::unit::native_unit_abbrev_v; - //using xo::unit::units::scaled_native_unit_abbrev_v; - //using xo::unit::native_dim_abbrev; - //using xo::unit::stringliteral_compare; - //using xo::unit::literal_size_v; - //using xo::unit::stringliteral_from_digit; - //using xo::unit::stringliteral_from_int_v; - //using xo::unit::stringliteral; -#ifndef __clang__ - //using xo::unit::stringliteral_concat; - //using xo::unit::stringliteral_from_ratio; - //using xo::unit::bpu_assemble_abbrev_helper; - //using xo::unit::bpu_assemble_abbrev; -#endif - //using xo::unit::bpu_node; - //using xo::unit::wrap_unit; - //using xo::unit::unit_abbrev_v; - //using xo::unit::dim_abbrev_v; - //using xo::unit::di_cartesian_product; - //using xo::unit::di_cartesian_product1; - //using xo::unit::unit_cartesian_product_t; - //using xo::unit::bpu_cartesian_product; - //using xo::unit::bpu_cartesian_product_helper; - //using xo::unit::unit_invert_t; - //using xo::unit::units::gram; - //using xo::unit::units::second; using xo::print::ccs; template @@ -206,7 +180,7 @@ namespace xo { log && log(xtag("price", scaled_native_unit2_abbrev_v)); - REQUIRE(xo::unit::units::scaled_native_unit2_abbrev::value == xo::flatstring("g")); + REQUIRE(xo::qty::units::scaled_native_unit2_abbrev::value == xo::flatstring("g")); /* proof that scaled_native_unit2_abbrev::value is constexpr */ static_assert(scaled_native_unit2_abbrev_v