39 #ifndef OME_XML_MODEL_ENUMS_UNITSFREQUENCYCONVERT_H 40 #define OME_XML_MODEL_ENUMS_UNITSFREQUENCYCONVERT_H 42 #include <boost/preprocessor.hpp> 46 #include <ome/xml/model/enums/UnitsFrequency.h> 47 #include <ome/xml/model/primitives/Quantity.h> 61 using ::ome::xml::model::enums::UnitsFrequency;
63 #define OME_XML_MODEL_ENUMS_UNITSFREQUENCY_PROPERTY_LIST \ 64 ((YOTTAHERTZ)(yottahertz_quantity)) \ 65 ((ZETTAHERTZ)(zettahertz_quantity)) \ 66 ((EXAHERTZ)(exahertz_quantity)) \ 67 ((PETAHERTZ)(petahertz_quantity)) \ 68 ((TERAHERTZ)(terahertz_quantity)) \ 69 ((GIGAHERTZ)(gigahertz_quantity)) \ 70 ((MEGAHERTZ)(megahertz_quantity)) \ 71 ((KILOHERTZ)(kilohertz_quantity)) \ 72 ((HECTOHERTZ)(hectohertz_quantity)) \ 73 ((DECAHERTZ)(decahertz_quantity)) \ 74 ((HERTZ)(hertz_quantity)) \ 75 ((DECIHERTZ)(decihertz_quantity)) \ 76 ((CENTIHERTZ)(centihertz_quantity)) \ 77 ((MILLIHERTZ)(millihertz_quantity)) \ 78 ((MICROHERTZ)(microhertz_quantity)) \ 79 ((NANOHERTZ)(nanohertz_quantity)) \ 80 ((PICOHERTZ)(picohertz_quantity)) \ 81 ((FEMTOHERTZ)(femtohertz_quantity)) \ 82 ((ATTOHERTZ)(attohertz_quantity)) \ 83 ((ZEPTOHERTZ)(zeptohertz_quantity)) \ 84 ((YOCTOHERTZ)(yoctohertz_quantity)) 92 #define OME_XML_MODEL_ENUMS_UNITSFREQUENCY_UNIT_CASE(maR, maProperty, maType) \ 94 struct FrequencyProperties<UnitsFrequency::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_UNITSFREQUENCY_UNIT_CASE, %%, OME_XML_MODEL_ENUMS_UNITSFREQUENCY_PROPERTY_LIST)
101 #undef OME_XML_MODEL_ENUMS_UNITSFREQUENCY_UNIT_CASE 102 #undef OME_XML_MODEL_ENUMS_UNITSFREQUENCY_PROPERTY_LIST 105 template<
typename Q,
int Src,
int Dest>
107 frequency_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_UNITSFREQUENCY_DEST_UNIT_CASE(maR, maProperty, maType) \ 123 case UnitsFrequency::maType: \ 125 maProperty = frequency_convert_src_dest<Q, Src, UnitsFrequency::maType>(value, dest); \ 129 template<
typename Q,
int Src>
131 frequency_convert_dest(
typename Q::value_type value,
132 typename Q::unit_type dest)
138 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSFREQUENCY_DEST_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSFREQUENCY_VALUES);
144 #undef OME_XML_MODEL_ENUMS_UNITSFREQUENCY_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_UNITSFREQUENCY_SRC_UNIT_CASE(maR, maProperty, maType) \ 161 case ome::xml::model::enums::UnitsFrequency::maType: \ 162 maProperty = detail::frequency_convert_dest<Quantity<ome::xml::model::enums::UnitsFrequency>, ome::xml::model::enums::UnitsFrequency::maType>(quantity.getValue(), unit); \ 166 template<
typename Value>
179 BOOST_PP_SEQ_FOR_EACH(OME_XML_MODEL_ENUMS_UNITSFREQUENCY_SRC_UNIT_CASE, q, OME_XML_MODEL_ENUMS_UNITSFREQUENCY_VALUES);
186 #undef OME_XML_MODEL_ENUMS_UNITSFREQUENCY_SRC_UNIT_CASE 189 # pragma GCC diagnostic pop 197 #endif // OME_XML_MODEL_ENUMS_UNITSFREQUENCYCONVERT_H
UnitsElectricPotential enumeration.
Definition: UnitsElectricPotential.h:74
Open Microscopy Environment C++ implementation.
Convert a quantity to a different unit.
Definition: Quantity.h:267
Map a given UnitsFrequency enum to the corresponding language types.
Definition: UnitsFrequencyConvert.h:90
A quantity of a defined unit.
Definition: Quantity.h:57
UnitsFrequency enumeration.
Definition: UnitsFrequency.h:74
unit_type getUnit() const
Get the unit for this quantity.
Definition: Quantity.h:131