Boost logo

Boost-Commit :

From: boost_at_[hidden]
Date: 2008-05-15 12:40:50


Author: matthiasschabel
Date: 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
New Revision: 45394
URL: http://svn.boost.org/trac/boost/changeset/45394

Log:
add imperial weights and volumes
Added:
   sandbox/units/boost/units/systems/imperial/
   sandbox/units/boost/units/systems/imperial/drachm.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/fluid_ounce.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/gallon.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/gill.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/grain.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/hundredweight.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/ounce.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/pint.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/pound.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/quart.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/quarter.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/stone.hpp (contents, props changed)
   sandbox/units/boost/units/systems/imperial/ton.hpp (contents, props changed)

Added: sandbox/units/boost/units/systems/imperial/drachm.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/drachm.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_DRACHM_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_DRACHM_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pound.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pound_base_unit, scale<16, static_rational<-2> > > drachm_base_unit; // ~1.771g
+
+}
+
+template<>
+struct base_unit_info<imperial::drachm_base_unit> {
+ static const char* name() { return("drachm"); }
+ static const char* symbol() { return("drachm"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/fluid_ounce.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/fluid_ounce.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_FLUID_OUNCE_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_FLUID_OUNCE_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pint.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pint_base_unit, scale<20, static_rational<-1> > > fluid_ounce_base_unit; // ~28.41 ml
+
+}
+
+template<>
+struct base_unit_info<imperial::fluid_ounce_base_unit> {
+ static const char* name() { return("fluid ounce"); }
+ static const char* symbol() { return("fl oz"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/gallon.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/gallon.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_GALLON_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_GALLON_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pint.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<3> > > gallon_base_unit; // exactly 4.54609 liters
+
+}
+
+template<>
+struct base_unit_info<imperial::gallon_base_unit> {
+ static const char* name() { return("gallon"); }
+ static const char* symbol() { return("gal"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/gill.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/gill.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_GILL_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_GILL_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pint.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-2> > > gill_base_unit; // ~142.1 ml
+
+}
+
+template<>
+struct base_unit_info<imperial::gill_base_unit> {
+ static const char* name() { return("gill"); }
+ static const char* symbol() { return("gill"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/grain.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/grain.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_GRAIN_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_GRAIN_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pound.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pound_base_unit, scale<7000, static_rational<-1> > > grain_base_unit; // ~64.8mg
+
+}
+
+template<>
+struct base_unit_info<imperial::grain_base_unit> {
+ static const char* name() { return("grain"); }
+ static const char* symbol() { return("grain"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/hundredweight.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/hundredweight.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_HUNDREDWEIGHT_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_HUNDREDWEIGHT_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pound.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pound_base_unit, scale<112, static_rational<1> > > hundredweight_base_unit; // ~50.8kg
+
+}
+
+template<>
+struct base_unit_info<imperial::hundredweight_base_unit> {
+ static const char* name() { return("hundredweight"); }
+ static const char* symbol() { return("cwt"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/ounce.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/ounce.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_OUNCE_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_OUNCE_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pound.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pound_base_unit, scale<16, static_rational<-1> > > ounce_base_unit; // ~28.35g
+
+}
+
+template<>
+struct base_unit_info<imperial::ounce_base_unit> {
+ static const char* name() { return("ounce"); }
+ static const char* symbol() { return("oz"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/pint.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/pint.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,19 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_PINT_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_PINT_HPP_INCLUDED
+
+#include <boost/units/systems/detail/non_si_unit.hpp>
+#include <boost/units/systems/si/volume.hpp>
+
+BOOST_UNITS_NON_SI_UNIT(imperial, pint, pt, 0.56826125, SI::volume, 21); // exact conversion
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/pound.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/pound.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,19 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_POUND_HPP_INCLUDED
+
+#include <boost/units/systems/detail/non_si_unit.hpp>
+#include <boost/units/systems/base_units/kilogram.hpp>
+
+BOOST_UNITS_NON_SI_UNIT(imperial, pound, lb, 0.45359237, kilogram_base_unit, 21);
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/quart.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/quart.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_QUART_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_QUART_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pint.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<1> > > quart_base_unit; // ~1.136l
+
+}
+
+template<>
+struct base_unit_info<imperial::quart_base_unit> {
+ static const char* name() { return("quart"); }
+ static const char* symbol() { return("qt"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/quarter.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/quarter.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_QUARTER_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_QUARTER_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pound.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pound_base_unit, scale<28, static_rational<1> > > quarter_base_unit; // ~12.7kg
+
+}
+
+template<>
+struct base_unit_info<imperial::quarter_base_unit> {
+ static const char* name() { return("quarter"); }
+ static const char* symbol() { return("quarter"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/stone.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/stone.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_STONE_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_STONE_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pound.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pound_base_unit, scale<14, static_rational<1> > > stone_base_unit; // ~6.35kg
+
+}
+
+template<>
+struct base_unit_info<imperial::stone_base_unit> {
+ static const char* name() { return("stone"); }
+ static const char* symbol() { return("st"); }
+};
+
+}
+}
+
+#endif

Added: sandbox/units/boost/units/systems/imperial/ton.hpp
==============================================================================
--- (empty file)
+++ sandbox/units/boost/units/systems/imperial/ton.hpp 2008-05-15 12:40:49 EDT (Thu, 15 May 2008)
@@ -0,0 +1,37 @@
+// Boost.Units - A C++ library for zero-overhead dimensional analysis and
+// unit/quantity manipulation and conversion
+//
+// Copyright (C) 2003-2008 Matthias Christian Schabel
+// Copyright (C) 2007-2008 Steven Watanabe
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_UNIT_SYSTEMS_IMPERIAL_TON_HPP_INCLUDED
+#define BOOST_UNIT_SYSTEMS_IMPERIAL_TON_HPP_INCLUDED
+
+#include <boost/units/scaled_base_unit.hpp>
+#include <boost/units/static_rational.hpp>
+#include <boost/units/scale.hpp>
+#include <boost/units/units_fwd.hpp>
+#include <boost/units/systems/imperial/pound.hpp>
+
+namespace boost {
+namespace units {
+namespace imperial {
+
+typedef scaled_base_unit<pound_base_unit, scale<2240, static_rational<1> > > ton_base_unit; // ~1016kg
+
+}
+
+template<>
+struct base_unit_info<imperial::ton_base_unit> {
+ static const char* name() { return("ton"); }
+ static const char* symbol() { return("t"); }
+};
+
+}
+}
+
+#endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk