ome-xml 5.2.3

TemperatureQuantity.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_TEMPERATUREQUANTITY_H
47 #define OME_XML_MODEL_PRIMITIVES_TEMPERATUREQUANTITY_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 UnitsTemperature
69 {
70 public:
72 enum enum_value
73 {
75 CELSIUS,
77 FAHRENHEIT,
79 KELVIN,
81 RANKINE
82 };
83
89 UnitsTemperature (enum_value value);
90
105 UnitsTemperature (const std::string& name, bool strict = true);
106
112 UnitsTemperature (const UnitsTemperature& original);
113
118 inline UnitsTemperature&
119 operator= (const UnitsTemperature& rhs)
120 {
121 this->value = rhs.value;
122 this->name = rhs.name;
123 return *this;
124 }
125
131 inline
132 operator enum_value () const
133 {
134 return this->value;
135 }
136
142 inline
143 operator const std::string& () const
144 {
145 return *this->name;
146 }
147
149 typedef std::map<std::string, UnitsTemperature::enum_value> string_map_type;
151 typedef std::map<UnitsTemperature::enum_value, std::string> value_map_type;
152
158 static const string_map_type&
159 strings();
160
166 static const value_map_type&
167 values();
168
169 private:
175 static const string_map_type&
176 lowercase_strings();
177
179 enum_value value;
181 const std::string *name;
182 };
183
191 inline bool
192 operator== (const UnitsTemperature& lhs,
193 const UnitsTemperature& rhs)
194 {
195 return static_cast<UnitsTemperature::enum_value>(lhs) == static_cast<UnitsTemperature::enum_value>(rhs);
196 }
197
205 inline bool
206 operator== (const UnitsTemperature& lhs,
207 const UnitsTemperature::enum_value& rhs)
208 {
209 return static_cast<UnitsTemperature::enum_value>(lhs) == rhs;
210 }
211
219 inline bool
220 operator== (const UnitsTemperature::enum_value& lhs,
221 const UnitsTemperature& rhs)
222 {
223 return lhs == static_cast<UnitsTemperature::enum_value>(rhs);
224 }
225
233 inline bool
234 operator== (const UnitsTemperature& lhs,
235 const std::string& rhs)
236 {
237 return static_cast<const std::string&>(lhs) == rhs;
238 }
239
247 inline bool
248 operator== (const std::string& lhs,
249 const UnitsTemperature& rhs)
250 {
251 return lhs == static_cast<const std::string&>(rhs);
252 }
253
261 inline bool
262 operator!= (const UnitsTemperature& lhs,
263 const UnitsTemperature& rhs)
264 {
265 return static_cast<UnitsTemperature::enum_value>(lhs) != static_cast<UnitsTemperature::enum_value>(rhs);
266 }
267
275 inline bool
276 operator!= (const UnitsTemperature& lhs,
277 const UnitsTemperature::enum_value& rhs)
278 {
279 return static_cast<UnitsTemperature::enum_value>(lhs) != rhs;
280 }
281
289 inline bool
290 operator!= (const UnitsTemperature::enum_value& lhs,
291 const UnitsTemperature& rhs)
292 {
293 return lhs != static_cast<UnitsTemperature::enum_value>(rhs);
294 }
295
303 inline bool
304 operator!= (const UnitsTemperature& lhs,
305 const std::string& rhs)
306 {
307 return static_cast<const std::string&>(lhs) != rhs;
308 }
309
317 inline bool
318 operator!= (const std::string& lhs,
319 const UnitsTemperature& rhs)
320 {
321 return lhs != static_cast<const std::string&>(rhs);
322 }
323
331 template<class charT, class traits>
332 inline std::basic_ostream<charT,traits>&
333 operator<< (std::basic_ostream<charT,traits>& os,
334 const UnitsTemperature& enumeration)
335 {
336 return os << static_cast<const std::string&>(enumeration);
337 }
338
346 template<class charT, class traits>
347 inline std::basic_istream<charT,traits>&
348 operator>> (std::basic_istream<charT,traits>& is,
349 UnitsTemperature& enumeration)
350 {
351 std::string value;
352 is >> value;
353 if (is)
354 {
355 try
356 {
357 enumeration = UnitsTemperature(value, false);
358 }
359 catch (const EnumerationException&)
360 {
361 is.setstate(std::ios::failbit);
362 }
363 }
364
365 return is;
366 }
367
368 }
369 }
370 }
371 }
372
373 #endif // OME_XML_MODEL_PRIMITIVES_TEMPERATUREQUANTITY_H
374
375 /*
376 * Local Variables:
377 * mode:C++
378 * End:
379 */
ome::xml::model::primitives::UnitsTemperature::RANKINE
degree Rankine unit.
Definition: TemperatureQuantity.h:81
ome::xml::model::primitives::UnitsTemperature::KELVIN
Kelvin unit.
Definition: TemperatureQuantity.h:79
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::UnitsTemperature::value_map_type
std::map< UnitsTemperature::enum_value, std::string > value_map_type
Value map type.
Definition: TemperatureQuantity.h:151
ome::xml::model::primitives::UnitsTemperature::UnitsTemperature
UnitsTemperature(enum_value value)
Construct a UnitsTemperature quantity by an enumeration value.
ome::xml::model::primitives::UnitsTemperature::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
ome::xml::model::primitives::UnitsTemperature::FAHRENHEIT
degree Fahrenheit unit.
Definition: TemperatureQuantity.h:77
ome::xml::model::primitives::UnitsTemperature::string_map_type
std::map< std::string, UnitsTemperature::enum_value > string_map_type
String map type.
Definition: TemperatureQuantity.h:149
ome::xml::model::primitives::UnitsTemperature::CELSIUS
degree Celsius unit.
Definition: TemperatureQuantity.h:75
ome
Open Microscopy Environment C++ implementation.
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::UnitsTemperature::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
ome::xml::model::primitives::UnitsTemperature::enum_value
enum_value
Enumeration values.
Definition: TemperatureQuantity.h:72
ome::xml::model::primitives::UnitsTemperature::values
static const value_map_type & values()
Get a map of valid enum values and string names.
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
log.h
ome::xml::model::primitives::UnitsTemperature::value
enum_value value
Enumeration value.
Definition: TemperatureQuantity.h:179
ome::xml::model::primitives::UnitsTemperature::operator=
UnitsTemperature & operator=(const UnitsTemperature &rhs)
Assignment operator.
Definition: TemperatureQuantity.h:119
ome::xml::model::primitives::UnitsTemperature
UnitsTemperature enumeration.
Definition: TemperatureQuantity.h:68
ome::xml::model::primitives::UnitsTemperature::name
const std::string * name
Enumeration name.
Definition: TemperatureQuantity.h:181