ome-xml  5.2.0-m5
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 
252  inline UnitsLength&
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&
311 
315  const std::string *name;
316  };
317 
325  inline bool
327  const UnitsLength& rhs)
328  {
329  return static_cast<UnitsLength::enum_value>(lhs) == static_cast<UnitsLength::enum_value>(rhs);
330  }
331 
339  inline bool
341  const UnitsLength::enum_value& rhs)
342  {
343  return static_cast<UnitsLength::enum_value>(lhs) == rhs;
344  }
345 
353  inline bool
355  const UnitsLength& rhs)
356  {
357  return lhs == static_cast<UnitsLength::enum_value>(rhs);
358  }
359 
367  inline bool
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
397  const UnitsLength& rhs)
398  {
399  return static_cast<UnitsLength::enum_value>(lhs) != static_cast<UnitsLength::enum_value>(rhs);
400  }
401 
409  inline bool
411  const UnitsLength::enum_value& rhs)
412  {
413  return static_cast<UnitsLength::enum_value>(lhs) != rhs;
414  }
415 
423  inline bool
425  const UnitsLength& rhs)
426  {
427  return lhs != static_cast<UnitsLength::enum_value>(rhs);
428  }
429 
437  inline bool
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  namespace primitives
505  {
506 
516  Quantity< ome::xml::model::enums::UnitsLength>
517  convert(const Quantity< ome::xml::model::enums::UnitsLength>& quantity,
518  Quantity< ome::xml::model::enums::UnitsLength>::unit_type unit);
519 
520  }
521 
522  }
523  }
524 }
525 
526 #endif // OME_XML_MODEL_ENUMS_UNITSLENGTH_H
527 
528 /*
529  * Local Variables:
530  * mode:C++
531  * End:
532  */
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:384
std::map< UnitsLength::enum_value, std::string > value_map_type
Value map type.
Definition: UnitsLength.h:285
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:298
inch Imperial unit.
Definition: UnitsLength.h:179
UnitsLength & operator=(const UnitsLength &rhs)
Assignment operator.
Definition: UnitsLength.h:253
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:185
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:75
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:232
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:228
enum_value value
Enumeration value.
Definition: UnitsLength.h:313
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:315
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:283
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:138
micrometer SI unit.
Definition: UnitsLength.h:139