39 #ifndef OME_XML_MODEL_ENUMS_UNITSPOWERCONVERT_H 40 #define OME_XML_MODEL_ENUMS_UNITSPOWERCONVERT_H 42 #include <boost/preprocessor.hpp> 46 #include <ome/xml/model/enums/UnitsPower.h> 47 #include <ome/xml/model/primitives/Quantity.h> 61 using ::ome::xml::model::enums::UnitsPower;
63 #define OME_XML_MODEL_ENUMS_UNITSPOWER_PROPERTY_LIST \ 64 ((YOTTAWATT)(yottawatt_quantity)) \ 65 ((ZETTAWATT)(zettawatt_quantity)) \ 66 ((EXAWATT)(exawatt_quantity)) \ 67 ((PETAWATT)(petawatt_quantity)) \ 68 ((TERAWATT)(terawatt_quantity)) \ 69 ((GIGAWATT)(gigawatt_quantity)) \ 70 ((MEGAWATT)(megawatt_quantity)) \ 71 ((KILOWATT)(kilowatt_quantity)) \ 72 ((HECTOWATT)(hectowatt_quantity)) \ 73 ((DECAWATT)(decawatt_quantity)) \ 74 ((WATT)(watt_quantity)) \ 75 ((DECIWATT)(deciwatt_quantity)) \ 76 ((CENTIWATT)(centiwatt_quantity)) \ 77 ((MILLIWATT)(milliwatt_quantity)) \ 78 ((MICROWATT)(microwatt_quantity)) \ 79 ((NANOWATT)(nanowatt_quantity)) \ 80 ((PICOWATT)(picowatt_quantity)) \ 81 ((FEMTOWATT)(femtowatt_quantity)) \ 82 ((ATTOWATT)(attowatt_quantity)) \ 83 ((ZEPTOWATT)(zeptowatt_quantity)) \ 84 ((YOCTOWATT)(yoctowatt_quantity)) 92 #define OME_XML_MODEL_ENUMS_UNITSPOWER_UNIT_CASE(maR, maProperty, maType) \ 94 struct PowerProperties<UnitsPower::BOOST_PP_SEQ_ELEM(0, maType)> \ 96 typedef BOOST_PP_SEQ_ELEM(1, maType) quantity_type; \ 99 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSPOWER_UNIT_CASE, %%, OME_XML_MODEL_ENUMS_UNITSPOWER_PROPERTY_LIST)
101 #undef OME_XML_MODEL_ENUMS_UNITSPOWER_UNIT_CASE 102 #undef OME_XML_MODEL_ENUMS_UNITSPOWER_PROPERTY_LIST 105 template<
typename Q,
int Src,
int Dest>
107 power_convert_src_dest(
typename Q::value_type v,
108 typename Q::unit_type dest)
111 return Q(quantity_cast<typename Q::value_type>(d), dest);
118 # pragma GCC diagnostic push 119 # pragma GCC diagnostic ignored "-Wswitch-default" 122 #define OME_XML_MODEL_ENUMS_UNITSPOWER_DEST_UNIT_CASE(maR, maProperty, maType) \ 123 case UnitsPower::maType: \ 125 maProperty = power_convert_src_dest<Q, Src, UnitsPower::maType>(value, dest); \ 129 template<
typename Q,
int Src>
131 power_convert_dest(
typename Q::value_type value,
132 typename Q::unit_type dest)
138 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSPOWER_DEST_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSPOWER_VALUES);
144 #undef OME_XML_MODEL_ENUMS_UNITSPOWER_DEST_UNIT_CASE 147 # pragma GCC diagnostic pop 156 # pragma GCC diagnostic push 157 # pragma GCC diagnostic ignored "-Wswitch-default" 160 #define OME_XML_MODEL_ENUMS_UNITSPOWER_SRC_UNIT_CASE(maR, maProperty, maType) \ 161 case ome::xml::model::enums::UnitsPower::maType: \ 162 maProperty = detail::power_convert_dest<Quantity<ome::xml::model::enums::UnitsPower>, ome::xml::model::enums::UnitsPower::maType>(quantity.getValue(), unit); \ 166 template<
typename Value>
179 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSPOWER_SRC_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSPOWER_VALUES);
186 #undef OME_XML_MODEL_ENUMS_UNITSPOWER_SRC_UNIT_CASE 189 # pragma GCC diagnostic pop 197 #endif // OME_XML_MODEL_ENUMS_UNITSPOWERCONVERT_H
UnitsElectricPotential enumeration.
Definition: UnitsElectricPotential.h:74
Map a given UnitsPower enum to the corresponding language types.
Definition: UnitsPowerConvert.h:90
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
UnitsPower enumeration.
Definition: UnitsPower.h:74
unit_type getUnit() const
Get the unit for this quantity.
Definition: Quantity.h:131