ome-common 5.2.0-m2

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

time.h
Go to the documentation of this file.
1 /*
2 * #%L
3 * OME-COMMON C++ library for C++ compatibility/portability
4 * %%
5 * Copyright © 2015 Open Microscopy Environment:
6 * - Massachusetts Institute of Technology
7 * - National Institutes of Health
8 * - University of Dundee
9 * - Board of Regents of the University of Wisconsin-Madison
10 * - Glencoe Software, Inc.
11 * %%
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * The views and conclusions contained in the software and documentation are
34 * those of the authors and should not be interpreted as representing official
35 * policies, either expressed or implied, of any organization.
36 * #L%
37 */
38
47 #ifndef OME_COMMON_UNITS_TIME_H
48 #define OME_COMMON_UNITS_TIME_H
49
50 #include <ome/common/config.h>
51 #include <ome/common/units/types.h>
52
53 #include <boost/units/unit.hpp>
54 #include <boost/units/base_units/metric/minute.hpp>
55 #include <boost/units/base_units/metric/hour.hpp>
56 #include <boost/units/base_units/metric/day.hpp>
57 #include <boost/units/quantity.hpp>
58 #include <boost/units/systems/si.hpp>
59
60 namespace ome
61 {
62 namespace common
63 {
64 namespace units
65 {
66
67 // Time types, constants and quantities.
68
70 typedef si::time time_unit;
72 typedef quantity<si::time> time_quantity;
73
75 typedef make_scaled_unit<si::time,scale<10,static_rational<-24> > >::type yoctosecond_unit;
77 typedef make_scaled_unit<si::time,scale<10,static_rational<-21> > >::type zeptosecond_unit;
79 typedef make_scaled_unit<si::time,scale<10,static_rational<-18> > >::type attosecond_unit;
81 typedef make_scaled_unit<si::time,scale<10,static_rational<-15> > >::type femtosecond_unit;
83 typedef make_scaled_unit<si::time,scale<10,static_rational<-12> > >::type picosecond_unit;
85 typedef make_scaled_unit<si::time,scale<10,static_rational< -9> > >::type nanosecond_unit;
87 typedef make_scaled_unit<si::time,scale<10,static_rational< -6> > >::type microsecond_unit;
89 typedef make_scaled_unit<si::time,scale<10,static_rational< -3> > >::type millisecond_unit;
91 typedef make_scaled_unit<si::time,scale<10,static_rational< -2> > >::type centisecond_unit;
93 typedef make_scaled_unit<si::time,scale<10,static_rational< -1> > >::type decisecond_unit;
95 typedef make_scaled_unit<si::time,scale<10,static_rational< 0> > >::type second_unit;
97 typedef make_scaled_unit<si::time,scale<10,static_rational< 1> > >::type dekasecond_unit;
99 typedef make_scaled_unit<si::time,scale<10,static_rational< 1> > >::type decasecond_unit;
101 typedef make_scaled_unit<si::time,scale<10,static_rational< 2> > >::type hectosecond_unit;
103 typedef make_scaled_unit<si::time,scale<10,static_rational< 3> > >::type kilosecond_unit;
105 typedef make_scaled_unit<si::time,scale<10,static_rational< 6> > >::type megasecond_unit;
107 typedef make_scaled_unit<si::time,scale<10,static_rational< 9> > >::type gigasecond_unit;
109 typedef make_scaled_unit<si::time,scale<10,static_rational< 12> > >::type terasecond_unit;
111 typedef make_scaled_unit<si::time,scale<10,static_rational< 15> > >::type petasecond_unit;
113 typedef make_scaled_unit<si::time,scale<10,static_rational< 18> > >::type exasecond_unit;
115 typedef make_scaled_unit<si::time,scale<10,static_rational< 21> > >::type zettasecond_unit;
117 typedef make_scaled_unit<si::time,scale<10,static_rational< 24> > >::type yottasecond_unit;
118
120 BOOST_UNITS_STATIC_CONSTANT(yoctosecond, yoctosecond_unit);
122 BOOST_UNITS_STATIC_CONSTANT(zeptosecond, zeptosecond_unit);
124 BOOST_UNITS_STATIC_CONSTANT(attosecond, attosecond_unit);
126 BOOST_UNITS_STATIC_CONSTANT(femtosecond, femtosecond_unit);
128 BOOST_UNITS_STATIC_CONSTANT(picosecond, picosecond_unit);
130 BOOST_UNITS_STATIC_CONSTANT(nanosecond, nanosecond_unit);
132 BOOST_UNITS_STATIC_CONSTANT(microsecond, microsecond_unit);
134 BOOST_UNITS_STATIC_CONSTANT(millisecond, millisecond_unit);
136 BOOST_UNITS_STATIC_CONSTANT(centisecond, centisecond_unit);
138 BOOST_UNITS_STATIC_CONSTANT(decisecond, decisecond_unit);
140 BOOST_UNITS_STATIC_CONSTANT(second, second_unit);
142 BOOST_UNITS_STATIC_CONSTANT(dekasecond, dekasecond_unit);
144 BOOST_UNITS_STATIC_CONSTANT(decasecond, decasecond_unit);
146 BOOST_UNITS_STATIC_CONSTANT(hectosecond, hectosecond_unit);
148 BOOST_UNITS_STATIC_CONSTANT(kilosecond, kilosecond_unit);
150 BOOST_UNITS_STATIC_CONSTANT(megasecond, megasecond_unit);
152 BOOST_UNITS_STATIC_CONSTANT(gigasecond, gigasecond_unit);
154 BOOST_UNITS_STATIC_CONSTANT(terasecond, terasecond_unit);
156 BOOST_UNITS_STATIC_CONSTANT(petasecond, petasecond_unit);
158 BOOST_UNITS_STATIC_CONSTANT(exasecond, exasecond_unit);
160 BOOST_UNITS_STATIC_CONSTANT(zettasecond, zettasecond_unit);
162 BOOST_UNITS_STATIC_CONSTANT(yottasecond, yottasecond_unit);
163
165 BOOST_UNITS_STATIC_CONSTANT(yoctoseconds, yoctosecond_unit);
167 BOOST_UNITS_STATIC_CONSTANT(zeptoseconds, zeptosecond_unit);
169 BOOST_UNITS_STATIC_CONSTANT(attoseconds, attosecond_unit);
171 BOOST_UNITS_STATIC_CONSTANT(femtoseconds, femtosecond_unit);
173 BOOST_UNITS_STATIC_CONSTANT(picoseconds, picosecond_unit);
175 BOOST_UNITS_STATIC_CONSTANT(nanoseconds, nanosecond_unit);
177 BOOST_UNITS_STATIC_CONSTANT(microseconds, microsecond_unit);
179 BOOST_UNITS_STATIC_CONSTANT(milliseconds, millisecond_unit);
181 BOOST_UNITS_STATIC_CONSTANT(centiseconds, centisecond_unit);
183 BOOST_UNITS_STATIC_CONSTANT(deciseconds, decisecond_unit);
185 BOOST_UNITS_STATIC_CONSTANT(seconds, second_unit);
187 BOOST_UNITS_STATIC_CONSTANT(dekaseconds, dekasecond_unit);
189 BOOST_UNITS_STATIC_CONSTANT(decaseconds, decasecond_unit);
191 BOOST_UNITS_STATIC_CONSTANT(hectoseconds, hectosecond_unit);
193 BOOST_UNITS_STATIC_CONSTANT(kiloseconds, kilosecond_unit);
195 BOOST_UNITS_STATIC_CONSTANT(megaseconds, megasecond_unit);
197 BOOST_UNITS_STATIC_CONSTANT(gigaseconds, gigasecond_unit);
199 BOOST_UNITS_STATIC_CONSTANT(teraseconds, terasecond_unit);
201 BOOST_UNITS_STATIC_CONSTANT(petaseconds, petasecond_unit);
203 BOOST_UNITS_STATIC_CONSTANT(exaseconds, exasecond_unit);
205 BOOST_UNITS_STATIC_CONSTANT(zettaseconds, zettasecond_unit);
207 BOOST_UNITS_STATIC_CONSTANT(yottaseconds, yottasecond_unit);
208
210 typedef quantity<yoctosecond_unit> yoctosecond_quantity;
212 typedef quantity<zeptosecond_unit> zeptosecond_quantity;
214 typedef quantity<attosecond_unit> attosecond_quantity;
216 typedef quantity<femtosecond_unit> femtosecond_quantity;
218 typedef quantity<picosecond_unit> picosecond_quantity;
220 typedef quantity<nanosecond_unit> nanosecond_quantity;
222 typedef quantity<microsecond_unit> microsecond_quantity;
224 typedef quantity<millisecond_unit> millisecond_quantity;
226 typedef quantity<centisecond_unit> centisecond_quantity;
228 typedef quantity<decisecond_unit> decisecond_quantity;
230 typedef quantity<second_unit> second_quantity;
232 typedef quantity<dekasecond_unit> dekasecond_quantity;
234 typedef quantity<decasecond_unit> decasecond_quantity;
236 typedef quantity<hectosecond_unit> hectosecond_quantity;
238 typedef quantity<kilosecond_unit> kilosecond_quantity;
240 typedef quantity<megasecond_unit> megasecond_quantity;
242 typedef quantity<gigasecond_unit> gigasecond_quantity;
244 typedef quantity<terasecond_unit> terasecond_quantity;
246 typedef quantity<petasecond_unit> petasecond_quantity;
248 typedef quantity<exasecond_unit> exasecond_quantity;
250 typedef quantity<zettasecond_unit> zettasecond_quantity;
252 typedef quantity<yottasecond_unit> yottasecond_quantity;
253
255 typedef boost::units::metric::minute_base_unit::unit_type minute_unit;
257 BOOST_UNITS_STATIC_CONSTANT(minute, minute_unit);
259 BOOST_UNITS_STATIC_CONSTANT(minutes, minute_unit);
261 typedef quantity<minute_unit> minute_quantity;
262
264 typedef boost::units::metric::hour_base_unit::unit_type hour_unit;
266 BOOST_UNITS_STATIC_CONSTANT(hour, hour_unit);
268 BOOST_UNITS_STATIC_CONSTANT(hours, hour_unit);
270 typedef quantity<hour_unit> hour_quantity;
271
273 typedef boost::units::metric::day_base_unit::unit_type day_unit;
275 BOOST_UNITS_STATIC_CONSTANT(day, day_unit);
277 BOOST_UNITS_STATIC_CONSTANT(days, day_unit);
279 typedef quantity<day_unit> day_quantity;
280 }
281 }
282 }
283
284 #endif // OME_COMMON_UNITS_TIME_H
285
286 /*
287 * Local Variables:
288 * mode:C++
289 * End:
290 */
ome
Definition: boolean.h:48