39 #ifndef OME_XML_MODEL_ENUMS_UNITSPRESSURECONVERT_H
40 #define OME_XML_MODEL_ENUMS_UNITSPRESSURECONVERT_H
42 #include <boost/preprocessor.hpp>
46 #include <ome/xml/model/enums/UnitsPressure.h>
47 #include <ome/xml/model/primitives/Quantity.h>
50 #pragma push_macro("PASCAL")
65 using namespace ::ome::common::units;
66 using ::ome::xml::model::enums::UnitsPressure;
68 #define OME_XML_MODEL_ENUMS_UNITSPRESSURE_PROPERTY_LIST \
69 ((YOTTAPASCAL)(yottapascal_quantity)) \
70 ((ZETTAPASCAL)(zettapascal_quantity)) \
71 ((EXAPASCAL)(exapascal_quantity)) \
72 ((PETAPASCAL)(petapascal_quantity)) \
73 ((TERAPASCAL)(terapascal_quantity)) \
74 ((GIGAPASCAL)(gigapascal_quantity)) \
75 ((MEGAPASCAL)(megapascal_quantity)) \
76 ((KILOPASCAL)(kilopascal_quantity)) \
77 ((HECTOPASCAL)(hectopascal_quantity)) \
78 ((DECAPASCAL)(decapascal_quantity)) \
79 ((PASCAL)(pascal_quantity)) \
80 ((DECIPASCAL)(decipascal_quantity)) \
81 ((CENTIPASCAL)(centipascal_quantity)) \
82 ((MILLIPASCAL)(millipascal_quantity)) \
83 ((MICROPASCAL)(micropascal_quantity)) \
84 ((NANOPASCAL)(nanopascal_quantity)) \
85 ((PICOPASCAL)(picopascal_quantity)) \
86 ((FEMTOPASCAL)(femtopascal_quantity)) \
87 ((ATTOPASCAL)(attopascal_quantity)) \
88 ((ZEPTOPASCAL)(zeptopascal_quantity)) \
89 ((YOCTOPASCAL)(yoctopascal_quantity)) \
90 ((BAR)(bar_quantity)) \
91 ((MEGABAR)(megabar_quantity)) \
92 ((KILOBAR)(kilobar_quantity)) \
93 ((DECIBAR)(decibar_quantity)) \
94 ((CENTIBAR)(centibar_quantity)) \
95 ((MILLIBAR)(millibar_quantity)) \
96 ((ATMOSPHERE)(atmosphere_quantity)) \
97 ((PSI)(psi_quantity)) \
98 ((TORR)(torr_quantity)) \
99 ((MILLITORR)(millitorr_quantity)) \
100 ((MMHG)(mmHg_quantity))
108 #define OME_XML_MODEL_ENUMS_UNITSPRESSURE_UNIT_CASE(maR, maProperty, maType) \
110 struct PressureProperties<UnitsPressure::BOOST_PP_SEQ_ELEM(0, maType)> \
112 typedef BOOST_PP_SEQ_ELEM(1, maType) quantity_type; \
115 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSPRESSURE_UNIT_CASE, %%, OME_XML_MODEL_ENUMS_UNITSPRESSURE_PROPERTY_LIST)
117 #undef OME_XML_MODEL_ENUMS_UNITSPRESSURE_UNIT_CASE
118 #undef OME_XML_MODEL_ENUMS_UNITSPRESSURE_PROPERTY_LIST
121 template<
typename Q,
int Src,
int Dest>
123 pressure_convert_src_dest(
typename Q::value_type v,
124 typename Q::unit_type dest)
127 return Q(quantity_cast<typename Q::value_type>(d), dest);
134 # pragma GCC diagnostic push
135 # pragma GCC diagnostic ignored "-Wswitch-default"
138 #define OME_XML_MODEL_ENUMS_UNITSPRESSURE_DEST_UNIT_CASE(maR, maProperty, maType) \
139 case UnitsPressure::maType: \
141 maProperty = pressure_convert_src_dest<Q, Src, UnitsPressure::maType>(value, dest); \
145 template<
typename Q,
int Src>
147 pressure_convert_dest(
typename Q::value_type value,
148 typename Q::unit_type dest)
154 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSPRESSURE_DEST_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSPRESSURE_VALUES);
160 #undef OME_XML_MODEL_ENUMS_UNITSPRESSURE_DEST_UNIT_CASE
163 # pragma GCC diagnostic pop
172 # pragma GCC diagnostic push
173 # pragma GCC diagnostic ignored "-Wswitch-default"
176 #define OME_XML_MODEL_ENUMS_UNITSPRESSURE_SRC_UNIT_CASE(maR, maProperty, maType) \
177 case ome::xml::model::enums::UnitsPressure::maType: \
178 maProperty = detail::pressure_convert_dest<Quantity<ome::xml::model::enums::UnitsPressure>, ome::xml::model::enums::UnitsPressure::maType>(quantity.getValue(), unit); \
182 template<
typename Value>
195 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSPRESSURE_SRC_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSPRESSURE_VALUES);
202 #undef OME_XML_MODEL_ENUMS_UNITSPRESSURE_SRC_UNIT_CASE
205 # pragma GCC diagnostic pop
214 #pragma pop_macro("PASCAL")
217 #endif // OME_XML_MODEL_ENUMS_UNITSPRESSURECONVERT_H
UnitsPressure enumeration.
Definition: UnitsPressure.h:79
UnitsElectricPotential enumeration.
Definition: UnitsElectricPotential.h:74
Quantity< Unit, Value > operator()(const Quantity< Unit, Value > &quantity, typename Quantity< Unit, Value >::unit_type unit) const
Convert quantity to another unit.
unit_type getUnit() const
Get the unit for this quantity.
Definition: Quantity.h:131
Convert a quantity to a different unit.
Definition: Quantity.h:267
Map a given UnitsPressure enum to the corresponding language types.
Definition: UnitsPressureConvert.h:106
A quantity of a defined unit.
Definition: Quantity.h:57