ome-xml 5.2.3

LengthQuantity.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_LENGTHQUANTITY_H
47 #define OME_XML_MODEL_PRIMITIVES_LENGTHQUANTITY_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 UnitsLength
69 {
70 public:
72 enum enum_value
73 {
75 YOTTAMETER,
77 ZETTAMETER,
79 EXAMETER,
81 PETAMETER,
83 TERAMETER,
85 GIGAMETER,
87 MEGAMETER,
89 KILOMETER,
91 HECTOMETER,
93 DECAMETER,
95 METER,
97 DECIMETER,
99 CENTIMETER,
101 MILLIMETER,
103 MICROMETER,
105 NANOMETER,
107 PICOMETER,
109 FEMTOMETER,
111 ATTOMETER,
113 ZEPTOMETER,
115 YOCTOMETER,
117 ANGSTROM,
119 THOU,
121 LINE,
123 INCH,
125 FOOT,
127 YARD,
129 MILE,
131 ASTRONOMICALUNIT,
133 LIGHTYEAR,
135 PARSEC,
137 POINT,
139 PIXEL,
141 REFERENCEFRAME
142 };
143
149 UnitsLength (enum_value value);
150
165 UnitsLength (const std::string& name, bool strict = true);
166
172 UnitsLength (const UnitsLength& original);
173
178 inline UnitsLength&
179 operator= (const UnitsLength& rhs)
180 {
181 this->value = rhs.value;
182 this->name = rhs.name;
183 return *this;
184 }
185
191 inline
192 operator enum_value () const
193 {
194 return this->value;
195 }
196
202 inline
203 operator const std::string& () const
204 {
205 return *this->name;
206 }
207
209 typedef std::map<std::string, UnitsLength::enum_value> string_map_type;
211 typedef std::map<UnitsLength::enum_value, std::string> value_map_type;
212
218 static const string_map_type&
219 strings();
220
226 static const value_map_type&
227 values();
228
229 private:
235 static const string_map_type&
236 lowercase_strings();
237
239 enum_value value;
241 const std::string *name;
242 };
243
251 inline bool
252 operator== (const UnitsLength& lhs,
253 const UnitsLength& rhs)
254 {
255 return static_cast<UnitsLength::enum_value>(lhs) == static_cast<UnitsLength::enum_value>(rhs);
256 }
257
265 inline bool
266 operator== (const UnitsLength& lhs,
267 const UnitsLength::enum_value& rhs)
268 {
269 return static_cast<UnitsLength::enum_value>(lhs) == rhs;
270 }
271
279 inline bool
280 operator== (const UnitsLength::enum_value& lhs,
281 const UnitsLength& rhs)
282 {
283 return lhs == static_cast<UnitsLength::enum_value>(rhs);
284 }
285
293 inline bool
294 operator== (const UnitsLength& lhs,
295 const std::string& rhs)
296 {
297 return static_cast<const std::string&>(lhs) == rhs;
298 }
299
307 inline bool
308 operator== (const std::string& lhs,
309 const UnitsLength& rhs)
310 {
311 return lhs == static_cast<const std::string&>(rhs);
312 }
313
321 inline bool
322 operator!= (const UnitsLength& lhs,
323 const UnitsLength& rhs)
324 {
325 return static_cast<UnitsLength::enum_value>(lhs) != static_cast<UnitsLength::enum_value>(rhs);
326 }
327
335 inline bool
336 operator!= (const UnitsLength& lhs,
337 const UnitsLength::enum_value& rhs)
338 {
339 return static_cast<UnitsLength::enum_value>(lhs) != rhs;
340 }
341
349 inline bool
350 operator!= (const UnitsLength::enum_value& lhs,
351 const UnitsLength& rhs)
352 {
353 return lhs != static_cast<UnitsLength::enum_value>(rhs);
354 }
355
363 inline bool
364 operator!= (const UnitsLength& lhs,
365 const std::string& rhs)
366 {
367 return static_cast<const std::string&>(lhs) != rhs;
368 }
369
377 inline bool
378 operator!= (const std::string& lhs,
379 const UnitsLength& rhs)
380 {
381 return lhs != static_cast<const std::string&>(rhs);
382 }
383
391 template<class charT, class traits>
392 inline std::basic_ostream<charT,traits>&
393 operator<< (std::basic_ostream<charT,traits>& os,
394 const UnitsLength& enumeration)
395 {
396 return os << static_cast<const std::string&>(enumeration);
397 }
398
406 template<class charT, class traits>
407 inline std::basic_istream<charT,traits>&
408 operator>> (std::basic_istream<charT,traits>& is,
409 UnitsLength& enumeration)
410 {
411 std::string value;
412 is >> value;
413 if (is)
414 {
415 try
416 {
417 enumeration = UnitsLength(value, false);
418 }
419 catch (const EnumerationException&)
420 {
421 is.setstate(std::ios::failbit);
422 }
423 }
424
425 return is;
426 }
427
428 }
429 }
430 }
431 }
432
433 #endif // OME_XML_MODEL_PRIMITIVES_LENGTHQUANTITY_H
434
435 /*
436 * Local Variables:
437 * mode:C++
438 * End:
439 */
ome::xml::model::primitives::UnitsLength::INCH
inch Imperial unit.
Definition: LengthQuantity.h:123
ome::xml::model::primitives::UnitsLength::MILE
terrestrial mile Imperial unit.
Definition: LengthQuantity.h:129
ome::xml::model::primitives::UnitsLength::LINE
line Imperial unit (1/12 inch).
Definition: LengthQuantity.h:121
ome::xml::model::primitives::UnitsLength::value_map_type
std::map< UnitsLength::enum_value, std::string > value_map_type
Value map type.
Definition: LengthQuantity.h:211
ome::xml::model::primitives::UnitsLength::NANOMETER
nanometer SI unit.
Definition: LengthQuantity.h:105
ome::xml::model::primitives::UnitsLength::THOU
thou Imperial unit (or mil, 1/1000 inch).
Definition: LengthQuantity.h:119
ome::xml::model::primitives::UnitsLength::REFERENCEFRAME
reference frame abstract unit. This is not convertible to any other length unit without a scaling fac...
Definition: LengthQuantity.h:141
ome::xml::model::primitives::UnitsLength::ASTRONOMICALUNIT
astronomical unit SI-derived unit. The official term is ua as the SI standard assigned AU to absorban...
Definition: LengthQuantity.h:131
ome::xml::model::primitives::UnitsLength::PARSEC
parsec.
Definition: LengthQuantity.h:135
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::UnitsLength::value
enum_value value
Enumeration value.
Definition: LengthQuantity.h:239
ome::xml::model::primitives::UnitsLength::PIXEL
pixel abstract unit. This is not convertible to any other length unit without a calibrated scaling fa...
Definition: LengthQuantity.h:139
ome::xml::model::primitives::UnitsLength::HECTOMETER
hectometer SI unit.
Definition: LengthQuantity.h:91
ome::xml::model::primitives::UnitsLength::GIGAMETER
gigameter SI unit.
Definition: LengthQuantity.h:85
ome::xml::model::primitives::UnitsLength::EXAMETER
exameter SI unit.
Definition: LengthQuantity.h:79
ome::xml::model::primitives::UnitsLength::YOCTOMETER
yoctometer SI unit.
Definition: LengthQuantity.h:115
ome::xml::model::primitives::UnitsLength::LIGHTYEAR
light year.
Definition: LengthQuantity.h:133
ome::xml::model::primitives::UnitsLength::ANGSTROM
ångström SI-derived unit.
Definition: LengthQuantity.h:117
ome::xml::model::primitives::UnitsLength::name
const std::string * name
Enumeration name.
Definition: LengthQuantity.h:241
ome::xml::model::primitives::UnitsLength::YARD
yard Imperial unit.
Definition: LengthQuantity.h:127
ome::xml::model::primitives::UnitsLength::ATTOMETER
attometer SI unit.
Definition: LengthQuantity.h:111
ome::xml::model::primitives::UnitsLength::POINT
typography point Imperial-derived unit (1/72 inch). Use of this unit should be limited to font sizes...
Definition: LengthQuantity.h:137
ome::xml::model::primitives::UnitsLength::ZETTAMETER
zettameter SI unit.
Definition: LengthQuantity.h:77
ome::xml::model::primitives::UnitsLength::PETAMETER
petameter SI unit.
Definition: LengthQuantity.h:81
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::UnitsLength::PICOMETER
picometer SI unit.
Definition: LengthQuantity.h:107
ome::xml::model::primitives::UnitsLength::ZEPTOMETER
zeptometer SI unit.
Definition: LengthQuantity.h:113
ome::xml::model::primitives::UnitsLength::YOTTAMETER
yottameter SI unit.
Definition: LengthQuantity.h:75
ome::xml::model::primitives::UnitsLength::MILLIMETER
millimeter SI unit.
Definition: LengthQuantity.h:101
ome::xml::model::primitives::UnitsLength::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
ome::xml::model::primitives::UnitsLength::string_map_type
std::map< std::string, UnitsLength::enum_value > string_map_type
String map type.
Definition: LengthQuantity.h:209
ome::xml::model::primitives::UnitsLength::UnitsLength
UnitsLength(enum_value value)
Construct a UnitsLength quantity by an enumeration value.
ome::xml::model::primitives::UnitsLength::METER
meter SI unit.
Definition: LengthQuantity.h:95
ome::xml::model::primitives::UnitsLength::KILOMETER
kilometer SI unit.
Definition: LengthQuantity.h:89
ome::xml::model::primitives::UnitsLength::MEGAMETER
megameter SI unit.
Definition: LengthQuantity.h:87
ome::xml::model::primitives::UnitsLength
UnitsLength enumeration.
Definition: LengthQuantity.h:68
ome::xml::model::primitives::UnitsLength::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
ome::xml::model::primitives::UnitsLength::TERAMETER
terameter SI unit.
Definition: LengthQuantity.h:83
ome::xml::model::primitives::UnitsLength::CENTIMETER
centimeter SI unit.
Definition: LengthQuantity.h:99
ome::xml::model::primitives::UnitsLength::operator=
UnitsLength & operator=(const UnitsLength &rhs)
Assignment operator.
Definition: LengthQuantity.h:179
ome::xml::model::primitives::UnitsLength::DECAMETER
decameter SI unit.
Definition: LengthQuantity.h:93
ome::xml::model::primitives::UnitsLength::DECIMETER
decimeter SI unit.
Definition: LengthQuantity.h:97
ome::xml::model::primitives::UnitsLength::enum_value
enum_value
Enumeration values.
Definition: LengthQuantity.h:72
ome::xml::model::primitives::UnitsLength::FEMTOMETER
femtometer SI unit.
Definition: LengthQuantity.h:109
log.h
ome::xml::model::primitives::UnitsLength::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
ome::xml::model::primitives::UnitsLength::FOOT
foot Imperial unit.
Definition: LengthQuantity.h:125
ome::xml::model::primitives::UnitsLength::MICROMETER
micrometer SI unit.
Definition: LengthQuantity.h:103