1 | // Boost.Units - A C++ library for zero-overhead dimensional analysis and |
2 | // unit/quantity manipulation and conversion |
3 | // |
4 | // Copyright (C) 2003-2008 Matthias Christian Schabel |
5 | // Copyright (C) 2008 Steven Watanabe |
6 | // |
7 | // Distributed under the Boost Software License, Version 1.0. (See |
8 | // accompanying file LICENSE_1_0.txt or copy at |
9 | // http://www.boost.org/LICENSE_1_0.txt) |
10 | |
11 | #ifndef BOOST_UNITS_GET_DIMENSION_HPP |
12 | #define BOOST_UNITS_GET_DIMENSION_HPP |
13 | |
14 | /// |
15 | /// \file |
16 | /// \brief Get the dimension of a unit, absolute unit and quantity. |
17 | /// \details |
18 | /// |
19 | |
20 | #include <boost/units/units_fwd.hpp> |
21 | |
22 | namespace boost { |
23 | |
24 | namespace units { |
25 | |
26 | template<class T> |
27 | struct get_dimension {}; |
28 | |
29 | /// Get the dimension of a unit. |
30 | template<class Dim,class System> |
31 | struct get_dimension< unit<Dim,System> > |
32 | { |
33 | typedef Dim type; |
34 | }; |
35 | |
36 | /// Get the dimension of an absolute unit. |
37 | template<class Unit> |
38 | struct get_dimension< absolute<Unit> > |
39 | { |
40 | typedef typename get_dimension<Unit>::type type; |
41 | }; |
42 | |
43 | /// Get the dimension of a quantity. |
44 | template<class Unit,class Y> |
45 | struct get_dimension< quantity<Unit,Y> > |
46 | { |
47 | typedef typename get_dimension<Unit>::type type; |
48 | }; |
49 | |
50 | } // namespace units |
51 | |
52 | } // namespace boost |
53 | |
54 | #endif // BOOST_UNITS_GET_DIMENSION_HPP |
55 | |