ome-xml 5.2.3

UnitsLength.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_ENUMS_UNITSLENGTH_H
47 #define OME_XML_MODEL_ENUMS_UNITSLENGTH_H
48
49 #include <ostream>
50 #include <map>
51 #include <string>
52
53 #include <ome/common/log.h>
54
55 #include <ome/xml/model/enums/EnumerationException.h>
56
57 #include <ome/xml/model/primitives/Quantity.h>
58
59 // All values in the UnitsLength enumeration.
60 #define OME_XML_MODEL_ENUMS_UNITSLENGTH_VALUES (YOTTAMETER)(ZETTAMETER)(EXAMETER)(PETAMETER)(TERAMETER)(GIGAMETER)(MEGAMETER)(KILOMETER)(HECTOMETER)(DECAMETER)(METER)(DECIMETER)(CENTIMETER)(MILLIMETER)(MICROMETER)(NANOMETER)(PICOMETER)(FEMTOMETER)(ATTOMETER)(ZEPTOMETER)(YOCTOMETER)(ANGSTROM)(THOU)(LINE)(INCH)(FOOT)(YARD)(MILE)(ASTRONOMICALUNIT)(LIGHTYEAR)(PARSEC)(POINT)(PIXEL)(REFERENCEFRAME)
61
62 namespace ome
63 {
64 namespace xml
65 {
66 namespace model
67 {
68 namespace enums
69 {
70
74 class UnitsLength
75 {
76 public:
78 enum enum_value
79 {
83 YOTTAMETER,
87 ZETTAMETER,
91 EXAMETER,
95 PETAMETER,
99 TERAMETER,
103 GIGAMETER,
107 MEGAMETER,
111 KILOMETER,
115 HECTOMETER,
119 DECAMETER,
123 METER,
127 DECIMETER,
131 CENTIMETER,
135 MILLIMETER,
139 MICROMETER,
143 NANOMETER,
147 PICOMETER,
151 FEMTOMETER,
155 ATTOMETER,
159 ZEPTOMETER,
163 YOCTOMETER,
167 ANGSTROM,
171 THOU,
175 LINE,
179 INCH,
183 FOOT,
187 YARD,
191 MILE,
195 ASTRONOMICALUNIT,
199 LIGHTYEAR,
203 PARSEC,
207 POINT,
211 PIXEL,
215 REFERENCEFRAME
216 };
217
223 UnitsLength (enum_value value);
224
239 UnitsLength (const std::string& name, bool strict = true);
240
246 UnitsLength (const UnitsLength& original);
247
252 inline UnitsLength&
253 operator= (const UnitsLength& rhs)
254 {
255 this->value = rhs.value;
256 this->name = rhs.name;
257 return *this;
258 }
259
265 inline
266 operator enum_value () const
267 {
268 return this->value;
269 }
270
276 inline
277 operator const std::string& () const
278 {
279 return *this->name;
280 }
281
283 typedef std::map<std::string, UnitsLength::enum_value> string_map_type;
285 typedef std::map<UnitsLength::enum_value, std::string> value_map_type;
286
292 static const string_map_type&
293 strings();
294
300 static const value_map_type&
301 values();
302
303 private:
309 static const string_map_type&
310 lowercase_strings();
311
313 enum_value value;
315 const std::string *name;
316 };
317
325 inline bool
326 operator== (const UnitsLength& lhs,
327 const UnitsLength& rhs)
328 {
329 return static_cast<UnitsLength::enum_value>(lhs) == static_cast<UnitsLength::enum_value>(rhs);
330 }
331
339 inline bool
340 operator== (const UnitsLength& lhs,
341 const UnitsLength::enum_value& rhs)
342 {
343 return static_cast<UnitsLength::enum_value>(lhs) == rhs;
344 }
345
353 inline bool
354 operator== (const UnitsLength::enum_value& lhs,
355 const UnitsLength& rhs)
356 {
357 return lhs == static_cast<UnitsLength::enum_value>(rhs);
358 }
359
367 inline bool
368 operator== (const UnitsLength& lhs,
369 const std::string& rhs)
370 {
371 return static_cast<const std::string&>(lhs) == rhs;
372 }
373
381 inline bool
382 operator== (const std::string& lhs,
383 const UnitsLength& rhs)
384 {
385 return lhs == static_cast<const std::string&>(rhs);
386 }
387
395 inline bool
396 operator!= (const UnitsLength& lhs,
397 const UnitsLength& rhs)
398 {
399 return static_cast<UnitsLength::enum_value>(lhs) != static_cast<UnitsLength::enum_value>(rhs);
400 }
401
409 inline bool
410 operator!= (const UnitsLength& lhs,
411 const UnitsLength::enum_value& rhs)
412 {
413 return static_cast<UnitsLength::enum_value>(lhs) != rhs;
414 }
415
423 inline bool
424 operator!= (const UnitsLength::enum_value& lhs,
425 const UnitsLength& rhs)
426 {
427 return lhs != static_cast<UnitsLength::enum_value>(rhs);
428 }
429
437 inline bool
438 operator!= (const UnitsLength& lhs,
439 const std::string& rhs)
440 {
441 return static_cast<const std::string&>(lhs) != rhs;
442 }
443
451 inline bool
452 operator!= (const std::string& lhs,
453 const UnitsLength& rhs)
454 {
455 return lhs != static_cast<const std::string&>(rhs);
456 }
457
465 template<class charT, class traits>
466 inline std::basic_ostream<charT,traits>&
467 operator<< (std::basic_ostream<charT,traits>& os,
468 const UnitsLength& enumeration)
469 {
470 return os << static_cast<const std::string&>(enumeration);
471 }
472
480 template<class charT, class traits>
481 inline std::basic_istream<charT,traits>&
482 operator>> (std::basic_istream<charT,traits>& is,
483 UnitsLength& enumeration)
484 {
485 std::string value;
486 is >> value;
487 if (is)
488 {
489 try
490 {
491 enumeration = UnitsLength(value, false);
492 }
493 catch (const EnumerationException&)
494 {
495 is.setstate(std::ios::failbit);
496 }
497 }
498
499 return is;
500 }
501
502 }
503 }
504 }
505 }
506
507 #include <ome/xml/model/enums/UnitsLengthConvert.h>
508
509 #endif // OME_XML_MODEL_ENUMS_UNITSLENGTH_H
510
511 /*
512 * Local Variables:
513 * mode:C++
514 * End:
515 */
ome::xml::model::enums::operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:390
ome::xml::model::enums::UnitsLength::value_map_type
std::map< UnitsLength::enum_value, std::string > value_map_type
Value map type.
Definition: UnitsLength.h:285
ome::xml::model::enums::operator!=
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:304
ome::xml::model::enums::UnitsLength::INCH
inch Imperial unit.
Definition: UnitsLength.h:179
ome::xml::model::enums::UnitsLength::operator=
UnitsLength & operator=(const UnitsLength &rhs)
Assignment operator.
Definition: UnitsLength.h:253
ome::xml::model::enums::UnitsLength::YARD
yard Imperial unit.
Definition: UnitsLength.h:187
ome::xml::model::enums::UnitsLength::GIGAMETER
gigameter SI unit.
Definition: UnitsLength.h:103
ome::xml::model::enums::UnitsLength::ATTOMETER
attometer SI unit.
Definition: UnitsLength.h:155
ome::xml::model::enums::EnumerationException
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
ome::xml::model::enums::UnitsLength::ZEPTOMETER
zeptometer SI unit.
Definition: UnitsLength.h:159
ome::xml::model::enums::UnitsLength::PICOMETER
picometer SI unit.
Definition: UnitsLength.h:147
ome::xml::model::enums::UnitsLength::values
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: UnitsLength.cpp:185
ome::xml::model::enums::UnitsLength::KILOMETER
kilometer SI unit.
Definition: UnitsLength.h:111
ome::xml::model::enums::UnitsLength::NANOMETER
nanometer SI unit.
Definition: UnitsLength.h:143
ome::xml::model::enums::UnitsLength::THOU
thou Imperial unit (or mil, 1/1000 inch).
Definition: UnitsLength.h:171
ome::xml::model::enums::UnitsLength::UnitsLength
UnitsLength(enum_value value)
Construct a UnitsLength enumeration by an enumeration value.
Definition: UnitsLength.cpp:75
ome::xml::model::enums::UnitsLength::DECIMETER
decimeter SI unit.
Definition: UnitsLength.h:127
ome::xml::model::enums::UnitsLength::DECAMETER
decameter SI unit.
Definition: UnitsLength.h:119
ome::xml::model::enums::UnitsLength::ANGSTROM
ångström SI-derived unit.
Definition: UnitsLength.h:167
ome::xml::model::enums::UnitsLength::METER
meter SI unit.
Definition: UnitsLength.h:123
ome::xml::model::enums::UnitsLength::FEMTOMETER
femtometer SI unit.
Definition: UnitsLength.h:151
ome::xml::model::enums::UnitsLength::YOTTAMETER
yottameter SI unit.
Definition: UnitsLength.h:83
ome::xml::model::enums::UnitsLength::LINE
line Imperial unit (1/12 inch).
Definition: UnitsLength.h:175
ome::xml::model::enums::UnitsLength::CENTIMETER
centimeter SI unit.
Definition: UnitsLength.h:131
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::enums::UnitsLength::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: UnitsLength.cpp:232
ome::xml::model::enums::UnitsLength::EXAMETER
exameter SI unit.
Definition: UnitsLength.h:91
ome::xml::model::enums::UnitsLength::ASTRONOMICALUNIT
astronomical unit SI-derived unit.
Definition: UnitsLength.h:195
ome::xml::model::enums::operator==
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:234
ome::xml::model::enums::UnitsLength::value
enum_value value
Enumeration value.
Definition: UnitsLength.h:313
ome::xml::model::enums::UnitsLength::MEGAMETER
megameter SI unit.
Definition: UnitsLength.h:107
ome::xml::model::enums::UnitsLength::TERAMETER
terameter SI unit.
Definition: UnitsLength.h:99
ome::xml::model::enums::UnitsLength::enum_value
enum_value
Enumeration values.
Definition: UnitsLength.h:78
ome::xml::model::enums::UnitsLength::MILE
terrestrial mile Imperial unit.
Definition: UnitsLength.h:191
ome::xml::model::enums::UnitsLength::LIGHTYEAR
light year.
Definition: UnitsLength.h:199
ome::xml::model::enums::UnitsLength::YOCTOMETER
yoctometer SI unit.
Definition: UnitsLength.h:163
ome::xml::model::enums::UnitsLength::ZETTAMETER
zettameter SI unit.
Definition: UnitsLength.h:87
ome::xml::model::enums::UnitsLength::FOOT
foot Imperial unit.
Definition: UnitsLength.h:183
ome::xml::model::enums::UnitsLength::POINT
typography point Imperial-derived unit (1/72 inch).
Definition: UnitsLength.h:207
ome::xml::model::enums::UnitsLength::PETAMETER
petameter SI unit.
Definition: UnitsLength.h:95
ome::xml::model::enums::UnitsLength::PARSEC
parsec.
Definition: UnitsLength.h:203
ome::xml::model::enums::UnitsLength::name
const std::string * name
Enumeration name.
Definition: UnitsLength.h:315
ome::xml::model::enums::UnitsLength
UnitsLength enumeration.
Definition: UnitsLength.h:74
ome::xml::model::enums::UnitsLength::MILLIMETER
millimeter SI unit.
Definition: UnitsLength.h:135
ome::xml::model::enums::UnitsLength::PIXEL
pixel abstract unit.
Definition: UnitsLength.h:211
ome::xml::model::enums::UnitsLength::string_map_type
std::map< std::string, UnitsLength::enum_value > string_map_type
String map type.
Definition: UnitsLength.h:283
log.h
ome::xml::model::enums::UnitsLength::HECTOMETER
hectometer SI unit.
Definition: UnitsLength.h:115
ome::xml::model::enums::UnitsLength::REFERENCEFRAME
reference frame abstract unit.
Definition: UnitsLength.h:215
ome::xml::model::enums::UnitsLength::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: UnitsLength.cpp:138
ome::xml::model::enums::UnitsLength::MICROMETER
micrometer SI unit.
Definition: UnitsLength.h:139