ome-xml  5.5.1
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 
178  inline UnitsLength&
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&
237 
241  const std::string *name;
242  };
243 
251  inline bool
253  const UnitsLength& rhs)
254  {
255  return static_cast<UnitsLength::enum_value>(lhs) == static_cast<UnitsLength::enum_value>(rhs);
256  }
257 
265  inline bool
267  const UnitsLength::enum_value& rhs)
268  {
269  return static_cast<UnitsLength::enum_value>(lhs) == rhs;
270  }
271 
279  inline bool
281  const UnitsLength& rhs)
282  {
283  return lhs == static_cast<UnitsLength::enum_value>(rhs);
284  }
285 
293  inline bool
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
323  const UnitsLength& rhs)
324  {
325  return static_cast<UnitsLength::enum_value>(lhs) != static_cast<UnitsLength::enum_value>(rhs);
326  }
327 
335  inline bool
337  const UnitsLength::enum_value& rhs)
338  {
339  return static_cast<UnitsLength::enum_value>(lhs) != rhs;
340  }
341 
349  inline bool
351  const UnitsLength& rhs)
352  {
353  return lhs != static_cast<UnitsLength::enum_value>(rhs);
354  }
355 
363  inline bool
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  */
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:211
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:239
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:241
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:209
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:179
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