ome-common  5.5.0
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  */
quantity< millisecond_unit > millisecond_quantity
Measured quantity in milliseconds.
Definition: time.h:224
quantity< hour_unit > hour_quantity
Measured quantity in hours.
Definition: time.h:270
BOOST_UNITS_STATIC_CONSTANT(radian, radian_unit)
Numeric constant for radian.
make_scaled_unit< si::time, scale< 10, static_rational< 3 > > >::type kilosecond_unit
Unit definition for kilosecond time.
Definition: time.h:103
make_scaled_unit< si::time, scale< 10, static_rational<-24 > > >::type yoctosecond_unit
Unit definition for yoctosecond time.
Definition: time.h:75
make_scaled_unit< si::time, scale< 10, static_rational< 6 > > >::type megasecond_unit
Unit definition for megasecond time.
Definition: time.h:105
make_scaled_unit< si::time, scale< 10, static_rational< 2 > > >::type hectosecond_unit
Unit definition for hectosecond time.
Definition: time.h:101
boost::units::metric::minute_base_unit::unit_type minute_unit
Unit definition for minute time.
Definition: time.h:255
make_scaled_unit< si::time, scale< 10, static_rational< -3 > > >::type millisecond_unit
Unit definition for millisecond time.
Definition: time.h:89
quantity< petasecond_unit > petasecond_quantity
Measured quantity in petaseconds.
Definition: time.h:246
quantity< decisecond_unit > decisecond_quantity
Measured quantity in deciseconds.
Definition: time.h:228
boost::units::metric::hour_base_unit::unit_type hour_unit
Unit definition for hour time.
Definition: time.h:264
make_scaled_unit< si::time, scale< 10, static_rational< -9 > > >::type nanosecond_unit
Unit definition for nanosecond time.
Definition: time.h:85
make_scaled_unit< si::time, scale< 10, static_rational< 15 > > >::type petasecond_unit
Unit definition for petasecond time.
Definition: time.h:111
make_scaled_unit< si::time, scale< 10, static_rational< 24 > > >::type yottasecond_unit
Unit definition for yottasecond time.
Definition: time.h:117
quantity< megasecond_unit > megasecond_quantity
Measured quantity in megaseconds.
Definition: time.h:240
quantity< day_unit > day_quantity
Measured quantity in days.
Definition: time.h:279
quantity< minute_unit > minute_quantity
Measured quantity in minutes.
Definition: time.h:261
quantity< yottasecond_unit > yottasecond_quantity
Measured quantity in yottaseconds.
Definition: time.h:252
quantity< hectosecond_unit > hectosecond_quantity
Measured quantity in hectoseconds.
Definition: time.h:236
make_scaled_unit< si::time, scale< 10, static_rational< 0 > > >::type second_unit
Unit definition for second time.
Definition: time.h:95
quantity< dekasecond_unit > dekasecond_quantity
Measured quantity in dekaseconds.
Definition: time.h:232
boost::units::metric::day_base_unit::unit_type day_unit
Unit definition for day time.
Definition: time.h:273
si::time time_unit
Unit definition for time.
Definition: time.h:70
quantity< nanosecond_unit > nanosecond_quantity
Measured quantity in nanoseconds.
Definition: time.h:220
quantity< decasecond_unit > decasecond_quantity
Measured quantity in decaseconds.
Definition: time.h:234
make_scaled_unit< si::time, scale< 10, static_rational< 18 > > >::type exasecond_unit
Unit definition for exasecond time.
Definition: time.h:113
Open Microscopy Environment C++.
Definition: base64.h:48
quantity< attosecond_unit > attosecond_quantity
Measured quantity in attoseconds.
Definition: time.h:214
quantity< femtosecond_unit > femtosecond_quantity
Measured quantity in femtoseconds.
Definition: time.h:216
quantity< zettasecond_unit > zettasecond_quantity
Measured quantity in zettaseconds.
Definition: time.h:250
make_scaled_unit< si::time, scale< 10, static_rational<-21 > > >::type zeptosecond_unit
Unit definition for zeptosecond time.
Definition: time.h:77
make_scaled_unit< si::time, scale< 10, static_rational< 9 > > >::type gigasecond_unit
Unit definition for gigasecond time.
Definition: time.h:107
quantity< yoctosecond_unit > yoctosecond_quantity
Measured quantity in yoctoseconds.
Definition: time.h:210
make_scaled_unit< si::time, scale< 10, static_rational< 12 > > >::type terasecond_unit
Unit definition for terasecond time.
Definition: time.h:109
quantity< terasecond_unit > terasecond_quantity
Measured quantity in teraseconds.
Definition: time.h:244
quantity< kilosecond_unit > kilosecond_quantity
Measured quantity in kiloseconds.
Definition: time.h:238
quantity< si::time > time_quantity
Measured quantity (time, seconds).
Definition: time.h:72
make_scaled_unit< si::time, scale< 10, static_rational< 21 > > >::type zettasecond_unit
Unit definition for zettasecond time.
Definition: time.h:115
make_scaled_unit< si::time, scale< 10, static_rational< -1 > > >::type decisecond_unit
Unit definition for decisecond time.
Definition: time.h:93
make_scaled_unit< si::time, scale< 10, static_rational<-15 > > >::type femtosecond_unit
Unit definition for femtosecond time.
Definition: time.h:81
make_scaled_unit< si::time, scale< 10, static_rational<-18 > > >::type attosecond_unit
Unit definition for attosecond time.
Definition: time.h:79
make_scaled_unit< si::time, scale< 10, static_rational< -6 > > >::type microsecond_unit
Unit definition for microsecond time.
Definition: time.h:87
quantity< second_unit > second_quantity
Measured quantity in seconds.
Definition: time.h:230
make_scaled_unit< si::time, scale< 10, static_rational< 1 > > >::type decasecond_unit
Unit definition for decasecond time.
Definition: time.h:99
make_scaled_unit< si::time, scale< 10, static_rational< -2 > > >::type centisecond_unit
Unit definition for centisecond time.
Definition: time.h:91
make_scaled_unit< si::time, scale< 10, static_rational<-12 > > >::type picosecond_unit
Unit definition for picosecond time.
Definition: time.h:83
quantity< centisecond_unit > centisecond_quantity
Measured quantity in centiseconds.
Definition: time.h:226
quantity< picosecond_unit > picosecond_quantity
Measured quantity in picoseconds.
Definition: time.h:218
quantity< microsecond_unit > microsecond_quantity
Measured quantity in microseconds.
Definition: time.h:222
quantity< exasecond_unit > exasecond_quantity
Measured quantity in exaseconds.
Definition: time.h:248
make_scaled_unit< si::time, scale< 10, static_rational< 1 > > >::type dekasecond_unit
Unit definition for dekasecond time.
Definition: time.h:97
quantity< gigasecond_unit > gigasecond_quantity
Measured quantity in gigaseconds.
Definition: time.h:242
quantity< zeptosecond_unit > zeptosecond_quantity
Measured quantity in zeptoseconds.
Definition: time.h:212