ome-xml 5.2.3

PowerQuantity.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_POWERQUANTITY_H
47 #define OME_XML_MODEL_PRIMITIVES_POWERQUANTITY_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 UnitsPower
69 {
70 public:
72 enum enum_value
73 {
75 YOTTAWATT,
77 ZETTAWATT,
79 EXAWATT,
81 PETAWATT,
83 TERAWATT,
85 GIGAWATT,
87 MEGAWATT,
89 KILOWATT,
91 HECTOWATT,
93 DECAWATT,
95 WATT,
97 DECIWATT,
99 CENTIWATT,
101 MILLIWATT,
103 MICROWATT,
105 NANOWATT,
107 PICOWATT,
109 FEMTOWATT,
111 ATTOWATT,
113 ZEPTOWATT,
115 YOCTOWATT
116 };
117
123 UnitsPower (enum_value value);
124
139 UnitsPower (const std::string& name, bool strict = true);
140
146 UnitsPower (const UnitsPower& original);
147
152 inline UnitsPower&
153 operator= (const UnitsPower& 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, UnitsPower::enum_value> string_map_type;
185 typedef std::map<UnitsPower::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 UnitsPower& lhs,
227 const UnitsPower& rhs)
228 {
229 return static_cast<UnitsPower::enum_value>(lhs) == static_cast<UnitsPower::enum_value>(rhs);
230 }
231
239 inline bool
240 operator== (const UnitsPower& lhs,
241 const UnitsPower::enum_value& rhs)
242 {
243 return static_cast<UnitsPower::enum_value>(lhs) == rhs;
244 }
245
253 inline bool
254 operator== (const UnitsPower::enum_value& lhs,
255 const UnitsPower& rhs)
256 {
257 return lhs == static_cast<UnitsPower::enum_value>(rhs);
258 }
259
267 inline bool
268 operator== (const UnitsPower& 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 UnitsPower& rhs)
284 {
285 return lhs == static_cast<const std::string&>(rhs);
286 }
287
295 inline bool
296 operator!= (const UnitsPower& lhs,
297 const UnitsPower& rhs)
298 {
299 return static_cast<UnitsPower::enum_value>(lhs) != static_cast<UnitsPower::enum_value>(rhs);
300 }
301
309 inline bool
310 operator!= (const UnitsPower& lhs,
311 const UnitsPower::enum_value& rhs)
312 {
313 return static_cast<UnitsPower::enum_value>(lhs) != rhs;
314 }
315
323 inline bool
324 operator!= (const UnitsPower::enum_value& lhs,
325 const UnitsPower& rhs)
326 {
327 return lhs != static_cast<UnitsPower::enum_value>(rhs);
328 }
329
337 inline bool
338 operator!= (const UnitsPower& 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 UnitsPower& 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 UnitsPower& 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 UnitsPower& enumeration)
384 {
385 std::string value;
386 is >> value;
387 if (is)
388 {
389 try
390 {
391 enumeration = UnitsPower(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_POWERQUANTITY_H
408
409 /*
410 * Local Variables:
411 * mode:C++
412 * End:
413 */
ome::xml::model::primitives::UnitsPower::enum_value
enum_value
Enumeration values.
Definition: PowerQuantity.h:72
ome::xml::model::primitives::UnitsPower::WATT
watt unit.
Definition: PowerQuantity.h:95
ome::xml::model::primitives::UnitsPower::ZETTAWATT
zettawatt unit.
Definition: PowerQuantity.h:77
ome::xml::model::primitives::UnitsPower::ATTOWATT
attowatt unit.
Definition: PowerQuantity.h:111
ome::xml::model::primitives::UnitsPower::PICOWATT
picowatt unit.
Definition: PowerQuantity.h:107
ome::xml::model::primitives::UnitsPower::FEMTOWATT
femtowatt unit.
Definition: PowerQuantity.h:109
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::UnitsPower::HECTOWATT
hectowatt unit.
Definition: PowerQuantity.h:91
ome::xml::model::primitives::UnitsPower::DECIWATT
deciwatt unit.
Definition: PowerQuantity.h:97
ome::xml::model::primitives::UnitsPower::UnitsPower
UnitsPower(enum_value value)
Construct a UnitsPower quantity by an enumeration value.
ome::xml::model::primitives::UnitsPower::MEGAWATT
megawatt unit.
Definition: PowerQuantity.h:87
ome::xml::model::primitives::UnitsPower::GIGAWATT
gigawatt unit.
Definition: PowerQuantity.h:85
ome::xml::model::primitives::UnitsPower::YOCTOWATT
yoctowatt unit.
Definition: PowerQuantity.h:115
ome::xml::model::primitives::UnitsPower::value_map_type
std::map< UnitsPower::enum_value, std::string > value_map_type
Value map type.
Definition: PowerQuantity.h:185
ome::xml::model::primitives::UnitsPower::string_map_type
std::map< std::string, UnitsPower::enum_value > string_map_type
String map type.
Definition: PowerQuantity.h:183
ome::xml::model::primitives::UnitsPower
UnitsPower enumeration.
Definition: PowerQuantity.h:68
ome::xml::model::primitives::UnitsPower::ZEPTOWATT
zeptowatt unit.
Definition: PowerQuantity.h:113
ome::xml::model::primitives::UnitsPower::KILOWATT
kilowatt unit.
Definition: PowerQuantity.h:89
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::primitives::UnitsPower::EXAWATT
exawatt unit.
Definition: PowerQuantity.h:79
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::UnitsPower::values
static const value_map_type & values()
Get a map of valid enum values and string names.
ome::xml::model::primitives::UnitsPower::TERAWATT
terawatt unit.
Definition: PowerQuantity.h:83
ome::xml::model::primitives::UnitsPower::value
enum_value value
Enumeration value.
Definition: PowerQuantity.h:213
ome::xml::model::primitives::UnitsPower::NANOWATT
nanowatt unit.
Definition: PowerQuantity.h:105
ome::xml::model::primitives::UnitsPower::YOTTAWATT
yottawatt unit.
Definition: PowerQuantity.h:75
ome::xml::model::primitives::UnitsPower::operator=
UnitsPower & operator=(const UnitsPower &rhs)
Assignment operator.
Definition: PowerQuantity.h:153
ome::xml::model::primitives::UnitsPower::MICROWATT
microwatt unit.
Definition: PowerQuantity.h:103
ome::xml::model::primitives::UnitsPower::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
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::UnitsPower::CENTIWATT
centiwatt unit.
Definition: PowerQuantity.h:99
ome::xml::model::primitives::UnitsPower::PETAWATT
petawatt unit.
Definition: PowerQuantity.h:81
ome::xml::model::primitives::UnitsPower::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
ome::xml::model::primitives::UnitsPower::name
const std::string * name
Enumeration name.
Definition: PowerQuantity.h:215
ome::xml::model::primitives::UnitsPower::DECAWATT
decawatt unit.
Definition: PowerQuantity.h:93
log.h
ome::xml::model::primitives::UnitsPower::MILLIWATT
milliwatt unit.
Definition: PowerQuantity.h:101