39 #ifndef OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIALCONVERT_H 40 #define OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIALCONVERT_H 42 #include <boost/preprocessor.hpp> 44 #include <ome/common/units/electric-potential.h> 46 #include <ome/xml/model/enums/UnitsElectricPotential.h> 47 #include <ome/xml/model/primitives/Quantity.h> 61 using ::ome::xml::model::enums::UnitsElectricPotential;
63 #define OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_PROPERTY_LIST \ 64 ((YOTTAVOLT)(yottavolt_quantity)) \ 65 ((ZETTAVOLT)(zettavolt_quantity)) \ 66 ((EXAVOLT)(exavolt_quantity)) \ 67 ((PETAVOLT)(petavolt_quantity)) \ 68 ((TERAVOLT)(teravolt_quantity)) \ 69 ((GIGAVOLT)(gigavolt_quantity)) \ 70 ((MEGAVOLT)(megavolt_quantity)) \ 71 ((KILOVOLT)(kilovolt_quantity)) \ 72 ((HECTOVOLT)(hectovolt_quantity)) \ 73 ((DECAVOLT)(decavolt_quantity)) \ 74 ((VOLT)(volt_quantity)) \ 75 ((DECIVOLT)(decivolt_quantity)) \ 76 ((CENTIVOLT)(centivolt_quantity)) \ 77 ((MILLIVOLT)(millivolt_quantity)) \ 78 ((MICROVOLT)(microvolt_quantity)) \ 79 ((NANOVOLT)(nanovolt_quantity)) \ 80 ((PICOVOLT)(picovolt_quantity)) \ 81 ((FEMTOVOLT)(femtovolt_quantity)) \ 82 ((ATTOVOLT)(attovolt_quantity)) \ 83 ((ZEPTOVOLT)(zeptovolt_quantity)) \ 84 ((YOCTOVOLT)(yoctovolt_quantity)) 92 #define OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_UNIT_CASE(maR, maProperty, maType) \ 94 struct ElectricPotentialProperties<UnitsElectricPotential::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_UNITSELECTRICPOTENTIAL_UNIT_CASE, %%, OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_PROPERTY_LIST)
101 #undef OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_UNIT_CASE 102 #undef OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_PROPERTY_LIST 105 template<
typename Q,
int Src,
int Dest>
107 electricpotential_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_UNITSELECTRICPOTENTIAL_DEST_UNIT_CASE(maR, maProperty, maType) \ 123 case UnitsElectricPotential::maType: \ 125 maProperty = electricpotential_convert_src_dest<Q, Src, UnitsElectricPotential::maType>(value, dest); \ 129 template<
typename Q,
int Src>
131 electricpotential_convert_dest(
typename Q::value_type value,
132 typename Q::unit_type dest)
138 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_DEST_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_VALUES);
144 #undef OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_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_UNITSELECTRICPOTENTIAL_SRC_UNIT_CASE(maR, maProperty, maType) \ 161 case ome::xml::model::enums::UnitsElectricPotential::maType: \ 162 maProperty = detail::electricpotential_convert_dest<Quantity<ome::xml::model::enums::UnitsElectricPotential>, ome::xml::model::enums::UnitsElectricPotential::maType>(quantity.getValue(), unit); \ 166 template<
typename Value>
179 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_SRC_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_VALUES);
186 #undef OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIAL_SRC_UNIT_CASE 189 # pragma GCC diagnostic pop 197 #endif // OME_XML_MODEL_ENUMS_UNITSELECTRICPOTENTIALCONVERT_H UnitsElectricPotential enumeration.
Definition: UnitsElectricPotential.h:74
Map a given UnitsElectricPotential enum to the corresponding language types.
Definition: UnitsElectricPotentialConvert.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
unit_type getUnit() const
Get the unit for this quantity.
Definition: Quantity.h:131