39 #ifndef OME_XML_MODEL_ENUMS_UNITSTEMPERATURECONVERT_H 40 #define OME_XML_MODEL_ENUMS_UNITSTEMPERATURECONVERT_H 42 #include <boost/preprocessor.hpp> 46 #include <ome/xml/model/enums/UnitsTemperature.h> 47 #include <ome/xml/model/primitives/Quantity.h> 61 using ::ome::xml::model::enums::UnitsTemperature;
63 #define OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_PROPERTY_LIST \ 64 ((CELSIUS)(celsius_absolute_quantity)) \ 65 ((FAHRENHEIT)(fahrenheit_absolute_quantity)) \ 66 ((KELVIN)(kelvin_absolute_quantity)) \ 67 ((RANKINE)(rankine_absolute_quantity)) 75 #define OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_UNIT_CASE(maR, maProperty, maType) \ 77 struct TemperatureProperties<UnitsTemperature::BOOST_PP_SEQ_ELEM(0, maType)> \ 79 typedef BOOST_PP_SEQ_ELEM(1, maType) quantity_type; \ 82 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_UNIT_CASE, %%, OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_PROPERTY_LIST)
84 #undef OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_UNIT_CASE 85 #undef OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_PROPERTY_LIST 88 template<
typename Q,
int Src,
int Dest>
90 temperature_convert_src_dest(
typename Q::value_type v,
91 typename Q::unit_type dest)
94 return Q(quantity_cast<typename Q::value_type>(d), dest);
101 # pragma GCC diagnostic push 102 # pragma GCC diagnostic ignored "-Wswitch-default" 105 #define OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_DEST_UNIT_CASE(maR, maProperty, maType) \ 106 case UnitsTemperature::maType: \ 108 maProperty = temperature_convert_src_dest<Q, Src, UnitsTemperature::maType>(value, dest); \ 112 template<
typename Q,
int Src>
114 temperature_convert_dest(
typename Q::value_type value,
115 typename Q::unit_type dest)
121 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_DEST_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_VALUES);
127 #undef OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_DEST_UNIT_CASE 130 # pragma GCC diagnostic pop 139 # pragma GCC diagnostic push 140 # pragma GCC diagnostic ignored "-Wswitch-default" 143 #define OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_SRC_UNIT_CASE(maR, maProperty, maType) \ 144 case ome::xml::model::enums::UnitsTemperature::maType: \ 145 maProperty = detail::temperature_convert_dest<Quantity<ome::xml::model::enums::UnitsTemperature>, \ 146 ome::xml::model::enums::UnitsTemperature::maType>(quantity.getValue(), unit); \ 150 template<
typename Value>
163 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_SRC_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_VALUES);
170 #undef OME_XML_MODEL_ENUMS_UNITSTEMPERATURE_SRC_UNIT_CASE 173 # pragma GCC diagnostic pop 181 #endif // OME_XML_MODEL_ENUMS_UNITSTEMPERATURECONVERT_H Map a given UnitsTemperature enum to the corresponding language types.
Definition: UnitsTemperatureConvert.h:73
UnitsElectricPotential enumeration.
Definition: UnitsElectricPotential.h:74
UnitsTemperature enumeration.
Definition: UnitsTemperature.h:74
Open Microscopy Environment C++ implementation.
Convert a quantity to a different unit.
Definition: Quantity.h:267
A quantity of a defined unit.
Definition: Quantity.h:57
unit_type getUnit() const
Get the unit for this quantity.
Definition: Quantity.h:131