ome-xml  5.6.0
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 
69  {
70  public:
73  {
142  };
143 
150 
165  UnitsLength (const std::string& name, bool strict = true);
166 
172  UnitsLength (const UnitsLength& original);
173 
180  inline UnitsLength&
182  {
183  this->value = rhs.value;
184  this->name = rhs.name;
185  return *this;
186  }
187 
193  inline
194  operator enum_value () const
195  {
196  return this->value;
197  }
198 
204  inline
205  operator const std::string& () const
206  {
207  return *this->name;
208  }
209 
211  typedef std::map<std::string, UnitsLength::enum_value> string_map_type;
213  typedef std::map<UnitsLength::enum_value, std::string> value_map_type;
214 
220  static const string_map_type&
221  strings();
222 
228  static const value_map_type&
229  values();
230 
231  private:
237  static const string_map_type&
239 
243  const std::string *name;
244  };
245 
253  inline bool
255  const UnitsLength& rhs)
256  {
257  return static_cast<UnitsLength::enum_value>(lhs) == static_cast<UnitsLength::enum_value>(rhs);
258  }
259 
267  inline bool
269  const UnitsLength::enum_value& rhs)
270  {
271  return static_cast<UnitsLength::enum_value>(lhs) == rhs;
272  }
273 
281  inline bool
283  const UnitsLength& rhs)
284  {
285  return lhs == static_cast<UnitsLength::enum_value>(rhs);
286  }
287 
295  inline bool
297  const std::string& rhs)
298  {
299  return static_cast<const std::string&>(lhs) == rhs;
300  }
301 
309  inline bool
310  operator== (const std::string& lhs,
311  const UnitsLength& rhs)
312  {
313  return lhs == static_cast<const std::string&>(rhs);
314  }
315 
323  inline bool
325  const UnitsLength& rhs)
326  {
327  return static_cast<UnitsLength::enum_value>(lhs) != static_cast<UnitsLength::enum_value>(rhs);
328  }
329 
337  inline bool
339  const UnitsLength::enum_value& rhs)
340  {
341  return static_cast<UnitsLength::enum_value>(lhs) != rhs;
342  }
343 
351  inline bool
353  const UnitsLength& rhs)
354  {
355  return lhs != static_cast<UnitsLength::enum_value>(rhs);
356  }
357 
365  inline bool
367  const std::string& rhs)
368  {
369  return static_cast<const std::string&>(lhs) != rhs;
370  }
371 
379  inline bool
380  operator!= (const std::string& lhs,
381  const UnitsLength& rhs)
382  {
383  return lhs != static_cast<const std::string&>(rhs);
384  }
385 
393  template<class charT, class traits>
394  inline std::basic_ostream<charT,traits>&
395  operator<< (std::basic_ostream<charT,traits>& os,
396  const UnitsLength& enumeration)
397  {
398  return os << static_cast<const std::string&>(enumeration);
399  }
400 
408  template<class charT, class traits>
409  inline std::basic_istream<charT,traits>&
410  operator>> (std::basic_istream<charT,traits>& is,
411  UnitsLength& enumeration)
412  {
413  std::string value;
414  is >> value;
415  if (is)
416  {
417  try
418  {
419  enumeration = UnitsLength(value, false);
420  }
421  catch (const EnumerationException&)
422  {
423  is.setstate(std::ios::failbit);
424  }
425  }
426 
427  return is;
428  }
429 
430  }
431  }
432  }
433 }
434 
435 #endif // OME_XML_MODEL_PRIMITIVES_LENGTHQUANTITY_H
436 
437 /*
438  * Local Variables:
439  * mode:C++
440  * End:
441  */
inch Imperial unit.
Definition: LengthQuantity.h:123
terrestrial mile Imperial unit.
Definition: LengthQuantity.h:129
line Imperial unit (1/12 inch).
Definition: LengthQuantity.h:121
std::map< UnitsLength::enum_value, std::string > value_map_type
Value map type.
Definition: LengthQuantity.h:213
nanometer SI unit.
Definition: LengthQuantity.h:105
thou Imperial unit (or mil, 1/1000 inch).
Definition: LengthQuantity.h:119
reference frame abstract unit. This is not convertible to any other length unit without a scaling fac...
Definition: LengthQuantity.h:141
astronomical unit SI-derived unit. The official term is ua as the SI standard assigned AU to absorban...
Definition: LengthQuantity.h:131
parsec.
Definition: LengthQuantity.h:135
bool operator!=(const Color &lhs, const Color &rhs)
Compare two Color objects for non-equality.
Definition: Color.h:392
enum_value value
Enumeration value.
Definition: LengthQuantity.h:241
pixel abstract unit. This is not convertible to any other length unit without a calibrated scaling fa...
Definition: LengthQuantity.h:139
hectometer SI unit.
Definition: LengthQuantity.h:91
gigameter SI unit.
Definition: LengthQuantity.h:85
exameter SI unit.
Definition: LengthQuantity.h:79
yoctometer SI unit.
Definition: LengthQuantity.h:115
light year.
Definition: LengthQuantity.h:133
ångström SI-derived unit.
Definition: LengthQuantity.h:117
const std::string * name
Enumeration name.
Definition: LengthQuantity.h:243
yard Imperial unit.
Definition: LengthQuantity.h:127
attometer SI unit.
Definition: LengthQuantity.h:111
typography point Imperial-derived unit (1/72 inch). Use of this unit should be limited to font sizes...
Definition: LengthQuantity.h:137
zettameter SI unit.
Definition: LengthQuantity.h:77
petameter SI unit.
Definition: LengthQuantity.h:81
Open Microscopy Environment C++ implementation.
bool operator==(const Color &lhs, const Color &rhs)
Compare two Color objects for equality.
Definition: Color.h:322
picometer SI unit.
Definition: LengthQuantity.h:107
zeptometer SI unit.
Definition: LengthQuantity.h:113
yottameter SI unit.
Definition: LengthQuantity.h:75
millimeter SI unit.
Definition: LengthQuantity.h:101
static const string_map_type & strings()
Get a map of valid string names and enum values.
std::map< std::string, UnitsLength::enum_value > string_map_type
String map type.
Definition: LengthQuantity.h:211
UnitsLength(enum_value value)
Construct a UnitsLength quantity by an enumeration value.
meter SI unit.
Definition: LengthQuantity.h:95
kilometer SI unit.
Definition: LengthQuantity.h:89
megameter SI unit.
Definition: LengthQuantity.h:87
UnitsLength enumeration.
Definition: LengthQuantity.h:68
static const value_map_type & values()
Get a map of valid enum values and string names.
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, Color &color)
Set Color from input stream.
Definition: Color.h:478
terameter SI unit.
Definition: LengthQuantity.h:83
centimeter SI unit.
Definition: LengthQuantity.h:99
UnitsLength & operator=(const UnitsLength &rhs)
Assignment operator.
Definition: LengthQuantity.h:181
decameter SI unit.
Definition: LengthQuantity.h:93
decimeter SI unit.
Definition: LengthQuantity.h:97
enum_value
Enumeration values.
Definition: LengthQuantity.h:72
femtometer SI unit.
Definition: LengthQuantity.h:109
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
foot Imperial unit.
Definition: LengthQuantity.h:125
micrometer SI unit.
Definition: LengthQuantity.h:103