ome-xml 5.2.3

FrequencyQuantity.h
1 /*
2 * #%L
3 * OME-XML C++ library for working with OME-XML metadata structures.
4 * %%
5 * Copyright © 2006 - 2016 Open Microscopy Environment:
6 * - Massachusetts Institute of Technology
7 * - National Institutes of Health
8 * - University of Dundee
9 * - Board of Regents of the University of Wisconsin-Madison
10 * - Glencoe Software, Inc.
11 * %%
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * The views and conclusions contained in the software and documentation are
34 * those of the authors and should not be interpreted as representing official
35 * policies, either expressed or implied, of any organization.
36 * #L%
37 */
38
39 /*─────────────────────────────────────────────────────────────────────────────
40 *
41 * THIS IS AUTOMATICALLY GENERATED CODE. DO NOT MODIFY.
42 *
43 *─────────────────────────────────────────────────────────────────────────────
44 */
45
46 #ifndef OME_XML_MODEL_PRIMITIVES_FREQUENCYQUANTITY_H
47 #define OME_XML_MODEL_PRIMITIVES_FREQUENCYQUANTITY_H
48
49 #include <ostream>
50 #include <string>
51
52 #include <ome/common/log.h>
53
54 #include <ome/xml/model/primitives/Quantity.h>
55
56 namespace ome
57 {
58 namespace xml
59 {
60 namespace model
61 {
62 namespace primitives
63 {
64
68 class UnitsFrequency
69 {
70 public:
72 enum enum_value
73 {
75 YOTTAHERTZ,
77 ZETTAHERTZ,
79 EXAHERTZ,
81 PETAHERTZ,
83 TERAHERTZ,
85 GIGAHERTZ,
87 MEGAHERTZ,
89 KILOHERTZ,
91 HECTOHERTZ,
93 DECAHERTZ,
95 HERTZ,
97 DECIHERTZ,
99 CENTIHERTZ,
101 MILLIHERTZ,
103 MICROHERTZ,
105 NANOHERTZ,
107 PICOHERTZ,
109 FEMTOHERTZ,
111 ATTOHERTZ,
113 ZEPTOHERTZ,
115 YOCTOHERTZ
116 };
117
123 UnitsFrequency (enum_value value);
124
139 UnitsFrequency (const std::string& name, bool strict = true);
140
146 UnitsFrequency (const UnitsFrequency& original);
147
152 inline UnitsFrequency&
153 operator= (const UnitsFrequency& rhs)
154 {
155 this->value = rhs.value;
156 this->name = rhs.name;
157 return *this;
158 }
159
165 inline
166 operator enum_value () const
167 {
168 return this->value;
169 }
170
176 inline
177 operator const std::string& () const
178 {
179 return *this->name;
180 }
181
183 typedef std::map<std::string, UnitsFrequency::enum_value> string_map_type;
185 typedef std::map<UnitsFrequency::enum_value, std::string> value_map_type;
186
192 static const string_map_type&
193 strings();
194
200 static const value_map_type&
201 values();
202
203 private:
209 static const string_map_type&
210 lowercase_strings();
211
213 enum_value value;
215 const std::string *name;
216 };
217
225 inline bool
226 operator== (const UnitsFrequency& lhs,
227 const UnitsFrequency& rhs)
228 {
229 return static_cast<UnitsFrequency::enum_value>(lhs) == static_cast<UnitsFrequency::enum_value>(rhs);
230 }
231
239 inline bool
240 operator== (const UnitsFrequency& lhs,
241 const UnitsFrequency::enum_value& rhs)
242 {
243 return static_cast<UnitsFrequency::enum_value>(lhs) == rhs;
244 }
245
253 inline bool
254 operator== (const UnitsFrequency::enum_value& lhs,
255 const UnitsFrequency& rhs)
256 {
257 return lhs == static_cast<UnitsFrequency::enum_value>(rhs);
258 }
259
267 inline bool
268 operator== (const UnitsFrequency& lhs,
269 const std::string& rhs)
270 {
271 return static_cast<const std::string&>(lhs) == rhs;
272 }
273
281 inline bool
282 operator== (const std::string& lhs,
283 const UnitsFrequency& rhs)
284 {
285 return lhs == static_cast<const std::string&>(rhs);
286 }
287
295 inline bool
296 operator!= (const UnitsFrequency& lhs,
297 const UnitsFrequency& rhs)
298 {
299 return static_cast<UnitsFrequency::enum_value>(lhs) != static_cast<UnitsFrequency::enum_value>(rhs);
300 }
301
309 inline bool
310 operator!= (const UnitsFrequency& lhs,
311 const UnitsFrequency::enum_value& rhs)
312 {
313 return static_cast<UnitsFrequency::enum_value>(lhs) != rhs;
314 }
315
323 inline bool
324 operator!= (const UnitsFrequency::enum_value& lhs,
325 const UnitsFrequency& rhs)
326 {
327 return lhs != static_cast<UnitsFrequency::enum_value>(rhs);
328 }
329
337 inline bool
338 operator!= (const UnitsFrequency& lhs,
339 const std::string& rhs)
340 {
341 return static_cast<const std::string&>(lhs) != rhs;
342 }
343
351 inline bool
352 operator!= (const std::string& lhs,
353 const UnitsFrequency& rhs)
354 {
355 return lhs != static_cast<const std::string&>(rhs);
356 }
357
365 template<class charT, class traits>
366 inline std::basic_ostream<charT,traits>&
367 operator<< (std::basic_ostream<charT,traits>& os,
368 const UnitsFrequency& enumeration)
369 {
370 return os << static_cast<const std::string&>(enumeration);
371 }
372
380 template<class charT, class traits>
381 inline std::basic_istream<charT,traits>&
382 operator>> (std::basic_istream<charT,traits>& is,
383 UnitsFrequency& enumeration)
384 {
385 std::string value;
386 is >> value;
387 if (is)
388 {
389 try
390 {
391 enumeration = UnitsFrequency(value, false);
392 }
393 catch (const EnumerationException&)
394 {
395 is.setstate(std::ios::failbit);
396 }
397 }
398
399 return is;
400 }
401
402 }
403 }
404 }
405 }
406
407 #endif // OME_XML_MODEL_PRIMITIVES_FREQUENCYQUANTITY_H
408
409 /*
410 * Local Variables:
411 * mode:C++
412 * End:
413 */
ome::xml::model::primitives::UnitsFrequency::MICROHERTZ
microhertz unit.
Definition: FrequencyQuantity.h:103
ome::xml::model::primitives::UnitsFrequency::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
ome::xml::model::primitives::UnitsFrequency::ZEPTOHERTZ
zeptohertz unit.
Definition: FrequencyQuantity.h:113
ome::xml::model::primitives::UnitsFrequency::operator=
UnitsFrequency & operator=(const UnitsFrequency &rhs)
Assignment operator.
Definition: FrequencyQuantity.h:153
ome::xml::model::primitives::UnitsFrequency::value_map_type
std::map< UnitsFrequency::enum_value, std::string > value_map_type
Value map type.
Definition: FrequencyQuantity.h:185
ome::xml::model::primitives::operator!=
bool operator!=(const Color &lhs, const Color &rhs)
Compare two Color objects for non-equality.
Definition: Color.h:393
ome::xml::model::primitives::UnitsFrequency::TERAHERTZ
terahertz unit.
Definition: FrequencyQuantity.h:83
ome::xml::model::primitives::UnitsFrequency::string_map_type
std::map< std::string, UnitsFrequency::enum_value > string_map_type
String map type.
Definition: FrequencyQuantity.h:183
ome::xml::model::primitives::UnitsFrequency::ZETTAHERTZ
zettahertz unit.
Definition: FrequencyQuantity.h:77
ome::xml::model::primitives::UnitsFrequency::FEMTOHERTZ
femtohertz unit.
Definition: FrequencyQuantity.h:109
ome::xml::model::primitives::UnitsFrequency::YOTTAHERTZ
yottahertz unit.
Definition: FrequencyQuantity.h:75
ome::xml::model::primitives::UnitsFrequency::DECIHERTZ
decihertz unit.
Definition: FrequencyQuantity.h:97
ome::xml::model::primitives::UnitsFrequency::CENTIHERTZ
centihertz unit.
Definition: FrequencyQuantity.h:99
ome::xml::model::primitives::UnitsFrequency::YOCTOHERTZ
yoctohertz unit.
Definition: FrequencyQuantity.h:115
ome::xml::model::primitives::UnitsFrequency::values
static const value_map_type & values()
Get a map of valid enum values and string names.
ome::xml::model::primitives::UnitsFrequency::KILOHERTZ
kilohertz unit.
Definition: FrequencyQuantity.h:89
ome::xml::model::primitives::UnitsFrequency::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
ome::xml::model::primitives::UnitsFrequency::UnitsFrequency
UnitsFrequency(enum_value value)
Construct a UnitsFrequency quantity by an enumeration value.
ome::xml::model::primitives::UnitsFrequency
UnitsFrequency enumeration.
Definition: FrequencyQuantity.h:68
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::primitives::UnitsFrequency::enum_value
enum_value
Enumeration values.
Definition: FrequencyQuantity.h:72
ome::xml::model::primitives::operator==
bool operator==(const Color &lhs, const Color &rhs)
Compare two Color objects for equality.
Definition: Color.h:323
ome::xml::model::primitives::UnitsFrequency::MILLIHERTZ
millihertz unit.
Definition: FrequencyQuantity.h:101
ome::xml::model::primitives::UnitsFrequency::PETAHERTZ
petahertz unit.
Definition: FrequencyQuantity.h:81
ome::xml::model::primitives::UnitsFrequency::MEGAHERTZ
megahertz unit.
Definition: FrequencyQuantity.h:87
ome::xml::model::primitives::UnitsFrequency::HECTOHERTZ
hectohertz unit.
Definition: FrequencyQuantity.h:91
ome::xml::model::primitives::UnitsFrequency::PICOHERTZ
picohertz unit.
Definition: FrequencyQuantity.h:107
ome::xml::model::primitives::UnitsFrequency::HERTZ
hertz unit.
Definition: FrequencyQuantity.h:95
ome::xml::model::primitives::operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, Color &color)
Set Color from input stream.
Definition: Color.h:479
ome::xml::model::primitives::UnitsFrequency::GIGAHERTZ
gigahertz unit.
Definition: FrequencyQuantity.h:85
ome::xml::model::primitives::UnitsFrequency::name
const std::string * name
Enumeration name.
Definition: FrequencyQuantity.h:215
ome::xml::model::primitives::UnitsFrequency::EXAHERTZ
exahertz unit.
Definition: FrequencyQuantity.h:79
ome::xml::model::primitives::UnitsFrequency::value
enum_value value
Enumeration value.
Definition: FrequencyQuantity.h:213
ome::xml::model::primitives::UnitsFrequency::ATTOHERTZ
attohertz unit.
Definition: FrequencyQuantity.h:111
ome::xml::model::primitives::UnitsFrequency::NANOHERTZ
nanohertz unit.
Definition: FrequencyQuantity.h:105
log.h
ome::xml::model::primitives::UnitsFrequency::DECAHERTZ
decahertz unit.
Definition: FrequencyQuantity.h:93