39 #ifndef OME_XML_MODEL_ENUMS_UNITSTIMECONVERT_H 40 #define OME_XML_MODEL_ENUMS_UNITSTIMECONVERT_H 42 #include <boost/preprocessor.hpp> 46 #include <ome/xml/model/enums/UnitsTime.h> 47 #include <ome/xml/model/primitives/Quantity.h> 61 using ::ome::xml::model::enums::UnitsTime;
63 #define OME_XML_MODEL_ENUMS_UNITSTIME_PROPERTY_LIST \ 64 ((YOTTASECOND)(yottasecond_quantity)) \ 65 ((ZETTASECOND)(zettasecond_quantity)) \ 66 ((EXASECOND)(exasecond_quantity)) \ 67 ((PETASECOND)(petasecond_quantity)) \ 68 ((TERASECOND)(terasecond_quantity)) \ 69 ((GIGASECOND)(gigasecond_quantity)) \ 70 ((MEGASECOND)(megasecond_quantity)) \ 71 ((KILOSECOND)(kilosecond_quantity)) \ 72 ((HECTOSECOND)(hectosecond_quantity)) \ 73 ((DECASECOND)(decasecond_quantity)) \ 74 ((SECOND)(second_quantity)) \ 75 ((DECISECOND)(decisecond_quantity)) \ 76 ((CENTISECOND)(centisecond_quantity)) \ 77 ((MILLISECOND)(millisecond_quantity)) \ 78 ((MICROSECOND)(microsecond_quantity)) \ 79 ((NANOSECOND)(nanosecond_quantity)) \ 80 ((PICOSECOND)(picosecond_quantity)) \ 81 ((FEMTOSECOND)(femtosecond_quantity)) \ 82 ((ATTOSECOND)(attosecond_quantity)) \ 83 ((ZEPTOSECOND)(zeptosecond_quantity)) \ 84 ((YOCTOSECOND)(yoctosecond_quantity)) \ 85 ((MINUTE)(minute_quantity)) \ 86 ((HOUR)(hour_quantity)) \ 95 #define OME_XML_MODEL_ENUMS_UNITSTIME_UNIT_CASE(maR, maProperty, maType) \ 97 struct TimeProperties<UnitsTime::BOOST_PP_SEQ_ELEM(0, maType)> \ 99 typedef BOOST_PP_SEQ_ELEM(1, maType) quantity_type; \ 102 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSTIME_UNIT_CASE, %%, OME_XML_MODEL_ENUMS_UNITSTIME_PROPERTY_LIST)
104 #undef OME_XML_MODEL_ENUMS_UNITSTIME_UNIT_CASE 105 #undef OME_XML_MODEL_ENUMS_UNITSTIME_PROPERTY_LIST 108 template<
typename Q,
int Src,
int Dest>
110 time_convert_src_dest(
typename Q::value_type v,
111 typename Q::unit_type dest)
114 return Q(quantity_cast<typename Q::value_type>(d), dest);
121 # pragma GCC diagnostic push 122 # pragma GCC diagnostic ignored "-Wswitch-default" 125 #define OME_XML_MODEL_ENUMS_UNITSTIME_DEST_UNIT_CASE(maR, maProperty, maType) \ 126 case UnitsTime::maType: \ 128 maProperty = time_convert_src_dest<Q, Src, UnitsTime::maType>(value, dest); \ 132 template<
typename Q,
int Src>
134 time_convert_dest(
typename Q::value_type value,
135 typename Q::unit_type dest)
141 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSTIME_DEST_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSTIME_VALUES);
147 #undef OME_XML_MODEL_ENUMS_UNITSTIME_DEST_UNIT_CASE 150 # pragma GCC diagnostic pop 159 # pragma GCC diagnostic push 160 # pragma GCC diagnostic ignored "-Wswitch-default" 163 #define OME_XML_MODEL_ENUMS_UNITSTIME_SRC_UNIT_CASE(maR, maProperty, maType) \ 164 case ome::xml::model::enums::UnitsTime::maType: \ 165 maProperty = detail::time_convert_dest<Quantity<ome::xml::model::enums::UnitsTime>, ome::xml::model::enums::UnitsTime::maType>(quantity.getValue(), unit); \ 169 template<
typename Value>
182 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSTIME_SRC_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSTIME_VALUES);
189 #undef OME_XML_MODEL_ENUMS_UNITSTIME_SRC_UNIT_CASE 192 # pragma GCC diagnostic pop 200 #endif // OME_XML_MODEL_ENUMS_UNITSTIMECONVERT_H Map a given UnitsTime enum to the corresponding language types.
Definition: UnitsTimeConvert.h:93
UnitsElectricPotential enumeration.
Definition: UnitsElectricPotential.h:74
Open Microscopy Environment C++ implementation.
Convert a quantity to a different unit.
Definition: Quantity.h:267
UnitsTime enumeration.
Definition: UnitsTime.h:74
A quantity of a defined unit.
Definition: Quantity.h:57
unit_type getUnit() const
Get the unit for this quantity.
Definition: Quantity.h:131