ome-xml  5.6.0
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 
75  {
76  public:
79  {
216  };
217 
224 
239  UnitsLength (const std::string& name, bool strict = true);
240 
246  UnitsLength (const UnitsLength& original);
247 
254  inline UnitsLength&
256  {
257  this->value = rhs.value;
258  this->name = rhs.name;
259  return *this;
260  }
261 
267  inline
268  operator enum_value () const
269  {
270  return this->value;
271  }
272 
278  inline
279  operator const std::string& () const
280  {
281  return *this->name;
282  }
283 
285  typedef std::map<std::string, UnitsLength::enum_value> string_map_type;
287  typedef std::map<UnitsLength::enum_value, std::string> value_map_type;
288 
294  static const string_map_type&
295  strings();
296 
302  static const value_map_type&
303  values();
304 
305  private:
311  static const string_map_type&
313 
317  const std::string *name;
318  };
319 
327  inline bool
329  const UnitsLength& rhs)
330  {
331  return static_cast<UnitsLength::enum_value>(lhs) == static_cast<UnitsLength::enum_value>(rhs);
332  }
333 
341  inline bool
343  const UnitsLength::enum_value& rhs)
344  {
345  return static_cast<UnitsLength::enum_value>(lhs) == rhs;
346  }
347 
355  inline bool
357  const UnitsLength& rhs)
358  {
359  return lhs == static_cast<UnitsLength::enum_value>(rhs);
360  }
361 
369  inline bool
371  const std::string& rhs)
372  {
373  return static_cast<const std::string&>(lhs) == rhs;
374  }
375 
383  inline bool
384  operator== (const std::string& lhs,
385  const UnitsLength& rhs)
386  {
387  return lhs == static_cast<const std::string&>(rhs);
388  }
389 
397  inline bool
399  const UnitsLength& rhs)
400  {
401  return static_cast<UnitsLength::enum_value>(lhs) != static_cast<UnitsLength::enum_value>(rhs);
402  }
403 
411  inline bool
413  const UnitsLength::enum_value& rhs)
414  {
415  return static_cast<UnitsLength::enum_value>(lhs) != rhs;
416  }
417 
425  inline bool
427  const UnitsLength& rhs)
428  {
429  return lhs != static_cast<UnitsLength::enum_value>(rhs);
430  }
431 
439  inline bool
441  const std::string& rhs)
442  {
443  return static_cast<const std::string&>(lhs) != rhs;
444  }
445 
453  inline bool
454  operator!= (const std::string& lhs,
455  const UnitsLength& rhs)
456  {
457  return lhs != static_cast<const std::string&>(rhs);
458  }
459 
467  template<class charT, class traits>
468  inline std::basic_ostream<charT,traits>&
469  operator<< (std::basic_ostream<charT,traits>& os,
470  const UnitsLength& enumeration)
471  {
472  return os << static_cast<const std::string&>(enumeration);
473  }
474 
482  template<class charT, class traits>
483  inline std::basic_istream<charT,traits>&
484  operator>> (std::basic_istream<charT,traits>& is,
485  UnitsLength& enumeration)
486  {
487  std::string value;
488  is >> value;
489  if (is)
490  {
491  try
492  {
493  enumeration = UnitsLength(value, false);
494  }
495  catch (const EnumerationException&)
496  {
497  is.setstate(std::ios::failbit);
498  }
499  }
500 
501  return is;
502  }
503 
504  }
505  }
506  }
507 }
508 
509 #include <ome/xml/model/enums/UnitsLengthConvert.h>
510 
511 #endif // OME_XML_MODEL_ENUMS_UNITSLENGTH_H
512 
513 /*
514  * Local Variables:
515  * mode:C++
516  * End:
517  */
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:392
std::map< UnitsLength::enum_value, std::string > value_map_type
Value map type.
Definition: UnitsLength.h:287
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:306
inch Imperial unit.
Definition: UnitsLength.h:179
UnitsLength & operator=(const UnitsLength &rhs)
Assignment operator.
Definition: UnitsLength.h:255
yard Imperial unit.
Definition: UnitsLength.h:187
gigameter SI unit.
Definition: UnitsLength.h:103
attometer SI unit.
Definition: UnitsLength.h:155
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
zeptometer SI unit.
Definition: UnitsLength.h:159
picometer SI unit.
Definition: UnitsLength.h:147
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: UnitsLength.cpp:174
kilometer SI unit.
Definition: UnitsLength.h:111
nanometer SI unit.
Definition: UnitsLength.h:143
thou Imperial unit (or mil, 1/1000 inch).
Definition: UnitsLength.h:171
UnitsLength(enum_value value)
Construct a UnitsLength enumeration by an enumeration value.
Definition: UnitsLength.cpp:67
decimeter SI unit.
Definition: UnitsLength.h:127
decameter SI unit.
Definition: UnitsLength.h:119
ångström SI-derived unit.
Definition: UnitsLength.h:167
meter SI unit.
Definition: UnitsLength.h:123
femtometer SI unit.
Definition: UnitsLength.h:151
yottameter SI unit.
Definition: UnitsLength.h:83
line Imperial unit (1/12 inch).
Definition: UnitsLength.h:175
centimeter SI unit.
Definition: UnitsLength.h:131
Open Microscopy Environment C++ implementation.
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: UnitsLength.cpp:218
exameter SI unit.
Definition: UnitsLength.h:91
astronomical unit SI-derived unit.
Definition: UnitsLength.h:195
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:236
enum_value value
Enumeration value.
Definition: UnitsLength.h:315
megameter SI unit.
Definition: UnitsLength.h:107
terameter SI unit.
Definition: UnitsLength.h:99
enum_value
Enumeration values.
Definition: UnitsLength.h:78
terrestrial mile Imperial unit.
Definition: UnitsLength.h:191
light year.
Definition: UnitsLength.h:199
yoctometer SI unit.
Definition: UnitsLength.h:163
zettameter SI unit.
Definition: UnitsLength.h:87
foot Imperial unit.
Definition: UnitsLength.h:183
typography point Imperial-derived unit (1/72 inch).
Definition: UnitsLength.h:207
petameter SI unit.
Definition: UnitsLength.h:95
parsec.
Definition: UnitsLength.h:203
const std::string * name
Enumeration name.
Definition: UnitsLength.h:317
UnitsLength enumeration.
Definition: UnitsLength.h:74
millimeter SI unit.
Definition: UnitsLength.h:135
pixel abstract unit.
Definition: UnitsLength.h:211
std::map< std::string, UnitsLength::enum_value > string_map_type
String map type.
Definition: UnitsLength.h:285
hectometer SI unit.
Definition: UnitsLength.h:115
reference frame abstract unit.
Definition: UnitsLength.h:215
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: UnitsLength.cpp:130
micrometer SI unit.
Definition: UnitsLength.h:139